diff --git "a/languages/java/test_out_of_distribution.jsonl" "b/languages/java/test_out_of_distribution.jsonl" new file mode 100644--- /dev/null +++ "b/languages/java/test_out_of_distribution.jsonl" @@ -0,0 +1,1000 @@ +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s526091614", "group_id": "codeNet:p02262", "input_text": "\nimport java.util.*;\npublic class Main {\n\tScanner sc = new Scanner(System.in);\n\t\n\tint n;\n\tint[] A;\n\tint m,cnt;\n\tint h;\n\tpublic ArrayList G = new ArrayList();\n\t\n\tpublic void input() {\n\t\tn = sc.nextInt();\n\t\tA = new int[n];\n\t\tfor(int i=0; i=0; i--) {insertSort(G.get(i));}\n\t}\n\t\n\tpublic void insertSort(int g) {\n\t\tfor(int i=g; i=0 && A[j] > v) {\n\t\t\t\tA[j+g] =A[j];\n\t\t\t\tj -= g;\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t\tA[j+g] = v;\n\t\t}\n\t}\n\t\n\tpublic void output() {\n\t\tSystem.out.println(m);\n\t\tfor(int i=G.size()-1; i>=0; i--) {\n\t\t\tif(i == 0) System.out.println( G.get(i) );\n\t\t\telse System.out.print(G.get(i)+\" \");\n\t\t}\n\t\tSystem.out.println(cnt);\n\t\tfor(int i=0; i G = new ArrayList();\n\t\n\tpublic void input() {\n\t\tn = sc.nextInt();\n\t\tA = new int[n];\n\t\tfor(int i=0; i=0; i--) {insertSort(G.get(i));}\n\t}\n\t\n\tpublic void insertSort(int g) {\n\t\tfor(int i=g; i=0 && A[j] > v) {\n\t\t\t\tA[j+g] =A[j];\n\t\t\t\tj -= g;\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t\tA[j+g] = v;\n\t\t}\n\t}\n\t\n\tpublic void output() {\n\t\tSystem.out.println(m);\n\t\tfor(int i=G.size()-1; i>=0; i--) {\n\t\t\tif(i == 0) System.out.println( G.get(i) );\n\t\t\telse System.out.print(G.get(i)+\" \");\n\t\t}\n\t\tSystem.out.println(cnt);\n\t\tfor(int i=0; i= 0 && A[j] > v\n6 A[j+g] = A[j]\n7 j = j - g\n8 cnt++\n9 A[j+g] = v\n10\n11 shellSort(A, n)\n12 cnt = 0\n13 m = ?\n14 G[] = {?, ?,..., ?}\n15 for i = 0 to m-1\n16 insertionSort(A, n, G[i])\n\nA function shellSort(A, n) performs a function insertionSort(A, n, g), which considers every $g$-th elements. Beginning with large values of $g$, it repeats the insertion sort with smaller $g$.\n\nYour task is to complete the above program by filling ?. Write a program which reads an integer $n$ and a sequence $A$, and prints $m$, $G_i (i = 0, 1, ..., m − 1)$ in the pseudo code and the sequence $A$ in ascending order. The output of your program must meet the following requirements:\n\n$1 \\leq m \\leq 100$\n\n$0 \\leq G_i \\leq n$\n\ncnt does not exceed $\\lceil n^{1.5}\\rceil$\n\nInput\n\nIn the first line, an integer $n$ is given. In the following $n$ lines, $A_i (i=0,1,...,n-1)$ are given for each line.\n\nOutput\n\nIn the first line, print an integer $m$. In the second line, print $m$ integers $G_i (i=0,1,...,m-1)$ separated by single space character in a line.\n\nIn the third line, print cnt in a line. In the following $n$ lines, print $A_i (i=0,1,...,n-1)$ respectively.\n\nThis problem has multiple solutions and the judge will be performed by a special validator.\n\nConstraints\n\n$1 \\leq n \\leq 1,000,000$\n\n$0 \\leq A_i \\leq 10^9$\n\nSample Input 1\n\n5\n5\n1\n4\n3\n2\n\nSample Output 1\n\n2\n4 1\n3\n1\n2\n3\n4\n5\n\nSample Input 2\n\n3\n3\n2\n1\n\nSample Output 2\n\n1\n1\n3\n1\n2\n3", "sample_input": "5\n5\n1\n4\n3\n2\n"}, "reference_outputs": ["2\n4 1\n3\n1\n2\n3\n4\n5\n"], "source_document_id": "p02262", "source_text": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nShell Sort\n\nShell Sort is a generalization of Insertion Sort to arrange a list of $n$ elements $A$.\n\n1 insertionSort(A, n, g)\n2 for i = g to n-1\n3 v = A[i]\n4 j = i - g\n5 while j >= 0 && A[j] > v\n6 A[j+g] = A[j]\n7 j = j - g\n8 cnt++\n9 A[j+g] = v\n10\n11 shellSort(A, n)\n12 cnt = 0\n13 m = ?\n14 G[] = {?, ?,..., ?}\n15 for i = 0 to m-1\n16 insertionSort(A, n, G[i])\n\nA function shellSort(A, n) performs a function insertionSort(A, n, g), which considers every $g$-th elements. Beginning with large values of $g$, it repeats the insertion sort with smaller $g$.\n\nYour task is to complete the above program by filling ?. Write a program which reads an integer $n$ and a sequence $A$, and prints $m$, $G_i (i = 0, 1, ..., m − 1)$ in the pseudo code and the sequence $A$ in ascending order. The output of your program must meet the following requirements:\n\n$1 \\leq m \\leq 100$\n\n$0 \\leq G_i \\leq n$\n\ncnt does not exceed $\\lceil n^{1.5}\\rceil$\n\nInput\n\nIn the first line, an integer $n$ is given. In the following $n$ lines, $A_i (i=0,1,...,n-1)$ are given for each line.\n\nOutput\n\nIn the first line, print an integer $m$. In the second line, print $m$ integers $G_i (i=0,1,...,m-1)$ separated by single space character in a line.\n\nIn the third line, print cnt in a line. In the following $n$ lines, print $A_i (i=0,1,...,n-1)$ respectively.\n\nThis problem has multiple solutions and the judge will be performed by a special validator.\n\nConstraints\n\n$1 \\leq n \\leq 1,000,000$\n\n$0 \\leq A_i \\leq 10^9$\n\nSample Input 1\n\n5\n5\n1\n4\n3\n2\n\nSample Output 1\n\n2\n4 1\n3\n1\n2\n3\n4\n5\n\nSample Input 2\n\n3\n3\n2\n1\n\nSample Output 2\n\n1\n1\n3\n1\n2\n3", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 3400, "memory_kb": 306988}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s798349297", "group_id": "codeNet:p02262", "input_text": "\n\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint N = scan.nextInt();\n\t\tint[] A = new int[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tA[i] = scan.nextInt();\n\t\t}\n\t\tshellSort(A, N);\n\t\tfor (int i = 0; i < A.length; i++) {\n\t\t\tSystem.out.println(A[i]);\n\t\t}\n\t\tscan.close();\n\t}\n\n\tstatic int cnt = 0;\n\n\tpublic static void shellSort(int[] A, int N) {\n\t\t// G(n+1)=3G(n)+1 n=0,1,2,,,\n\t\tint max = (int) Math.ceil((N + 1) / 3.0);\n\t\tSystem.out.println(max);\n\t\tint[] G = new int[max];\n\t\tfor (int i = 0; i < G.length; i++) {\n\t\t\tG[i] = 3 * i + 1;\n\t\t}\n\n\t\tfor (int i = G.length - 1; i >= 0; i--) {\n\t\t\t// ??????\n\t\t\tSystem.out.print(G[i]);\n\t\t\tif (i != 0) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t} else {\n\t\t\t\tSystem.out.println();\n\t\t\t}\n\t\t\tinsertionSort(A, N, G[i]);\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}\n\n\tpublic static void insertionSort(int[] A, int N, int g) {\n\n\t\tfor (int i = g; i < N; i++) {\n\t\t\tint v = A[i];\n\t\t\tint j = i - g;\n\t\t\t// ?????§???????????????????????°???????????????????????\\????????????????????????????????§??????\n\t\t\twhile (j >= 0 && A[j] > v) {\n\t\t\t\tA[j + g] = A[j];\n\t\t\t\tj -= g;\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t\tA[j + g] = v;\n\t\t}\n\t}\n}", "language": "Java", "metadata": {"date": 1457795792, "filename_ext": "java", "original_language": "JAVA", "problem_description_relpath": "problem_descriptions/p02262.html", "problem_id": "p02262", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02262/input.txt", "sample_output_relpath": "derived/input_output/data/p02262/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02262/Java/s798349297.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s798349297", "user_id": "u003091509"}, "prompt_components": {"gold_output": "2\n4 1\n3\n1\n2\n3\n4\n5\n", "input_to_evaluate": "\n\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint N = scan.nextInt();\n\t\tint[] A = new int[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tA[i] = scan.nextInt();\n\t\t}\n\t\tshellSort(A, N);\n\t\tfor (int i = 0; i < A.length; i++) {\n\t\t\tSystem.out.println(A[i]);\n\t\t}\n\t\tscan.close();\n\t}\n\n\tstatic int cnt = 0;\n\n\tpublic static void shellSort(int[] A, int N) {\n\t\t// G(n+1)=3G(n)+1 n=0,1,2,,,\n\t\tint max = (int) Math.ceil((N + 1) / 3.0);\n\t\tSystem.out.println(max);\n\t\tint[] G = new int[max];\n\t\tfor (int i = 0; i < G.length; i++) {\n\t\t\tG[i] = 3 * i + 1;\n\t\t}\n\n\t\tfor (int i = G.length - 1; i >= 0; i--) {\n\t\t\t// ??????\n\t\t\tSystem.out.print(G[i]);\n\t\t\tif (i != 0) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t} else {\n\t\t\t\tSystem.out.println();\n\t\t\t}\n\t\t\tinsertionSort(A, N, G[i]);\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}\n\n\tpublic static void insertionSort(int[] A, int N, int g) {\n\n\t\tfor (int i = g; i < N; i++) {\n\t\t\tint v = A[i];\n\t\t\tint j = i - g;\n\t\t\t// ?????§???????????????????????°???????????????????????\\????????????????????????????????§??????\n\t\t\twhile (j >= 0 && A[j] > v) {\n\t\t\t\tA[j + g] = A[j];\n\t\t\t\tj -= g;\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t\tA[j + g] = v;\n\t\t}\n\t}\n}", "problem_context": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nShell Sort\n\nShell Sort is a generalization of Insertion Sort to arrange a list of $n$ elements $A$.\n\n1 insertionSort(A, n, g)\n2 for i = g to n-1\n3 v = A[i]\n4 j = i - g\n5 while j >= 0 && A[j] > v\n6 A[j+g] = A[j]\n7 j = j - g\n8 cnt++\n9 A[j+g] = v\n10\n11 shellSort(A, n)\n12 cnt = 0\n13 m = ?\n14 G[] = {?, ?,..., ?}\n15 for i = 0 to m-1\n16 insertionSort(A, n, G[i])\n\nA function shellSort(A, n) performs a function insertionSort(A, n, g), which considers every $g$-th elements. Beginning with large values of $g$, it repeats the insertion sort with smaller $g$.\n\nYour task is to complete the above program by filling ?. Write a program which reads an integer $n$ and a sequence $A$, and prints $m$, $G_i (i = 0, 1, ..., m − 1)$ in the pseudo code and the sequence $A$ in ascending order. The output of your program must meet the following requirements:\n\n$1 \\leq m \\leq 100$\n\n$0 \\leq G_i \\leq n$\n\ncnt does not exceed $\\lceil n^{1.5}\\rceil$\n\nInput\n\nIn the first line, an integer $n$ is given. In the following $n$ lines, $A_i (i=0,1,...,n-1)$ are given for each line.\n\nOutput\n\nIn the first line, print an integer $m$. In the second line, print $m$ integers $G_i (i=0,1,...,m-1)$ separated by single space character in a line.\n\nIn the third line, print cnt in a line. In the following $n$ lines, print $A_i (i=0,1,...,n-1)$ respectively.\n\nThis problem has multiple solutions and the judge will be performed by a special validator.\n\nConstraints\n\n$1 \\leq n \\leq 1,000,000$\n\n$0 \\leq A_i \\leq 10^9$\n\nSample Input 1\n\n5\n5\n1\n4\n3\n2\n\nSample Output 1\n\n2\n4 1\n3\n1\n2\n3\n4\n5\n\nSample Input 2\n\n3\n3\n2\n1\n\nSample Output 2\n\n1\n1\n3\n1\n2\n3", "sample_input": "5\n5\n1\n4\n3\n2\n"}, "reference_outputs": ["2\n4 1\n3\n1\n2\n3\n4\n5\n"], "source_document_id": "p02262", "source_text": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nShell Sort\n\nShell Sort is a generalization of Insertion Sort to arrange a list of $n$ elements $A$.\n\n1 insertionSort(A, n, g)\n2 for i = g to n-1\n3 v = A[i]\n4 j = i - g\n5 while j >= 0 && A[j] > v\n6 A[j+g] = A[j]\n7 j = j - g\n8 cnt++\n9 A[j+g] = v\n10\n11 shellSort(A, n)\n12 cnt = 0\n13 m = ?\n14 G[] = {?, ?,..., ?}\n15 for i = 0 to m-1\n16 insertionSort(A, n, G[i])\n\nA function shellSort(A, n) performs a function insertionSort(A, n, g), which considers every $g$-th elements. Beginning with large values of $g$, it repeats the insertion sort with smaller $g$.\n\nYour task is to complete the above program by filling ?. Write a program which reads an integer $n$ and a sequence $A$, and prints $m$, $G_i (i = 0, 1, ..., m − 1)$ in the pseudo code and the sequence $A$ in ascending order. The output of your program must meet the following requirements:\n\n$1 \\leq m \\leq 100$\n\n$0 \\leq G_i \\leq n$\n\ncnt does not exceed $\\lceil n^{1.5}\\rceil$\n\nInput\n\nIn the first line, an integer $n$ is given. In the following $n$ lines, $A_i (i=0,1,...,n-1)$ are given for each line.\n\nOutput\n\nIn the first line, print an integer $m$. In the second line, print $m$ integers $G_i (i=0,1,...,m-1)$ separated by single space character in a line.\n\nIn the third line, print cnt in a line. In the following $n$ lines, print $A_i (i=0,1,...,n-1)$ respectively.\n\nThis problem has multiple solutions and the judge will be performed by a special validator.\n\nConstraints\n\n$1 \\leq n \\leq 1,000,000$\n\n$0 \\leq A_i \\leq 10^9$\n\nSample Input 1\n\n5\n5\n1\n4\n3\n2\n\nSample Output 1\n\n2\n4 1\n3\n1\n2\n3\n4\n5\n\nSample Input 2\n\n3\n3\n2\n1\n\nSample Output 2\n\n1\n1\n3\n1\n2\n3", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1191, "cpu_time_ms": 70, "memory_kb": 26304}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s781993840", "group_id": "codeNet:p02262", "input_text": "\n\nimport java.util.Scanner;\n\npublic class Main{\n\n\tpublic static void main(String[] args) {\n\t\t// TODO ?????????????????????????????????????????????\n\t\tnew Main().start();\n\t}\n\tvoid start(){\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = in.nextInt();\n\t\tint[] a = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\ta[i] = in.nextInt();\n\t\t}\n\t\tprintArray(shellSort(a,n));\n\n\t\tin.close();\n\t}\n\tint cnt = 0;\n\tint[] insertionSort(int[]a, int n, int g){\n\t\tfor(int i = g; i < n; i++){\n\t\t\tint v = a[i];\n\t\t\tint j = i - g;\n\t\t\twhile(j >= 0 && a[j] > v){\n\t\t\t\ta[j+g] = a[j];\n\t\t\t\tj -= g;\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t\ta[j+g] = v;\n\t\t}\n\t\treturn a;\n\t}\n\tint[] shellSort(int[] a, int n){\n\t\tcnt = 0;\n\t\tint m = (int)(Math.log(n) / Math.log(4));\n\t\tint[] g = new int[m];\n\t\tfor(int i = 0; i < m; i++){\n\t\t\tg[m-i-1] = (int)Math.pow(4, i);\n\t\t}\n\t\tfor(int i = 0; i < m; i++){\n\t\t\ta = insertionSort(a,n,g[i]);\n\t\t}\n\t\tSystem.out.println(m);\n\t\tprintArray2(g);\n\t\tSystem.out.println(cnt);\n\t\treturn a;\n\t}\n\tvoid printArray(int[] a){\n\t\tfor(int x : a){\n\t\t\tSystem.out.println(x);\n\t\t}\n\t}\n\tvoid printArray2(int[] a){\n\t\tSystem.out.print(a[0]);\n\t\tfor(int i= 1; i < a.length; i++){\n\t\t\tSystem.out.print(\" \" + a[i]);\n\t\t}\n\t\tSystem.out.println();\n\t}\n\n\n}", "language": "Java", "metadata": {"date": 1496715224, "filename_ext": "java", "original_language": "JAVA", "problem_description_relpath": "problem_descriptions/p02262.html", "problem_id": "p02262", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02262/input.txt", "sample_output_relpath": "derived/input_output/data/p02262/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02262/Java/s781993840.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s781993840", "user_id": "u017937470"}, "prompt_components": {"gold_output": "2\n4 1\n3\n1\n2\n3\n4\n5\n", "input_to_evaluate": "\n\nimport java.util.Scanner;\n\npublic class Main{\n\n\tpublic static void main(String[] args) {\n\t\t// TODO ?????????????????????????????????????????????\n\t\tnew Main().start();\n\t}\n\tvoid start(){\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = in.nextInt();\n\t\tint[] a = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\ta[i] = in.nextInt();\n\t\t}\n\t\tprintArray(shellSort(a,n));\n\n\t\tin.close();\n\t}\n\tint cnt = 0;\n\tint[] insertionSort(int[]a, int n, int g){\n\t\tfor(int i = g; i < n; i++){\n\t\t\tint v = a[i];\n\t\t\tint j = i - g;\n\t\t\twhile(j >= 0 && a[j] > v){\n\t\t\t\ta[j+g] = a[j];\n\t\t\t\tj -= g;\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t\ta[j+g] = v;\n\t\t}\n\t\treturn a;\n\t}\n\tint[] shellSort(int[] a, int n){\n\t\tcnt = 0;\n\t\tint m = (int)(Math.log(n) / Math.log(4));\n\t\tint[] g = new int[m];\n\t\tfor(int i = 0; i < m; i++){\n\t\t\tg[m-i-1] = (int)Math.pow(4, i);\n\t\t}\n\t\tfor(int i = 0; i < m; i++){\n\t\t\ta = insertionSort(a,n,g[i]);\n\t\t}\n\t\tSystem.out.println(m);\n\t\tprintArray2(g);\n\t\tSystem.out.println(cnt);\n\t\treturn a;\n\t}\n\tvoid printArray(int[] a){\n\t\tfor(int x : a){\n\t\t\tSystem.out.println(x);\n\t\t}\n\t}\n\tvoid printArray2(int[] a){\n\t\tSystem.out.print(a[0]);\n\t\tfor(int i= 1; i < a.length; i++){\n\t\t\tSystem.out.print(\" \" + a[i]);\n\t\t}\n\t\tSystem.out.println();\n\t}\n\n\n}", "problem_context": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nShell Sort\n\nShell Sort is a generalization of Insertion Sort to arrange a list of $n$ elements $A$.\n\n1 insertionSort(A, n, g)\n2 for i = g to n-1\n3 v = A[i]\n4 j = i - g\n5 while j >= 0 && A[j] > v\n6 A[j+g] = A[j]\n7 j = j - g\n8 cnt++\n9 A[j+g] = v\n10\n11 shellSort(A, n)\n12 cnt = 0\n13 m = ?\n14 G[] = {?, ?,..., ?}\n15 for i = 0 to m-1\n16 insertionSort(A, n, G[i])\n\nA function shellSort(A, n) performs a function insertionSort(A, n, g), which considers every $g$-th elements. Beginning with large values of $g$, it repeats the insertion sort with smaller $g$.\n\nYour task is to complete the above program by filling ?. Write a program which reads an integer $n$ and a sequence $A$, and prints $m$, $G_i (i = 0, 1, ..., m − 1)$ in the pseudo code and the sequence $A$ in ascending order. The output of your program must meet the following requirements:\n\n$1 \\leq m \\leq 100$\n\n$0 \\leq G_i \\leq n$\n\ncnt does not exceed $\\lceil n^{1.5}\\rceil$\n\nInput\n\nIn the first line, an integer $n$ is given. In the following $n$ lines, $A_i (i=0,1,...,n-1)$ are given for each line.\n\nOutput\n\nIn the first line, print an integer $m$. In the second line, print $m$ integers $G_i (i=0,1,...,m-1)$ separated by single space character in a line.\n\nIn the third line, print cnt in a line. In the following $n$ lines, print $A_i (i=0,1,...,n-1)$ respectively.\n\nThis problem has multiple solutions and the judge will be performed by a special validator.\n\nConstraints\n\n$1 \\leq n \\leq 1,000,000$\n\n$0 \\leq A_i \\leq 10^9$\n\nSample Input 1\n\n5\n5\n1\n4\n3\n2\n\nSample Output 1\n\n2\n4 1\n3\n1\n2\n3\n4\n5\n\nSample Input 2\n\n3\n3\n2\n1\n\nSample Output 2\n\n1\n1\n3\n1\n2\n3", "sample_input": "5\n5\n1\n4\n3\n2\n"}, "reference_outputs": ["2\n4 1\n3\n1\n2\n3\n4\n5\n"], "source_document_id": "p02262", "source_text": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nShell Sort\n\nShell Sort is a generalization of Insertion Sort to arrange a list of $n$ elements $A$.\n\n1 insertionSort(A, n, g)\n2 for i = g to n-1\n3 v = A[i]\n4 j = i - g\n5 while j >= 0 && A[j] > v\n6 A[j+g] = A[j]\n7 j = j - g\n8 cnt++\n9 A[j+g] = v\n10\n11 shellSort(A, n)\n12 cnt = 0\n13 m = ?\n14 G[] = {?, ?,..., ?}\n15 for i = 0 to m-1\n16 insertionSort(A, n, G[i])\n\nA function shellSort(A, n) performs a function insertionSort(A, n, g), which considers every $g$-th elements. Beginning with large values of $g$, it repeats the insertion sort with smaller $g$.\n\nYour task is to complete the above program by filling ?. Write a program which reads an integer $n$ and a sequence $A$, and prints $m$, $G_i (i = 0, 1, ..., m − 1)$ in the pseudo code and the sequence $A$ in ascending order. The output of your program must meet the following requirements:\n\n$1 \\leq m \\leq 100$\n\n$0 \\leq G_i \\leq n$\n\ncnt does not exceed $\\lceil n^{1.5}\\rceil$\n\nInput\n\nIn the first line, an integer $n$ is given. In the following $n$ lines, $A_i (i=0,1,...,n-1)$ are given for each line.\n\nOutput\n\nIn the first line, print an integer $m$. In the second line, print $m$ integers $G_i (i=0,1,...,m-1)$ separated by single space character in a line.\n\nIn the third line, print cnt in a line. In the following $n$ lines, print $A_i (i=0,1,...,n-1)$ respectively.\n\nThis problem has multiple solutions and the judge will be performed by a special validator.\n\nConstraints\n\n$1 \\leq n \\leq 1,000,000$\n\n$0 \\leq A_i \\leq 10^9$\n\nSample Input 1\n\n5\n5\n1\n4\n3\n2\n\nSample Output 1\n\n2\n4 1\n3\n1\n2\n3\n4\n5\n\nSample Input 2\n\n3\n3\n2\n1\n\nSample Output 2\n\n1\n1\n3\n1\n2\n3", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1182, "cpu_time_ms": 50, "memory_kb": 26088}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s738604408", "group_id": "codeNet:p02262", "input_text": "import java.util.Scanner;\n\npublic class Main {\n static int insertionSort(int[] a, int n, int g) {\n int t, j;\n int count = 0;\n for (int i = g; i < n; i++) {\n t = a[i];\n j = i - g;\n while (j >= 0 && a[j] > t) {\n a[j + g] = a[j];\n j -= g;\n count++;\n }\n a[j + g] = t;\n }\n return count;\n }\n\n static int shellSort(int[] a, int n) {\n int count = 0;\n int g = 0;\n int m = 0;\n for (int g_tmp = 1; g_tmp < n / 9; g_tmp += 3 * g_tmp + 1) {\n m++;\n g = g_tmp;\n }\n if (n < 10) {\n m = 1;\n g = 1;\n }\n System.out.println(m);\n int[] G = new int[m];\n G[0] = g;\n for (int i = 1; i < m; i++) {\n G[i] = (G[i - 1] - 1) / 3;\n }\n for (int i = 0; i < m; i++) \n count += insertionSort(a, n, G[i]); \n for (int i = 0; i < m; i++) {\n System.out.print(G[i]);\n if (i != m - 1) System.out.print(' ');\n else System.out.println();\n }\n return count;\n }\n\n\n public static void main(String[] args) {\n Scanner stdIn = new Scanner(System.in);\n int n = stdIn.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; i++) a[i] = stdIn.nextInt();\n int count = shellSort(a, n);\n System.out.println(count);\n for (int i = 0; i < n; i++)\n System.out.println(a[i]);\n }\n}", "language": "Java", "metadata": {"date": 1496744086, "filename_ext": "java", "original_language": "JAVA", "problem_description_relpath": "problem_descriptions/p02262.html", "problem_id": "p02262", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02262/input.txt", "sample_output_relpath": "derived/input_output/data/p02262/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02262/Java/s738604408.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s738604408", "user_id": "u671560012"}, "prompt_components": {"gold_output": "2\n4 1\n3\n1\n2\n3\n4\n5\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n static int insertionSort(int[] a, int n, int g) {\n int t, j;\n int count = 0;\n for (int i = g; i < n; i++) {\n t = a[i];\n j = i - g;\n while (j >= 0 && a[j] > t) {\n a[j + g] = a[j];\n j -= g;\n count++;\n }\n a[j + g] = t;\n }\n return count;\n }\n\n static int shellSort(int[] a, int n) {\n int count = 0;\n int g = 0;\n int m = 0;\n for (int g_tmp = 1; g_tmp < n / 9; g_tmp += 3 * g_tmp + 1) {\n m++;\n g = g_tmp;\n }\n if (n < 10) {\n m = 1;\n g = 1;\n }\n System.out.println(m);\n int[] G = new int[m];\n G[0] = g;\n for (int i = 1; i < m; i++) {\n G[i] = (G[i - 1] - 1) / 3;\n }\n for (int i = 0; i < m; i++) \n count += insertionSort(a, n, G[i]); \n for (int i = 0; i < m; i++) {\n System.out.print(G[i]);\n if (i != m - 1) System.out.print(' ');\n else System.out.println();\n }\n return count;\n }\n\n\n public static void main(String[] args) {\n Scanner stdIn = new Scanner(System.in);\n int n = stdIn.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; i++) a[i] = stdIn.nextInt();\n int count = shellSort(a, n);\n System.out.println(count);\n for (int i = 0; i < n; i++)\n System.out.println(a[i]);\n }\n}", "problem_context": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nShell Sort\n\nShell Sort is a generalization of Insertion Sort to arrange a list of $n$ elements $A$.\n\n1 insertionSort(A, n, g)\n2 for i = g to n-1\n3 v = A[i]\n4 j = i - g\n5 while j >= 0 && A[j] > v\n6 A[j+g] = A[j]\n7 j = j - g\n8 cnt++\n9 A[j+g] = v\n10\n11 shellSort(A, n)\n12 cnt = 0\n13 m = ?\n14 G[] = {?, ?,..., ?}\n15 for i = 0 to m-1\n16 insertionSort(A, n, G[i])\n\nA function shellSort(A, n) performs a function insertionSort(A, n, g), which considers every $g$-th elements. Beginning with large values of $g$, it repeats the insertion sort with smaller $g$.\n\nYour task is to complete the above program by filling ?. Write a program which reads an integer $n$ and a sequence $A$, and prints $m$, $G_i (i = 0, 1, ..., m − 1)$ in the pseudo code and the sequence $A$ in ascending order. The output of your program must meet the following requirements:\n\n$1 \\leq m \\leq 100$\n\n$0 \\leq G_i \\leq n$\n\ncnt does not exceed $\\lceil n^{1.5}\\rceil$\n\nInput\n\nIn the first line, an integer $n$ is given. In the following $n$ lines, $A_i (i=0,1,...,n-1)$ are given for each line.\n\nOutput\n\nIn the first line, print an integer $m$. In the second line, print $m$ integers $G_i (i=0,1,...,m-1)$ separated by single space character in a line.\n\nIn the third line, print cnt in a line. In the following $n$ lines, print $A_i (i=0,1,...,n-1)$ respectively.\n\nThis problem has multiple solutions and the judge will be performed by a special validator.\n\nConstraints\n\n$1 \\leq n \\leq 1,000,000$\n\n$0 \\leq A_i \\leq 10^9$\n\nSample Input 1\n\n5\n5\n1\n4\n3\n2\n\nSample Output 1\n\n2\n4 1\n3\n1\n2\n3\n4\n5\n\nSample Input 2\n\n3\n3\n2\n1\n\nSample Output 2\n\n1\n1\n3\n1\n2\n3", "sample_input": "5\n5\n1\n4\n3\n2\n"}, "reference_outputs": ["2\n4 1\n3\n1\n2\n3\n4\n5\n"], "source_document_id": "p02262", "source_text": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nShell Sort\n\nShell Sort is a generalization of Insertion Sort to arrange a list of $n$ elements $A$.\n\n1 insertionSort(A, n, g)\n2 for i = g to n-1\n3 v = A[i]\n4 j = i - g\n5 while j >= 0 && A[j] > v\n6 A[j+g] = A[j]\n7 j = j - g\n8 cnt++\n9 A[j+g] = v\n10\n11 shellSort(A, n)\n12 cnt = 0\n13 m = ?\n14 G[] = {?, ?,..., ?}\n15 for i = 0 to m-1\n16 insertionSort(A, n, G[i])\n\nA function shellSort(A, n) performs a function insertionSort(A, n, g), which considers every $g$-th elements. Beginning with large values of $g$, it repeats the insertion sort with smaller $g$.\n\nYour task is to complete the above program by filling ?. Write a program which reads an integer $n$ and a sequence $A$, and prints $m$, $G_i (i = 0, 1, ..., m − 1)$ in the pseudo code and the sequence $A$ in ascending order. The output of your program must meet the following requirements:\n\n$1 \\leq m \\leq 100$\n\n$0 \\leq G_i \\leq n$\n\ncnt does not exceed $\\lceil n^{1.5}\\rceil$\n\nInput\n\nIn the first line, an integer $n$ is given. In the following $n$ lines, $A_i (i=0,1,...,n-1)$ are given for each line.\n\nOutput\n\nIn the first line, print an integer $m$. In the second line, print $m$ integers $G_i (i=0,1,...,m-1)$ separated by single space character in a line.\n\nIn the third line, print cnt in a line. In the following $n$ lines, print $A_i (i=0,1,...,n-1)$ respectively.\n\nThis problem has multiple solutions and the judge will be performed by a special validator.\n\nConstraints\n\n$1 \\leq n \\leq 1,000,000$\n\n$0 \\leq A_i \\leq 10^9$\n\nSample Input 1\n\n5\n5\n1\n4\n3\n2\n\nSample Output 1\n\n2\n4 1\n3\n1\n2\n3\n4\n5\n\nSample Input 2\n\n3\n3\n2\n1\n\nSample Output 2\n\n1\n1\n3\n1\n2\n3", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1310, "cpu_time_ms": 50, "memory_kb": 25972}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s996521135", "group_id": "codeNet:p02262", "input_text": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.IOException;\n\npublic class Main{\n\tpublic static void main(String[] args)\n\t{\n\t\ttry{\n\t\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tint n = Integer.parseInt(br.readLine());\n\t\t\tint[] A = new int[n];\n\t\t\tfor(int i = 0; i= 0 ; m--){\n\t\t\tsb.append(G[m]).append(' ');\n\t\t\tcnt += insertionSort(arr,l,G[m]);\n\t\t}\n\t\tsb.deleteCharAt(sb.length()-1).append('\\n').append(cnt).append('\\n');\n\t\t\n\t\tfor(m = 0 ; m < l ; m++){\n\t\t\tsb.append(arr[m]).append('\\n');\n\t\t}\n\t\t\tSystem.out.print(sb.toString());\n\t}\n\tpublic static int insertionSort(int[] a,int n , int g)\n\t{\n\t\tint cnt = 0;\n\t\tint v;\n\t\tfor(int i = g ; i < n ; i++)\n\t\t{\n\t\t\tv = a[i];\n\t\t\tint j = i-g;\n\t\t\twhile(j >= 0 && a[j] > v)\n\t\t\t{\n\t\t\t\ta[j+g] = a[j];\n\t\t\t\ta[j] = v;\n\t\t\t\tj -= g;\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t\treturn cnt;\n\t}\n}", "language": "Java", "metadata": {"date": 1499593324, "filename_ext": "java", "original_language": "JAVA", "problem_description_relpath": "problem_descriptions/p02262.html", "problem_id": "p02262", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02262/input.txt", "sample_output_relpath": "derived/input_output/data/p02262/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02262/Java/s996521135.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s996521135", "user_id": "u345663362"}, "prompt_components": {"gold_output": "2\n4 1\n3\n1\n2\n3\n4\n5\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.IOException;\n\npublic class Main{\n\tpublic static void main(String[] args)\n\t{\n\t\ttry{\n\t\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tint n = Integer.parseInt(br.readLine());\n\t\t\tint[] A = new int[n];\n\t\t\tfor(int i = 0; i= 0 ; m--){\n\t\t\tsb.append(G[m]).append(' ');\n\t\t\tcnt += insertionSort(arr,l,G[m]);\n\t\t}\n\t\tsb.deleteCharAt(sb.length()-1).append('\\n').append(cnt).append('\\n');\n\t\t\n\t\tfor(m = 0 ; m < l ; m++){\n\t\t\tsb.append(arr[m]).append('\\n');\n\t\t}\n\t\t\tSystem.out.print(sb.toString());\n\t}\n\tpublic static int insertionSort(int[] a,int n , int g)\n\t{\n\t\tint cnt = 0;\n\t\tint v;\n\t\tfor(int i = g ; i < n ; i++)\n\t\t{\n\t\t\tv = a[i];\n\t\t\tint j = i-g;\n\t\t\twhile(j >= 0 && a[j] > v)\n\t\t\t{\n\t\t\t\ta[j+g] = a[j];\n\t\t\t\ta[j] = v;\n\t\t\t\tj -= g;\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t\treturn cnt;\n\t}\n}", "problem_context": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nShell Sort\n\nShell Sort is a generalization of Insertion Sort to arrange a list of $n$ elements $A$.\n\n1 insertionSort(A, n, g)\n2 for i = g to n-1\n3 v = A[i]\n4 j = i - g\n5 while j >= 0 && A[j] > v\n6 A[j+g] = A[j]\n7 j = j - g\n8 cnt++\n9 A[j+g] = v\n10\n11 shellSort(A, n)\n12 cnt = 0\n13 m = ?\n14 G[] = {?, ?,..., ?}\n15 for i = 0 to m-1\n16 insertionSort(A, n, G[i])\n\nA function shellSort(A, n) performs a function insertionSort(A, n, g), which considers every $g$-th elements. Beginning with large values of $g$, it repeats the insertion sort with smaller $g$.\n\nYour task is to complete the above program by filling ?. Write a program which reads an integer $n$ and a sequence $A$, and prints $m$, $G_i (i = 0, 1, ..., m − 1)$ in the pseudo code and the sequence $A$ in ascending order. The output of your program must meet the following requirements:\n\n$1 \\leq m \\leq 100$\n\n$0 \\leq G_i \\leq n$\n\ncnt does not exceed $\\lceil n^{1.5}\\rceil$\n\nInput\n\nIn the first line, an integer $n$ is given. In the following $n$ lines, $A_i (i=0,1,...,n-1)$ are given for each line.\n\nOutput\n\nIn the first line, print an integer $m$. In the second line, print $m$ integers $G_i (i=0,1,...,m-1)$ separated by single space character in a line.\n\nIn the third line, print cnt in a line. In the following $n$ lines, print $A_i (i=0,1,...,n-1)$ respectively.\n\nThis problem has multiple solutions and the judge will be performed by a special validator.\n\nConstraints\n\n$1 \\leq n \\leq 1,000,000$\n\n$0 \\leq A_i \\leq 10^9$\n\nSample Input 1\n\n5\n5\n1\n4\n3\n2\n\nSample Output 1\n\n2\n4 1\n3\n1\n2\n3\n4\n5\n\nSample Input 2\n\n3\n3\n2\n1\n\nSample Output 2\n\n1\n1\n3\n1\n2\n3", "sample_input": "5\n5\n1\n4\n3\n2\n"}, "reference_outputs": ["2\n4 1\n3\n1\n2\n3\n4\n5\n"], "source_document_id": "p02262", "source_text": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nShell Sort\n\nShell Sort is a generalization of Insertion Sort to arrange a list of $n$ elements $A$.\n\n1 insertionSort(A, n, g)\n2 for i = g to n-1\n3 v = A[i]\n4 j = i - g\n5 while j >= 0 && A[j] > v\n6 A[j+g] = A[j]\n7 j = j - g\n8 cnt++\n9 A[j+g] = v\n10\n11 shellSort(A, n)\n12 cnt = 0\n13 m = ?\n14 G[] = {?, ?,..., ?}\n15 for i = 0 to m-1\n16 insertionSort(A, n, G[i])\n\nA function shellSort(A, n) performs a function insertionSort(A, n, g), which considers every $g$-th elements. Beginning with large values of $g$, it repeats the insertion sort with smaller $g$.\n\nYour task is to complete the above program by filling ?. Write a program which reads an integer $n$ and a sequence $A$, and prints $m$, $G_i (i = 0, 1, ..., m − 1)$ in the pseudo code and the sequence $A$ in ascending order. The output of your program must meet the following requirements:\n\n$1 \\leq m \\leq 100$\n\n$0 \\leq G_i \\leq n$\n\ncnt does not exceed $\\lceil n^{1.5}\\rceil$\n\nInput\n\nIn the first line, an integer $n$ is given. In the following $n$ lines, $A_i (i=0,1,...,n-1)$ are given for each line.\n\nOutput\n\nIn the first line, print an integer $m$. In the second line, print $m$ integers $G_i (i=0,1,...,m-1)$ separated by single space character in a line.\n\nIn the third line, print cnt in a line. In the following $n$ lines, print $A_i (i=0,1,...,n-1)$ respectively.\n\nThis problem has multiple solutions and the judge will be performed by a special validator.\n\nConstraints\n\n$1 \\leq n \\leq 1,000,000$\n\n$0 \\leq A_i \\leq 10^9$\n\nSample Input 1\n\n5\n5\n1\n4\n3\n2\n\nSample Output 1\n\n2\n4 1\n3\n1\n2\n3\n4\n5\n\nSample Input 2\n\n3\n3\n2\n1\n\nSample Output 2\n\n1\n1\n3\n1\n2\n3", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1250, "cpu_time_ms": 190, "memory_kb": 39724}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s021250244", "group_id": "codeNet:p02262", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\t\n\t\tint n = scanner.nextInt();\n\t\tint[] a = new int[n];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = scanner.nextInt();\n\t\t}\n\t\t\n\t\tscanner.close();\n\t\t\n\t\tint cnt = 0;\n\t\t\n\t\tint m;\n\t\tfor (m = 0; (n >> m) > 0; m++);\n\t\tint[] g = new int[m];\n\t\tfor (int i = 0; i < m; g[i] = (1 << (m - i - 1)), i++);\n\t\t\n\t\tfor (int k = 0; k < m; k++) {\n\t\t\tfor (int i = g[k]; i < n; i++) {\n\t\t\t\tint v = a[i];\n\t\t\t\tint j = i - g[k];\n\t\t\t\t\n\t\t\t\twhile (j >= 0 && a[j] > v) {\n\t\t\t\t\ta[j + g[k]] = a[j];\n\t\t\t\t\tj -= g[k];\n\t\t\t\t\tcnt ++;\n\t\t\t\t}\n\t\t\t\ta[j + g[k]] = v;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(m);\n\t\tfor (int i = 0; i < m - 1; i++) {\n\t\t\tSystem.out.print(g[i] + \" \");\n\t\t}\n\t\tSystem.out.println(g[m - 1]);\n\t\t\n\t\tSystem.out.println(cnt);\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tSystem.out.println(a[i]);\n\t\t}\n\t}\n} \n\n", "language": "Java", "metadata": {"date": 1523750038, "filename_ext": "java", "original_language": "JAVA", "problem_description_relpath": "problem_descriptions/p02262.html", "problem_id": "p02262", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02262/input.txt", "sample_output_relpath": "derived/input_output/data/p02262/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02262/Java/s021250244.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s021250244", "user_id": "u312158419"}, "prompt_components": {"gold_output": "2\n4 1\n3\n1\n2\n3\n4\n5\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\t\n\t\tint n = scanner.nextInt();\n\t\tint[] a = new int[n];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = scanner.nextInt();\n\t\t}\n\t\t\n\t\tscanner.close();\n\t\t\n\t\tint cnt = 0;\n\t\t\n\t\tint m;\n\t\tfor (m = 0; (n >> m) > 0; m++);\n\t\tint[] g = new int[m];\n\t\tfor (int i = 0; i < m; g[i] = (1 << (m - i - 1)), i++);\n\t\t\n\t\tfor (int k = 0; k < m; k++) {\n\t\t\tfor (int i = g[k]; i < n; i++) {\n\t\t\t\tint v = a[i];\n\t\t\t\tint j = i - g[k];\n\t\t\t\t\n\t\t\t\twhile (j >= 0 && a[j] > v) {\n\t\t\t\t\ta[j + g[k]] = a[j];\n\t\t\t\t\tj -= g[k];\n\t\t\t\t\tcnt ++;\n\t\t\t\t}\n\t\t\t\ta[j + g[k]] = v;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(m);\n\t\tfor (int i = 0; i < m - 1; i++) {\n\t\t\tSystem.out.print(g[i] + \" \");\n\t\t}\n\t\tSystem.out.println(g[m - 1]);\n\t\t\n\t\tSystem.out.println(cnt);\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tSystem.out.println(a[i]);\n\t\t}\n\t}\n} \n\n", "problem_context": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nShell Sort\n\nShell Sort is a generalization of Insertion Sort to arrange a list of $n$ elements $A$.\n\n1 insertionSort(A, n, g)\n2 for i = g to n-1\n3 v = A[i]\n4 j = i - g\n5 while j >= 0 && A[j] > v\n6 A[j+g] = A[j]\n7 j = j - g\n8 cnt++\n9 A[j+g] = v\n10\n11 shellSort(A, n)\n12 cnt = 0\n13 m = ?\n14 G[] = {?, ?,..., ?}\n15 for i = 0 to m-1\n16 insertionSort(A, n, G[i])\n\nA function shellSort(A, n) performs a function insertionSort(A, n, g), which considers every $g$-th elements. Beginning with large values of $g$, it repeats the insertion sort with smaller $g$.\n\nYour task is to complete the above program by filling ?. Write a program which reads an integer $n$ and a sequence $A$, and prints $m$, $G_i (i = 0, 1, ..., m − 1)$ in the pseudo code and the sequence $A$ in ascending order. The output of your program must meet the following requirements:\n\n$1 \\leq m \\leq 100$\n\n$0 \\leq G_i \\leq n$\n\ncnt does not exceed $\\lceil n^{1.5}\\rceil$\n\nInput\n\nIn the first line, an integer $n$ is given. In the following $n$ lines, $A_i (i=0,1,...,n-1)$ are given for each line.\n\nOutput\n\nIn the first line, print an integer $m$. In the second line, print $m$ integers $G_i (i=0,1,...,m-1)$ separated by single space character in a line.\n\nIn the third line, print cnt in a line. In the following $n$ lines, print $A_i (i=0,1,...,n-1)$ respectively.\n\nThis problem has multiple solutions and the judge will be performed by a special validator.\n\nConstraints\n\n$1 \\leq n \\leq 1,000,000$\n\n$0 \\leq A_i \\leq 10^9$\n\nSample Input 1\n\n5\n5\n1\n4\n3\n2\n\nSample Output 1\n\n2\n4 1\n3\n1\n2\n3\n4\n5\n\nSample Input 2\n\n3\n3\n2\n1\n\nSample Output 2\n\n1\n1\n3\n1\n2\n3", "sample_input": "5\n5\n1\n4\n3\n2\n"}, "reference_outputs": ["2\n4 1\n3\n1\n2\n3\n4\n5\n"], "source_document_id": "p02262", "source_text": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nShell Sort\n\nShell Sort is a generalization of Insertion Sort to arrange a list of $n$ elements $A$.\n\n1 insertionSort(A, n, g)\n2 for i = g to n-1\n3 v = A[i]\n4 j = i - g\n5 while j >= 0 && A[j] > v\n6 A[j+g] = A[j]\n7 j = j - g\n8 cnt++\n9 A[j+g] = v\n10\n11 shellSort(A, n)\n12 cnt = 0\n13 m = ?\n14 G[] = {?, ?,..., ?}\n15 for i = 0 to m-1\n16 insertionSort(A, n, G[i])\n\nA function shellSort(A, n) performs a function insertionSort(A, n, g), which considers every $g$-th elements. Beginning with large values of $g$, it repeats the insertion sort with smaller $g$.\n\nYour task is to complete the above program by filling ?. Write a program which reads an integer $n$ and a sequence $A$, and prints $m$, $G_i (i = 0, 1, ..., m − 1)$ in the pseudo code and the sequence $A$ in ascending order. The output of your program must meet the following requirements:\n\n$1 \\leq m \\leq 100$\n\n$0 \\leq G_i \\leq n$\n\ncnt does not exceed $\\lceil n^{1.5}\\rceil$\n\nInput\n\nIn the first line, an integer $n$ is given. In the following $n$ lines, $A_i (i=0,1,...,n-1)$ are given for each line.\n\nOutput\n\nIn the first line, print an integer $m$. In the second line, print $m$ integers $G_i (i=0,1,...,m-1)$ separated by single space character in a line.\n\nIn the third line, print cnt in a line. In the following $n$ lines, print $A_i (i=0,1,...,n-1)$ respectively.\n\nThis problem has multiple solutions and the judge will be performed by a special validator.\n\nConstraints\n\n$1 \\leq n \\leq 1,000,000$\n\n$0 \\leq A_i \\leq 10^9$\n\nSample Input 1\n\n5\n5\n1\n4\n3\n2\n\nSample Output 1\n\n2\n4 1\n3\n1\n2\n3\n4\n5\n\nSample Input 2\n\n3\n3\n2\n1\n\nSample Output 2\n\n1\n1\n3\n1\n2\n3", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 902, "cpu_time_ms": 4000, "memory_kb": 298788}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s663778569", "group_id": "codeNet:p02262", "input_text": "\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Scanner;\n\n\n\npublic class Main {\n\tpublic static void init(int[] arr, int[] init) {\n\t\tfor(int i = 0; i < arr.length; i++) {\n\t\t\tarr[i] = init[i];\n\t\t}\n\t}\n\tpublic static int insertionSort(int[] arr, int n, int g) {\n\t\tint count = 0;\n\t\tfor(int i = g; i < n; i++) {\n\t\t\tint key = arr[i];\n\t\t\tint j = i - g;\n\t\t\twhile(j >= 0 && arr[j] > key) {\n\t\t\t\tarr[j + g] = arr[j];\n\t\t\t\tj -= g;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\tarr[j + g] = key;\n\t\t}\n\t\treturn count;\n\n\t}\n\tpublic static int shellSort(int[] arr, int n, List list) {\n\t\tint count = 0;\n\t\tfor(int i = 0; i < list.size(); i++) {\n\t\t\tcount += insertionSort(arr, n, list.get(i));\n\t\t}\n\t\treturn count;\n\t}\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] arr = new int[n];\n\t\tint[] init = new int[n];\n\t\tint count = 0;\n\t\tList g = new ArrayList<>();\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tinit[i] = sc.nextInt();\n\t\t\tarr[i] = init[i];\n\t\t}\n\t\tint index = 1;\n\t\tg.add(index);\n\t\tif(n > 4) {\n\t\t\tindex = 4;\n\t\t\tg.add(0, index);\n\t\t}\n\t\twhile(index <= n / 9) {\n\t\t\tif(index == 4) {\n\t\t\t\tindex = index * 3 + 1;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tg.add(0, index);\n\t\t\tindex = index * 3 + 1;\n\t\t}\n\t\twhile (true) {\n\t\t\tcount = shellSort(arr, n, g);\n\t\t\tif(count < Math.ceil(Math.pow(n, 1.5))) {\n\t\t\t\tbreak;\n\t\t\t} else {\n\t\t\t\tinit(arr, init);\n\t\t\t\tcount = 0;\n\t\t\t\tindex = 3 * index + 1;\n\t\t\t\tg.add(0, index);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(g.size());\n\t\tfor(int i = 0; i < g.size(); i++) {\n\t\t\tif(i == g.size() - 1) {\n\t\t\t\tSystem.out.println(g.get(i));\n\t\t\t} else {\n\t\t\t\tSystem.out.print(g.get(i) + \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t\tfor (int i = 0; i < arr.length; i++) {\n\t\t\tSystem.out.println(arr[i]);\n\n\t\t}\n\t\tsc.close();\n\t}\n}\n\n", "language": "Java", "metadata": {"date": 1529718724, "filename_ext": "java", "original_language": "JAVA", "problem_description_relpath": "problem_descriptions/p02262.html", "problem_id": "p02262", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02262/input.txt", "sample_output_relpath": "derived/input_output/data/p02262/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02262/Java/s663778569.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s663778569", "user_id": "u676874280"}, "prompt_components": {"gold_output": "2\n4 1\n3\n1\n2\n3\n4\n5\n", "input_to_evaluate": "\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Scanner;\n\n\n\npublic class Main {\n\tpublic static void init(int[] arr, int[] init) {\n\t\tfor(int i = 0; i < arr.length; i++) {\n\t\t\tarr[i] = init[i];\n\t\t}\n\t}\n\tpublic static int insertionSort(int[] arr, int n, int g) {\n\t\tint count = 0;\n\t\tfor(int i = g; i < n; i++) {\n\t\t\tint key = arr[i];\n\t\t\tint j = i - g;\n\t\t\twhile(j >= 0 && arr[j] > key) {\n\t\t\t\tarr[j + g] = arr[j];\n\t\t\t\tj -= g;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\tarr[j + g] = key;\n\t\t}\n\t\treturn count;\n\n\t}\n\tpublic static int shellSort(int[] arr, int n, List list) {\n\t\tint count = 0;\n\t\tfor(int i = 0; i < list.size(); i++) {\n\t\t\tcount += insertionSort(arr, n, list.get(i));\n\t\t}\n\t\treturn count;\n\t}\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] arr = new int[n];\n\t\tint[] init = new int[n];\n\t\tint count = 0;\n\t\tList g = new ArrayList<>();\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tinit[i] = sc.nextInt();\n\t\t\tarr[i] = init[i];\n\t\t}\n\t\tint index = 1;\n\t\tg.add(index);\n\t\tif(n > 4) {\n\t\t\tindex = 4;\n\t\t\tg.add(0, index);\n\t\t}\n\t\twhile(index <= n / 9) {\n\t\t\tif(index == 4) {\n\t\t\t\tindex = index * 3 + 1;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tg.add(0, index);\n\t\t\tindex = index * 3 + 1;\n\t\t}\n\t\twhile (true) {\n\t\t\tcount = shellSort(arr, n, g);\n\t\t\tif(count < Math.ceil(Math.pow(n, 1.5))) {\n\t\t\t\tbreak;\n\t\t\t} else {\n\t\t\t\tinit(arr, init);\n\t\t\t\tcount = 0;\n\t\t\t\tindex = 3 * index + 1;\n\t\t\t\tg.add(0, index);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(g.size());\n\t\tfor(int i = 0; i < g.size(); i++) {\n\t\t\tif(i == g.size() - 1) {\n\t\t\t\tSystem.out.println(g.get(i));\n\t\t\t} else {\n\t\t\t\tSystem.out.print(g.get(i) + \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t\tfor (int i = 0; i < arr.length; i++) {\n\t\t\tSystem.out.println(arr[i]);\n\n\t\t}\n\t\tsc.close();\n\t}\n}\n\n", "problem_context": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nShell Sort\n\nShell Sort is a generalization of Insertion Sort to arrange a list of $n$ elements $A$.\n\n1 insertionSort(A, n, g)\n2 for i = g to n-1\n3 v = A[i]\n4 j = i - g\n5 while j >= 0 && A[j] > v\n6 A[j+g] = A[j]\n7 j = j - g\n8 cnt++\n9 A[j+g] = v\n10\n11 shellSort(A, n)\n12 cnt = 0\n13 m = ?\n14 G[] = {?, ?,..., ?}\n15 for i = 0 to m-1\n16 insertionSort(A, n, G[i])\n\nA function shellSort(A, n) performs a function insertionSort(A, n, g), which considers every $g$-th elements. Beginning with large values of $g$, it repeats the insertion sort with smaller $g$.\n\nYour task is to complete the above program by filling ?. Write a program which reads an integer $n$ and a sequence $A$, and prints $m$, $G_i (i = 0, 1, ..., m − 1)$ in the pseudo code and the sequence $A$ in ascending order. The output of your program must meet the following requirements:\n\n$1 \\leq m \\leq 100$\n\n$0 \\leq G_i \\leq n$\n\ncnt does not exceed $\\lceil n^{1.5}\\rceil$\n\nInput\n\nIn the first line, an integer $n$ is given. In the following $n$ lines, $A_i (i=0,1,...,n-1)$ are given for each line.\n\nOutput\n\nIn the first line, print an integer $m$. In the second line, print $m$ integers $G_i (i=0,1,...,m-1)$ separated by single space character in a line.\n\nIn the third line, print cnt in a line. In the following $n$ lines, print $A_i (i=0,1,...,n-1)$ respectively.\n\nThis problem has multiple solutions and the judge will be performed by a special validator.\n\nConstraints\n\n$1 \\leq n \\leq 1,000,000$\n\n$0 \\leq A_i \\leq 10^9$\n\nSample Input 1\n\n5\n5\n1\n4\n3\n2\n\nSample Output 1\n\n2\n4 1\n3\n1\n2\n3\n4\n5\n\nSample Input 2\n\n3\n3\n2\n1\n\nSample Output 2\n\n1\n1\n3\n1\n2\n3", "sample_input": "5\n5\n1\n4\n3\n2\n"}, "reference_outputs": ["2\n4 1\n3\n1\n2\n3\n4\n5\n"], "source_document_id": "p02262", "source_text": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nShell Sort\n\nShell Sort is a generalization of Insertion Sort to arrange a list of $n$ elements $A$.\n\n1 insertionSort(A, n, g)\n2 for i = g to n-1\n3 v = A[i]\n4 j = i - g\n5 while j >= 0 && A[j] > v\n6 A[j+g] = A[j]\n7 j = j - g\n8 cnt++\n9 A[j+g] = v\n10\n11 shellSort(A, n)\n12 cnt = 0\n13 m = ?\n14 G[] = {?, ?,..., ?}\n15 for i = 0 to m-1\n16 insertionSort(A, n, G[i])\n\nA function shellSort(A, n) performs a function insertionSort(A, n, g), which considers every $g$-th elements. Beginning with large values of $g$, it repeats the insertion sort with smaller $g$.\n\nYour task is to complete the above program by filling ?. Write a program which reads an integer $n$ and a sequence $A$, and prints $m$, $G_i (i = 0, 1, ..., m − 1)$ in the pseudo code and the sequence $A$ in ascending order. The output of your program must meet the following requirements:\n\n$1 \\leq m \\leq 100$\n\n$0 \\leq G_i \\leq n$\n\ncnt does not exceed $\\lceil n^{1.5}\\rceil$\n\nInput\n\nIn the first line, an integer $n$ is given. In the following $n$ lines, $A_i (i=0,1,...,n-1)$ are given for each line.\n\nOutput\n\nIn the first line, print an integer $m$. In the second line, print $m$ integers $G_i (i=0,1,...,m-1)$ separated by single space character in a line.\n\nIn the third line, print cnt in a line. In the following $n$ lines, print $A_i (i=0,1,...,n-1)$ respectively.\n\nThis problem has multiple solutions and the judge will be performed by a special validator.\n\nConstraints\n\n$1 \\leq n \\leq 1,000,000$\n\n$0 \\leq A_i \\leq 10^9$\n\nSample Input 1\n\n5\n5\n1\n4\n3\n2\n\nSample Output 1\n\n2\n4 1\n3\n1\n2\n3\n4\n5\n\nSample Input 2\n\n3\n3\n2\n1\n\nSample Output 2\n\n1\n1\n3\n1\n2\n3", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1750, "cpu_time_ms": 3450, "memory_kb": 303704}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s417766367", "group_id": "codeNet:p02262", "input_text": "import java.util.ArrayList;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tprivate static int cnt;\n\t\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in); \n\n\t\tint n = sc.nextInt();\n\t\tint[] data = new int[n];\n\t\t\n \tfor (int i = 0; i < n; i++) {\n \t\tdata[i] = sc.nextInt();\n \t}\n \t\n \t// Shell Sort\n \tcnt = 0;\n \tint[] g;\n\n// \tint m = (n - 1) / 3 + 1;\n// \tif (m > 100) {\n// \t\tm = 100;\n// \t}\n// \tg = new int[m];\n// \tfor (int i = m - 1; i >= 0; i --) {\n// \t\tg[i] = 3 * i + 1;\n// \t}\n \t\n \tint m = (int)Math.pow(n, 1.25);\n \tif (m > 100) {\n \t\tm = 100;\n \t}\n\t\tg = new int[m];\n\t\tint ii = 0;\n\t\tg[ii] = 1;\n\t\tfor (ii = 1; ii < m; ii++) {\n\t\t\tint next = g[ii - 1] * 3 + 1;\n\t\t\tif (next > n) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tg[ii] = next;\n\t\t}\n\t\tm = ii;\n \t\n \tfor (int i = 0; i < m; i++) {\n \t\tinsertionSort(data, n, g[m - 1 - i]);\n \t}\n\n \t// m\n \tSystem.out.println(m);\n \t// g\n\t\tStringBuffer printData = new StringBuffer();\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tprintData.append(g[m - 1 - i]);\n\t\t\tprintData.append(\" \");\n\t\t}\n\t\tprintData.delete(printData.length() - 1, printData.length());\n\t\tSystem.out.println(printData);\n \t// cnt\n \tSystem.out.println(cnt);\n \t// data\n\t\tfor (int i = 0; i < data.length; i++) {\n\t \tSystem.out.println(data[i]);\n\t\t}\n\n \tsc.close();\n\t}\n\t\n\tprivate static void insertionSort(int[] data, int n, int g) {\n\t\tfor (int i = g; i < n; i++) {\n\t\t\tint v = data[i];\n\t\t\tint j = i - g;\n\t\t\tint tmp;\n//\t\t\tfor (; j >= 0 && data[j] > v;) {\n//\t\t\t data[j + g] = data[j];\n\t\t\tfor (; j >= 0 && (tmp = data[j]) > v;) {\n\t\t\t\tdata[j + g] = tmp;\n\t\t\t\tj -= g;\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t\tdata[j + g] = v;\n\t\t}\n\t\treturn;\n\t}\n}", "language": "Java", "metadata": {"date": 1398836231, "filename_ext": "java", "original_language": "JAVA", "problem_description_relpath": "problem_descriptions/p02262.html", "problem_id": "p02262", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02262/input.txt", "sample_output_relpath": "derived/input_output/data/p02262/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02262/Java/s417766367.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s417766367", "user_id": "u722784748"}, "prompt_components": {"gold_output": "2\n4 1\n3\n1\n2\n3\n4\n5\n", "input_to_evaluate": "import java.util.ArrayList;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tprivate static int cnt;\n\t\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in); \n\n\t\tint n = sc.nextInt();\n\t\tint[] data = new int[n];\n\t\t\n \tfor (int i = 0; i < n; i++) {\n \t\tdata[i] = sc.nextInt();\n \t}\n \t\n \t// Shell Sort\n \tcnt = 0;\n \tint[] g;\n\n// \tint m = (n - 1) / 3 + 1;\n// \tif (m > 100) {\n// \t\tm = 100;\n// \t}\n// \tg = new int[m];\n// \tfor (int i = m - 1; i >= 0; i --) {\n// \t\tg[i] = 3 * i + 1;\n// \t}\n \t\n \tint m = (int)Math.pow(n, 1.25);\n \tif (m > 100) {\n \t\tm = 100;\n \t}\n\t\tg = new int[m];\n\t\tint ii = 0;\n\t\tg[ii] = 1;\n\t\tfor (ii = 1; ii < m; ii++) {\n\t\t\tint next = g[ii - 1] * 3 + 1;\n\t\t\tif (next > n) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tg[ii] = next;\n\t\t}\n\t\tm = ii;\n \t\n \tfor (int i = 0; i < m; i++) {\n \t\tinsertionSort(data, n, g[m - 1 - i]);\n \t}\n\n \t// m\n \tSystem.out.println(m);\n \t// g\n\t\tStringBuffer printData = new StringBuffer();\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tprintData.append(g[m - 1 - i]);\n\t\t\tprintData.append(\" \");\n\t\t}\n\t\tprintData.delete(printData.length() - 1, printData.length());\n\t\tSystem.out.println(printData);\n \t// cnt\n \tSystem.out.println(cnt);\n \t// data\n\t\tfor (int i = 0; i < data.length; i++) {\n\t \tSystem.out.println(data[i]);\n\t\t}\n\n \tsc.close();\n\t}\n\t\n\tprivate static void insertionSort(int[] data, int n, int g) {\n\t\tfor (int i = g; i < n; i++) {\n\t\t\tint v = data[i];\n\t\t\tint j = i - g;\n\t\t\tint tmp;\n//\t\t\tfor (; j >= 0 && data[j] > v;) {\n//\t\t\t data[j + g] = data[j];\n\t\t\tfor (; j >= 0 && (tmp = data[j]) > v;) {\n\t\t\t\tdata[j + g] = tmp;\n\t\t\t\tj -= g;\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t\tdata[j + g] = v;\n\t\t}\n\t\treturn;\n\t}\n}", "problem_context": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nShell Sort\n\nShell Sort is a generalization of Insertion Sort to arrange a list of $n$ elements $A$.\n\n1 insertionSort(A, n, g)\n2 for i = g to n-1\n3 v = A[i]\n4 j = i - g\n5 while j >= 0 && A[j] > v\n6 A[j+g] = A[j]\n7 j = j - g\n8 cnt++\n9 A[j+g] = v\n10\n11 shellSort(A, n)\n12 cnt = 0\n13 m = ?\n14 G[] = {?, ?,..., ?}\n15 for i = 0 to m-1\n16 insertionSort(A, n, G[i])\n\nA function shellSort(A, n) performs a function insertionSort(A, n, g), which considers every $g$-th elements. Beginning with large values of $g$, it repeats the insertion sort with smaller $g$.\n\nYour task is to complete the above program by filling ?. Write a program which reads an integer $n$ and a sequence $A$, and prints $m$, $G_i (i = 0, 1, ..., m − 1)$ in the pseudo code and the sequence $A$ in ascending order. The output of your program must meet the following requirements:\n\n$1 \\leq m \\leq 100$\n\n$0 \\leq G_i \\leq n$\n\ncnt does not exceed $\\lceil n^{1.5}\\rceil$\n\nInput\n\nIn the first line, an integer $n$ is given. In the following $n$ lines, $A_i (i=0,1,...,n-1)$ are given for each line.\n\nOutput\n\nIn the first line, print an integer $m$. In the second line, print $m$ integers $G_i (i=0,1,...,m-1)$ separated by single space character in a line.\n\nIn the third line, print cnt in a line. In the following $n$ lines, print $A_i (i=0,1,...,n-1)$ respectively.\n\nThis problem has multiple solutions and the judge will be performed by a special validator.\n\nConstraints\n\n$1 \\leq n \\leq 1,000,000$\n\n$0 \\leq A_i \\leq 10^9$\n\nSample Input 1\n\n5\n5\n1\n4\n3\n2\n\nSample Output 1\n\n2\n4 1\n3\n1\n2\n3\n4\n5\n\nSample Input 2\n\n3\n3\n2\n1\n\nSample Output 2\n\n1\n1\n3\n1\n2\n3", "sample_input": "5\n5\n1\n4\n3\n2\n"}, "reference_outputs": ["2\n4 1\n3\n1\n2\n3\n4\n5\n"], "source_document_id": "p02262", "source_text": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nShell Sort\n\nShell Sort is a generalization of Insertion Sort to arrange a list of $n$ elements $A$.\n\n1 insertionSort(A, n, g)\n2 for i = g to n-1\n3 v = A[i]\n4 j = i - g\n5 while j >= 0 && A[j] > v\n6 A[j+g] = A[j]\n7 j = j - g\n8 cnt++\n9 A[j+g] = v\n10\n11 shellSort(A, n)\n12 cnt = 0\n13 m = ?\n14 G[] = {?, ?,..., ?}\n15 for i = 0 to m-1\n16 insertionSort(A, n, G[i])\n\nA function shellSort(A, n) performs a function insertionSort(A, n, g), which considers every $g$-th elements. Beginning with large values of $g$, it repeats the insertion sort with smaller $g$.\n\nYour task is to complete the above program by filling ?. Write a program which reads an integer $n$ and a sequence $A$, and prints $m$, $G_i (i = 0, 1, ..., m − 1)$ in the pseudo code and the sequence $A$ in ascending order. The output of your program must meet the following requirements:\n\n$1 \\leq m \\leq 100$\n\n$0 \\leq G_i \\leq n$\n\ncnt does not exceed $\\lceil n^{1.5}\\rceil$\n\nInput\n\nIn the first line, an integer $n$ is given. In the following $n$ lines, $A_i (i=0,1,...,n-1)$ are given for each line.\n\nOutput\n\nIn the first line, print an integer $m$. In the second line, print $m$ integers $G_i (i=0,1,...,m-1)$ separated by single space character in a line.\n\nIn the third line, print cnt in a line. In the following $n$ lines, print $A_i (i=0,1,...,n-1)$ respectively.\n\nThis problem has multiple solutions and the judge will be performed by a special validator.\n\nConstraints\n\n$1 \\leq n \\leq 1,000,000$\n\n$0 \\leq A_i \\leq 10^9$\n\nSample Input 1\n\n5\n5\n1\n4\n3\n2\n\nSample Output 1\n\n2\n4 1\n3\n1\n2\n3\n4\n5\n\nSample Input 2\n\n3\n3\n2\n1\n\nSample Output 2\n\n1\n1\n3\n1\n2\n3", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1696, "cpu_time_ms": 4250, "memory_kb": 297016}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s995786732", "group_id": "codeNet:p02262", "input_text": "import java.util.*;\n\nclass Main {\n public static void main(String...args) {\n Scanner scan = new Scanner(System.in);\n int aryLen = scan.nextInt();\n int[] ary = new int[aryLen];\n int interCount = 1;\n int sortCount = 0;\n int maxInter = 0;\n \n\n for(int i = 0; i < aryLen; i++) {\n ary[i] = scan.nextInt();\n }\n \n int inter = 1;\n while(inter * 3 + 1 < aryLen ) {\n inter = inter * 3 + 1;\n interCount++;\n }\n\n maxInter = inter;\n\n for(; inter > 0 ; inter /= 3) {\n for(int j = inter; j < aryLen; j++) {\n int tmp = ary[j];\n int point = j;\n while(point - inter >= 0 && ary[point - inter] > tmp) {\n ary[point] = ary[point - inter];\n point -= inter;\n sortCount++; \n }\n ary[point] = tmp;\n }\n \n }\n System.out.println(interCount);\n for(; maxInter > 0; maxInter/=3) {\n System.out.print(maxInter);\n if(maxInter != 1) {\n System.out.print(\" \");\n } else if(maxInter == 1) {\n System.out.println();\n }\n }\n System.out.println(sortCount);\n for(int k = 0; k < aryLen; k++) {\n System.out.println(ary[k]);\n }\n }\n}\n\n", "language": "Java", "metadata": {"date": 1594473858, "filename_ext": "java", "original_language": "JAVA", "problem_description_relpath": "problem_descriptions/p02262.html", "problem_id": "p02262", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02262/input.txt", "sample_output_relpath": "derived/input_output/data/p02262/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02262/Java/s995786732.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s995786732", "user_id": "u118641326"}, "prompt_components": {"gold_output": "2\n4 1\n3\n1\n2\n3\n4\n5\n", "input_to_evaluate": "import java.util.*;\n\nclass Main {\n public static void main(String...args) {\n Scanner scan = new Scanner(System.in);\n int aryLen = scan.nextInt();\n int[] ary = new int[aryLen];\n int interCount = 1;\n int sortCount = 0;\n int maxInter = 0;\n \n\n for(int i = 0; i < aryLen; i++) {\n ary[i] = scan.nextInt();\n }\n \n int inter = 1;\n while(inter * 3 + 1 < aryLen ) {\n inter = inter * 3 + 1;\n interCount++;\n }\n\n maxInter = inter;\n\n for(; inter > 0 ; inter /= 3) {\n for(int j = inter; j < aryLen; j++) {\n int tmp = ary[j];\n int point = j;\n while(point - inter >= 0 && ary[point - inter] > tmp) {\n ary[point] = ary[point - inter];\n point -= inter;\n sortCount++; \n }\n ary[point] = tmp;\n }\n \n }\n System.out.println(interCount);\n for(; maxInter > 0; maxInter/=3) {\n System.out.print(maxInter);\n if(maxInter != 1) {\n System.out.print(\" \");\n } else if(maxInter == 1) {\n System.out.println();\n }\n }\n System.out.println(sortCount);\n for(int k = 0; k < aryLen; k++) {\n System.out.println(ary[k]);\n }\n }\n}\n\n", "problem_context": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nShell Sort\n\nShell Sort is a generalization of Insertion Sort to arrange a list of $n$ elements $A$.\n\n1 insertionSort(A, n, g)\n2 for i = g to n-1\n3 v = A[i]\n4 j = i - g\n5 while j >= 0 && A[j] > v\n6 A[j+g] = A[j]\n7 j = j - g\n8 cnt++\n9 A[j+g] = v\n10\n11 shellSort(A, n)\n12 cnt = 0\n13 m = ?\n14 G[] = {?, ?,..., ?}\n15 for i = 0 to m-1\n16 insertionSort(A, n, G[i])\n\nA function shellSort(A, n) performs a function insertionSort(A, n, g), which considers every $g$-th elements. Beginning with large values of $g$, it repeats the insertion sort with smaller $g$.\n\nYour task is to complete the above program by filling ?. Write a program which reads an integer $n$ and a sequence $A$, and prints $m$, $G_i (i = 0, 1, ..., m − 1)$ in the pseudo code and the sequence $A$ in ascending order. The output of your program must meet the following requirements:\n\n$1 \\leq m \\leq 100$\n\n$0 \\leq G_i \\leq n$\n\ncnt does not exceed $\\lceil n^{1.5}\\rceil$\n\nInput\n\nIn the first line, an integer $n$ is given. In the following $n$ lines, $A_i (i=0,1,...,n-1)$ are given for each line.\n\nOutput\n\nIn the first line, print an integer $m$. In the second line, print $m$ integers $G_i (i=0,1,...,m-1)$ separated by single space character in a line.\n\nIn the third line, print cnt in a line. In the following $n$ lines, print $A_i (i=0,1,...,n-1)$ respectively.\n\nThis problem has multiple solutions and the judge will be performed by a special validator.\n\nConstraints\n\n$1 \\leq n \\leq 1,000,000$\n\n$0 \\leq A_i \\leq 10^9$\n\nSample Input 1\n\n5\n5\n1\n4\n3\n2\n\nSample Output 1\n\n2\n4 1\n3\n1\n2\n3\n4\n5\n\nSample Input 2\n\n3\n3\n2\n1\n\nSample Output 2\n\n1\n1\n3\n1\n2\n3", "sample_input": "5\n5\n1\n4\n3\n2\n"}, "reference_outputs": ["2\n4 1\n3\n1\n2\n3\n4\n5\n"], "source_document_id": "p02262", "source_text": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nShell Sort\n\nShell Sort is a generalization of Insertion Sort to arrange a list of $n$ elements $A$.\n\n1 insertionSort(A, n, g)\n2 for i = g to n-1\n3 v = A[i]\n4 j = i - g\n5 while j >= 0 && A[j] > v\n6 A[j+g] = A[j]\n7 j = j - g\n8 cnt++\n9 A[j+g] = v\n10\n11 shellSort(A, n)\n12 cnt = 0\n13 m = ?\n14 G[] = {?, ?,..., ?}\n15 for i = 0 to m-1\n16 insertionSort(A, n, G[i])\n\nA function shellSort(A, n) performs a function insertionSort(A, n, g), which considers every $g$-th elements. Beginning with large values of $g$, it repeats the insertion sort with smaller $g$.\n\nYour task is to complete the above program by filling ?. Write a program which reads an integer $n$ and a sequence $A$, and prints $m$, $G_i (i = 0, 1, ..., m − 1)$ in the pseudo code and the sequence $A$ in ascending order. The output of your program must meet the following requirements:\n\n$1 \\leq m \\leq 100$\n\n$0 \\leq G_i \\leq n$\n\ncnt does not exceed $\\lceil n^{1.5}\\rceil$\n\nInput\n\nIn the first line, an integer $n$ is given. In the following $n$ lines, $A_i (i=0,1,...,n-1)$ are given for each line.\n\nOutput\n\nIn the first line, print an integer $m$. In the second line, print $m$ integers $G_i (i=0,1,...,m-1)$ separated by single space character in a line.\n\nIn the third line, print cnt in a line. In the following $n$ lines, print $A_i (i=0,1,...,n-1)$ respectively.\n\nThis problem has multiple solutions and the judge will be performed by a special validator.\n\nConstraints\n\n$1 \\leq n \\leq 1,000,000$\n\n$0 \\leq A_i \\leq 10^9$\n\nSample Input 1\n\n5\n5\n1\n4\n3\n2\n\nSample Output 1\n\n2\n4 1\n3\n1\n2\n3\n4\n5\n\nSample Input 2\n\n3\n3\n2\n1\n\nSample Output 2\n\n1\n1\n3\n1\n2\n3", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1429, "cpu_time_ms": 3440, "memory_kb": 299008}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s197295210", "group_id": "codeNet:p02262", "input_text": "import java.util.ArrayList;\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint a[] = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextInt();\n\t\t}\n\t\tshellSort(a, n);\n\t\tprintArrays(a, n);\n\t}\n\n\tpublic static int insertionSort(int a[], int n, int g) {\n\t\tint v, j = 0, cnt = 0;\n\t\tfor (int i = g; i < n; i++) {\n\t\t\tv = a[i];\n\t\t\tj = i - g;\n\t\t\twhile (j >= 0 && a[j] > v) {\n\t\t\t\ta[j + g] = a[j];\n\t\t\t\tj = j - g;\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t\ta[j + g] = v;\n\t\t}\n\t\treturn cnt;\n\t}\n\n\tpublic static void shellSort(int a[], int n) {\n\t\tint cnt = 0;\n\t\tArrayList b = new ArrayList<>();\n\t\tfor (int h = 1;;) {\n\t\t\tif (h > n)\n\t\t\t\tbreak;\n\t\t\tb.add(h);\n\t\t\th = 3 * h + 1;\n\t\t}\n\t\tint m = b.size();\n\t\tSystem.out.println(m);\n\t\tfor (int i = m-1; i >0; i--) {\n\t\t\tSystem.out.print(b.get(i) + \" \");\n\t\t}\n\t\tSystem.out.println(b.get(0));\n\n\t\tfor (int i = m - 1; i >= 0; i--) {\n\t\t\tcnt += insertionSort(a, n, b.get(i));\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}\n\n\tpublic static void printArrays(int a[], int n) {\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tSystem.out.println(a[i]);\n\t\t}\n\t}\n}\n", "language": "Java", "metadata": {"date": 1541599167, "filename_ext": "java", "original_language": "JAVA", "problem_description_relpath": "problem_descriptions/p02262.html", "problem_id": "p02262", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02262/input.txt", "sample_output_relpath": "derived/input_output/data/p02262/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02262/Java/s197295210.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s197295210", "user_id": "u829609117"}, "prompt_components": {"gold_output": "2\n4 1\n3\n1\n2\n3\n4\n5\n", "input_to_evaluate": "import java.util.ArrayList;\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint a[] = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextInt();\n\t\t}\n\t\tshellSort(a, n);\n\t\tprintArrays(a, n);\n\t}\n\n\tpublic static int insertionSort(int a[], int n, int g) {\n\t\tint v, j = 0, cnt = 0;\n\t\tfor (int i = g; i < n; i++) {\n\t\t\tv = a[i];\n\t\t\tj = i - g;\n\t\t\twhile (j >= 0 && a[j] > v) {\n\t\t\t\ta[j + g] = a[j];\n\t\t\t\tj = j - g;\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t\ta[j + g] = v;\n\t\t}\n\t\treturn cnt;\n\t}\n\n\tpublic static void shellSort(int a[], int n) {\n\t\tint cnt = 0;\n\t\tArrayList b = new ArrayList<>();\n\t\tfor (int h = 1;;) {\n\t\t\tif (h > n)\n\t\t\t\tbreak;\n\t\t\tb.add(h);\n\t\t\th = 3 * h + 1;\n\t\t}\n\t\tint m = b.size();\n\t\tSystem.out.println(m);\n\t\tfor (int i = m-1; i >0; i--) {\n\t\t\tSystem.out.print(b.get(i) + \" \");\n\t\t}\n\t\tSystem.out.println(b.get(0));\n\n\t\tfor (int i = m - 1; i >= 0; i--) {\n\t\t\tcnt += insertionSort(a, n, b.get(i));\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}\n\n\tpublic static void printArrays(int a[], int n) {\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tSystem.out.println(a[i]);\n\t\t}\n\t}\n}\n", "problem_context": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nShell Sort\n\nShell Sort is a generalization of Insertion Sort to arrange a list of $n$ elements $A$.\n\n1 insertionSort(A, n, g)\n2 for i = g to n-1\n3 v = A[i]\n4 j = i - g\n5 while j >= 0 && A[j] > v\n6 A[j+g] = A[j]\n7 j = j - g\n8 cnt++\n9 A[j+g] = v\n10\n11 shellSort(A, n)\n12 cnt = 0\n13 m = ?\n14 G[] = {?, ?,..., ?}\n15 for i = 0 to m-1\n16 insertionSort(A, n, G[i])\n\nA function shellSort(A, n) performs a function insertionSort(A, n, g), which considers every $g$-th elements. Beginning with large values of $g$, it repeats the insertion sort with smaller $g$.\n\nYour task is to complete the above program by filling ?. Write a program which reads an integer $n$ and a sequence $A$, and prints $m$, $G_i (i = 0, 1, ..., m − 1)$ in the pseudo code and the sequence $A$ in ascending order. The output of your program must meet the following requirements:\n\n$1 \\leq m \\leq 100$\n\n$0 \\leq G_i \\leq n$\n\ncnt does not exceed $\\lceil n^{1.5}\\rceil$\n\nInput\n\nIn the first line, an integer $n$ is given. In the following $n$ lines, $A_i (i=0,1,...,n-1)$ are given for each line.\n\nOutput\n\nIn the first line, print an integer $m$. In the second line, print $m$ integers $G_i (i=0,1,...,m-1)$ separated by single space character in a line.\n\nIn the third line, print cnt in a line. In the following $n$ lines, print $A_i (i=0,1,...,n-1)$ respectively.\n\nThis problem has multiple solutions and the judge will be performed by a special validator.\n\nConstraints\n\n$1 \\leq n \\leq 1,000,000$\n\n$0 \\leq A_i \\leq 10^9$\n\nSample Input 1\n\n5\n5\n1\n4\n3\n2\n\nSample Output 1\n\n2\n4 1\n3\n1\n2\n3\n4\n5\n\nSample Input 2\n\n3\n3\n2\n1\n\nSample Output 2\n\n1\n1\n3\n1\n2\n3", "sample_input": "5\n5\n1\n4\n3\n2\n"}, "reference_outputs": ["2\n4 1\n3\n1\n2\n3\n4\n5\n"], "source_document_id": "p02262", "source_text": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nShell Sort\n\nShell Sort is a generalization of Insertion Sort to arrange a list of $n$ elements $A$.\n\n1 insertionSort(A, n, g)\n2 for i = g to n-1\n3 v = A[i]\n4 j = i - g\n5 while j >= 0 && A[j] > v\n6 A[j+g] = A[j]\n7 j = j - g\n8 cnt++\n9 A[j+g] = v\n10\n11 shellSort(A, n)\n12 cnt = 0\n13 m = ?\n14 G[] = {?, ?,..., ?}\n15 for i = 0 to m-1\n16 insertionSort(A, n, G[i])\n\nA function shellSort(A, n) performs a function insertionSort(A, n, g), which considers every $g$-th elements. Beginning with large values of $g$, it repeats the insertion sort with smaller $g$.\n\nYour task is to complete the above program by filling ?. Write a program which reads an integer $n$ and a sequence $A$, and prints $m$, $G_i (i = 0, 1, ..., m − 1)$ in the pseudo code and the sequence $A$ in ascending order. The output of your program must meet the following requirements:\n\n$1 \\leq m \\leq 100$\n\n$0 \\leq G_i \\leq n$\n\ncnt does not exceed $\\lceil n^{1.5}\\rceil$\n\nInput\n\nIn the first line, an integer $n$ is given. In the following $n$ lines, $A_i (i=0,1,...,n-1)$ are given for each line.\n\nOutput\n\nIn the first line, print an integer $m$. In the second line, print $m$ integers $G_i (i=0,1,...,m-1)$ separated by single space character in a line.\n\nIn the third line, print cnt in a line. In the following $n$ lines, print $A_i (i=0,1,...,n-1)$ respectively.\n\nThis problem has multiple solutions and the judge will be performed by a special validator.\n\nConstraints\n\n$1 \\leq n \\leq 1,000,000$\n\n$0 \\leq A_i \\leq 10^9$\n\nSample Input 1\n\n5\n5\n1\n4\n3\n2\n\nSample Output 1\n\n2\n4 1\n3\n1\n2\n3\n4\n5\n\nSample Input 2\n\n3\n3\n2\n1\n\nSample Output 2\n\n1\n1\n3\n1\n2\n3", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1147, "cpu_time_ms": 3460, "memory_kb": 299648}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s438308019", "group_id": "codeNet:p02269", "input_text": "import java.util.*;\n\nclass Main{\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tHashSet hs = new HashSet();\n\t\tString cmd, str;\n\t\tlong hc;\n\n\t\tfor(int i=0; i hs = new HashSet();\n\t\tString cmd, str;\n\t\tlong hc;\n\n\t\tfor(int i=0; i {\n\t\t\tint index = 0;\n\n\t\t\tfor(int i=0, l=key.length(); i < l; i++)\n\t\t\t{\n\t\t\t\tindex = index * 37 + (int)key.charAt(i);\n\t\t\t\tindex = index % size;\n\t\t\t}\n\t\t\treturn index;\n\t\t});\n\t\t(new Solve(n, scan.nextObjectArray(new ICommand[n], (scanner) -> {\n\t\t\tString name = scanner.next();\n\t\t\treturn name.equals(\"insert\") ? new InsertCommand(dic, scan.next()) : name.equals(\"find\") ? new FindCommand(dic, scan.next()) : null;\n\t\t}))).solve();\n\t}\n}\nclass Solve {\n\tprivate final int n;\n\tprivate final ICommand[] commands;\n\n\tpublic Solve(final int n, final ICommand[] commands)\n\t{\n\t\tthis.n = n;\n\t\tthis.commands = commands;\n\t}\n\n\tpublic void solve()\n\t{\n\t\tfor(ICommand c: commands)\n\t\t{\n\t\t\tc.run();\n\t\t}\n\t}\n}\ninterface ICommand {\n\tpublic void run();\n}\nclass InsertCommand implements ICommand {\n\tpublic final String key;\n\tpublic final Dictionary dic;\n\tpublic InsertCommand(Dictionary dic, String key)\n\t{\n\t\tthis.dic = dic;\n\t\tthis.key = key;\n\t}\n\tpublic void run()\n\t{\n\t\tdic.add(key);\n\t}\n}\nclass FindCommand implements ICommand {\n\tpublic final String key;\n\tpublic final Dictionary dic;\n\tpublic FindCommand(Dictionary dic, String key)\n\t{\n\t\tthis.dic = dic;\n\t\tthis.key = key;\n\t}\n\tpublic void run()\n\t{\n\t\tSystem.out.println((dic.find(key) ? \"yes\" : \"no\"));\n\t}\n}\nclass ListItem {\n\tpublic final String value;\n\tpublic ListItem next;\n\n\tpublic ListItem(String value)\n\t{\n\t\tthis.value = value;\n\t\tthis.next = null;\n\t}\n\n\tpublic ListItem add(String value)\n\t{\n\n\t\tListItem entry = this;\n\n\t\twhile(entry != null && !entry.value.equals(value)) entry = entry.next;\n\n\t\tif(entry != null) return this;\n\n\t\tentry = new ListItem(value);\n\t\tentry.next = this;\n\t\treturn entry;\n\t}\n}\ninterface HashCreator {\n\tpublic int hash(int size, String value);\n}\nclass Dictionary {\n\tprivate final ListItem[] table;\n\tprivate final int tableSize;\n\tprivate final HashCreator hashCreator;\n\n\tpublic Dictionary(final int size, final HashCreator hashCreator)\n\t{\n\t\tthis.tableSize = size;\n\t\tthis.table = new ListItem[size];\n\t\tthis.hashCreator = hashCreator;\n\t}\n\n\tpublic void add(String value)\n\t{\n\t\tint index = hashCreator.hash(tableSize, value);\n\t\tListItem entry = table[index];\n\t\tif(entry == null) table[index] = new ListItem(value);\n\t\telse table[index] = entry.add(value);\n\t}\n\n\tpublic boolean find(String value)\n\t{\n\t\tint index = hashCreator.hash(tableSize, value);\n\t\tListItem entry = table[index];\n\n\t\twhile(entry != null && !entry.value.equals(value))\n\t\t{\n\t\t\tentry = entry.next;\n\t\t}\n\n\t\treturn entry != null;\n\t}\n}\nclass ContestScanner {\n\tBufferedReader reader;\n\tString[] line;\n\tint index;\n\tpublic ContestScanner() {\n\t\treader = new BufferedReader(new InputStreamReader(System.in));\n\t}\n\n\tpublic ContestScanner(String filename) throws FileNotFoundException {\n\t\treader = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));\n\t}\n\n\tpublic static interface ICreator {\n\t\tpublic T createFromToken(final ContestScanner scanner) throws IOException;\n\t}\n\n\tpublic static interface IArrayInitializer {\n\t\tpublic void initialize(final ContestScanner scanner, final int i) throws IOException;\n\t}\n\n\tpublic static interface IObjectInitializer {\n\t\tpublic T initialValue(final ContestScanner scanner);\n\t}\n\n\tpublic static class ObjectArrayInitializer implements IArrayInitializer {\n\t\tprotected T[] arr;\n\t\tprotected final IObjectInitializer initializer;\n\n\t\tprivate ObjectArrayInitializer(T[] arr, final IObjectInitializer initializer)\n\t\t{\n\t\t\tthis.arr = arr;\n\t\t\tthis.initializer = initializer;\n\t\t}\n\n\t\tpublic static ObjectArrayInitializer create(T[] arr, final IObjectInitializer initializer)\n\t\t{\n\t\t\treturn new ObjectArrayInitializer(arr, initializer);\n\t\t}\n\n\t\tpublic void initialize(final ContestScanner scanner, final int i) throws IOException {\n\t\t\tthis.arr[i] = initializer.initialValue(scanner);\n\t\t}\n\n\t\tpublic T[] getArray()\n\t\t{\n\t\t\treturn this.arr;\n\t\t}\n\t}\n\n\n\tpublic static class ByteArrayInitializer implements IArrayInitializer {\n\t\tprotected byte[] arr;\n\n\t\tprivate ByteArrayInitializer(final int n)\n\t\t{\n\t\t\tthis.arr = new byte[n];\n\t\t}\n\n\t\tpublic void initialize(final ContestScanner scanner, final int i) throws IOException {\n\t\t\tthis.arr[i] = scanner.nextByte();\n\t\t}\n\n\t\tpublic byte[] getArray()\n\t\t{\n\t\t\treturn this.arr;\n\t\t}\n\t}\n\n\tpublic static class ShortArrayInitializer implements IArrayInitializer {\n\t\tprotected short[] arr;\n\n\t\tprivate ShortArrayInitializer(final int n)\n\t\t{\n\t\t\tthis.arr = new short[n];\n\t\t}\n\n\t\tpublic void initialize(final ContestScanner scanner, final int i) throws IOException {\n\t\t\tthis.arr[i] = scanner.nextShort();\n\t\t}\n\n\t\tpublic short[] getArray()\n\t\t{\n\t\t\treturn this.arr;\n\t\t}\n\t}\n\n\tpublic static class IntArrayInitializer implements IArrayInitializer {\n\t\tprotected int[] arr;\n\n\t\tprivate IntArrayInitializer(final int n)\n\t\t{\n\t\t\tthis.arr = new int[n];\n\t\t}\n\n\t\tpublic void initialize(final ContestScanner scanner, final int i) throws IOException {\n\t\t\tthis.arr[i] = scanner.nextInt();\n\t\t}\n\n\t\tpublic int[] getArray()\n\t\t{\n\t\t\treturn this.arr;\n\t\t}\n\t}\n\n\tpublic static class LongArrayInitializer implements IArrayInitializer {\n\t\tprotected long[] arr;\n\n\t\tprivate LongArrayInitializer(final int n)\n\t\t{\n\t\t\tthis.arr = new long[n];\n\t\t}\n\n\t\tpublic void initialize(final ContestScanner scanner, final int i) throws IOException {\n\t\t\tthis.arr[i] = scanner.nextLong();\n\t\t}\n\n\t\tpublic long[] getArray()\n\t\t{\n\t\t\treturn this.arr;\n\t\t}\n\t}\n\n\tpublic static class FloatArrayInitializer implements IArrayInitializer {\n\t\tprotected float[] arr;\n\n\t\tprivate FloatArrayInitializer(final int n)\n\t\t{\n\t\t\tthis.arr = new float[n];\n\t\t}\n\n\t\tpublic void initialize(final ContestScanner scanner, final int i) throws IOException {\n\t\t\tthis.arr[i] = scanner.nextFloat();\n\t\t}\n\n\t\tpublic float[] getArray()\n\t\t{\n\t\t\treturn this.arr;\n\t\t}\n\t}\n\n\tpublic static class DoubleArrayInitializer implements IArrayInitializer {\n\t\tprotected double[] arr;\n\n\t\tprivate DoubleArrayInitializer(final int n)\n\t\t{\n\t\t\tthis.arr = new double[n];\n\t\t}\n\n\t\tpublic void initialize(final ContestScanner scanner, final int i) throws IOException {\n\t\t\tthis.arr[i] = scanner.nextDouble();\n\t\t}\n\n\t\tpublic double[] getArray()\n\t\t{\n\t\t\treturn this.arr;\n\t\t}\n\t}\n\n\tpublic String nextToken() throws IOException {\n\t\tif(line == null || index >= line.length)\n\t\t{\n\t\t\tline = reader.readLine().trim().split(\" \");\n\t\t\tindex = 0;\n\t\t}\n\n\t\treturn line[index++];\n\t}\n\n\tpublic String next() throws IOException {\n\t\treturn nextToken();\n\t}\n\n\tpublic String readLine() throws IOException {\n\t\tline = null;\n\t\tindex = 0;\n\n\t\treturn reader.readLine();\n\t}\n\n\tpublic byte nextByte() throws IOException, NumberFormatException {\n\t\treturn Byte.parseByte(nextToken());\n\t}\n\n\tpublic short nextShort() throws IOException, NumberFormatException {\n\t\treturn Short.parseShort(nextToken());\n\t}\n\n\tpublic int nextInt() throws IOException, NumberFormatException {\n\t\treturn Integer.parseInt(nextToken());\n\t}\n\n\tpublic long nextLong() throws IOException, NumberFormatException {\n\t\treturn Long.parseLong(nextToken());\n\t}\n\n\tpublic float nextFloat() throws IOException, NumberFormatException {\n\t\treturn Float.parseFloat(nextToken());\n\t}\n\n\tpublic double nextDouble() throws IOException, NumberFormatException {\n\t\treturn Double.parseDouble(nextToken());\n\t}\n\n\tpublic T nextObject(final ICreator creator) throws IOException, NumberFormatException {\n\t\treturn creator.createFromToken(this);\n\t}\n\n\tpublic int[] nextIntArray(final int N) throws IOException, NumberFormatException {\n\t\tint[] result = new int[N];\n\n\t\tfor(int i=0; i < N; i++) result[i] = nextInt();\n\n\t\treturn result;\n\t}\n\n\tpublic long[] nextLongArray(final int N) throws IOException, NumberFormatException {\n\t\tlong[] result = new long[N];\n\n\t\tfor(int i=0; i < N; i++) result[i] = nextLong();\n\n\t\treturn result;\n\t}\n\n\tpublic float[] nexFloatArray(final int N) throws IOException, NumberFormatException {\n\t\tfloat[] result = new float[N];\n\n\t\tfor(int i=0; i < N; i++) result[i] = nextFloat();\n\n\t\treturn result;\n\t}\n\n\tpublic double[] nexDoubleArray(final int N) throws IOException, NumberFormatException {\n\t\tdouble[] result = new double[N];\n\n\t\tfor(int i=0; i < N; i++) result[i] = nextDouble();\n\n\t\treturn result;\n\t}\n\n\tpublic T[] nextObjectArray(T[] result, final ICreator creator) throws IOException, NumberFormatException {\n\t\tfor(int i=0, N=result.length; i < N; i++) result[i] = nextObject(creator);\n\n\t\treturn result;\n\t}\n\n\tpublic ArrayList nextGenericObjectArrayList(final int N, final ICreator creator) throws IOException, NumberFormatException {\n\t\tArrayList result = new ArrayList();\n\t\tfor(int i=0; i < N; i++) result.add(nextObject(creator));\n\n\t\treturn result;\n\t}\n\n\tpublic void nextTable(final int N, IArrayInitializer... arrayInitializers) throws IOException, NumberFormatException {\n\t\tfor(int i=0; i < N; i++) for(IArrayInitializer initializer: arrayInitializers)\n\t\t{\n\t\t\tinitializer.initialize(this, i);\n\t\t}\n\t}\n}", "language": "Java", "metadata": {"date": 1479623861, "filename_ext": "java", "original_language": "JAVA", "problem_description_relpath": "problem_descriptions/p02269.html", "problem_id": "p02269", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02269/input.txt", "sample_output_relpath": "derived/input_output/data/p02269/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02269/Java/s622690307.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Memory Limit Exceeded", "submission_id": "s622690307", "user_id": "u390428842"}, "prompt_components": {"gold_output": "no\nyes\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.FileInputStream;\nimport java.io.FileNotFoundException;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\n\npublic class Main {\n\tpublic static void main(String[] args) throws IOException {\n\t\tContestScanner scan = new ContestScanner();\n\t\tfinal int n = scan.nextInt();\n\t\tfinal Dictionary dic = new Dictionary(200000000, (size, key) -> {\n\t\t\tint index = 0;\n\n\t\t\tfor(int i=0, l=key.length(); i < l; i++)\n\t\t\t{\n\t\t\t\tindex = index * 37 + (int)key.charAt(i);\n\t\t\t\tindex = index % size;\n\t\t\t}\n\t\t\treturn index;\n\t\t});\n\t\t(new Solve(n, scan.nextObjectArray(new ICommand[n], (scanner) -> {\n\t\t\tString name = scanner.next();\n\t\t\treturn name.equals(\"insert\") ? new InsertCommand(dic, scan.next()) : name.equals(\"find\") ? new FindCommand(dic, scan.next()) : null;\n\t\t}))).solve();\n\t}\n}\nclass Solve {\n\tprivate final int n;\n\tprivate final ICommand[] commands;\n\n\tpublic Solve(final int n, final ICommand[] commands)\n\t{\n\t\tthis.n = n;\n\t\tthis.commands = commands;\n\t}\n\n\tpublic void solve()\n\t{\n\t\tfor(ICommand c: commands)\n\t\t{\n\t\t\tc.run();\n\t\t}\n\t}\n}\ninterface ICommand {\n\tpublic void run();\n}\nclass InsertCommand implements ICommand {\n\tpublic final String key;\n\tpublic final Dictionary dic;\n\tpublic InsertCommand(Dictionary dic, String key)\n\t{\n\t\tthis.dic = dic;\n\t\tthis.key = key;\n\t}\n\tpublic void run()\n\t{\n\t\tdic.add(key);\n\t}\n}\nclass FindCommand implements ICommand {\n\tpublic final String key;\n\tpublic final Dictionary dic;\n\tpublic FindCommand(Dictionary dic, String key)\n\t{\n\t\tthis.dic = dic;\n\t\tthis.key = key;\n\t}\n\tpublic void run()\n\t{\n\t\tSystem.out.println((dic.find(key) ? \"yes\" : \"no\"));\n\t}\n}\nclass ListItem {\n\tpublic final String value;\n\tpublic ListItem next;\n\n\tpublic ListItem(String value)\n\t{\n\t\tthis.value = value;\n\t\tthis.next = null;\n\t}\n\n\tpublic ListItem add(String value)\n\t{\n\n\t\tListItem entry = this;\n\n\t\twhile(entry != null && !entry.value.equals(value)) entry = entry.next;\n\n\t\tif(entry != null) return this;\n\n\t\tentry = new ListItem(value);\n\t\tentry.next = this;\n\t\treturn entry;\n\t}\n}\ninterface HashCreator {\n\tpublic int hash(int size, String value);\n}\nclass Dictionary {\n\tprivate final ListItem[] table;\n\tprivate final int tableSize;\n\tprivate final HashCreator hashCreator;\n\n\tpublic Dictionary(final int size, final HashCreator hashCreator)\n\t{\n\t\tthis.tableSize = size;\n\t\tthis.table = new ListItem[size];\n\t\tthis.hashCreator = hashCreator;\n\t}\n\n\tpublic void add(String value)\n\t{\n\t\tint index = hashCreator.hash(tableSize, value);\n\t\tListItem entry = table[index];\n\t\tif(entry == null) table[index] = new ListItem(value);\n\t\telse table[index] = entry.add(value);\n\t}\n\n\tpublic boolean find(String value)\n\t{\n\t\tint index = hashCreator.hash(tableSize, value);\n\t\tListItem entry = table[index];\n\n\t\twhile(entry != null && !entry.value.equals(value))\n\t\t{\n\t\t\tentry = entry.next;\n\t\t}\n\n\t\treturn entry != null;\n\t}\n}\nclass ContestScanner {\n\tBufferedReader reader;\n\tString[] line;\n\tint index;\n\tpublic ContestScanner() {\n\t\treader = new BufferedReader(new InputStreamReader(System.in));\n\t}\n\n\tpublic ContestScanner(String filename) throws FileNotFoundException {\n\t\treader = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));\n\t}\n\n\tpublic static interface ICreator {\n\t\tpublic T createFromToken(final ContestScanner scanner) throws IOException;\n\t}\n\n\tpublic static interface IArrayInitializer {\n\t\tpublic void initialize(final ContestScanner scanner, final int i) throws IOException;\n\t}\n\n\tpublic static interface IObjectInitializer {\n\t\tpublic T initialValue(final ContestScanner scanner);\n\t}\n\n\tpublic static class ObjectArrayInitializer implements IArrayInitializer {\n\t\tprotected T[] arr;\n\t\tprotected final IObjectInitializer initializer;\n\n\t\tprivate ObjectArrayInitializer(T[] arr, final IObjectInitializer initializer)\n\t\t{\n\t\t\tthis.arr = arr;\n\t\t\tthis.initializer = initializer;\n\t\t}\n\n\t\tpublic static ObjectArrayInitializer create(T[] arr, final IObjectInitializer initializer)\n\t\t{\n\t\t\treturn new ObjectArrayInitializer(arr, initializer);\n\t\t}\n\n\t\tpublic void initialize(final ContestScanner scanner, final int i) throws IOException {\n\t\t\tthis.arr[i] = initializer.initialValue(scanner);\n\t\t}\n\n\t\tpublic T[] getArray()\n\t\t{\n\t\t\treturn this.arr;\n\t\t}\n\t}\n\n\n\tpublic static class ByteArrayInitializer implements IArrayInitializer {\n\t\tprotected byte[] arr;\n\n\t\tprivate ByteArrayInitializer(final int n)\n\t\t{\n\t\t\tthis.arr = new byte[n];\n\t\t}\n\n\t\tpublic void initialize(final ContestScanner scanner, final int i) throws IOException {\n\t\t\tthis.arr[i] = scanner.nextByte();\n\t\t}\n\n\t\tpublic byte[] getArray()\n\t\t{\n\t\t\treturn this.arr;\n\t\t}\n\t}\n\n\tpublic static class ShortArrayInitializer implements IArrayInitializer {\n\t\tprotected short[] arr;\n\n\t\tprivate ShortArrayInitializer(final int n)\n\t\t{\n\t\t\tthis.arr = new short[n];\n\t\t}\n\n\t\tpublic void initialize(final ContestScanner scanner, final int i) throws IOException {\n\t\t\tthis.arr[i] = scanner.nextShort();\n\t\t}\n\n\t\tpublic short[] getArray()\n\t\t{\n\t\t\treturn this.arr;\n\t\t}\n\t}\n\n\tpublic static class IntArrayInitializer implements IArrayInitializer {\n\t\tprotected int[] arr;\n\n\t\tprivate IntArrayInitializer(final int n)\n\t\t{\n\t\t\tthis.arr = new int[n];\n\t\t}\n\n\t\tpublic void initialize(final ContestScanner scanner, final int i) throws IOException {\n\t\t\tthis.arr[i] = scanner.nextInt();\n\t\t}\n\n\t\tpublic int[] getArray()\n\t\t{\n\t\t\treturn this.arr;\n\t\t}\n\t}\n\n\tpublic static class LongArrayInitializer implements IArrayInitializer {\n\t\tprotected long[] arr;\n\n\t\tprivate LongArrayInitializer(final int n)\n\t\t{\n\t\t\tthis.arr = new long[n];\n\t\t}\n\n\t\tpublic void initialize(final ContestScanner scanner, final int i) throws IOException {\n\t\t\tthis.arr[i] = scanner.nextLong();\n\t\t}\n\n\t\tpublic long[] getArray()\n\t\t{\n\t\t\treturn this.arr;\n\t\t}\n\t}\n\n\tpublic static class FloatArrayInitializer implements IArrayInitializer {\n\t\tprotected float[] arr;\n\n\t\tprivate FloatArrayInitializer(final int n)\n\t\t{\n\t\t\tthis.arr = new float[n];\n\t\t}\n\n\t\tpublic void initialize(final ContestScanner scanner, final int i) throws IOException {\n\t\t\tthis.arr[i] = scanner.nextFloat();\n\t\t}\n\n\t\tpublic float[] getArray()\n\t\t{\n\t\t\treturn this.arr;\n\t\t}\n\t}\n\n\tpublic static class DoubleArrayInitializer implements IArrayInitializer {\n\t\tprotected double[] arr;\n\n\t\tprivate DoubleArrayInitializer(final int n)\n\t\t{\n\t\t\tthis.arr = new double[n];\n\t\t}\n\n\t\tpublic void initialize(final ContestScanner scanner, final int i) throws IOException {\n\t\t\tthis.arr[i] = scanner.nextDouble();\n\t\t}\n\n\t\tpublic double[] getArray()\n\t\t{\n\t\t\treturn this.arr;\n\t\t}\n\t}\n\n\tpublic String nextToken() throws IOException {\n\t\tif(line == null || index >= line.length)\n\t\t{\n\t\t\tline = reader.readLine().trim().split(\" \");\n\t\t\tindex = 0;\n\t\t}\n\n\t\treturn line[index++];\n\t}\n\n\tpublic String next() throws IOException {\n\t\treturn nextToken();\n\t}\n\n\tpublic String readLine() throws IOException {\n\t\tline = null;\n\t\tindex = 0;\n\n\t\treturn reader.readLine();\n\t}\n\n\tpublic byte nextByte() throws IOException, NumberFormatException {\n\t\treturn Byte.parseByte(nextToken());\n\t}\n\n\tpublic short nextShort() throws IOException, NumberFormatException {\n\t\treturn Short.parseShort(nextToken());\n\t}\n\n\tpublic int nextInt() throws IOException, NumberFormatException {\n\t\treturn Integer.parseInt(nextToken());\n\t}\n\n\tpublic long nextLong() throws IOException, NumberFormatException {\n\t\treturn Long.parseLong(nextToken());\n\t}\n\n\tpublic float nextFloat() throws IOException, NumberFormatException {\n\t\treturn Float.parseFloat(nextToken());\n\t}\n\n\tpublic double nextDouble() throws IOException, NumberFormatException {\n\t\treturn Double.parseDouble(nextToken());\n\t}\n\n\tpublic T nextObject(final ICreator creator) throws IOException, NumberFormatException {\n\t\treturn creator.createFromToken(this);\n\t}\n\n\tpublic int[] nextIntArray(final int N) throws IOException, NumberFormatException {\n\t\tint[] result = new int[N];\n\n\t\tfor(int i=0; i < N; i++) result[i] = nextInt();\n\n\t\treturn result;\n\t}\n\n\tpublic long[] nextLongArray(final int N) throws IOException, NumberFormatException {\n\t\tlong[] result = new long[N];\n\n\t\tfor(int i=0; i < N; i++) result[i] = nextLong();\n\n\t\treturn result;\n\t}\n\n\tpublic float[] nexFloatArray(final int N) throws IOException, NumberFormatException {\n\t\tfloat[] result = new float[N];\n\n\t\tfor(int i=0; i < N; i++) result[i] = nextFloat();\n\n\t\treturn result;\n\t}\n\n\tpublic double[] nexDoubleArray(final int N) throws IOException, NumberFormatException {\n\t\tdouble[] result = new double[N];\n\n\t\tfor(int i=0; i < N; i++) result[i] = nextDouble();\n\n\t\treturn result;\n\t}\n\n\tpublic T[] nextObjectArray(T[] result, final ICreator creator) throws IOException, NumberFormatException {\n\t\tfor(int i=0, N=result.length; i < N; i++) result[i] = nextObject(creator);\n\n\t\treturn result;\n\t}\n\n\tpublic ArrayList nextGenericObjectArrayList(final int N, final ICreator creator) throws IOException, NumberFormatException {\n\t\tArrayList result = new ArrayList();\n\t\tfor(int i=0; i < N; i++) result.add(nextObject(creator));\n\n\t\treturn result;\n\t}\n\n\tpublic void nextTable(final int N, IArrayInitializer... arrayInitializers) throws IOException, NumberFormatException {\n\t\tfor(int i=0; i < N; i++) for(IArrayInitializer initializer: arrayInitializers)\n\t\t{\n\t\t\tinitializer.initialize(this, i);\n\t\t}\n\t}\n}", "problem_context": "Search III\n\nYour task is to write a program of a simple dictionary which implements the following instructions:\n\ninsert str: insert a string str in to the dictionary\n\nfind str: if the distionary contains str, then print 'yes', otherwise print 'no'\n\nInput\n\nIn the first line n, the number of instructions is given. In the following n lines, n instructions are given in the above mentioned format.\n\nOutput\n\nPrint yes or no for each find instruction in a line.\n\nConstraints\n\nA string consists of 'A', 'C', 'G', or 'T'\n\n1 ≤ length of a string ≤ 12\n\nn ≤ 1000000\n\nSample Input 1\n\n5\ninsert A\ninsert T\ninsert C\nfind G\nfind A\n\nSample Output 1\n\nno\nyes\n\nSample Input 2\n\n13\ninsert AAA\ninsert AAC\ninsert AGA\ninsert AGG\ninsert TTT\nfind AAA\nfind CCC\nfind CCC\ninsert CCC\nfind CCC\ninsert T\nfind TTT\nfind T\n\nSample Output 2\n\nyes\nno\nno\nyes\nyes\nyes\n\nNotes\n\nTemplate in C", "sample_input": "5\ninsert A\ninsert T\ninsert C\nfind G\nfind A\n"}, "reference_outputs": ["no\nyes\n"], "source_document_id": "p02269", "source_text": "Search III\n\nYour task is to write a program of a simple dictionary which implements the following instructions:\n\ninsert str: insert a string str in to the dictionary\n\nfind str: if the distionary contains str, then print 'yes', otherwise print 'no'\n\nInput\n\nIn the first line n, the number of instructions is given. In the following n lines, n instructions are given in the above mentioned format.\n\nOutput\n\nPrint yes or no for each find instruction in a line.\n\nConstraints\n\nA string consists of 'A', 'C', 'G', or 'T'\n\n1 ≤ length of a string ≤ 12\n\nn ≤ 1000000\n\nSample Input 1\n\n5\ninsert A\ninsert T\ninsert C\nfind G\nfind A\n\nSample Output 1\n\nno\nyes\n\nSample Input 2\n\n13\ninsert AAA\ninsert AAC\ninsert AGA\ninsert AGG\ninsert TTT\nfind AAA\nfind CCC\nfind CCC\ninsert CCC\nfind CCC\ninsert T\nfind TTT\nfind T\n\nSample Output 2\n\nyes\nno\nno\nyes\nyes\nyes\n\nNotes\n\nTemplate in C", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 9122, "cpu_time_ms": 290, "memory_kb": 814624}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s238998231", "group_id": "codeNet:p02269", "input_text": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n \n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n ArrayList array = new ArrayList();\n \n int N = in.nextInt();\n for (int i = 0; i < N; i++){\n String c1 = in.next();\n String c2 = in.next();\n \n if (c1.equals(\"insert\")){\n array.add(c2);\n }else if(c1.equals(\"find\")){ \n if (array.contains(c2)){\n System.out.println(\"yes\");\n }else{\n System.out.println(\"no\");\n }\n }\n \n System.out.println(c2);\n }\n }\n}", "language": "Java", "metadata": {"date": 1491959738, "filename_ext": "java", "original_language": "JAVA", "problem_description_relpath": "problem_descriptions/p02269.html", "problem_id": "p02269", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02269/input.txt", "sample_output_relpath": "derived/input_output/data/p02269/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02269/Java/s238998231.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s238998231", "user_id": "u851545257"}, "prompt_components": {"gold_output": "no\nyes\n", "input_to_evaluate": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n \n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n ArrayList array = new ArrayList();\n \n int N = in.nextInt();\n for (int i = 0; i < N; i++){\n String c1 = in.next();\n String c2 = in.next();\n \n if (c1.equals(\"insert\")){\n array.add(c2);\n }else if(c1.equals(\"find\")){ \n if (array.contains(c2)){\n System.out.println(\"yes\");\n }else{\n System.out.println(\"no\");\n }\n }\n \n System.out.println(c2);\n }\n }\n}", "problem_context": "Search III\n\nYour task is to write a program of a simple dictionary which implements the following instructions:\n\ninsert str: insert a string str in to the dictionary\n\nfind str: if the distionary contains str, then print 'yes', otherwise print 'no'\n\nInput\n\nIn the first line n, the number of instructions is given. In the following n lines, n instructions are given in the above mentioned format.\n\nOutput\n\nPrint yes or no for each find instruction in a line.\n\nConstraints\n\nA string consists of 'A', 'C', 'G', or 'T'\n\n1 ≤ length of a string ≤ 12\n\nn ≤ 1000000\n\nSample Input 1\n\n5\ninsert A\ninsert T\ninsert C\nfind G\nfind A\n\nSample Output 1\n\nno\nyes\n\nSample Input 2\n\n13\ninsert AAA\ninsert AAC\ninsert AGA\ninsert AGG\ninsert TTT\nfind AAA\nfind CCC\nfind CCC\ninsert CCC\nfind CCC\ninsert T\nfind TTT\nfind T\n\nSample Output 2\n\nyes\nno\nno\nyes\nyes\nyes\n\nNotes\n\nTemplate in C", "sample_input": "5\ninsert A\ninsert T\ninsert C\nfind G\nfind A\n"}, "reference_outputs": ["no\nyes\n"], "source_document_id": "p02269", "source_text": "Search III\n\nYour task is to write a program of a simple dictionary which implements the following instructions:\n\ninsert str: insert a string str in to the dictionary\n\nfind str: if the distionary contains str, then print 'yes', otherwise print 'no'\n\nInput\n\nIn the first line n, the number of instructions is given. In the following n lines, n instructions are given in the above mentioned format.\n\nOutput\n\nPrint yes or no for each find instruction in a line.\n\nConstraints\n\nA string consists of 'A', 'C', 'G', or 'T'\n\n1 ≤ length of a string ≤ 12\n\nn ≤ 1000000\n\nSample Input 1\n\n5\ninsert A\ninsert T\ninsert C\nfind G\nfind A\n\nSample Output 1\n\nno\nyes\n\nSample Input 2\n\n13\ninsert AAA\ninsert AAC\ninsert AGA\ninsert AGG\ninsert TTT\nfind AAA\nfind CCC\nfind CCC\ninsert CCC\nfind CCC\ninsert T\nfind TTT\nfind T\n\nSample Output 2\n\nyes\nno\nno\nyes\nyes\nyes\n\nNotes\n\nTemplate in C", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 80, "memory_kb": 26080}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s832360282", "group_id": "codeNet:p02269", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n\tstatic int count = 0;\n\n\tpublic static void main(String[] args) throws Exception {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\n\t\tString[] strArray = new String[n];\n\t\tint end = 0;\n\t\tStringBuffer sb = new StringBuffer();\n\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tString order = sc.next();\n\t\t\tString str = sc.next();\n\n\t\t\tif(order.equals(\"insert\")) {\n\t\t\t\tstrArray[end] = str;\n\t\t\t\tend++;\n\t\t\t} else {\n\t\t\t\tboolean chk = false;\n\n\t\t\t\tfor(int j = 0; j < end; j++) {\n\t\t\t\t\tif(str.equals(strArray[j])) {\n\t\t\t\t\t\tchk = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(chk) {\n\t\t\t\t\tsb.append(\"yes\\n\");\n\t\t\t\t} else {\n\t\t\t\t\tsb.append(\"no\\n\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sb);\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1516076732, "filename_ext": "java", "original_language": "JAVA", "problem_description_relpath": "problem_descriptions/p02269.html", "problem_id": "p02269", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02269/input.txt", "sample_output_relpath": "derived/input_output/data/p02269/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02269/Java/s832360282.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "WA: Presentation Error", "submission_id": "s832360282", "user_id": "u012343371"}, "prompt_components": {"gold_output": "no\nyes\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n\tstatic int count = 0;\n\n\tpublic static void main(String[] args) throws Exception {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\n\t\tString[] strArray = new String[n];\n\t\tint end = 0;\n\t\tStringBuffer sb = new StringBuffer();\n\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tString order = sc.next();\n\t\t\tString str = sc.next();\n\n\t\t\tif(order.equals(\"insert\")) {\n\t\t\t\tstrArray[end] = str;\n\t\t\t\tend++;\n\t\t\t} else {\n\t\t\t\tboolean chk = false;\n\n\t\t\t\tfor(int j = 0; j < end; j++) {\n\t\t\t\t\tif(str.equals(strArray[j])) {\n\t\t\t\t\t\tchk = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(chk) {\n\t\t\t\t\tsb.append(\"yes\\n\");\n\t\t\t\t} else {\n\t\t\t\t\tsb.append(\"no\\n\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sb);\n\t}\n\n}\n", "problem_context": "Search III\n\nYour task is to write a program of a simple dictionary which implements the following instructions:\n\ninsert str: insert a string str in to the dictionary\n\nfind str: if the distionary contains str, then print 'yes', otherwise print 'no'\n\nInput\n\nIn the first line n, the number of instructions is given. In the following n lines, n instructions are given in the above mentioned format.\n\nOutput\n\nPrint yes or no for each find instruction in a line.\n\nConstraints\n\nA string consists of 'A', 'C', 'G', or 'T'\n\n1 ≤ length of a string ≤ 12\n\nn ≤ 1000000\n\nSample Input 1\n\n5\ninsert A\ninsert T\ninsert C\nfind G\nfind A\n\nSample Output 1\n\nno\nyes\n\nSample Input 2\n\n13\ninsert AAA\ninsert AAC\ninsert AGA\ninsert AGG\ninsert TTT\nfind AAA\nfind CCC\nfind CCC\ninsert CCC\nfind CCC\ninsert T\nfind TTT\nfind T\n\nSample Output 2\n\nyes\nno\nno\nyes\nyes\nyes\n\nNotes\n\nTemplate in C", "sample_input": "5\ninsert A\ninsert T\ninsert C\nfind G\nfind A\n"}, "reference_outputs": ["no\nyes\n"], "source_document_id": "p02269", "source_text": "Search III\n\nYour task is to write a program of a simple dictionary which implements the following instructions:\n\ninsert str: insert a string str in to the dictionary\n\nfind str: if the distionary contains str, then print 'yes', otherwise print 'no'\n\nInput\n\nIn the first line n, the number of instructions is given. In the following n lines, n instructions are given in the above mentioned format.\n\nOutput\n\nPrint yes or no for each find instruction in a line.\n\nConstraints\n\nA string consists of 'A', 'C', 'G', or 'T'\n\n1 ≤ length of a string ≤ 12\n\nn ≤ 1000000\n\nSample Input 1\n\n5\ninsert A\ninsert T\ninsert C\nfind G\nfind A\n\nSample Output 1\n\nno\nyes\n\nSample Input 2\n\n13\ninsert AAA\ninsert AAC\ninsert AGA\ninsert AGG\ninsert TTT\nfind AAA\nfind CCC\nfind CCC\ninsert CCC\nfind CCC\ninsert T\nfind TTT\nfind T\n\nSample Output 2\n\nyes\nno\nno\nyes\nyes\nyes\n\nNotes\n\nTemplate in C", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 721, "cpu_time_ms": 60, "memory_kb": 26344}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s993844543", "group_id": "codeNet:p02269", "input_text": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayDeque;\n\nclass Main {\n\tpublic static void main(String args[]) {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\ttry {\n\t\t\tint ope_num = Integer.parseInt(br.readLine());\n\t\t\tDictionary(ope_num,br);\n\t\t} catch (NumberFormatException | IOException e) {\n\t\t\t// TODO 自動生成された catch ブロック\n\t\t\te.printStackTrace();\n\t\t}\n\t}\n\t\n\t//enum宣言\n\tpublic static enum Operate{\n\t\tinsert(\"insert\"),\n\t\tfind (\"find\"),;\n\t\t\n\t\tprivate final String name;\n\t\t\n\t\tOperate(String name){\n\t\t\tthis.name = name;\n\t\t}\n\t\t\n\t\tString getName(){\n\t\t\treturn this.name;\n\t\t}\n\n\t\tpublic static Operate getEnumName(String str){\n\t\t\tfor(Operate v : values()){\n\t\t\t\tif(v.getName().equals(str)){\n\t\t\t\t\treturn v;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthrow new IllegalArgumentException(\"undefined : \" + str);\n\t\t}\n\t}\n\n\tpublic static void Dictionary( int ope_num ,BufferedReader br ){\n\t\tArrayDeque que = new ArrayDeque();\n\t\tint i;\n\t\tString[] op;\n\t\tboolean bfind = false;\n\t\t\n\t\tfor ( i = 0; i < ope_num; i++) {\n\t\t\ttry {\n\t\t\t\top = br.readLine().split(\" \");\t\t//キーと命令を分割\n\t\t\t \n\t\t\t\tswitch( Operate.getEnumName(op[0]) ){ //命令によって処理\n\t\t\t\tcase insert:\n\t\t\t\t\tque.addFirst(op[1]);\t\t\t//キューに追加\n\t\t\t\t\tbreak;\n\t\t\t\tcase find:\n\t\t\t\t\tbfind = que.contains(op[1]);\t\t\t\t//キューから削除\n\t\t\t\t\t\n\t\t\t\t\tif(bfind) {\n\t\t\t\t\t\tSystem.out.println(\"yes\");\n\t\t\t\t\t\tbfind = false;\n\t\t\t\t\t}else {\n\t\t\t\t\t\tSystem.out.println(\"no\");\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} catch (IOException e) {\n\t\t\t\t// TODO 自動生成された catch ブロック\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t}\n}\n", "language": "Java", "metadata": {"date": 1524106228, "filename_ext": "java", "original_language": "JAVA", "problem_description_relpath": "problem_descriptions/p02269.html", "problem_id": "p02269", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02269/input.txt", "sample_output_relpath": "derived/input_output/data/p02269/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02269/Java/s993844543.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s993844543", "user_id": "u438493637"}, "prompt_components": {"gold_output": "no\nyes\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayDeque;\n\nclass Main {\n\tpublic static void main(String args[]) {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\ttry {\n\t\t\tint ope_num = Integer.parseInt(br.readLine());\n\t\t\tDictionary(ope_num,br);\n\t\t} catch (NumberFormatException | IOException e) {\n\t\t\t// TODO 自動生成された catch ブロック\n\t\t\te.printStackTrace();\n\t\t}\n\t}\n\t\n\t//enum宣言\n\tpublic static enum Operate{\n\t\tinsert(\"insert\"),\n\t\tfind (\"find\"),;\n\t\t\n\t\tprivate final String name;\n\t\t\n\t\tOperate(String name){\n\t\t\tthis.name = name;\n\t\t}\n\t\t\n\t\tString getName(){\n\t\t\treturn this.name;\n\t\t}\n\n\t\tpublic static Operate getEnumName(String str){\n\t\t\tfor(Operate v : values()){\n\t\t\t\tif(v.getName().equals(str)){\n\t\t\t\t\treturn v;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthrow new IllegalArgumentException(\"undefined : \" + str);\n\t\t}\n\t}\n\n\tpublic static void Dictionary( int ope_num ,BufferedReader br ){\n\t\tArrayDeque que = new ArrayDeque();\n\t\tint i;\n\t\tString[] op;\n\t\tboolean bfind = false;\n\t\t\n\t\tfor ( i = 0; i < ope_num; i++) {\n\t\t\ttry {\n\t\t\t\top = br.readLine().split(\" \");\t\t//キーと命令を分割\n\t\t\t \n\t\t\t\tswitch( Operate.getEnumName(op[0]) ){ //命令によって処理\n\t\t\t\tcase insert:\n\t\t\t\t\tque.addFirst(op[1]);\t\t\t//キューに追加\n\t\t\t\t\tbreak;\n\t\t\t\tcase find:\n\t\t\t\t\tbfind = que.contains(op[1]);\t\t\t\t//キューから削除\n\t\t\t\t\t\n\t\t\t\t\tif(bfind) {\n\t\t\t\t\t\tSystem.out.println(\"yes\");\n\t\t\t\t\t\tbfind = false;\n\t\t\t\t\t}else {\n\t\t\t\t\t\tSystem.out.println(\"no\");\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} catch (IOException e) {\n\t\t\t\t// TODO 自動生成された catch ブロック\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t}\n}\n", "problem_context": "Search III\n\nYour task is to write a program of a simple dictionary which implements the following instructions:\n\ninsert str: insert a string str in to the dictionary\n\nfind str: if the distionary contains str, then print 'yes', otherwise print 'no'\n\nInput\n\nIn the first line n, the number of instructions is given. In the following n lines, n instructions are given in the above mentioned format.\n\nOutput\n\nPrint yes or no for each find instruction in a line.\n\nConstraints\n\nA string consists of 'A', 'C', 'G', or 'T'\n\n1 ≤ length of a string ≤ 12\n\nn ≤ 1000000\n\nSample Input 1\n\n5\ninsert A\ninsert T\ninsert C\nfind G\nfind A\n\nSample Output 1\n\nno\nyes\n\nSample Input 2\n\n13\ninsert AAA\ninsert AAC\ninsert AGA\ninsert AGG\ninsert TTT\nfind AAA\nfind CCC\nfind CCC\ninsert CCC\nfind CCC\ninsert T\nfind TTT\nfind T\n\nSample Output 2\n\nyes\nno\nno\nyes\nyes\nyes\n\nNotes\n\nTemplate in C", "sample_input": "5\ninsert A\ninsert T\ninsert C\nfind G\nfind A\n"}, "reference_outputs": ["no\nyes\n"], "source_document_id": "p02269", "source_text": "Search III\n\nYour task is to write a program of a simple dictionary which implements the following instructions:\n\ninsert str: insert a string str in to the dictionary\n\nfind str: if the distionary contains str, then print 'yes', otherwise print 'no'\n\nInput\n\nIn the first line n, the number of instructions is given. In the following n lines, n instructions are given in the above mentioned format.\n\nOutput\n\nPrint yes or no for each find instruction in a line.\n\nConstraints\n\nA string consists of 'A', 'C', 'G', or 'T'\n\n1 ≤ length of a string ≤ 12\n\nn ≤ 1000000\n\nSample Input 1\n\n5\ninsert A\ninsert T\ninsert C\nfind G\nfind A\n\nSample Output 1\n\nno\nyes\n\nSample Input 2\n\n13\ninsert AAA\ninsert AAC\ninsert AGA\ninsert AGG\ninsert TTT\nfind AAA\nfind CCC\nfind CCC\ninsert CCC\nfind CCC\ninsert T\nfind TTT\nfind T\n\nSample Output 2\n\nyes\nno\nno\nyes\nyes\nyes\n\nNotes\n\nTemplate in C", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1680, "cpu_time_ms": 8250, "memory_kb": 65976}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s892989704", "group_id": "codeNet:p02269", "input_text": "import java.util.HashSet;\nimport java.util.Set;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n Set dic = new HashSet();\n\n String cmd;\n String str;\n int times = sc.nextInt();\n\n for(int i = 0; i < times; i++){\n cmd = sc.next();\n str = sc.next();\n\n if(cmd.equals(\"insert\"))\n dic.add(str);\n\n if(cmd.equals(\"find\")){\n if(dic.contains(str))\n System.out.println(\"yes\");\n else\n System.out.println(\"no\");\n }\n }\n sc.close();\n }\n}\n", "language": "Java", "metadata": {"date": 1524656189, "filename_ext": "java", "original_language": "JAVA", "problem_description_relpath": "problem_descriptions/p02269.html", "problem_id": "p02269", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02269/input.txt", "sample_output_relpath": "derived/input_output/data/p02269/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02269/Java/s892989704.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s892989704", "user_id": "u047818749"}, "prompt_components": {"gold_output": "no\nyes\n", "input_to_evaluate": "import java.util.HashSet;\nimport java.util.Set;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n Set dic = new HashSet();\n\n String cmd;\n String str;\n int times = sc.nextInt();\n\n for(int i = 0; i < times; i++){\n cmd = sc.next();\n str = sc.next();\n\n if(cmd.equals(\"insert\"))\n dic.add(str);\n\n if(cmd.equals(\"find\")){\n if(dic.contains(str))\n System.out.println(\"yes\");\n else\n System.out.println(\"no\");\n }\n }\n sc.close();\n }\n}\n", "problem_context": "Search III\n\nYour task is to write a program of a simple dictionary which implements the following instructions:\n\ninsert str: insert a string str in to the dictionary\n\nfind str: if the distionary contains str, then print 'yes', otherwise print 'no'\n\nInput\n\nIn the first line n, the number of instructions is given. In the following n lines, n instructions are given in the above mentioned format.\n\nOutput\n\nPrint yes or no for each find instruction in a line.\n\nConstraints\n\nA string consists of 'A', 'C', 'G', or 'T'\n\n1 ≤ length of a string ≤ 12\n\nn ≤ 1000000\n\nSample Input 1\n\n5\ninsert A\ninsert T\ninsert C\nfind G\nfind A\n\nSample Output 1\n\nno\nyes\n\nSample Input 2\n\n13\ninsert AAA\ninsert AAC\ninsert AGA\ninsert AGG\ninsert TTT\nfind AAA\nfind CCC\nfind CCC\ninsert CCC\nfind CCC\ninsert T\nfind TTT\nfind T\n\nSample Output 2\n\nyes\nno\nno\nyes\nyes\nyes\n\nNotes\n\nTemplate in C", "sample_input": "5\ninsert A\ninsert T\ninsert C\nfind G\nfind A\n"}, "reference_outputs": ["no\nyes\n"], "source_document_id": "p02269", "source_text": "Search III\n\nYour task is to write a program of a simple dictionary which implements the following instructions:\n\ninsert str: insert a string str in to the dictionary\n\nfind str: if the distionary contains str, then print 'yes', otherwise print 'no'\n\nInput\n\nIn the first line n, the number of instructions is given. In the following n lines, n instructions are given in the above mentioned format.\n\nOutput\n\nPrint yes or no for each find instruction in a line.\n\nConstraints\n\nA string consists of 'A', 'C', 'G', or 'T'\n\n1 ≤ length of a string ≤ 12\n\nn ≤ 1000000\n\nSample Input 1\n\n5\ninsert A\ninsert T\ninsert C\nfind G\nfind A\n\nSample Output 1\n\nno\nyes\n\nSample Input 2\n\n13\ninsert AAA\ninsert AAC\ninsert AGA\ninsert AGG\ninsert TTT\nfind AAA\nfind CCC\nfind CCC\ninsert CCC\nfind CCC\ninsert T\nfind TTT\nfind T\n\nSample Output 2\n\nyes\nno\nno\nyes\nyes\nyes\n\nNotes\n\nTemplate in C", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 716, "cpu_time_ms": 2630, "memory_kb": 209508}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s755673635", "group_id": "codeNet:p02269", "input_text": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.nio.file.FileStore;\n\npublic class Main {\n\n public static void main(String[] args) throws IOException {\n \n try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {\n\n int n = Integer.parseInt(br.readLine());\n String[] order;\n StringBuilder result = new StringBuilder(n*4);\n Dictionary dict = new Dictionary(4, n);\n\n for(int i=0; i set = new HashSet();\n\n String x,y;\n int n = sc.nextInt();\n int i;\n\n for(i = 0;i < n;i++){\n x = sc.next();\n y = sc.next();\n\n if(x.equals(\"insert\")){\n set.add(y);\n }\n\n if(x.equals(\"find\")){\n if(set.contains(y)){\n System.out.printf(\"yes\\n\");\n }else{\n System.out.printf(\"no\\n\");\n }\n }\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1557210719, "filename_ext": "java", "original_language": "JAVA", "problem_description_relpath": "problem_descriptions/p02269.html", "problem_id": "p02269", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02269/input.txt", "sample_output_relpath": "derived/input_output/data/p02269/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02269/Java/s256783806.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s256783806", "user_id": "u687099833"}, "prompt_components": {"gold_output": "no\nyes\n", "input_to_evaluate": "import java.util.Scanner;\nimport java.util.HashSet;\n\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n\n HashSet set = new HashSet();\n\n String x,y;\n int n = sc.nextInt();\n int i;\n\n for(i = 0;i < n;i++){\n x = sc.next();\n y = sc.next();\n\n if(x.equals(\"insert\")){\n set.add(y);\n }\n\n if(x.equals(\"find\")){\n if(set.contains(y)){\n System.out.printf(\"yes\\n\");\n }else{\n System.out.printf(\"no\\n\");\n }\n }\n }\n }\n}\n", "problem_context": "Search III\n\nYour task is to write a program of a simple dictionary which implements the following instructions:\n\ninsert str: insert a string str in to the dictionary\n\nfind str: if the distionary contains str, then print 'yes', otherwise print 'no'\n\nInput\n\nIn the first line n, the number of instructions is given. In the following n lines, n instructions are given in the above mentioned format.\n\nOutput\n\nPrint yes or no for each find instruction in a line.\n\nConstraints\n\nA string consists of 'A', 'C', 'G', or 'T'\n\n1 ≤ length of a string ≤ 12\n\nn ≤ 1000000\n\nSample Input 1\n\n5\ninsert A\ninsert T\ninsert C\nfind G\nfind A\n\nSample Output 1\n\nno\nyes\n\nSample Input 2\n\n13\ninsert AAA\ninsert AAC\ninsert AGA\ninsert AGG\ninsert TTT\nfind AAA\nfind CCC\nfind CCC\ninsert CCC\nfind CCC\ninsert T\nfind TTT\nfind T\n\nSample Output 2\n\nyes\nno\nno\nyes\nyes\nyes\n\nNotes\n\nTemplate in C", "sample_input": "5\ninsert A\ninsert T\ninsert C\nfind G\nfind A\n"}, "reference_outputs": ["no\nyes\n"], "source_document_id": "p02269", "source_text": "Search III\n\nYour task is to write a program of a simple dictionary which implements the following instructions:\n\ninsert str: insert a string str in to the dictionary\n\nfind str: if the distionary contains str, then print 'yes', otherwise print 'no'\n\nInput\n\nIn the first line n, the number of instructions is given. In the following n lines, n instructions are given in the above mentioned format.\n\nOutput\n\nPrint yes or no for each find instruction in a line.\n\nConstraints\n\nA string consists of 'A', 'C', 'G', or 'T'\n\n1 ≤ length of a string ≤ 12\n\nn ≤ 1000000\n\nSample Input 1\n\n5\ninsert A\ninsert T\ninsert C\nfind G\nfind A\n\nSample Output 1\n\nno\nyes\n\nSample Input 2\n\n13\ninsert AAA\ninsert AAC\ninsert AGA\ninsert AGG\ninsert TTT\nfind AAA\nfind CCC\nfind CCC\ninsert CCC\nfind CCC\ninsert T\nfind TTT\nfind T\n\nSample Output 2\n\nyes\nno\nno\nyes\nyes\nyes\n\nNotes\n\nTemplate in C", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 685, "cpu_time_ms": 2410, "memory_kb": 333804}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s294242639", "group_id": "codeNet:p02269", "input_text": "import java.util.*;\n\npublic class Main {\n\n static int NOT_FOUND = 99999999;\n static int M = 1046527;\n\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n Integer[] intArr = new Integer[M];\n for (int i = 0; i < n; i++) {\n String command = sc.next();\n String value = sc.next();\n if (command.equals(\"insert\")) {\n insert(intArr, toInt(value));\n } else {\n if (search(intArr, toInt(value)).equals(NOT_FOUND)) {\n System.out.println(\"no\");\n } else {\n System.out.println(\"yes\");\n }\n }\n\n }\n }\n\n static int getChar(char ch) {\n if (ch == 'A') {\n return 1;\n } else if (ch == 'C') {\n return 2;\n } else if (ch == 'G') {\n return 3;\n } else if (ch == 'T') {\n return 4;\n } else {\n return 0;\n }\n }\n\n static int toInt(String s) {\n int sum = 0;\n char[] arr = s.toCharArray();\n for (int i = 0; i < arr.length; i++) {\n sum += Math.pow(5, i) * getChar(arr[i]);\n }\n return sum;\n }\n\n static int h1(int key) {\n return key % M;\n }\n\n static int h2(int key) {\n return 1 + (key % (M - 1));\n }\n\n static int h(int key, int i) {\n return (h1(key) + i * h2(key)) % M;\n }\n\n static int insert(Integer[] arr, int key) {\n int i = 0;\n while (true) {\n int j = h(key, i);\n if (arr[j] == null) {\n arr[j] = key;\n return j;\n } else {\n i++;\n }\n }\n }\n\n static Integer search(Integer[] arr, int key) {\n int i = 0;\n while (true) {\n int j = h(key, i);\n if (arr[j] == null || i >= M) {\n return NOT_FOUND;\n } else if (key == arr[j]) {\n return j;\n } else {\n i++;\n }\n }\n }\n\n}\n\n", "language": "Java", "metadata": {"date": 1551670574, "filename_ext": "java", "original_language": "JAVA", "problem_description_relpath": "problem_descriptions/p02269.html", "problem_id": "p02269", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02269/input.txt", "sample_output_relpath": "derived/input_output/data/p02269/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02269/Java/s294242639.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s294242639", "user_id": "u927478431"}, "prompt_components": {"gold_output": "no\nyes\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n\n static int NOT_FOUND = 99999999;\n static int M = 1046527;\n\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n Integer[] intArr = new Integer[M];\n for (int i = 0; i < n; i++) {\n String command = sc.next();\n String value = sc.next();\n if (command.equals(\"insert\")) {\n insert(intArr, toInt(value));\n } else {\n if (search(intArr, toInt(value)).equals(NOT_FOUND)) {\n System.out.println(\"no\");\n } else {\n System.out.println(\"yes\");\n }\n }\n\n }\n }\n\n static int getChar(char ch) {\n if (ch == 'A') {\n return 1;\n } else if (ch == 'C') {\n return 2;\n } else if (ch == 'G') {\n return 3;\n } else if (ch == 'T') {\n return 4;\n } else {\n return 0;\n }\n }\n\n static int toInt(String s) {\n int sum = 0;\n char[] arr = s.toCharArray();\n for (int i = 0; i < arr.length; i++) {\n sum += Math.pow(5, i) * getChar(arr[i]);\n }\n return sum;\n }\n\n static int h1(int key) {\n return key % M;\n }\n\n static int h2(int key) {\n return 1 + (key % (M - 1));\n }\n\n static int h(int key, int i) {\n return (h1(key) + i * h2(key)) % M;\n }\n\n static int insert(Integer[] arr, int key) {\n int i = 0;\n while (true) {\n int j = h(key, i);\n if (arr[j] == null) {\n arr[j] = key;\n return j;\n } else {\n i++;\n }\n }\n }\n\n static Integer search(Integer[] arr, int key) {\n int i = 0;\n while (true) {\n int j = h(key, i);\n if (arr[j] == null || i >= M) {\n return NOT_FOUND;\n } else if (key == arr[j]) {\n return j;\n } else {\n i++;\n }\n }\n }\n\n}\n\n", "problem_context": "Search III\n\nYour task is to write a program of a simple dictionary which implements the following instructions:\n\ninsert str: insert a string str in to the dictionary\n\nfind str: if the distionary contains str, then print 'yes', otherwise print 'no'\n\nInput\n\nIn the first line n, the number of instructions is given. In the following n lines, n instructions are given in the above mentioned format.\n\nOutput\n\nPrint yes or no for each find instruction in a line.\n\nConstraints\n\nA string consists of 'A', 'C', 'G', or 'T'\n\n1 ≤ length of a string ≤ 12\n\nn ≤ 1000000\n\nSample Input 1\n\n5\ninsert A\ninsert T\ninsert C\nfind G\nfind A\n\nSample Output 1\n\nno\nyes\n\nSample Input 2\n\n13\ninsert AAA\ninsert AAC\ninsert AGA\ninsert AGG\ninsert TTT\nfind AAA\nfind CCC\nfind CCC\ninsert CCC\nfind CCC\ninsert T\nfind TTT\nfind T\n\nSample Output 2\n\nyes\nno\nno\nyes\nyes\nyes\n\nNotes\n\nTemplate in C", "sample_input": "5\ninsert A\ninsert T\ninsert C\nfind G\nfind A\n"}, "reference_outputs": ["no\nyes\n"], "source_document_id": "p02269", "source_text": "Search III\n\nYour task is to write a program of a simple dictionary which implements the following instructions:\n\ninsert str: insert a string str in to the dictionary\n\nfind str: if the distionary contains str, then print 'yes', otherwise print 'no'\n\nInput\n\nIn the first line n, the number of instructions is given. In the following n lines, n instructions are given in the above mentioned format.\n\nOutput\n\nPrint yes or no for each find instruction in a line.\n\nConstraints\n\nA string consists of 'A', 'C', 'G', or 'T'\n\n1 ≤ length of a string ≤ 12\n\nn ≤ 1000000\n\nSample Input 1\n\n5\ninsert A\ninsert T\ninsert C\nfind G\nfind A\n\nSample Output 1\n\nno\nyes\n\nSample Input 2\n\n13\ninsert AAA\ninsert AAC\ninsert AGA\ninsert AGG\ninsert TTT\nfind AAA\nfind CCC\nfind CCC\ninsert CCC\nfind CCC\ninsert T\nfind TTT\nfind T\n\nSample Output 2\n\nyes\nno\nno\nyes\nyes\nyes\n\nNotes\n\nTemplate in C", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2112, "cpu_time_ms": 2960, "memory_kb": 294028}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s752885831", "group_id": "codeNet:p02269", "input_text": "import java.util.Scanner;\n\npublic class Main{\n\tpublic static int M = 1046527;\n\tpublic static char H[][] = new char[M][14];\n\tpublic static char x[] = new char[14];\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint N = scan.nextInt();\n\t\tString cmd, s;\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tchar []str = new char[14];\n\t\t\tcmd = scan.next();\n\t\t\ts = scan.next();\n\t\t\tfor(int j = 0; j < s.length(); j++) {\n\t\t\t\tstr[j] = s.charAt(j);\n\t\t\t}\n\t\t\tif(cmd.charAt(0) == 'i') {\n\t\t\t\tinsert(str);\n\t\t\t}else {\n\t\t\t\tif(find(str) == 1) {\n\t\t\t\t\tSystem.out.println(\"yes\");\n\t\t\t\t}else {\n\t\t\t\t\tSystem.out.println(\"no\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tscan.close();\n\t}\n\n\tpublic static int getChar(char ch) {\n\t\tif(ch == 'A') return 1;\n\t\telse if(ch == 'C') return 2;\n\t\telse if(ch == 'G') return 3;\n\t\telse if(ch == 'T') return 4;\n\t\telse return 0;\n\t}\n\n\tpublic static long getKey(char []str) {\n\t\tlong sum = 0;\n\t\tlong p = 1;\n\t\tfor(int i = 0; i < 14; i++) {\n\t\t\tsum += p * (getChar(str[i]));\n\t\t\tp *= 5;\n\t\t}\n\t\treturn sum;\n\t}\n\n\tpublic static int find(char []str) {\n\t\tlong key = getKey(str);\n\t\tint h;\n\t\tfor(int i = 0;; i++) {\n\t\t\th = (h1(key) + i * h2(key)) % M;\n\n\t\t\tif(isCheck(H[h], str)) return 1;\n\t\t\telse if(H[h][0]== x[0]) return 0;\n\t\t}\n\t}\n\tpublic static boolean isCheck(char[] c1, char[] c2) {\n\t\tfor(int i = 0; i < 14; i++) {\n\t\t\tif(c1[i] != c2[i]) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\tpublic static void strcpy(char[] c1, char[] c2) {\n\t\tfor(int i = 0; i < 14; i++) {\n\t\t\tc1[i] = c2[i];\n\t\t}\n\t}\n\tpublic static int insert(char str[]) {\n\n\t\tlong key = getKey(str);\n\t\tint h;\n\t\tfor(int i = 0;; i++) {\n\t\t\th = (h1(key) + i * h2(key)) % M;\n\t\t\tif(isCheck(H[h], str)) return 1;\n\t\t\telse if(H[h][0]== x[0]) {\n\t\t\t\tstrcpy(H[h], str);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tpublic static int h1(long key) {\n\t\treturn (int)(key % M);\n\t}\n\tpublic static int h2(long key) {\n\t\treturn (int)(key % (M - 1));\n\t}\n\tpublic static void disp(char []c) {\n\t\tfor(int i = 0; i < 14; i++) {\n\t\t\tSystem.out.print(c[i]);\n\t\t}\n\t\tSystem.out.println();\n\t}\n}\n", "language": "Java", "metadata": {"date": 1526746172, "filename_ext": "java", "original_language": "JAVA", "problem_description_relpath": "problem_descriptions/p02269.html", "problem_id": "p02269", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02269/input.txt", "sample_output_relpath": "derived/input_output/data/p02269/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02269/Java/s752885831.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s752885831", "user_id": "u876209260"}, "prompt_components": {"gold_output": "no\nyes\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main{\n\tpublic static int M = 1046527;\n\tpublic static char H[][] = new char[M][14];\n\tpublic static char x[] = new char[14];\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint N = scan.nextInt();\n\t\tString cmd, s;\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tchar []str = new char[14];\n\t\t\tcmd = scan.next();\n\t\t\ts = scan.next();\n\t\t\tfor(int j = 0; j < s.length(); j++) {\n\t\t\t\tstr[j] = s.charAt(j);\n\t\t\t}\n\t\t\tif(cmd.charAt(0) == 'i') {\n\t\t\t\tinsert(str);\n\t\t\t}else {\n\t\t\t\tif(find(str) == 1) {\n\t\t\t\t\tSystem.out.println(\"yes\");\n\t\t\t\t}else {\n\t\t\t\t\tSystem.out.println(\"no\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tscan.close();\n\t}\n\n\tpublic static int getChar(char ch) {\n\t\tif(ch == 'A') return 1;\n\t\telse if(ch == 'C') return 2;\n\t\telse if(ch == 'G') return 3;\n\t\telse if(ch == 'T') return 4;\n\t\telse return 0;\n\t}\n\n\tpublic static long getKey(char []str) {\n\t\tlong sum = 0;\n\t\tlong p = 1;\n\t\tfor(int i = 0; i < 14; i++) {\n\t\t\tsum += p * (getChar(str[i]));\n\t\t\tp *= 5;\n\t\t}\n\t\treturn sum;\n\t}\n\n\tpublic static int find(char []str) {\n\t\tlong key = getKey(str);\n\t\tint h;\n\t\tfor(int i = 0;; i++) {\n\t\t\th = (h1(key) + i * h2(key)) % M;\n\n\t\t\tif(isCheck(H[h], str)) return 1;\n\t\t\telse if(H[h][0]== x[0]) return 0;\n\t\t}\n\t}\n\tpublic static boolean isCheck(char[] c1, char[] c2) {\n\t\tfor(int i = 0; i < 14; i++) {\n\t\t\tif(c1[i] != c2[i]) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\tpublic static void strcpy(char[] c1, char[] c2) {\n\t\tfor(int i = 0; i < 14; i++) {\n\t\t\tc1[i] = c2[i];\n\t\t}\n\t}\n\tpublic static int insert(char str[]) {\n\n\t\tlong key = getKey(str);\n\t\tint h;\n\t\tfor(int i = 0;; i++) {\n\t\t\th = (h1(key) + i * h2(key)) % M;\n\t\t\tif(isCheck(H[h], str)) return 1;\n\t\t\telse if(H[h][0]== x[0]) {\n\t\t\t\tstrcpy(H[h], str);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tpublic static int h1(long key) {\n\t\treturn (int)(key % M);\n\t}\n\tpublic static int h2(long key) {\n\t\treturn (int)(key % (M - 1));\n\t}\n\tpublic static void disp(char []c) {\n\t\tfor(int i = 0; i < 14; i++) {\n\t\t\tSystem.out.print(c[i]);\n\t\t}\n\t\tSystem.out.println();\n\t}\n}\n", "problem_context": "Search III\n\nYour task is to write a program of a simple dictionary which implements the following instructions:\n\ninsert str: insert a string str in to the dictionary\n\nfind str: if the distionary contains str, then print 'yes', otherwise print 'no'\n\nInput\n\nIn the first line n, the number of instructions is given. In the following n lines, n instructions are given in the above mentioned format.\n\nOutput\n\nPrint yes or no for each find instruction in a line.\n\nConstraints\n\nA string consists of 'A', 'C', 'G', or 'T'\n\n1 ≤ length of a string ≤ 12\n\nn ≤ 1000000\n\nSample Input 1\n\n5\ninsert A\ninsert T\ninsert C\nfind G\nfind A\n\nSample Output 1\n\nno\nyes\n\nSample Input 2\n\n13\ninsert AAA\ninsert AAC\ninsert AGA\ninsert AGG\ninsert TTT\nfind AAA\nfind CCC\nfind CCC\ninsert CCC\nfind CCC\ninsert T\nfind TTT\nfind T\n\nSample Output 2\n\nyes\nno\nno\nyes\nyes\nyes\n\nNotes\n\nTemplate in C", "sample_input": "5\ninsert A\ninsert T\ninsert C\nfind G\nfind A\n"}, "reference_outputs": ["no\nyes\n"], "source_document_id": "p02269", "source_text": "Search III\n\nYour task is to write a program of a simple dictionary which implements the following instructions:\n\ninsert str: insert a string str in to the dictionary\n\nfind str: if the distionary contains str, then print 'yes', otherwise print 'no'\n\nInput\n\nIn the first line n, the number of instructions is given. In the following n lines, n instructions are given in the above mentioned format.\n\nOutput\n\nPrint yes or no for each find instruction in a line.\n\nConstraints\n\nA string consists of 'A', 'C', 'G', or 'T'\n\n1 ≤ length of a string ≤ 12\n\nn ≤ 1000000\n\nSample Input 1\n\n5\ninsert A\ninsert T\ninsert C\nfind G\nfind A\n\nSample Output 1\n\nno\nyes\n\nSample Input 2\n\n13\ninsert AAA\ninsert AAC\ninsert AGA\ninsert AGG\ninsert TTT\nfind AAA\nfind CCC\nfind CCC\ninsert CCC\nfind CCC\ninsert T\nfind TTT\nfind T\n\nSample Output 2\n\nyes\nno\nno\nyes\nyes\nyes\n\nNotes\n\nTemplate in C", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1993, "cpu_time_ms": 2910, "memory_kb": 373824}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s721271856", "group_id": "codeNet:p02572", "input_text": "import java.util.*;\n\n/**\n * C Main\n *\n * @date 2020.09.19\n * @author 焼き鮭 \n */\n\npublic class Main {\n Scanner sc;\n long MOD = 1000000007;\n\n public static void main(String[] args) {\n new Main().execute();\n }\n\n public void execute() {\n this.sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n int[] ax = new int[n];\n for (int i = 0; i < n; i++) {\n ax[i] = sc.nextInt();\n }\n\n long prod = 1;\n for (int i = 0; i < n; i++) {\n for (int j = i + 1; j < n; j++) {\n prod = (prod + (ax[i] % MOD * ax[j] % MOD)) % MOD;\n }\n }\n\n System.out.println(prod);\n }\n}\n", "language": "Java", "metadata": {"date": 1600541890, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02572.html", "problem_id": "p02572", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02572/input.txt", "sample_output_relpath": "derived/input_output/data/p02572/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02572/Java/s721271856.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s721271856", "user_id": "u109534827"}, "prompt_components": {"gold_output": "11\n", "input_to_evaluate": "import java.util.*;\n\n/**\n * C Main\n *\n * @date 2020.09.19\n * @author 焼き鮭 \n */\n\npublic class Main {\n Scanner sc;\n long MOD = 1000000007;\n\n public static void main(String[] args) {\n new Main().execute();\n }\n\n public void execute() {\n this.sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n int[] ax = new int[n];\n for (int i = 0; i < n; i++) {\n ax[i] = sc.nextInt();\n }\n\n long prod = 1;\n for (int i = 0; i < n; i++) {\n for (int j = i + 1; j < n; j++) {\n prod = (prod + (ax[i] % MOD * ax[j] % MOD)) % MOD;\n }\n }\n\n System.out.println(prod);\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nFind the sum of A_i \\times A_j over all pairs (i,j) such that 1\\leq i < j \\leq N, modulo (10^9+7).\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\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 \\ldots A_N\n\nOutput\n\nPrint \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} A_i A_j, modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n11\n\nWe have 1 \\times 2 + 1 \\times 3 + 2 \\times 3 = 11.\n\nSample Input 2\n\n4\n141421356 17320508 22360679 244949\n\nSample Output 2\n\n437235829", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["11\n"], "source_document_id": "p02572", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nFind the sum of A_i \\times A_j over all pairs (i,j) such that 1\\leq i < j \\leq N, modulo (10^9+7).\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\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 \\ldots A_N\n\nOutput\n\nPrint \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} A_i A_j, modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n11\n\nWe have 1 \\times 2 + 1 \\times 3 + 2 \\times 3 = 11.\n\nSample Input 2\n\n4\n141421356 17320508 22360679 244949\n\nSample Output 2\n\n437235829", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 631, "cpu_time_ms": 2207, "memory_kb": 49884}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s830268548", "group_id": "codeNet:p02572", "input_text": "\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.math.BigInteger;\nimport java.util.*;\nimport java.util.List;\nimport java.util.jar.JarEntry;\nimport java.util.stream.Collectors;\nimport java.util.stream.IntStream;\nimport java.util.stream.LongStream;\n\nimport static java.lang.Math.max;\nimport static java.lang.Math.min;\nimport static java.lang.Math.pow;\n\nimport static java.lang.String.format;\n\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner=new Scanner();\n final int n = scanner.nextInt();\n final long[] a = new long[n];\n for (int i =0 ; i < n; i++) {\n a[i] = scanner.nextLong();\n }\n long sumA = LongStream.of(a).sum();\n BigInteger bi = BigInteger.valueOf(sumA);\n System.out.println(bi.multiply(bi).subtract(Arrays.stream(a).mapToObj(BigInteger::valueOf).map(it -> it.multiply(it)).reduce(BigInteger.ZERO, (x, b) -> x.add(b))).divide(BigInteger.valueOf(2)).mod(BigInteger.valueOf(1000_000_007)).longValue());\n\n }\n\n public static int upper_bound(int[] a,int val){\n return upper_bound(a,0,a.length,val);\n }\n public static int upper_bound(int[] a,int l,int r,int val){\n if(r-l==1){\n if(a[l]>val) return l;\n return r;\n }\n int mid=(l+r)/2;\n if(a[mid]>val){\n return upper_bound(a,l,mid,val);\n }else{\n return upper_bound(a,mid,r,val);\n }\n }\n public static int upper_bound(T[] a,int l,int r,T val,Comparator comparator){\n if(r-l==1){\n if(comparator.compare(a[l],val)>0) return l;\n return r;\n }\n int mid=(l+r)/2;\n if(comparator.compare(a[mid],val)>0){\n return upper_bound(a,l,mid,val,comparator);\n }else{\n return upper_bound(a,mid,r,val,comparator);\n }\n }\n public static int lower_bound(int[] a,int val){\n return lower_bound(a,0,a.length,val);\n }\n public static int lower_bound(int[] a,int l,int r,int val){\n if(r-l==1){\n if(a[l] int lower_bound(T[] a,int l,int r,T val,Comparator comparator){\n if(r-l==1){\n if(comparator.compare(a[l],val)<0) return r;\n return l;\n }\n int mid=(l+r)/2;\n if(comparator.compare(a[mid],val)<0){\n return lower_bound(a,mid,r,val,comparator);\n }else{\n return lower_bound(a,l,mid,val,comparator);\n }\n }\n\n\n public static void print(Object object){\n System.out.print(object);\n }\n public static void put(Object object) {\n System.out.println(object);\n }\n public static void put(){\n System.out.println();\n }\n\n final static private class Scanner {\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte())\n return buffer[ptr++];\n else\n return -1;\n }\n\n private boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr]))\n ptr++;\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext())\n throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext())\n throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)\n throw new NumberFormatException();\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n }\n final static private class FixedPair {\n final private long x, y;\n final static public FixedPair ZEROS=new FixedPair(0,0);\n FixedPair(long x, long y) {\n this.x = x;\n this.y = y;\n }\n\n public long getX() {\n return x;\n }\n\n public long getY() {\n return y;\n }\n\n @Override\n public int hashCode() {\n return (int)x+(int)y;\n }\n\n @Override\n public boolean equals(Object obj) {\n boolean result=super.equals(obj);\n if(obj.getClass()!=this.getClass()){\n return false;\n }\n FixedPair pair=(FixedPair)obj;\n if(this.x==pair.x&&this.y==pair.y) return true;\n return false;\n }\n\n @Override\n public String toString() {\n return String.format(\"(%d,%d)\", x, y);\n }\n }\n final static private class Tuple{\n //immutabl1でないことに注意(T,Vがmutableの場合変更可能)\n final private T t;\n final private V v;\n Tuple(T t,V v){\n this.t=t;\n this.v=v;\n }\n\n public T getT() {\n return t;\n }\n\n public V getV() {\n return v;\n }\n\n @Override\n public int hashCode() {\n return (t.hashCode()+v.hashCode());\n }\n\n @Override\n @SuppressWarnings(\"unchecked\")\n public boolean equals(Object obj) {\n if(obj.getClass()!=this.getClass()){\n return false;\n }\n Tuple tuple=(Tuple) obj;\n return tuple.t.equals(this.t)&&tuple.v.equals(this.v);\n }\n\n @Override\n public String toString() {\n return String.format(\"=<%s,%s>\",t,v);\n }\n }\n final static private class Util {\n static long gcd(long a,long b){\n //最大公約数 \n if(a%b==0)return b;\n return gcd(b,a%b);\n }\n static long lcm(long a,long b){\n //最小公倍数\n long gcd=gcd(a,b);\n long result=b/gcd;\n return a*result;\n }\n static long kaijoMod(int n,int mod){\n if(n<1) return -1;\n long result=1;\n for(int i=n;i>1;i--){\n result*=i;\n result%=mod;\n }\n return result;\n }\n static > Map count(List list){\n //副��用\n Collections.sort(list);\n Map result=new HashMap<>();\n int l=0,r=0;\n while(l count(int[] array){\n //副作用\n Arrays.sort(array);\n Map result=new HashMap<>();\n int l=0,r=0;\n while(l String toStringBWS(Iterable iterable){\n Iterator ite=iterable.iterator();\n return toStringBWS(ite);\n }\n static String toStringBWS(Iterator ite){\n StringBuilder sb=new StringBuilder();\n sb.append(ite.next());\n while(ite.hasNext()){\n sb.append(\" \");\n sb.append(ite.next());\n }\n return sb.toString();\n }\n static int[] factoringInPrimeNumbers(long n,int size){\n //素因数分解\n //sizeがnに比べて小さい場合完全に素因数分解出来ていない可能性がある\n int[] result=new int[size];\n for(int i=2;n>1&&i< result.length;i++){\n while(n%i==0){\n result[i]++;\n n/=i;\n }\n }\n return result;\n\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1599084616, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02572.html", "problem_id": "p02572", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02572/input.txt", "sample_output_relpath": "derived/input_output/data/p02572/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02572/Java/s830268548.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s830268548", "user_id": "u923606520"}, "prompt_components": {"gold_output": "11\n", "input_to_evaluate": "\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.math.BigInteger;\nimport java.util.*;\nimport java.util.List;\nimport java.util.jar.JarEntry;\nimport java.util.stream.Collectors;\nimport java.util.stream.IntStream;\nimport java.util.stream.LongStream;\n\nimport static java.lang.Math.max;\nimport static java.lang.Math.min;\nimport static java.lang.Math.pow;\n\nimport static java.lang.String.format;\n\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner=new Scanner();\n final int n = scanner.nextInt();\n final long[] a = new long[n];\n for (int i =0 ; i < n; i++) {\n a[i] = scanner.nextLong();\n }\n long sumA = LongStream.of(a).sum();\n BigInteger bi = BigInteger.valueOf(sumA);\n System.out.println(bi.multiply(bi).subtract(Arrays.stream(a).mapToObj(BigInteger::valueOf).map(it -> it.multiply(it)).reduce(BigInteger.ZERO, (x, b) -> x.add(b))).divide(BigInteger.valueOf(2)).mod(BigInteger.valueOf(1000_000_007)).longValue());\n\n }\n\n public static int upper_bound(int[] a,int val){\n return upper_bound(a,0,a.length,val);\n }\n public static int upper_bound(int[] a,int l,int r,int val){\n if(r-l==1){\n if(a[l]>val) return l;\n return r;\n }\n int mid=(l+r)/2;\n if(a[mid]>val){\n return upper_bound(a,l,mid,val);\n }else{\n return upper_bound(a,mid,r,val);\n }\n }\n public static int upper_bound(T[] a,int l,int r,T val,Comparator comparator){\n if(r-l==1){\n if(comparator.compare(a[l],val)>0) return l;\n return r;\n }\n int mid=(l+r)/2;\n if(comparator.compare(a[mid],val)>0){\n return upper_bound(a,l,mid,val,comparator);\n }else{\n return upper_bound(a,mid,r,val,comparator);\n }\n }\n public static int lower_bound(int[] a,int val){\n return lower_bound(a,0,a.length,val);\n }\n public static int lower_bound(int[] a,int l,int r,int val){\n if(r-l==1){\n if(a[l] int lower_bound(T[] a,int l,int r,T val,Comparator comparator){\n if(r-l==1){\n if(comparator.compare(a[l],val)<0) return r;\n return l;\n }\n int mid=(l+r)/2;\n if(comparator.compare(a[mid],val)<0){\n return lower_bound(a,mid,r,val,comparator);\n }else{\n return lower_bound(a,l,mid,val,comparator);\n }\n }\n\n\n public static void print(Object object){\n System.out.print(object);\n }\n public static void put(Object object) {\n System.out.println(object);\n }\n public static void put(){\n System.out.println();\n }\n\n final static private class Scanner {\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte())\n return buffer[ptr++];\n else\n return -1;\n }\n\n private boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr]))\n ptr++;\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext())\n throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext())\n throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)\n throw new NumberFormatException();\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n }\n final static private class FixedPair {\n final private long x, y;\n final static public FixedPair ZEROS=new FixedPair(0,0);\n FixedPair(long x, long y) {\n this.x = x;\n this.y = y;\n }\n\n public long getX() {\n return x;\n }\n\n public long getY() {\n return y;\n }\n\n @Override\n public int hashCode() {\n return (int)x+(int)y;\n }\n\n @Override\n public boolean equals(Object obj) {\n boolean result=super.equals(obj);\n if(obj.getClass()!=this.getClass()){\n return false;\n }\n FixedPair pair=(FixedPair)obj;\n if(this.x==pair.x&&this.y==pair.y) return true;\n return false;\n }\n\n @Override\n public String toString() {\n return String.format(\"(%d,%d)\", x, y);\n }\n }\n final static private class Tuple{\n //immutabl1でないことに注意(T,Vがmutableの場合変更可能)\n final private T t;\n final private V v;\n Tuple(T t,V v){\n this.t=t;\n this.v=v;\n }\n\n public T getT() {\n return t;\n }\n\n public V getV() {\n return v;\n }\n\n @Override\n public int hashCode() {\n return (t.hashCode()+v.hashCode());\n }\n\n @Override\n @SuppressWarnings(\"unchecked\")\n public boolean equals(Object obj) {\n if(obj.getClass()!=this.getClass()){\n return false;\n }\n Tuple tuple=(Tuple) obj;\n return tuple.t.equals(this.t)&&tuple.v.equals(this.v);\n }\n\n @Override\n public String toString() {\n return String.format(\"=<%s,%s>\",t,v);\n }\n }\n final static private class Util {\n static long gcd(long a,long b){\n //最大公約数 \n if(a%b==0)return b;\n return gcd(b,a%b);\n }\n static long lcm(long a,long b){\n //最小公倍数\n long gcd=gcd(a,b);\n long result=b/gcd;\n return a*result;\n }\n static long kaijoMod(int n,int mod){\n if(n<1) return -1;\n long result=1;\n for(int i=n;i>1;i--){\n result*=i;\n result%=mod;\n }\n return result;\n }\n static > Map count(List list){\n //副作用\n Collections.sort(list);\n Map result=new HashMap<>();\n int l=0,r=0;\n while(l count(int[] array){\n //副作用\n Arrays.sort(array);\n Map result=new HashMap<>();\n int l=0,r=0;\n while(l String toStringBWS(Iterable iterable){\n Iterator ite=iterable.iterator();\n return toStringBWS(ite);\n }\n static String toStringBWS(Iterator ite){\n StringBuilder sb=new StringBuilder();\n sb.append(ite.next());\n while(ite.hasNext()){\n sb.append(\" \");\n sb.append(ite.next());\n }\n return sb.toString();\n }\n static int[] factoringInPrimeNumbers(long n,int size){\n //素因数分解\n //sizeがnに比べて小さい場合完全に素因数分解出来ていない可能性がある\n int[] result=new int[size];\n for(int i=2;n>1&&i< result.length;i++){\n while(n%i==0){\n result[i]++;\n n/=i;\n }\n }\n return result;\n\n }\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nFind the sum of A_i \\times A_j over all pairs (i,j) such that 1\\leq i < j \\leq N, modulo (10^9+7).\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\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 \\ldots A_N\n\nOutput\n\nPrint \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} A_i A_j, modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n11\n\nWe have 1 \\times 2 + 1 \\times 3 + 2 \\times 3 = 11.\n\nSample Input 2\n\n4\n141421356 17320508 22360679 244949\n\nSample Output 2\n\n437235829", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["11\n"], "source_document_id": "p02572", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nFind the sum of A_i \\times A_j over all pairs (i,j) such that 1\\leq i < j \\leq N, modulo (10^9+7).\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\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 \\ldots A_N\n\nOutput\n\nPrint \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} A_i A_j, modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n11\n\nWe have 1 \\times 2 + 1 \\times 3 + 2 \\times 3 = 11.\n\nSample Input 2\n\n4\n141421356 17320508 22360679 244949\n\nSample Output 2\n\n437235829", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 9867, "cpu_time_ms": 237, "memory_kb": 60960}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s292784255", "group_id": "codeNet:p02572", "input_text": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n try (Scanner sc = new Scanner(System.in)) {\n final long mod = (long) (1e9 + 7);\n\n int N = sc.nextInt();\n long[] A = new long[N];\n for (int i = 0; i < N; i++) {\n A[i] = sc.nextInt();\n }\n\n long[] cumsum = new long[N + 1];\n for (int i = 0; i < N; i++) {\n cumsum[N - 1 - i] += cumsum[N - i] + A[N - 1 - i];\n cumsum[N - 1 - i] %= mod;\n }\n\n long sum = 0;\n for (int i = 0; i < N; i++) {\n sum += A[i] * cumsum[i + 1];\n sum %= mod;\n }\n\n System.out.println(sum);\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1598983791, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02572.html", "problem_id": "p02572", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02572/input.txt", "sample_output_relpath": "derived/input_output/data/p02572/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02572/Java/s292784255.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s292784255", "user_id": "u552502395"}, "prompt_components": {"gold_output": "11\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n try (Scanner sc = new Scanner(System.in)) {\n final long mod = (long) (1e9 + 7);\n\n int N = sc.nextInt();\n long[] A = new long[N];\n for (int i = 0; i < N; i++) {\n A[i] = sc.nextInt();\n }\n\n long[] cumsum = new long[N + 1];\n for (int i = 0; i < N; i++) {\n cumsum[N - 1 - i] += cumsum[N - i] + A[N - 1 - i];\n cumsum[N - 1 - i] %= mod;\n }\n\n long sum = 0;\n for (int i = 0; i < N; i++) {\n sum += A[i] * cumsum[i + 1];\n sum %= mod;\n }\n\n System.out.println(sum);\n }\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nFind the sum of A_i \\times A_j over all pairs (i,j) such that 1\\leq i < j \\leq N, modulo (10^9+7).\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\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 \\ldots A_N\n\nOutput\n\nPrint \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} A_i A_j, modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n11\n\nWe have 1 \\times 2 + 1 \\times 3 + 2 \\times 3 = 11.\n\nSample Input 2\n\n4\n141421356 17320508 22360679 244949\n\nSample Output 2\n\n437235829", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["11\n"], "source_document_id": "p02572", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nFind the sum of A_i \\times A_j over all pairs (i,j) such that 1\\leq i < j \\leq N, modulo (10^9+7).\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\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 \\ldots A_N\n\nOutput\n\nPrint \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} A_i A_j, modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n11\n\nWe have 1 \\times 2 + 1 \\times 3 + 2 \\times 3 = 11.\n\nSample Input 2\n\n4\n141421356 17320508 22360679 244949\n\nSample Output 2\n\n437235829", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 499, "memory_kb": 52064}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s874324881", "group_id": "codeNet:p02572", "input_text": "import java.util.Scanner;\n\n// \nclass Main{\n final static int MOD = (int)Math.pow(10, 9) + 7;\n\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int[] a = new int[N];\n\n long sum = 0;\t// n-1項までの合計\n long ans = 0;\n for(int i = 0; i < N; i++) {\n a[i] = sc.nextInt();\n sum += a[i];\n sum %= MOD;\n }\n \n for(int i = 0; i < N - 1; i++) {\n \tsum -= a[i];\n \tif(sum < 0) sum += MOD;\n ans += a[i] * sum;\n ans %= MOD;\n }\n \n System.out.println(ans % MOD);\n }\n\n}\n", "language": "Java", "metadata": {"date": 1598821270, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02572.html", "problem_id": "p02572", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02572/input.txt", "sample_output_relpath": "derived/input_output/data/p02572/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02572/Java/s874324881.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s874324881", "user_id": "u801296495"}, "prompt_components": {"gold_output": "11\n", "input_to_evaluate": "import java.util.Scanner;\n\n// \nclass Main{\n final static int MOD = (int)Math.pow(10, 9) + 7;\n\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int[] a = new int[N];\n\n long sum = 0;\t// n-1項までの合計\n long ans = 0;\n for(int i = 0; i < N; i++) {\n a[i] = sc.nextInt();\n sum += a[i];\n sum %= MOD;\n }\n \n for(int i = 0; i < N - 1; i++) {\n \tsum -= a[i];\n \tif(sum < 0) sum += MOD;\n ans += a[i] * sum;\n ans %= MOD;\n }\n \n System.out.println(ans % MOD);\n }\n\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nFind the sum of A_i \\times A_j over all pairs (i,j) such that 1\\leq i < j \\leq N, modulo (10^9+7).\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\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 \\ldots A_N\n\nOutput\n\nPrint \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} A_i A_j, modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n11\n\nWe have 1 \\times 2 + 1 \\times 3 + 2 \\times 3 = 11.\n\nSample Input 2\n\n4\n141421356 17320508 22360679 244949\n\nSample Output 2\n\n437235829", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["11\n"], "source_document_id": "p02572", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nFind the sum of A_i \\times A_j over all pairs (i,j) such that 1\\leq i < j \\leq N, modulo (10^9+7).\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\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 \\ldots A_N\n\nOutput\n\nPrint \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} A_i A_j, modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n11\n\nWe have 1 \\times 2 + 1 \\times 3 + 2 \\times 3 = 11.\n\nSample Input 2\n\n4\n141421356 17320508 22360679 244949\n\nSample Output 2\n\n437235829", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 674, "cpu_time_ms": 542, "memory_kb": 61736}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s629825398", "group_id": "codeNet:p02572", "input_text": "import java.util.Scanner;\npublic class Main {\n\t\n\t\tpublic static void main(String[] args) {\n\t\t\ttry(Scanner sc = new Scanner(System.in)){\n\t\t\t\tint n = sc.nextInt();\n\t\t\t\tlong[] s = new long[n];\n\t\t\t\tlong[] f = new long[n+1];\n\t\t\t\tint mod = 1000000007;\n\t\t\t\tf[0] = 0;\n\t\t\t\t long d = 0;\n\t\t\t\tfor(int x = 0;x < n;x++) {\n\t\t\t\t\ts[x] = sc.nextInt();\n\t\t\t\t}\n\t\t\t\tfor(int x = 1;x <= n;x++) {\n\t\t\t\t\tf[x] = f[x-1]+s[x-1];\n\t\t\t\t}\n\t\t\t\tfor(int x = 0;x < n;x++) {\n\t\t\t\t\tlong sum = f[n] - f[x + 1];\n\t\t\t\t\td += s[x] * sum; \n\t\t\t\t\td = d % mod;\n\t\t\t\t}\n\t\t\t\tSystem.out.println(d);\n\t\t\t}\n\t\t}\n}", "language": "Java", "metadata": {"date": 1598794513, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02572.html", "problem_id": "p02572", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02572/input.txt", "sample_output_relpath": "derived/input_output/data/p02572/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02572/Java/s629825398.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s629825398", "user_id": "u282011939"}, "prompt_components": {"gold_output": "11\n", "input_to_evaluate": "import java.util.Scanner;\npublic class Main {\n\t\n\t\tpublic static void main(String[] args) {\n\t\t\ttry(Scanner sc = new Scanner(System.in)){\n\t\t\t\tint n = sc.nextInt();\n\t\t\t\tlong[] s = new long[n];\n\t\t\t\tlong[] f = new long[n+1];\n\t\t\t\tint mod = 1000000007;\n\t\t\t\tf[0] = 0;\n\t\t\t\t long d = 0;\n\t\t\t\tfor(int x = 0;x < n;x++) {\n\t\t\t\t\ts[x] = sc.nextInt();\n\t\t\t\t}\n\t\t\t\tfor(int x = 1;x <= n;x++) {\n\t\t\t\t\tf[x] = f[x-1]+s[x-1];\n\t\t\t\t}\n\t\t\t\tfor(int x = 0;x < n;x++) {\n\t\t\t\t\tlong sum = f[n] - f[x + 1];\n\t\t\t\t\td += s[x] * sum; \n\t\t\t\t\td = d % mod;\n\t\t\t\t}\n\t\t\t\tSystem.out.println(d);\n\t\t\t}\n\t\t}\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nFind the sum of A_i \\times A_j over all pairs (i,j) such that 1\\leq i < j \\leq N, modulo (10^9+7).\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\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 \\ldots A_N\n\nOutput\n\nPrint \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} A_i A_j, modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n11\n\nWe have 1 \\times 2 + 1 \\times 3 + 2 \\times 3 = 11.\n\nSample Input 2\n\n4\n141421356 17320508 22360679 244949\n\nSample Output 2\n\n437235829", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["11\n"], "source_document_id": "p02572", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nFind the sum of A_i \\times A_j over all pairs (i,j) such that 1\\leq i < j \\leq N, modulo (10^9+7).\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\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 \\ldots A_N\n\nOutput\n\nPrint \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} A_i A_j, modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n11\n\nWe have 1 \\times 2 + 1 \\times 3 + 2 \\times 3 = 11.\n\nSample Input 2\n\n4\n141421356 17320508 22360679 244949\n\nSample Output 2\n\n437235829", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 553, "cpu_time_ms": 525, "memory_kb": 61768}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s257556368", "group_id": "codeNet:p02572", "input_text": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n int mod = 1000000007;\n Scanner sc = new Scanner(System.in);\n int n = Integer.parseInt(sc.next());\n int[] a = new int[n];\n long[] b = new long[n + 1];\n for (int i = 0; i < n; i++) {\n a[i] = Integer.parseInt(sc.next());\n b[i + 1] = b[i] + a[i];\n }\n long result = 0;\n for (int i = 0; i < n; i++) {\n long sum = (b[n] - b[i + 1]) % mod;\n\n result = (result + ((long) a[i] * sum) % mod) % mod;\n }\n System.out.println(result);\n }\n}", "language": "Java", "metadata": {"date": 1598746667, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02572.html", "problem_id": "p02572", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02572/input.txt", "sample_output_relpath": "derived/input_output/data/p02572/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02572/Java/s257556368.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s257556368", "user_id": "u562950829"}, "prompt_components": {"gold_output": "11\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n int mod = 1000000007;\n Scanner sc = new Scanner(System.in);\n int n = Integer.parseInt(sc.next());\n int[] a = new int[n];\n long[] b = new long[n + 1];\n for (int i = 0; i < n; i++) {\n a[i] = Integer.parseInt(sc.next());\n b[i + 1] = b[i] + a[i];\n }\n long result = 0;\n for (int i = 0; i < n; i++) {\n long sum = (b[n] - b[i + 1]) % mod;\n\n result = (result + ((long) a[i] * sum) % mod) % mod;\n }\n System.out.println(result);\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nFind the sum of A_i \\times A_j over all pairs (i,j) such that 1\\leq i < j \\leq N, modulo (10^9+7).\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\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 \\ldots A_N\n\nOutput\n\nPrint \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} A_i A_j, modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n11\n\nWe have 1 \\times 2 + 1 \\times 3 + 2 \\times 3 = 11.\n\nSample Input 2\n\n4\n141421356 17320508 22360679 244949\n\nSample Output 2\n\n437235829", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["11\n"], "source_document_id": "p02572", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nFind the sum of A_i \\times A_j over all pairs (i,j) such that 1\\leq i < j \\leq N, modulo (10^9+7).\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\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 \\ldots A_N\n\nOutput\n\nPrint \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} A_i A_j, modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n11\n\nWe have 1 \\times 2 + 1 \\times 3 + 2 \\times 3 = 11.\n\nSample Input 2\n\n4\n141421356 17320508 22360679 244949\n\nSample Output 2\n\n437235829", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 640, "cpu_time_ms": 450, "memory_kb": 61616}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s736371720", "group_id": "codeNet:p02572", "input_text": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n new Main();\n }\n\n public Main() {\n Scanner sc = new Scanner(System.in);\n int N = Integer.parseInt(sc.next());\n int[] A = new int[N];\n for (int i = 0; i < N; i++) {\n A[i] = Integer.parseInt(sc.next());\n }\n long sum = 0;\n long mod = 1000000007;\n long[][] cache = new long[N][N];\n for (int i = 0; i < N; i++) {\n for (int j = i + 1; j < N; j++) {\n if (cache[i][j] == 0) {\n cache[i][j] = ((A[i] % mod) * (A[j] % mod)) % mod;\n }\n sum = (sum + cache[i][j]) % mod;\n }\n }\n System.out.println(sum);\n }\n}\n", "language": "Java", "metadata": {"date": 1598732783, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02572.html", "problem_id": "p02572", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02572/input.txt", "sample_output_relpath": "derived/input_output/data/p02572/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02572/Java/s736371720.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s736371720", "user_id": "u148656159"}, "prompt_components": {"gold_output": "11\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n new Main();\n }\n\n public Main() {\n Scanner sc = new Scanner(System.in);\n int N = Integer.parseInt(sc.next());\n int[] A = new int[N];\n for (int i = 0; i < N; i++) {\n A[i] = Integer.parseInt(sc.next());\n }\n long sum = 0;\n long mod = 1000000007;\n long[][] cache = new long[N][N];\n for (int i = 0; i < N; i++) {\n for (int j = i + 1; j < N; j++) {\n if (cache[i][j] == 0) {\n cache[i][j] = ((A[i] % mod) * (A[j] % mod)) % mod;\n }\n sum = (sum + cache[i][j]) % mod;\n }\n }\n System.out.println(sum);\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nFind the sum of A_i \\times A_j over all pairs (i,j) such that 1\\leq i < j \\leq N, modulo (10^9+7).\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\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 \\ldots A_N\n\nOutput\n\nPrint \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} A_i A_j, modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n11\n\nWe have 1 \\times 2 + 1 \\times 3 + 2 \\times 3 = 11.\n\nSample Input 2\n\n4\n141421356 17320508 22360679 244949\n\nSample Output 2\n\n437235829", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["11\n"], "source_document_id": "p02572", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nFind the sum of A_i \\times A_j over all pairs (i,j) such that 1\\leq i < j \\leq N, modulo (10^9+7).\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\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 \\ldots A_N\n\nOutput\n\nPrint \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} A_i A_j, modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n11\n\nWe have 1 \\times 2 + 1 \\times 3 + 2 \\times 3 = 11.\n\nSample Input 2\n\n4\n141421356 17320508 22360679 244949\n\nSample Output 2\n\n437235829", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 776, "cpu_time_ms": 2236, "memory_kb": 959928}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s277546641", "group_id": "codeNet:p02572", "input_text": "import java.io.*;\nimport java.math.*;\nimport java.util.*;\n\npublic class Main {\n\tstatic final int INF = (int) (1e9 + 10);\n\tstatic final long MOD = (int) (1e9 + 7);\n\tstatic final int N = (int) (4e5 + 5);\n\n\t// static ArrayList[] graph;\n\t// static boolean visited[];\n\t// static long size[];\n\tstatic long findProductSum(long A[], int n) {\n\n\t\tlong array_sum = 0;\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tarray_sum = (array_sum + A[i]) ;\n\n\t\tlong array_sum_square = (array_sum * array_sum) % MOD;\n\n\t\tlong individual_square_sum = 0;\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tindividual_square_sum = (individual_square_sum + A[i] * A[i]) % MOD;\n\t\tif(array_sum_square {\n\t\tint u;\n\t\tint v;\n\n\t\tPair(int u, int v) {\n\t\t\tthis.u = u;\n\t\t\tthis.v = v;\n\n\t\t}\n\n\t\tpublic int compareTo(Pair compareEdge) {\n\t\t\treturn Long.compare(this.v, compareEdge.v);\n\t\t}\n\t};\n\n\tprivate static boolean possible(long[] arr, double mid, long k) {\n\t\tlong c = 0;\n\t\tfor (int i = 0; i < arr.length; i++) {\n\t\t\tc += ((arr[i]) / mid);\n\t\t\tif (c % arr[i] == 0)\n\t\t\t\tc--;\n\t\t}\n\t\t// System.out.println(mid+\" \"+c+\" \"+k);\n\t\tif (c <= k)\n\t\t\treturn true;\n\t\treturn false;\n\t}\n\n\tstatic void sort(long[] a) {\n\t\tArrayList l = new ArrayList<>();\n\t\tfor (long i : a)\n\t\t\tl.add(i);\n\t\tCollections.sort(l);\n\t\tfor (int i = 0; i < a.length; i++)\n\t\t\ta[i] = l.get(i);\n\t}\n\n\tstatic void sort(int[] a) {\n\t\tArrayList l = new ArrayList<>();\n\t\tfor (int i : a)\n\t\t\tl.add(i);\n\t\tCollections.sort(l);\n\t\tfor (int i = 0; i < a.length; i++)\n\t\t\ta[i] = l.get(i);\n\t}\n\n\tpublic static int lowerBound(ArrayList array, int length, long value) {\n\t\tint low = 0;\n\t\tint high = length;\n\t\twhile (low < high) {\n\t\t\tfinal int mid = (low + high) / 2;\n\t\t\tif (value <= array.get(mid)) {\n\t\t\t\thigh = mid;\n\t\t\t} else {\n\t\t\t\tlow = mid + 1;\n\t\t\t}\n\t\t}\n\t\treturn low;\n\t}\n\n\tpublic static long mul(long a, long b) {\n\t\treturn (a * b) % MOD;\n\t}\n\n\tstatic class FastReader {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\n\t\tpublic FastReader() {\n\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\t}\n\n\t\tString next() {\n\t\t\twhile (st == null || !st.hasMoreElements()) {\n\t\t\t\ttry {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tint nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tlong nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tdouble nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tString nextLine() {\n\t\t\tString str = \"\";\n\t\t\ttry {\n\t\t\t\tstr = br.readLine();\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\treturn str;\n\t\t}\n\n\t\tpublic int[] nextIntArray(int n) {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic long[] nextLongArray(int n) {\n\t\t\tlong[] a = new long[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();\n\t\t\treturn a;\n\t\t}\n\t}\n\n\tstatic long gcd(long a, long b) {\n\t\tif (a == 0)\n\t\t\treturn b;\n\t\treturn gcd(b % a, a);\n\t}\n\n\tstatic long lcm(long a, long b) {\n\t\treturn (a * b) / gcd(a, b);\n\t}\n\n\tpublic static void sortbyColumn(int[][] att, int col) {\n\t\t// Using built-in sort function Arrays.sort\n\t\tArrays.sort(att, new Comparator() {\n\n\t\t\t@Override\n\t\t\t// Compare values according to columns\n\t\t\tpublic int compare(final int[] entry1, final int[] entry2) {\n\n\t\t\t\t// To sort in descending order revert\n\t\t\t\t// the '>' Operator\n\t\t\t\t// if (entry1[col] > entry2[col])\n\t\t\t\t// return 1;\n\t\t\t\t// else //(entry1[col] >= entry2[col])\n\t\t\t\t// return -1;\n\t\t\t\treturn new Integer(entry1[col]).compareTo(entry2[col]);\n\t\t\t\t// return entry1[col].\n\t\t\t}\n\t\t}); // End of function call sort().\n\t}\n\n\tpublic static void sortbyColumn(double[][] att, int col) {\n\t\t// Using built-in sort function Arrays.sort\n\t\tArrays.sort(att, new Comparator() {\n\n\t\t\t@Override\n\t\t\t// Compare values according to columns\n\t\t\tpublic int compare(final double[] entry1, final double[] entry2) {\n\n\t\t\t\t// To sort in descending order revert\n\t\t\t\t// the '>' Operator\n\t\t\t\t// if (entry1[col] > entry2[col])\n\t\t\t\t// return 1;\n\t\t\t\t// else //(entry1[col] >= entry2[col])\n\t\t\t\t// return -1;\n\t\t\t\treturn new Double(entry1[col]).compareTo(entry2[col]);\n\t\t\t\t// return entry1[col].\n\t\t\t}\n\t\t}); // End of function call sort().\n\t}\n\n\tstatic class pair {\n\t\tint V, I;\n\n\t\tpair(int v, int i) {\n\t\t\tV = v;\n\t\t\tI = i;\n\t\t}\n\t}\n\n\tpublic static int[] swap(int data[], int left, int right) {\n\t\tint temp = data[left];\n\t\tdata[left] = data[right];\n\t\tdata[right] = temp;\n\t\treturn data;\n\t}\n\n\tpublic static int[] reverse(int data[], int left, int right) {\n\t\twhile (left < right) {\n\t\t\tint temp = data[left];\n\t\t\tdata[left++] = data[right];\n\t\t\tdata[right--] = temp;\n\t\t}\n\t\treturn data;\n\t}\n\n\tpublic static boolean findNextPermutation(int data[]) {\n\t\tif (data.length <= 1)\n\t\t\treturn false;\n\n\t\tint last = data.length - 2;\n\t\twhile (last >= 0) {\n\t\t\tif (data[last] < data[last + 1]) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tlast--;\n\t\t}\n\t\tif (last < 0)\n\t\t\treturn false;\n\n\t\tint nextGreater = data.length - 1;\n\t\tfor (int i = data.length - 1; i > last; i--) {\n\t\t\tif (data[i] > data[last]) {\n\t\t\t\tnextGreater = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tdata = swap(data, nextGreater, last);\n\t\tdata = reverse(data, last + 1, data.length - 1);\n\t\treturn true;\n\t}\n\n\tstatic long ncr(long a, long b) {\n\t\tif (b > a - b)\n\t\t\treturn ncr(a, a - b);\n\t\tlong ansMul = 1;\n\t\tlong ansDiv = 1;\n\t\tfor (int i = 0; i < b; i++) {\n\t\t\tansMul *= (a - i);\n\t\t\tansDiv *= (i + 1);\n\t\t\tansMul %= MOD;\n\t\t\tansDiv %= MOD;\n\t\t}\n\n\t\tlong ans = ansMul * power(ansDiv, MOD - 2, MOD) % MOD;\n\n\t\treturn ans;\n\t}\n\n\tstatic long __gcd(long n1, long n2) {\n\t\tlong gcd = 1;\n\n\t\tfor (int i = 1; i <= n1 && i <= n2; ++i) {\n\t\t\t// Checks if i is factor of both integers\n\t\t\tif (n1 % i == 0 && n2 % i == 0) {\n\t\t\t\tgcd = i;\n\t\t\t}\n\t\t}\n\t\treturn gcd;\n\t}\n\n\tstatic long power(long prev, long n2, long mod2) {\n\t\tlong res = 1;\n\n\t\tprev = prev % mod2;\n\n\t\tif (prev == 0)\n\t\t\treturn 0;\n\t\twhile (n2 > 0) {\n\n\t\t\tif ((n2 & 1) == 1)\n\t\t\t\tres = (res * prev) % mod2;\n\n\t\t\tn2 = n2 >> 1;\n\t\t\tprev = (prev * prev) % mod2;\n\t\t}\n\t\treturn res;\n\t}\n\n\tstatic long modInverse(long fac2, int p) {\n\t\treturn power(fac2, p - 2, p);\n\t}\n\n\tstatic boolean isPrime(int n) {\n\t\t// Corner cases\n\t\tif (n <= 1)\n\t\t\treturn false;\n\t\tif (n <= 3)\n\t\t\treturn true;\n\n\t\t// This is checked so that we can skip\n\t\t// middle five numbers in below loop\n\t\tif (n % 2 == 0 || n % 3 == 0)\n\t\t\treturn false;\n\n\t\tfor (int i = 5; i * i <= n; i = i + 6)\n\t\t\tif (n % i == 0 || n % (i + 2) == 0)\n\t\t\t\treturn false;\n\n\t\treturn true;\n\t}\n\n\tpublic static BigInteger lcmm(String a, String b) {\n\t\tBigInteger s = new BigInteger(a);\n\t\tBigInteger s1 = new BigInteger(b);\n\t\tBigInteger mul = s.multiply(s1);\n\t\tBigInteger gcd = s.gcd(s1);\n\t\tBigInteger lcm = mul.divide(gcd);\n\t\treturn lcm;\n\t}\n\t/*\n\t * static boolean prime[] = new boolean[10000007]; static int spf[] = new\n\t * int[10000007];\n\t * \n\t * public static void sieveOfEratosthenes(int n) { for (int i = 2; i < n;\n\t * i++) prime[i] = true; for (int p = 2; p * p <= n; p++) {\n\t * \n\t * if (prime[p] == true) {\n\t * \n\t * for (int i = p * p; i <= n; i += p) { prime[i] = false; spf[i] = p; } } }\n\t * }\n\t */\n}\n", "language": "Java", "metadata": {"date": 1598732460, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02572.html", "problem_id": "p02572", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02572/input.txt", "sample_output_relpath": "derived/input_output/data/p02572/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02572/Java/s277546641.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s277546641", "user_id": "u225470629"}, "prompt_components": {"gold_output": "11\n", "input_to_evaluate": "import java.io.*;\nimport java.math.*;\nimport java.util.*;\n\npublic class Main {\n\tstatic final int INF = (int) (1e9 + 10);\n\tstatic final long MOD = (int) (1e9 + 7);\n\tstatic final int N = (int) (4e5 + 5);\n\n\t// static ArrayList[] graph;\n\t// static boolean visited[];\n\t// static long size[];\n\tstatic long findProductSum(long A[], int n) {\n\n\t\tlong array_sum = 0;\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tarray_sum = (array_sum + A[i]) ;\n\n\t\tlong array_sum_square = (array_sum * array_sum) % MOD;\n\n\t\tlong individual_square_sum = 0;\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tindividual_square_sum = (individual_square_sum + A[i] * A[i]) % MOD;\n\t\tif(array_sum_square {\n\t\tint u;\n\t\tint v;\n\n\t\tPair(int u, int v) {\n\t\t\tthis.u = u;\n\t\t\tthis.v = v;\n\n\t\t}\n\n\t\tpublic int compareTo(Pair compareEdge) {\n\t\t\treturn Long.compare(this.v, compareEdge.v);\n\t\t}\n\t};\n\n\tprivate static boolean possible(long[] arr, double mid, long k) {\n\t\tlong c = 0;\n\t\tfor (int i = 0; i < arr.length; i++) {\n\t\t\tc += ((arr[i]) / mid);\n\t\t\tif (c % arr[i] == 0)\n\t\t\t\tc--;\n\t\t}\n\t\t// System.out.println(mid+\" \"+c+\" \"+k);\n\t\tif (c <= k)\n\t\t\treturn true;\n\t\treturn false;\n\t}\n\n\tstatic void sort(long[] a) {\n\t\tArrayList l = new ArrayList<>();\n\t\tfor (long i : a)\n\t\t\tl.add(i);\n\t\tCollections.sort(l);\n\t\tfor (int i = 0; i < a.length; i++)\n\t\t\ta[i] = l.get(i);\n\t}\n\n\tstatic void sort(int[] a) {\n\t\tArrayList l = new ArrayList<>();\n\t\tfor (int i : a)\n\t\t\tl.add(i);\n\t\tCollections.sort(l);\n\t\tfor (int i = 0; i < a.length; i++)\n\t\t\ta[i] = l.get(i);\n\t}\n\n\tpublic static int lowerBound(ArrayList array, int length, long value) {\n\t\tint low = 0;\n\t\tint high = length;\n\t\twhile (low < high) {\n\t\t\tfinal int mid = (low + high) / 2;\n\t\t\tif (value <= array.get(mid)) {\n\t\t\t\thigh = mid;\n\t\t\t} else {\n\t\t\t\tlow = mid + 1;\n\t\t\t}\n\t\t}\n\t\treturn low;\n\t}\n\n\tpublic static long mul(long a, long b) {\n\t\treturn (a * b) % MOD;\n\t}\n\n\tstatic class FastReader {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\n\t\tpublic FastReader() {\n\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\t}\n\n\t\tString next() {\n\t\t\twhile (st == null || !st.hasMoreElements()) {\n\t\t\t\ttry {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tint nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tlong nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tdouble nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tString nextLine() {\n\t\t\tString str = \"\";\n\t\t\ttry {\n\t\t\t\tstr = br.readLine();\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\treturn str;\n\t\t}\n\n\t\tpublic int[] nextIntArray(int n) {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic long[] nextLongArray(int n) {\n\t\t\tlong[] a = new long[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();\n\t\t\treturn a;\n\t\t}\n\t}\n\n\tstatic long gcd(long a, long b) {\n\t\tif (a == 0)\n\t\t\treturn b;\n\t\treturn gcd(b % a, a);\n\t}\n\n\tstatic long lcm(long a, long b) {\n\t\treturn (a * b) / gcd(a, b);\n\t}\n\n\tpublic static void sortbyColumn(int[][] att, int col) {\n\t\t// Using built-in sort function Arrays.sort\n\t\tArrays.sort(att, new Comparator() {\n\n\t\t\t@Override\n\t\t\t// Compare values according to columns\n\t\t\tpublic int compare(final int[] entry1, final int[] entry2) {\n\n\t\t\t\t// To sort in descending order revert\n\t\t\t\t// the '>' Operator\n\t\t\t\t// if (entry1[col] > entry2[col])\n\t\t\t\t// return 1;\n\t\t\t\t// else //(entry1[col] >= entry2[col])\n\t\t\t\t// return -1;\n\t\t\t\treturn new Integer(entry1[col]).compareTo(entry2[col]);\n\t\t\t\t// return entry1[col].\n\t\t\t}\n\t\t}); // End of function call sort().\n\t}\n\n\tpublic static void sortbyColumn(double[][] att, int col) {\n\t\t// Using built-in sort function Arrays.sort\n\t\tArrays.sort(att, new Comparator() {\n\n\t\t\t@Override\n\t\t\t// Compare values according to columns\n\t\t\tpublic int compare(final double[] entry1, final double[] entry2) {\n\n\t\t\t\t// To sort in descending order revert\n\t\t\t\t// the '>' Operator\n\t\t\t\t// if (entry1[col] > entry2[col])\n\t\t\t\t// return 1;\n\t\t\t\t// else //(entry1[col] >= entry2[col])\n\t\t\t\t// return -1;\n\t\t\t\treturn new Double(entry1[col]).compareTo(entry2[col]);\n\t\t\t\t// return entry1[col].\n\t\t\t}\n\t\t}); // End of function call sort().\n\t}\n\n\tstatic class pair {\n\t\tint V, I;\n\n\t\tpair(int v, int i) {\n\t\t\tV = v;\n\t\t\tI = i;\n\t\t}\n\t}\n\n\tpublic static int[] swap(int data[], int left, int right) {\n\t\tint temp = data[left];\n\t\tdata[left] = data[right];\n\t\tdata[right] = temp;\n\t\treturn data;\n\t}\n\n\tpublic static int[] reverse(int data[], int left, int right) {\n\t\twhile (left < right) {\n\t\t\tint temp = data[left];\n\t\t\tdata[left++] = data[right];\n\t\t\tdata[right--] = temp;\n\t\t}\n\t\treturn data;\n\t}\n\n\tpublic static boolean findNextPermutation(int data[]) {\n\t\tif (data.length <= 1)\n\t\t\treturn false;\n\n\t\tint last = data.length - 2;\n\t\twhile (last >= 0) {\n\t\t\tif (data[last] < data[last + 1]) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tlast--;\n\t\t}\n\t\tif (last < 0)\n\t\t\treturn false;\n\n\t\tint nextGreater = data.length - 1;\n\t\tfor (int i = data.length - 1; i > last; i--) {\n\t\t\tif (data[i] > data[last]) {\n\t\t\t\tnextGreater = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tdata = swap(data, nextGreater, last);\n\t\tdata = reverse(data, last + 1, data.length - 1);\n\t\treturn true;\n\t}\n\n\tstatic long ncr(long a, long b) {\n\t\tif (b > a - b)\n\t\t\treturn ncr(a, a - b);\n\t\tlong ansMul = 1;\n\t\tlong ansDiv = 1;\n\t\tfor (int i = 0; i < b; i++) {\n\t\t\tansMul *= (a - i);\n\t\t\tansDiv *= (i + 1);\n\t\t\tansMul %= MOD;\n\t\t\tansDiv %= MOD;\n\t\t}\n\n\t\tlong ans = ansMul * power(ansDiv, MOD - 2, MOD) % MOD;\n\n\t\treturn ans;\n\t}\n\n\tstatic long __gcd(long n1, long n2) {\n\t\tlong gcd = 1;\n\n\t\tfor (int i = 1; i <= n1 && i <= n2; ++i) {\n\t\t\t// Checks if i is factor of both integers\n\t\t\tif (n1 % i == 0 && n2 % i == 0) {\n\t\t\t\tgcd = i;\n\t\t\t}\n\t\t}\n\t\treturn gcd;\n\t}\n\n\tstatic long power(long prev, long n2, long mod2) {\n\t\tlong res = 1;\n\n\t\tprev = prev % mod2;\n\n\t\tif (prev == 0)\n\t\t\treturn 0;\n\t\twhile (n2 > 0) {\n\n\t\t\tif ((n2 & 1) == 1)\n\t\t\t\tres = (res * prev) % mod2;\n\n\t\t\tn2 = n2 >> 1;\n\t\t\tprev = (prev * prev) % mod2;\n\t\t}\n\t\treturn res;\n\t}\n\n\tstatic long modInverse(long fac2, int p) {\n\t\treturn power(fac2, p - 2, p);\n\t}\n\n\tstatic boolean isPrime(int n) {\n\t\t// Corner cases\n\t\tif (n <= 1)\n\t\t\treturn false;\n\t\tif (n <= 3)\n\t\t\treturn true;\n\n\t\t// This is checked so that we can skip\n\t\t// middle five numbers in below loop\n\t\tif (n % 2 == 0 || n % 3 == 0)\n\t\t\treturn false;\n\n\t\tfor (int i = 5; i * i <= n; i = i + 6)\n\t\t\tif (n % i == 0 || n % (i + 2) == 0)\n\t\t\t\treturn false;\n\n\t\treturn true;\n\t}\n\n\tpublic static BigInteger lcmm(String a, String b) {\n\t\tBigInteger s = new BigInteger(a);\n\t\tBigInteger s1 = new BigInteger(b);\n\t\tBigInteger mul = s.multiply(s1);\n\t\tBigInteger gcd = s.gcd(s1);\n\t\tBigInteger lcm = mul.divide(gcd);\n\t\treturn lcm;\n\t}\n\t/*\n\t * static boolean prime[] = new boolean[10000007]; static int spf[] = new\n\t * int[10000007];\n\t * \n\t * public static void sieveOfEratosthenes(int n) { for (int i = 2; i < n;\n\t * i++) prime[i] = true; for (int p = 2; p * p <= n; p++) {\n\t * \n\t * if (prime[p] == true) {\n\t * \n\t * for (int i = p * p; i <= n; i += p) { prime[i] = false; spf[i] = p; } } }\n\t * }\n\t */\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nFind the sum of A_i \\times A_j over all pairs (i,j) such that 1\\leq i < j \\leq N, modulo (10^9+7).\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\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 \\ldots A_N\n\nOutput\n\nPrint \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} A_i A_j, modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n11\n\nWe have 1 \\times 2 + 1 \\times 3 + 2 \\times 3 = 11.\n\nSample Input 2\n\n4\n141421356 17320508 22360679 244949\n\nSample Output 2\n\n437235829", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["11\n"], "source_document_id": "p02572", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nFind the sum of A_i \\times A_j over all pairs (i,j) such that 1\\leq i < j \\leq N, modulo (10^9+7).\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\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 \\ldots A_N\n\nOutput\n\nPrint \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} A_i A_j, modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n11\n\nWe have 1 \\times 2 + 1 \\times 3 + 2 \\times 3 = 11.\n\nSample Input 2\n\n4\n141421356 17320508 22360679 244949\n\nSample Output 2\n\n437235829", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 7688, "cpu_time_ms": 264, "memory_kb": 55992}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s917217424", "group_id": "codeNet:p02572", "input_text": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.Scanner;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author test\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n abc177_c solver = new abc177_c();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class abc177_c {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int N = in.nextInt();\n long[] A = new long[N];\n for (int i = 0; i < N; i++) {\n A[i] = in.nextLong();\n }\n Arrays.sort(A);\n long sum = 0;\n long mod = 1000000007;\n for (int i = 0; i < N; i++) {\n for (int j = 0; j < N; j++) {\n if (A[i] < A[j]) {\n sum = (sum + ((A[i] * A[j]) % mod)) % mod;\n }\n }\n }\n out.println(sum);\n }\n\n }\n}\n\n", "language": "Java", "metadata": {"date": 1598732054, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02572.html", "problem_id": "p02572", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02572/input.txt", "sample_output_relpath": "derived/input_output/data/p02572/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02572/Java/s917217424.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s917217424", "user_id": "u054465385"}, "prompt_components": {"gold_output": "11\n", "input_to_evaluate": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.Scanner;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author test\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n abc177_c solver = new abc177_c();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class abc177_c {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int N = in.nextInt();\n long[] A = new long[N];\n for (int i = 0; i < N; i++) {\n A[i] = in.nextLong();\n }\n Arrays.sort(A);\n long sum = 0;\n long mod = 1000000007;\n for (int i = 0; i < N; i++) {\n for (int j = 0; j < N; j++) {\n if (A[i] < A[j]) {\n sum = (sum + ((A[i] * A[j]) % mod)) % mod;\n }\n }\n }\n out.println(sum);\n }\n\n }\n}\n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nFind the sum of A_i \\times A_j over all pairs (i,j) such that 1\\leq i < j \\leq N, modulo (10^9+7).\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\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 \\ldots A_N\n\nOutput\n\nPrint \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} A_i A_j, modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n11\n\nWe have 1 \\times 2 + 1 \\times 3 + 2 \\times 3 = 11.\n\nSample Input 2\n\n4\n141421356 17320508 22360679 244949\n\nSample Output 2\n\n437235829", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["11\n"], "source_document_id": "p02572", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nFind the sum of A_i \\times A_j over all pairs (i,j) such that 1\\leq i < j \\leq N, modulo (10^9+7).\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\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 \\ldots A_N\n\nOutput\n\nPrint \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} A_i A_j, modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n11\n\nWe have 1 \\times 2 + 1 \\times 3 + 2 \\times 3 = 11.\n\nSample Input 2\n\n4\n141421356 17320508 22360679 244949\n\nSample Output 2\n\n437235829", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1274, "cpu_time_ms": 2208, "memory_kb": 62560}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s546510989", "group_id": "codeNet:p02572", "input_text": "import java.io.*;\nimport java.util.*;\nclass Main\n{\n\tpublic static void main(String args[]) throws IOException\n\t{\n\t\ttry{\n\t\tBufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n\t\tint n=0;\n\t\tn=Integer.parseInt(br.readLine());\n\t\tString brr[]=br.readLine().split(\" \");\n\t\tlong ar[]=new long[n];\n\t\tfor(int i=0;i= 0; i--) \n sum[i] = sum[i + 1] + ar[i]; \n long res = 0;\n for (int i = 0; i < n - 1; i++) \n res += (sum[i + 1] * ar[i]); \n System.out.println((long)(res%(1e9+7)));\n }\n\tcatch(Exception e){}\n}}\n", "language": "Java", "metadata": {"date": 1598730682, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02572.html", "problem_id": "p02572", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02572/input.txt", "sample_output_relpath": "derived/input_output/data/p02572/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02572/Java/s546510989.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s546510989", "user_id": "u309234531"}, "prompt_components": {"gold_output": "11\n", "input_to_evaluate": "import java.io.*;\nimport java.util.*;\nclass Main\n{\n\tpublic static void main(String args[]) throws IOException\n\t{\n\t\ttry{\n\t\tBufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n\t\tint n=0;\n\t\tn=Integer.parseInt(br.readLine());\n\t\tString brr[]=br.readLine().split(\" \");\n\t\tlong ar[]=new long[n];\n\t\tfor(int i=0;i= 0; i--) \n sum[i] = sum[i + 1] + ar[i]; \n long res = 0;\n for (int i = 0; i < n - 1; i++) \n res += (sum[i + 1] * ar[i]); \n System.out.println((long)(res%(1e9+7)));\n }\n\tcatch(Exception e){}\n}}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nFind the sum of A_i \\times A_j over all pairs (i,j) such that 1\\leq i < j \\leq N, modulo (10^9+7).\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\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 \\ldots A_N\n\nOutput\n\nPrint \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} A_i A_j, modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n11\n\nWe have 1 \\times 2 + 1 \\times 3 + 2 \\times 3 = 11.\n\nSample Input 2\n\n4\n141421356 17320508 22360679 244949\n\nSample Output 2\n\n437235829", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["11\n"], "source_document_id": "p02572", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nFind the sum of A_i \\times A_j over all pairs (i,j) such that 1\\leq i < j \\leq N, modulo (10^9+7).\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\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 \\ldots A_N\n\nOutput\n\nPrint \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} A_i A_j, modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n11\n\nWe have 1 \\times 2 + 1 \\times 3 + 2 \\times 3 = 11.\n\nSample Input 2\n\n4\n141421356 17320508 22360679 244949\n\nSample Output 2\n\n437235829", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 712, "cpu_time_ms": 261, "memory_kb": 62692}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s566688134", "group_id": "codeNet:p02572", "input_text": "import java.io.*;\nimport java.util.*;\npublic class Main {\n final static long mod = 1000000007;\n\n public static void main(String[] args) {\n InputReader sc = new InputReader(System.in);\n PrintWriter pw = new PrintWriter(System.out);\n Random gen = new Random();\n int test = 1;//sc.nextInt();\n while(test-->0) {\n long ans = 0;\n int n = sc.nextInt();\n long [] ar = new long[n];\n long sum = 0;\n long [] pre = new long[n];\n for(int i=0;i{\n int x;\n int y;\n\n public Data (int m, int n) {\n x = m;\n y = n;\n }\n @Override\n public int compareTo(Data o) {\n return y - o.y;\n }\n }\n\n static class InputReader {\n\n private final InputStream stream;\n private final byte[] buf = new byte[8192];\n private int curChar, snumChars;\n\n public InputReader(InputStream st) {\n this.stream = st;\n }\n\n public int read() {\n if (snumChars == -1)\n throw new InputMismatchException();\n if (curChar >= snumChars) {\n curChar = 0;\n try {\n snumChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (snumChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public long nextLong() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public int[] nextIntArray(int n) {\n int [] a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = nextInt();\n }\n return a;\n }\n\n public static int[] shuffle(int[] a, Random gen)\n { for(int i = 0, n = a.length;i < n;i++)\n { int ind = gen.nextInt(n-i)+i;\n int d = a[i];\n a[i] = a[ind];\n a[ind] = d;\n\n }\n return a;\n }\n public static char[] shuffle(char[] a, Random gen)\n { for(int i = 0, n = a.length;i < n;i++)\n { int ind = gen.nextInt(n-i)+i;\n char d = a[i];\n a[i] = a[ind];\n a[ind] = d;\n\n }\n return a;\n }\n\n\n public String readString() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isSpaceChar(c));\n return res.toString();\n }\n\n public String nextLine() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isEndOfLine(c));\n return res.toString();\n }\n\n public boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n private boolean isEndOfLine(int c) {\n return c == '\\n' || c == '\\r' || c == -1;\n }\n\n }\n\n}\n", "language": "Java", "metadata": {"date": 1598730497, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02572.html", "problem_id": "p02572", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02572/input.txt", "sample_output_relpath": "derived/input_output/data/p02572/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02572/Java/s566688134.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s566688134", "user_id": "u110643071"}, "prompt_components": {"gold_output": "11\n", "input_to_evaluate": "import java.io.*;\nimport java.util.*;\npublic class Main {\n final static long mod = 1000000007;\n\n public static void main(String[] args) {\n InputReader sc = new InputReader(System.in);\n PrintWriter pw = new PrintWriter(System.out);\n Random gen = new Random();\n int test = 1;//sc.nextInt();\n while(test-->0) {\n long ans = 0;\n int n = sc.nextInt();\n long [] ar = new long[n];\n long sum = 0;\n long [] pre = new long[n];\n for(int i=0;i{\n int x;\n int y;\n\n public Data (int m, int n) {\n x = m;\n y = n;\n }\n @Override\n public int compareTo(Data o) {\n return y - o.y;\n }\n }\n\n static class InputReader {\n\n private final InputStream stream;\n private final byte[] buf = new byte[8192];\n private int curChar, snumChars;\n\n public InputReader(InputStream st) {\n this.stream = st;\n }\n\n public int read() {\n if (snumChars == -1)\n throw new InputMismatchException();\n if (curChar >= snumChars) {\n curChar = 0;\n try {\n snumChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (snumChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public long nextLong() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public int[] nextIntArray(int n) {\n int [] a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = nextInt();\n }\n return a;\n }\n\n public static int[] shuffle(int[] a, Random gen)\n { for(int i = 0, n = a.length;i < n;i++)\n { int ind = gen.nextInt(n-i)+i;\n int d = a[i];\n a[i] = a[ind];\n a[ind] = d;\n\n }\n return a;\n }\n public static char[] shuffle(char[] a, Random gen)\n { for(int i = 0, n = a.length;i < n;i++)\n { int ind = gen.nextInt(n-i)+i;\n char d = a[i];\n a[i] = a[ind];\n a[ind] = d;\n\n }\n return a;\n }\n\n\n public String readString() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isSpaceChar(c));\n return res.toString();\n }\n\n public String nextLine() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isEndOfLine(c));\n return res.toString();\n }\n\n public boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n private boolean isEndOfLine(int c) {\n return c == '\\n' || c == '\\r' || c == -1;\n }\n\n }\n\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nFind the sum of A_i \\times A_j over all pairs (i,j) such that 1\\leq i < j \\leq N, modulo (10^9+7).\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\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 \\ldots A_N\n\nOutput\n\nPrint \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} A_i A_j, modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n11\n\nWe have 1 \\times 2 + 1 \\times 3 + 2 \\times 3 = 11.\n\nSample Input 2\n\n4\n141421356 17320508 22360679 244949\n\nSample Output 2\n\n437235829", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["11\n"], "source_document_id": "p02572", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nFind the sum of A_i \\times A_j over all pairs (i,j) such that 1\\leq i < j \\leq N, modulo (10^9+7).\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\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 \\ldots A_N\n\nOutput\n\nPrint \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} A_i A_j, modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n11\n\nWe have 1 \\times 2 + 1 \\times 3 + 2 \\times 3 = 11.\n\nSample Input 2\n\n4\n141421356 17320508 22360679 244949\n\nSample Output 2\n\n437235829", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 4793, "cpu_time_ms": 176, "memory_kb": 37560}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s383056931", "group_id": "codeNet:p02572", "input_text": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.InputMismatchException;\nimport java.io.IOException;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author Pranay2516\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastReader in = new FastReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n C solver = new C();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class C {\n public void solve(int testNumber, FastReader in, PrintWriter out) {\n int n = in.nextInt(), a[] = in.readIntArray(n), mod = (int) 1e9 + 7;\n long[] pref = new long[n];\n pref[n - 1] = a[n - 1];\n for (int i = n - 2; i >= 0; --i) pref[i] = ((pref[i + 1] + a[i]) + mod) % mod;\n long sum = 0;\n for (int i = 0; i < n - 1; ++i) sum = ((sum % mod) + ((pref[i + 1] * a[i] + mod) % mod) + mod) % mod;\n out.println(sum);\n }\n\n }\n\n static class FastReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private FastReader.SpaceCharFilter filter;\n\n public FastReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) return -1;\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n }\n while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public int[] readIntArray(int size) {\n int[] array = new int[(int) size];\n for (int i = 0; i < size; i++) array[i] = nextInt();\n return array;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }\n}\n\n", "language": "Java", "metadata": {"date": 1598730259, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02572.html", "problem_id": "p02572", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02572/input.txt", "sample_output_relpath": "derived/input_output/data/p02572/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02572/Java/s383056931.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s383056931", "user_id": "u222548870"}, "prompt_components": {"gold_output": "11\n", "input_to_evaluate": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.InputMismatchException;\nimport java.io.IOException;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author Pranay2516\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastReader in = new FastReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n C solver = new C();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class C {\n public void solve(int testNumber, FastReader in, PrintWriter out) {\n int n = in.nextInt(), a[] = in.readIntArray(n), mod = (int) 1e9 + 7;\n long[] pref = new long[n];\n pref[n - 1] = a[n - 1];\n for (int i = n - 2; i >= 0; --i) pref[i] = ((pref[i + 1] + a[i]) + mod) % mod;\n long sum = 0;\n for (int i = 0; i < n - 1; ++i) sum = ((sum % mod) + ((pref[i + 1] * a[i] + mod) % mod) + mod) % mod;\n out.println(sum);\n }\n\n }\n\n static class FastReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private FastReader.SpaceCharFilter filter;\n\n public FastReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) return -1;\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n }\n while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public int[] readIntArray(int size) {\n int[] array = new int[(int) size];\n for (int i = 0; i < size; i++) array[i] = nextInt();\n return array;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }\n}\n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nFind the sum of A_i \\times A_j over all pairs (i,j) such that 1\\leq i < j \\leq N, modulo (10^9+7).\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\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 \\ldots A_N\n\nOutput\n\nPrint \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} A_i A_j, modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n11\n\nWe have 1 \\times 2 + 1 \\times 3 + 2 \\times 3 = 11.\n\nSample Input 2\n\n4\n141421356 17320508 22360679 244949\n\nSample Output 2\n\n437235829", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["11\n"], "source_document_id": "p02572", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nFind the sum of A_i \\times A_j over all pairs (i,j) such that 1\\leq i < j \\leq N, modulo (10^9+7).\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\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 \\ldots A_N\n\nOutput\n\nPrint \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} A_i A_j, modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n11\n\nWe have 1 \\times 2 + 1 \\times 3 + 2 \\times 3 = 11.\n\nSample Input 2\n\n4\n141421356 17320508 22360679 244949\n\nSample Output 2\n\n437235829", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2997, "cpu_time_ms": 151, "memory_kb": 36388}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s754358104", "group_id": "codeNet:p02572", "input_text": "import java.util.*;\nimport java.io.*;\nclass Main{\n static class InputReader {\n\n private final InputStream stream;\n private final byte[] buf = new byte[8192];\n private int curChar, snumChars;\n private SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int snext() {\n if (snumChars == -1)\n throw new InputMismatchException();\n if (curChar >= snumChars) {\n curChar = 0;\n try {\n snumChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (snumChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = snext();\n while (isSpaceChar(c)) {\n c = snext();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = snext();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = snext();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public long nextLong() {\n int c = snext();\n while (isSpaceChar(c)) {\n c = snext();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = snext();\n }\n long res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = snext();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public int[] nextIntArray(int n) {\n int a[] = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = nextInt();\n }\n return a;\n }\n\n public String readString() {\n int c = snext();\n while (isSpaceChar(c)) {\n c = snext();\n }\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = snext();\n } while (!isSpaceChar(c));\n return res.toString();\n }\n\n public String nextLine() {\n int c = snext();\n while (isSpaceChar(c))\n c = snext();\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = snext();\n } while (!isEndOfLine(c));\n return res.toString();\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n private boolean isEndOfLine(int c) {\n return c == '\\n' || c == '\\r' || c == -1;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n\n }\n static class OutputWriter {\n\t\tprivate final PrintWriter writer;\n \n\t\tpublic OutputWriter(OutputStream outputStream) {\n\t\t\twriter = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n\t\t}\n \n\t\tpublic OutputWriter(Writer writer) {\n\t\t\tthis.writer = new PrintWriter(writer);\n\t\t}\n \n\t\tpublic void print(Object...objects) {\n\t\t\tfor (int i = 0; i < objects.length; i++) {\n\t\t\t\tif (i != 0)\n\t\t\t\t\twriter.print(' ');\n\t\t\t\twriter.print(objects[i]);\n\t\t\t}\n\t\t}\n \n\t\tpublic void printLine(Object...objects) {\n\t\t\tprint(objects);\n\t\t\twriter.println();\n\t\t}\n \n\t\tpublic void close() {\n\t\t\twriter.close();\n\t\t}\n \n\t\tpublic void flush() {\n\t\t\twriter.flush();\n\t\t}\n \n\t\t}\n static int gcd(int a, int b) \n { \n if (a == 0) \n return b; \n return gcd(b % a, a); \n } \n static int mod = (int)(1e9+7);\n public static long pow(long a,long b)\n {\n long ans = 1;\n while(b> 0)\n {\n if((b & 1)==1){\n ans = (ans*a) % mod; \n }\n a = (a*a) % mod;\n b = b>>1;\n }\n return ans;\n }\n\n public static void main(String[] args) {\n InputReader in = new InputReader(System.in);\n OutputWriter out = new OutputWriter(System.out);\n int n = in.nextInt();\n long[] arr = new long[n];\n for(int i=0;i=0;i--)\n {\n res = (res+(arr[i]*sumTillnow))%mod;\n sumTillnow+=arr[i];\n assert sumTillnow>=0;\n }\n out.printLine(res);\n out.flush();\n out.close();\n }\n}", "language": "Java", "metadata": {"date": 1598729796, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02572.html", "problem_id": "p02572", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02572/input.txt", "sample_output_relpath": "derived/input_output/data/p02572/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02572/Java/s754358104.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s754358104", "user_id": "u048677748"}, "prompt_components": {"gold_output": "11\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\nclass Main{\n static class InputReader {\n\n private final InputStream stream;\n private final byte[] buf = new byte[8192];\n private int curChar, snumChars;\n private SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int snext() {\n if (snumChars == -1)\n throw new InputMismatchException();\n if (curChar >= snumChars) {\n curChar = 0;\n try {\n snumChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (snumChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = snext();\n while (isSpaceChar(c)) {\n c = snext();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = snext();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = snext();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public long nextLong() {\n int c = snext();\n while (isSpaceChar(c)) {\n c = snext();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = snext();\n }\n long res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = snext();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public int[] nextIntArray(int n) {\n int a[] = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = nextInt();\n }\n return a;\n }\n\n public String readString() {\n int c = snext();\n while (isSpaceChar(c)) {\n c = snext();\n }\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = snext();\n } while (!isSpaceChar(c));\n return res.toString();\n }\n\n public String nextLine() {\n int c = snext();\n while (isSpaceChar(c))\n c = snext();\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = snext();\n } while (!isEndOfLine(c));\n return res.toString();\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n private boolean isEndOfLine(int c) {\n return c == '\\n' || c == '\\r' || c == -1;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n\n }\n static class OutputWriter {\n\t\tprivate final PrintWriter writer;\n \n\t\tpublic OutputWriter(OutputStream outputStream) {\n\t\t\twriter = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n\t\t}\n \n\t\tpublic OutputWriter(Writer writer) {\n\t\t\tthis.writer = new PrintWriter(writer);\n\t\t}\n \n\t\tpublic void print(Object...objects) {\n\t\t\tfor (int i = 0; i < objects.length; i++) {\n\t\t\t\tif (i != 0)\n\t\t\t\t\twriter.print(' ');\n\t\t\t\twriter.print(objects[i]);\n\t\t\t}\n\t\t}\n \n\t\tpublic void printLine(Object...objects) {\n\t\t\tprint(objects);\n\t\t\twriter.println();\n\t\t}\n \n\t\tpublic void close() {\n\t\t\twriter.close();\n\t\t}\n \n\t\tpublic void flush() {\n\t\t\twriter.flush();\n\t\t}\n \n\t\t}\n static int gcd(int a, int b) \n { \n if (a == 0) \n return b; \n return gcd(b % a, a); \n } \n static int mod = (int)(1e9+7);\n public static long pow(long a,long b)\n {\n long ans = 1;\n while(b> 0)\n {\n if((b & 1)==1){\n ans = (ans*a) % mod; \n }\n a = (a*a) % mod;\n b = b>>1;\n }\n return ans;\n }\n\n public static void main(String[] args) {\n InputReader in = new InputReader(System.in);\n OutputWriter out = new OutputWriter(System.out);\n int n = in.nextInt();\n long[] arr = new long[n];\n for(int i=0;i=0;i--)\n {\n res = (res+(arr[i]*sumTillnow))%mod;\n sumTillnow+=arr[i];\n assert sumTillnow>=0;\n }\n out.printLine(res);\n out.flush();\n out.close();\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nFind the sum of A_i \\times A_j over all pairs (i,j) such that 1\\leq i < j \\leq N, modulo (10^9+7).\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\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 \\ldots A_N\n\nOutput\n\nPrint \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} A_i A_j, modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n11\n\nWe have 1 \\times 2 + 1 \\times 3 + 2 \\times 3 = 11.\n\nSample Input 2\n\n4\n141421356 17320508 22360679 244949\n\nSample Output 2\n\n437235829", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["11\n"], "source_document_id": "p02572", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nFind the sum of A_i \\times A_j over all pairs (i,j) such that 1\\leq i < j \\leq N, modulo (10^9+7).\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\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 \\ldots A_N\n\nOutput\n\nPrint \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} A_i A_j, modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n11\n\nWe have 1 \\times 2 + 1 \\times 3 + 2 \\times 3 = 11.\n\nSample Input 2\n\n4\n141421356 17320508 22360679 244949\n\nSample Output 2\n\n437235829", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 5024, "cpu_time_ms": 117, "memory_kb": 35352}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s798852519", "group_id": "codeNet:p02572", "input_text": "import java.io.FileNotFoundException;\nimport java.math.BigInteger;\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) throws FileNotFoundException {\n\n\t\t// \tFile file = new File(\"src/in.txt\");\n\t\t// \tScanner sc = new Scanner(file);\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint N = sc.nextInt();\n\t\tBigInteger sum = BigInteger.valueOf(0);\n\t\tBigInteger sqsum = BigInteger.valueOf(0);\n\n\t\tfor(int i=0;i comp(LinkedList q){\n\t\tLinkedList op = new LinkedList<>();\n\t\tStack stack = new Stack<>();\n\t\twhile(q.size()>0){\n\t\t\tstack.push(q.pop());\n\t\t}\n\t\twhile(stack.size()>0){\n\t\t\top.addLast(stack.pop());\n\t\t}\n\t\treturn op;\n\t}\n\t\n\tpublic static ArrayList primefactor(int n){\n\t\tint sqrt = (int)Math.sqrt(n);\n\t\tArrayList al = new ArrayList<>();\n\t\twhile(n%2==0){\n\t\t\tal.add(2);\n\t\t\tn/=2;\n\t\t}\n\t\tfor(int i=3;i<=sqrt;i+=2){\n\t\t\twhile(n%i==0){\n\t\t\t\tal.add(i);\n\t\t\t\tn/=i;\n\t\t\t}\n\t\t}\n\t\tif(n>2)\n\t\t\tal.add(n);\n\t\treturn al;\n\t}\n\t\n\tpublic static long sum(long val){\n\t\tlong fg =0 ;\n\t\twhile(val!=0){\n\t\t\tfg+=val%10;\n\t\t\tval/=10;\n\t\t}\n\t\treturn fg;\n\t}\n\t\n\t\n\t\n\tpublic static ArrayList factor(long n){\n\t\tlong sqrt = (long)Math.sqrt(n);\n\t\tArrayList al = new ArrayList<>();\n\t\tfor(long i=1;i<=sqrt;i++){\n\t\t\tif(n%i!=0)\n\t\t\t\tcontinue;\n\t\t\tlong first = i;\n\t\t\tlong second = n/i;\n\t\t\tal.add(i);\n\t\t\tif(first==second){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tal.add(n/i);\n\t\t}\n\t\treturn al;\n\t}\n\t\n\t\n\t\n\tpublic static ArrayList comp(){\n\t\tArrayList al = new ArrayList<>();\n\t\t\tint n = (int)2e5;\n\t\t\tboolean arr[] = new boolean[n+1];\n\t\t\tint sqrt = (int)Math.sqrt(n);\n\t\t\tfor(int i=2;i<=sqrt;i++){\n\t\t\t\tif(arr[i]==false){\n\t\t\t\t\tfor(int j=i*i;j<=n;j+=i){\n\t\t\t\t\t\tarr[j]=true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(int i=2;i<=n;i++){\n\t\t\t\tif(arr[i]==false)\n\t\t\t\t\tal.add(i);\n\t\t\t}\n\t\t\t\n\t\treturn al;\n\t}\n\t\n\tpublic static class pair{\n\t\tint x;\n\t\tint y;\n\t\tpair(int x, int y){\n\t\t\tthis.x=x;\n\t\t\tthis.y=y;\n\t\t}\n\t}\n\t\n\tpublic static class comp implements Comparator{\n\t\tpublic int compare(pair o1, pair o2){\n\t\t\treturn o2.y-o1.y;\n\t\t}\n\t}\n\t\n\t\n\t\n\tstatic class Node{\n\t\tint node;\n\t\tint d;\n\t\tArrayList al = new ArrayList<>();\t\n\t}\n\t\n\n\tstatic int gcd(int a, int b) \n { \n if (b == 0) \n return a; \n return gcd(b, a % b); \n }\n\t\n\t\t\n\tstatic class FastReader \n\t{ \n\t\tfinal private int BUFFER_SIZE = 1 << 16; \n\t\tprivate DataInputStream din; \n\t\tprivate byte[] buffer; \n\t\tprivate int bufferPointer, bytesRead; \n \n\t\tpublic FastReader() \n\t\t{ \n\t\t\tdin = new DataInputStream(System.in); \n\t\t\tbuffer = new byte[BUFFER_SIZE]; \n\t\t\tbufferPointer = bytesRead = 0; \n\t\t} \n \n\t\tpublic FastReader(String file_name) throws IOException \n\t\t{ \n\t\t\tdin = new DataInputStream(new FileInputStream(file_name)); \n\t\t\tbuffer = new byte[BUFFER_SIZE]; \n\t\t\tbufferPointer = bytesRead = 0; \n\t\t} \n \n\t\tpublic String readLine() throws IOException \n\t\t{ \n\t\t\tbyte[] buf = new byte[64]; // line length \n\t\t\tint cnt = 0, c; \n\t\t\twhile ((c = read()) != -1) \n\t\t\t{ \n\t\t\t\tif (c == '\\n') \n\t\t\t\t\tbreak; \n\t\t\t\tbuf[cnt++] = (byte) c; \n\t\t\t} \n\t\t\treturn new String(buf, 0, cnt); \n\t\t} \n \n\t\tpublic int nextInt() throws IOException \n\t\t{ \n\t\t\tint ret = 0; \n\t\t\tbyte c = read(); \n\t\t\twhile (c <= ' ') \n\t\t\t\tc = read(); \n\t\t\tboolean neg = (c == '-'); \n\t\t\tif (neg) \n\t\t\t\tc = read(); \n\t\t\tdo\n\t\t\t{ \n\t\t\t\tret = ret * 10 + c - '0'; \n\t\t\t} while ((c = read()) >= '0' && c <= '9'); \n \n\t\t\tif (neg) \n\t\t\t\treturn -ret; \n\t\t\treturn ret; \n\t\t} \n \n\t\tpublic long nextLong() throws IOException \n\t\t{ \n\t\t\tlong ret = 0; \n\t\t\tbyte c = read(); \n\t\t\twhile (c <= ' ') \n\t\t\t\tc = read(); \n\t\t\tboolean neg = (c == '-'); \n\t\t\tif (neg) \n\t\t\t\tc = read(); \n\t\t\tdo { \n\t\t\t\tret = ret * 10 + c - '0'; \n\t\t\t} \n\t\t\twhile ((c = read()) >= '0' && c <= '9'); \n\t\t\tif (neg) \n\t\t\t\treturn -ret; \n\t\t\treturn ret; \n\t\t} \n \n\t\tpublic double nextDouble() throws IOException \n\t\t{ \n\t\t\tdouble ret = 0, div = 1; \n\t\t\tbyte c = read(); \n\t\t\twhile (c <= ' ') \n\t\t\t\tc = read(); \n\t\t\tboolean neg = (c == '-'); \n\t\t\tif (neg) \n\t\t\t\tc = read(); \n \n\t\t\tdo { \n\t\t\t\tret = ret * 10 + c - '0'; \n\t\t\t} \n\t\t\twhile ((c = read()) >= '0' && c <= '9'); \n \n\t\t\tif (c == '.') \n\t\t\t{ \n\t\t\t\twhile ((c = read()) >= '0' && c <= '9') \n\t\t\t\t{ \n\t\t\t\t\tret += (c - '0') / (div *= 10); \n\t\t\t\t} \n\t\t\t} \n \n\t\t\tif (neg) \n\t\t\t\treturn -ret; \n\t\t\treturn ret; \n\t\t} \n\t\t\n\t\t\n \n\t\tprivate void fillBuffer() throws IOException \n\t\t{ \n\t\t\tbytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); \n\t\t\tif (bytesRead == -1) \n\t\t\t\tbuffer[0] = -1; \n\t\t} \n \n\t\tprivate byte read() throws IOException \n\t\t{ \n\t\t\tif (bufferPointer == bytesRead) \n\t\t\t\tfillBuffer(); \n\t\t\treturn buffer[bufferPointer++]; \n\t\t} \n \n\t\tpublic void close() throws IOException \n\t\t{ \n\t\t\tif (din == null) \n\t\t\t\treturn; \n\t\t\tdin.close(); \n\t\t} \n\t} \n}", "language": "Java", "metadata": {"date": 1598729467, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02572.html", "problem_id": "p02572", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02572/input.txt", "sample_output_relpath": "derived/input_output/data/p02572/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02572/Java/s771986319.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s771986319", "user_id": "u016768375"}, "prompt_components": {"gold_output": "11\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\nimport java.math.*;\npublic class Main{\n\tstatic long mod = (long)(1e9+7);\n\tpublic static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));\n\tpublic static void main(String[] args)throws IOException {\n\t\tScanner sc =new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong arr[] = new long[n+1];\n\t\tlong total= 0;\n\t\tfor(int i=1;i<=n;i++){\n\t\t\tarr[i] = sc.nextLong();\n\t\t}\n\t\t\n\t\ttotal=0;\n\t\tlong ans = 0;\n\t\tfor(int i=1;i<=n;i++){\n\t\t\tlong p = (arr[i]%mod*total%mod)%mod;\n\t\t\tans = (ans%mod + p%mod)%mod;\n\t\t\ttotal=(total%mod+arr[i]%mod)%mod;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\t\n\tpublic static long power(long a, long b){\n\t\tlong temp = 0l;\n\t\tif(b==0)\n\t\t\treturn 1l;\n\t\t\n\t\ttemp = power(a, b/2);\n\t\tif(b%2==0)\n\t\t\treturn (temp%mod*temp%mod)%mod;\n\t\telse return (temp%mod*(temp%mod*a%mod)%mod)%mod; \n\t}\n\t\n\t\n\tpublic static LinkedList comp(LinkedList q){\n\t\tLinkedList op = new LinkedList<>();\n\t\tStack stack = new Stack<>();\n\t\twhile(q.size()>0){\n\t\t\tstack.push(q.pop());\n\t\t}\n\t\twhile(stack.size()>0){\n\t\t\top.addLast(stack.pop());\n\t\t}\n\t\treturn op;\n\t}\n\t\n\tpublic static ArrayList primefactor(int n){\n\t\tint sqrt = (int)Math.sqrt(n);\n\t\tArrayList al = new ArrayList<>();\n\t\twhile(n%2==0){\n\t\t\tal.add(2);\n\t\t\tn/=2;\n\t\t}\n\t\tfor(int i=3;i<=sqrt;i+=2){\n\t\t\twhile(n%i==0){\n\t\t\t\tal.add(i);\n\t\t\t\tn/=i;\n\t\t\t}\n\t\t}\n\t\tif(n>2)\n\t\t\tal.add(n);\n\t\treturn al;\n\t}\n\t\n\tpublic static long sum(long val){\n\t\tlong fg =0 ;\n\t\twhile(val!=0){\n\t\t\tfg+=val%10;\n\t\t\tval/=10;\n\t\t}\n\t\treturn fg;\n\t}\n\t\n\t\n\t\n\tpublic static ArrayList factor(long n){\n\t\tlong sqrt = (long)Math.sqrt(n);\n\t\tArrayList al = new ArrayList<>();\n\t\tfor(long i=1;i<=sqrt;i++){\n\t\t\tif(n%i!=0)\n\t\t\t\tcontinue;\n\t\t\tlong first = i;\n\t\t\tlong second = n/i;\n\t\t\tal.add(i);\n\t\t\tif(first==second){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tal.add(n/i);\n\t\t}\n\t\treturn al;\n\t}\n\t\n\t\n\t\n\tpublic static ArrayList comp(){\n\t\tArrayList al = new ArrayList<>();\n\t\t\tint n = (int)2e5;\n\t\t\tboolean arr[] = new boolean[n+1];\n\t\t\tint sqrt = (int)Math.sqrt(n);\n\t\t\tfor(int i=2;i<=sqrt;i++){\n\t\t\t\tif(arr[i]==false){\n\t\t\t\t\tfor(int j=i*i;j<=n;j+=i){\n\t\t\t\t\t\tarr[j]=true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(int i=2;i<=n;i++){\n\t\t\t\tif(arr[i]==false)\n\t\t\t\t\tal.add(i);\n\t\t\t}\n\t\t\t\n\t\treturn al;\n\t}\n\t\n\tpublic static class pair{\n\t\tint x;\n\t\tint y;\n\t\tpair(int x, int y){\n\t\t\tthis.x=x;\n\t\t\tthis.y=y;\n\t\t}\n\t}\n\t\n\tpublic static class comp implements Comparator{\n\t\tpublic int compare(pair o1, pair o2){\n\t\t\treturn o2.y-o1.y;\n\t\t}\n\t}\n\t\n\t\n\t\n\tstatic class Node{\n\t\tint node;\n\t\tint d;\n\t\tArrayList al = new ArrayList<>();\t\n\t}\n\t\n\n\tstatic int gcd(int a, int b) \n { \n if (b == 0) \n return a; \n return gcd(b, a % b); \n }\n\t\n\t\t\n\tstatic class FastReader \n\t{ \n\t\tfinal private int BUFFER_SIZE = 1 << 16; \n\t\tprivate DataInputStream din; \n\t\tprivate byte[] buffer; \n\t\tprivate int bufferPointer, bytesRead; \n \n\t\tpublic FastReader() \n\t\t{ \n\t\t\tdin = new DataInputStream(System.in); \n\t\t\tbuffer = new byte[BUFFER_SIZE]; \n\t\t\tbufferPointer = bytesRead = 0; \n\t\t} \n \n\t\tpublic FastReader(String file_name) throws IOException \n\t\t{ \n\t\t\tdin = new DataInputStream(new FileInputStream(file_name)); \n\t\t\tbuffer = new byte[BUFFER_SIZE]; \n\t\t\tbufferPointer = bytesRead = 0; \n\t\t} \n \n\t\tpublic String readLine() throws IOException \n\t\t{ \n\t\t\tbyte[] buf = new byte[64]; // line length \n\t\t\tint cnt = 0, c; \n\t\t\twhile ((c = read()) != -1) \n\t\t\t{ \n\t\t\t\tif (c == '\\n') \n\t\t\t\t\tbreak; \n\t\t\t\tbuf[cnt++] = (byte) c; \n\t\t\t} \n\t\t\treturn new String(buf, 0, cnt); \n\t\t} \n \n\t\tpublic int nextInt() throws IOException \n\t\t{ \n\t\t\tint ret = 0; \n\t\t\tbyte c = read(); \n\t\t\twhile (c <= ' ') \n\t\t\t\tc = read(); \n\t\t\tboolean neg = (c == '-'); \n\t\t\tif (neg) \n\t\t\t\tc = read(); \n\t\t\tdo\n\t\t\t{ \n\t\t\t\tret = ret * 10 + c - '0'; \n\t\t\t} while ((c = read()) >= '0' && c <= '9'); \n \n\t\t\tif (neg) \n\t\t\t\treturn -ret; \n\t\t\treturn ret; \n\t\t} \n \n\t\tpublic long nextLong() throws IOException \n\t\t{ \n\t\t\tlong ret = 0; \n\t\t\tbyte c = read(); \n\t\t\twhile (c <= ' ') \n\t\t\t\tc = read(); \n\t\t\tboolean neg = (c == '-'); \n\t\t\tif (neg) \n\t\t\t\tc = read(); \n\t\t\tdo { \n\t\t\t\tret = ret * 10 + c - '0'; \n\t\t\t} \n\t\t\twhile ((c = read()) >= '0' && c <= '9'); \n\t\t\tif (neg) \n\t\t\t\treturn -ret; \n\t\t\treturn ret; \n\t\t} \n \n\t\tpublic double nextDouble() throws IOException \n\t\t{ \n\t\t\tdouble ret = 0, div = 1; \n\t\t\tbyte c = read(); \n\t\t\twhile (c <= ' ') \n\t\t\t\tc = read(); \n\t\t\tboolean neg = (c == '-'); \n\t\t\tif (neg) \n\t\t\t\tc = read(); \n \n\t\t\tdo { \n\t\t\t\tret = ret * 10 + c - '0'; \n\t\t\t} \n\t\t\twhile ((c = read()) >= '0' && c <= '9'); \n \n\t\t\tif (c == '.') \n\t\t\t{ \n\t\t\t\twhile ((c = read()) >= '0' && c <= '9') \n\t\t\t\t{ \n\t\t\t\t\tret += (c - '0') / (div *= 10); \n\t\t\t\t} \n\t\t\t} \n \n\t\t\tif (neg) \n\t\t\t\treturn -ret; \n\t\t\treturn ret; \n\t\t} \n\t\t\n\t\t\n \n\t\tprivate void fillBuffer() throws IOException \n\t\t{ \n\t\t\tbytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); \n\t\t\tif (bytesRead == -1) \n\t\t\t\tbuffer[0] = -1; \n\t\t} \n \n\t\tprivate byte read() throws IOException \n\t\t{ \n\t\t\tif (bufferPointer == bytesRead) \n\t\t\t\tfillBuffer(); \n\t\t\treturn buffer[bufferPointer++]; \n\t\t} \n \n\t\tpublic void close() throws IOException \n\t\t{ \n\t\t\tif (din == null) \n\t\t\t\treturn; \n\t\t\tdin.close(); \n\t\t} \n\t} \n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nFind the sum of A_i \\times A_j over all pairs (i,j) such that 1\\leq i < j \\leq N, modulo (10^9+7).\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\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 \\ldots A_N\n\nOutput\n\nPrint \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} A_i A_j, modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n11\n\nWe have 1 \\times 2 + 1 \\times 3 + 2 \\times 3 = 11.\n\nSample Input 2\n\n4\n141421356 17320508 22360679 244949\n\nSample Output 2\n\n437235829", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["11\n"], "source_document_id": "p02572", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nFind the sum of A_i \\times A_j over all pairs (i,j) such that 1\\leq i < j \\leq N, modulo (10^9+7).\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\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 \\ldots A_N\n\nOutput\n\nPrint \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} A_i A_j, modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n11\n\nWe have 1 \\times 2 + 1 \\times 3 + 2 \\times 3 = 11.\n\nSample Input 2\n\n4\n141421356 17320508 22360679 244949\n\nSample Output 2\n\n437235829", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 5066, "cpu_time_ms": 571, "memory_kb": 60956}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s916848218", "group_id": "codeNet:p02572", "input_text": "import java.util.Scanner;\n\nclass Main {\n public static void main(String[] args) {\n\n var m = 1000000000 + 7;\n\n var sc = new Scanner(System.in);\n\n var n = sc.nextInt();\n var a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextInt() % m;\n }\n\n long answer = 0;\n for (int i = 0; i < n; i++) {\n for (int j = i + 1; j < n; j++) {\n answer = (answer + (long)a[i] * a[j] % m) % m;\n }\n }\n\n System.out.println(answer);\n\n }\n}", "language": "Java", "metadata": {"date": 1598729240, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02572.html", "problem_id": "p02572", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02572/input.txt", "sample_output_relpath": "derived/input_output/data/p02572/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02572/Java/s916848218.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s916848218", "user_id": "u691782712"}, "prompt_components": {"gold_output": "11\n", "input_to_evaluate": "import java.util.Scanner;\n\nclass Main {\n public static void main(String[] args) {\n\n var m = 1000000000 + 7;\n\n var sc = new Scanner(System.in);\n\n var n = sc.nextInt();\n var a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextInt() % m;\n }\n\n long answer = 0;\n for (int i = 0; i < n; i++) {\n for (int j = i + 1; j < n; j++) {\n answer = (answer + (long)a[i] * a[j] % m) % m;\n }\n }\n\n System.out.println(answer);\n\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nFind the sum of A_i \\times A_j over all pairs (i,j) such that 1\\leq i < j \\leq N, modulo (10^9+7).\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\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 \\ldots A_N\n\nOutput\n\nPrint \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} A_i A_j, modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n11\n\nWe have 1 \\times 2 + 1 \\times 3 + 2 \\times 3 = 11.\n\nSample Input 2\n\n4\n141421356 17320508 22360679 244949\n\nSample Output 2\n\n437235829", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["11\n"], "source_document_id": "p02572", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nFind the sum of A_i \\times A_j over all pairs (i,j) such that 1\\leq i < j \\leq N, modulo (10^9+7).\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\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 \\ldots A_N\n\nOutput\n\nPrint \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} A_i A_j, modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n11\n\nWe have 1 \\times 2 + 1 \\times 3 + 2 \\times 3 = 11.\n\nSample Input 2\n\n4\n141421356 17320508 22360679 244949\n\nSample Output 2\n\n437235829", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 60516}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s451960933", "group_id": "codeNet:p02572", "input_text": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\n\npublic class Main {\n \n public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new java.io.InputStreamReader(System.in));\n PrintWriter pw = new PrintWriter(System.out);\n StringTokenizer st = new StringTokenizer(br.readLine());\n\n int N = Integer.parseInt(st.nextToken());\n String[] input_array = br.readLine().split(\" \");\n\n long result = 0;\n long mod = 1000000000 + 7;\n\n for(int i = 0; i < N; i++) {\n long num_i = Long.parseLong(input_array[i]);\n\n for(int j = i + 1; j < N; j++) {\n long num_j = Long.parseLong(input_array[j]);\n result += num_i * num_j;\n result = result % mod;\n }\n }\n\n pw.println(result);\n br.close();\n pw.close();\n }\n}", "language": "Java", "metadata": {"date": 1598729235, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02572.html", "problem_id": "p02572", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02572/input.txt", "sample_output_relpath": "derived/input_output/data/p02572/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02572/Java/s451960933.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s451960933", "user_id": "u262376886"}, "prompt_components": {"gold_output": "11\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\n\npublic class Main {\n \n public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new java.io.InputStreamReader(System.in));\n PrintWriter pw = new PrintWriter(System.out);\n StringTokenizer st = new StringTokenizer(br.readLine());\n\n int N = Integer.parseInt(st.nextToken());\n String[] input_array = br.readLine().split(\" \");\n\n long result = 0;\n long mod = 1000000000 + 7;\n\n for(int i = 0; i < N; i++) {\n long num_i = Long.parseLong(input_array[i]);\n\n for(int j = i + 1; j < N; j++) {\n long num_j = Long.parseLong(input_array[j]);\n result += num_i * num_j;\n result = result % mod;\n }\n }\n\n pw.println(result);\n br.close();\n pw.close();\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nFind the sum of A_i \\times A_j over all pairs (i,j) such that 1\\leq i < j \\leq N, modulo (10^9+7).\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\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 \\ldots A_N\n\nOutput\n\nPrint \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} A_i A_j, modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n11\n\nWe have 1 \\times 2 + 1 \\times 3 + 2 \\times 3 = 11.\n\nSample Input 2\n\n4\n141421356 17320508 22360679 244949\n\nSample Output 2\n\n437235829", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["11\n"], "source_document_id": "p02572", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nFind the sum of A_i \\times A_j over all pairs (i,j) such that 1\\leq i < j \\leq N, modulo (10^9+7).\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\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 \\ldots A_N\n\nOutput\n\nPrint \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} A_i A_j, modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n11\n\nWe have 1 \\times 2 + 1 \\times 3 + 2 \\times 3 = 11.\n\nSample Input 2\n\n4\n141421356 17320508 22360679 244949\n\nSample Output 2\n\n437235829", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 971, "cpu_time_ms": 2208, "memory_kb": 62168}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s656864817", "group_id": "codeNet:p02572", "input_text": "import java.util.*;\nimport java.io.*;\nimport java.math.*;\n\t public class Main {\n\t \tstatic int mxn = (int)1e9 + 7;\n//\t \tstatic int check(String s, String t) {\n//\t \t}\n\t public static void main(String args[]) throws IOException {\n\t \tFastReader sc = new FastReader();\n\t \tint n = sc.nextInt();\n\t \tlong[] arr = sc.readLongArray(n);\n\t \tlong sum = 0;\n\t \tfor(int i = 0;i> A min(A a, A b) {\n\t\treturn a.compareTo(b) < 0 ? a : b;\n\t}\n\n\tstatic int max(int a, int b) {\n\t\treturn a > b ? a : b;\n\t}\n\n\tstatic long max(long a, long b) {\n\t\treturn a > b ? a : b;\n\t}\n\n\tstatic > A max(A a, A b) {\n\t\treturn a.compareTo(b) > 0 ? a : b;\n\t}\n\n\tstatic int clamp(int a, int min, int max) {\n\t\treturn a < min ? min : a > max ? max : a;\n\t}\n\n\tstatic long clamp(long a, long min, long max) {\n\t\treturn a < min ? min : a > max ? max : a;\n\t}\n\n\tstatic int abs(int a) {\n\t\treturn a < 0 ? -a : a;\n\t}\n\n\tstatic long abs(long a) {\n\t\treturn a < 0 ? -a : a;\n\t}\n\n\tstatic > A clamp(A a, A min, A max) {\n\t\treturn a.compareTo(min) < 0 ? min : a.compareTo(max) > 0 ? max : a;\n\t}\n\n\tstatic void out(String val) {\n\t\tIO.out(val);\n\t}\n\n\tstatic void out(Object val) {\n\t\tIO.out(String.valueOf(val));\n\t}\n\n\tstatic void out(int val) {\n\t\tIO.out(String.valueOf(val));\n\t}\n\n\tstatic void out(long val) {\n\t\tIO.out(String.valueOf(val));\n\t}\n\n\tstatic void out(char val) {\n\t\tIO.out(String.valueOf(val));\n\t}\n\n\tstatic void out(double val) {\n\t\tIO.out(Double.isFinite(val) ? BigDecimal.valueOf(val).toPlainString() : String.valueOf(val));\n\t}\n\n\tstatic void out(boolean val) {\n\t\tIO.out(val ? \"true\" : \"false\");\n\t}\n\n\tstatic void outn(String val) {\n\t\tIO.outn(val);\n\t}\n\n\tstatic void outn(Object val) {\n\t\tIO.outn(String.valueOf(val));\n\t}\n\n\tstatic void outn(int val) {\n\t\tIO.outn(String.valueOf(val));\n\t}\n\n\tstatic void outn(long val) {\n\t\tIO.outn(String.valueOf(val));\n\t}\n\n\tstatic void outn(char val) {\n\t\tIO.outn(String.valueOf(val));\n\t}\n\n\tstatic void outn(double val) {\n\t\tIO.outn(Double.isFinite(val) ? BigDecimal.valueOf(val).toPlainString() : String.valueOf(val));\n\t}\n\n\tstatic void outn(boolean val) {\n\t\tIO.outn(val ? \"true\" : \"false\");\n\t}\n\n\tstatic void kil(String val) {\n\t\tIO.out(val);\n\t\tIO.flush();\n\t\tSystem.exit(0);\n\t}\n\n\tstatic void kil(Object val) {\n\t\tIO.out(String.valueOf(val));\n\t\tIO.flush();\n\t\tSystem.exit(0);\n\t}\n\n\tstatic void kil(int val) {\n\t\tIO.out(String.valueOf(val));\n\t\tIO.flush();\n\t\tSystem.exit(0);\n\t}\n\n\tstatic void kil(long val) {\n\t\tIO.out(String.valueOf(val));\n\t\tIO.flush();\n\t\tSystem.exit(0);\n\t}\n\n\tstatic void kil(char val) {\n\t\tIO.out(String.valueOf(val));\n\t\tIO.flush();\n\t\tSystem.exit(0);\n\t}\n\n\tstatic void kil(double val) {\n\t\tIO.out(Double.isFinite(val) ? BigDecimal.valueOf(val).toPlainString() : String.valueOf(val));\n\t\tIO.flush();\n\t\tSystem.exit(0);\n\t}\n\n\tstatic void kil(boolean val) {\n\t\tIO.out(val ? \"true\" : \"false\");\n\t\tIO.flush();\n\t\tSystem.exit(0);\n\t}\n\n\tstatic String ns() {\n\t\treturn IO.next();\n\t}\n\n\tstatic int ni() {\n\t\treturn IO.nextInt();\n\t}\n\n\tstatic long nl() {\n\t\treturn IO.nextLong();\n\t}\n\n\tstatic double nd() {\n\t\treturn IO.nextDouble();\n\t}\n\n\tstatic char nc() {\n\t\treturn IO.nextChar();\n\t}\n\n\tstatic String[] nss(int n) {\n\t\tString[] as = new String[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tas[i] = IO.next();\n\t\t}\n\t\treturn as;\n\t}\n\n\tstatic int[] nis(int n) {\n\t\tint[] as = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tas[i] = IO.nextInt();\n\t\t}\n\t\treturn as;\n\t}\n\n\tstatic long[] nls(int n) {\n\t\tlong[] as = new long[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tas[i] = IO.nextLong();\n\t\t}\n\t\treturn as;\n\t}\n\n\tstatic double[] nds(int n) {\n\t\tdouble[] as = new double[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tas[i] = IO.nextDouble();\n\t\t}\n\t\treturn as;\n\t}\n\n\tstatic char[] ncs(int n) {\n\t\tchar[] as = new char[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tas[i] = IO.nextChar();\n\t\t}\n\t\treturn as;\n\t}\n\n\tstatic String[][] nss2(int n, int m) {\n\t\tString[][] as = new String[n][m];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tfor (int j = 0; j < m; j++) {\n\t\t\t\tas[i][j] = IO.next();\n\t\t\t}\n\t\t}\n\t\treturn as;\n\t}\n\n\tstatic int[][] nis2(int n, int m) {\n\t\tint[][] as = new int[n][m];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tfor (int j = 0; j < m; j++) {\n\t\t\t\tas[i][j] = IO.nextInt();\n\t\t\t}\n\t\t}\n\t\treturn as;\n\t}\n\n\tstatic long[][] nls2(int n, int m) {\n\t\tlong[][] as = new long[n][m];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tfor (int j = 0; j < m; j++) {\n\t\t\t\tas[i][j] = IO.nextLong();\n\t\t\t}\n\t\t}\n\t\treturn as;\n\t}\n\n\tstatic double[][] nds2(int n, int m) {\n\t\tdouble[][] as = new double[n][m];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tfor (int j = 0; j < m; j++) {\n\t\t\t\tas[i][j] = IO.nextDouble();\n\t\t\t}\n\t\t}\n\t\treturn as;\n\t}\n\n\tstatic char[][] ncs2(int n, int m) {\n\t\tchar[][] as = new char[n][m];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tfor (int j = 0; j < m; j++) {\n\t\t\t\tas[i][j] = IO.nextChar();\n\t\t\t}\n\t\t}\n\t\treturn as;\n\t}\n\n\tstatic int parseInt(String val) {\n\t\treturn Integer.parseInt(val);\n\t}\n\n\tstatic long parseLong(String val) {\n\t\treturn Long.parseLong(val);\n\t}\n\n\tpublic static void main(String[] args) {\n\t\ttry {\n\t\t\tsolve();\n\t\t\tIO.flush();\n\t\t} catch (NumberFormatException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (OutOfMemoryError e) {\n\t\t\te.printStackTrace(); // this will be detected as RE\n\t\t}\n\t}\n}\n\nfinal class IO {\n\tprivate static final InputStream in = System.in;\n\tprivate static final PrintWriter out = new PrintWriter(System.out, false);\n\tprivate static final byte[] buffer = new byte[1024];\n\tprivate static int ptr = 0;\n\tprivate static int len = 0;\n\n\tprivate static boolean hasNextByte() {\n\t\tif (ptr < len)\n\t\t\treturn true;\n\t\tptr = 0;\n\t\ttry {\n\t\t\tlen = in.read(buffer);\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn len > 0;\n\t}\n\n\tprivate static int readByte() {\n\t\tif (hasNextByte())\n\t\t\treturn buffer[ptr++];\n\t\telse\n\t\t\treturn -1;\n\t}\n\n\tstatic boolean hasNext() {\n\t\tbyte c;\n\t\twhile (hasNextByte() && ((c = buffer[ptr]) < '!' || c > '~'))\n\t\t\tptr++;\n\t\treturn hasNextByte();\n\t}\n\n\tstatic String next() {\n\t\tif (!hasNext())\n\t\t\tthrow new NoSuchElementException();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint b = readByte();\n\t\twhile (b >= '!' && b <= '~') {\n\t\t\tsb.append((char) b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\n\tstatic char nextChar() {\n\t\tif (!hasNext())\n\t\t\tthrow new NoSuchElementException();\n\t\treturn (char) readByte();\n\t}\n\n\tstatic long nextLong() {\n\t\tif (!hasNext())\n\t\t\tthrow new NoSuchElementException();\n\t\tlong n = 0;\n\t\tint sign = 1;\n\t\tint b = readByte();\n\t\tif (b == '-') {\n\t\t\tsign = -1;\n\t\t\tb = readByte();\n\t\t}\n\t\tif (b < '0' || '9' < b)\n\t\t\tthrow new NumberFormatException();\n\t\twhile (true) {\n\t\t\tif ('0' <= b && b <= '9')\n\t\t\t\tn = n * 10 + b - '0';\n\t\t\telse if (b == -1 || b < '!' || b > '~')\n\t\t\t\treturn n * sign;\n\t\t\telse\n\t\t\t\tthrow new NumberFormatException();\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n\tstatic int nextInt() {\n\t\tif (!hasNext())\n\t\t\tthrow new NoSuchElementException();\n\t\tint n = 0;\n\t\tint sign = 1;\n\t\tint b = readByte();\n\t\tif (b == '-') {\n\t\t\tsign = -1;\n\t\t\tb = readByte();\n\t\t}\n\t\tif (b < '0' || '9' < b)\n\t\t\tthrow new NumberFormatException();\n\t\twhile (true) {\n\t\t\tif ('0' <= b && b <= '9')\n\t\t\t\tn = n * 10 + b - '0';\n\t\t\telse if (b == -1 || b < '!' || b > '~')\n\t\t\t\treturn n * sign;\n\t\t\telse\n\t\t\t\tthrow new NumberFormatException();\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n\tstatic double nextDouble() {\n\t\treturn Double.parseDouble(next());\n\t}\n\n\tstatic void out(String val) {\n\t\tout.println(val);\n\t}\n\n\tstatic void outn(String val) {\n\t\tout.print(val);\n\t}\n\n\tstatic void flush() {\n\t\tout.flush();\n\t}\n}\n\n// TODO: paste library here\n\nclass UF { // Union Find Tree\n\tprivate int[] parents;\n\tprivate int[] ranks;\n\tprivate ArrayList roots;\n\tprivate F.XXX merger;\n\n\tUF(int n, F.IX maker, F.XXX merger) {\n\t\tthis.merger = merger;\n\t\tparents = new int[n];\n\t\tranks = new int[n];\n\t\troots = U.make(n, maker);\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tparents[i] = i;\n\t\t}\n\t}\n\n\tint index(int i) {\n\t\tint p = parents[i];\n\t\tif (i == p) {\n\t\t\treturn i;\n\t\t}\n\t\treturn parents[i] = index(p);\n\t}\n\n\tboolean same(int i, int j) {\n\t\treturn index(i) == index(j);\n\t}\n\n\tA root(int i) {\n\t\treturn roots.get(index(i));\n\t}\n\n\tvoid unite(int i, int j) {\n\t\ti = index(i);\n\t\tj = index(j);\n\t\tif (i == j)\n\t\t\treturn;\n\t\tA r = merger.f(root(i), root(j));\n\t\tif (ranks[i] < ranks[j]) {\n\t\t\ti ^= j;\n\t\t\tj ^= i;\n\t\t\ti ^= j;\n\t\t}\n\t\tparents[j] = i;\n\t\troots.set(i, r);\n\t\tif (ranks[i] == ranks[j])\n\t\t\tranks[i]++;\n\t}\n}\n\nclass MS {\n\tprivate TreeMap tm;\n\n\tMS() {\n\t\ttm = new TreeMap();\n\t}\n\n\tMS(Comparator comp) {\n\t\ttm = new TreeMap(comp);\n\t}\n\n\tvoid add(A a, long num) {\n\t\tif (tm.containsKey(a))\n\t\t\ttm.put(a, tm.get(a) + num);\n\t\telse\n\t\t\ttm.put(a, num);\n\t}\n\n\tvoid add(A a) {\n\t\tadd(a, 1);\n\t}\n\n\tlong remove(A a, long num) {\n\t\tif (tm.containsKey(a)) {\n\t\t\tlong n = tm.get(a);\n\t\t\tif (n <= num) {\n\t\t\t\ttm.remove(a);\n\t\t\t\treturn n;\n\t\t\t}\n\t\t\ttm.put(a, n - num);\n\t\t\treturn num;\n\t\t}\n\t\treturn 0;\n\t}\n\n\tboolean remove(A a) {\n\t\treturn remove(a, 1) == 1;\n\t}\n\n\tlong removeAll(A a) {\n\t\treturn remove(a, Long.MAX_VALUE);\n\t}\n\n\tlong num(A a) {\n\t\treturn tm.containsKey(a) ? tm.get(a) : 0;\n\t}\n\n\tint size() {\n\t\treturn tm.size();\n\t}\n\n\tA floor(A a) {\n\t\treturn tm.floorKey(a);\n\t}\n\n\tUP floorNum(A a) {\n\t\tEntry e = tm.floorEntry(a);\n\t\treturn e == null ? null : UP.make(e.getKey(), e.getValue());\n\t}\n\n\tA ceil(A a) {\n\t\treturn tm.ceilingKey(a);\n\t}\n\n\tUP ceilNum(A a) {\n\t\tEntry e = tm.ceilingEntry(a);\n\t\treturn e == null ? null : UP.make(e.getKey(), e.getValue());\n\t}\n\n\tvoid clear() {\n\t\ttm.clear();\n\t}\n\n\tSet keySet() {\n\t\treturn tm.keySet();\n\t}\n\n\tCollection valueSet() {\n\t\treturn tm.values();\n\t}\n\n\tSet> entrySet() {\n\t\treturn tm.entrySet();\n\t}\n\n\tpublic String toString() {\n\t\treturn tm.toString();\n\t}\n}\n\nclass WUF { // Weighted Union Find Tree\n\tprivate int[] parents;\n\tprivate int[] ranks;\n\tprivate ArrayList roots;\n\tprivate ArrayList weights;\n\tprivate F.XXX merger;\n\tprivate F.XXX add;\n\tprivate F.XX inv;\n\tprivate W e;\n\n\tWUF(int n, F.IX maker, F.XXX merger, F.XXX add, F.XX inv, W e) {\n\t\tthis.merger = merger;\n\t\tthis.add = add;\n\t\tthis.inv = inv;\n\t\tthis.e = e;\n\t\tparents = new int[n];\n\t\tranks = new int[n];\n\t\troots = U.make(n, maker);\n\t\tweights = U.make(n, i -> e);\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tparents[i] = i;\n\t\t}\n\t}\n\n\tint index(int i) {\n\t\tint p = parents[i];\n\t\tif (i == p) {\n\t\t\treturn i;\n\t\t}\n\t\tint r = index(p);\n\t\tweights.set(i, add.f(weights.get(i), weights.get(p)));\n\t\treturn parents[i] = r;\n\t}\n\n\tboolean same(int i, int j) {\n\t\treturn index(i) == index(j);\n\t}\n\n\tA root(int i) {\n\t\treturn roots.get(index(i));\n\t}\n\n\tW weight(int i) {\n\t\tindex(i);\n\t\treturn weights.get(i);\n\t}\n\n\tW diff(int i, int j) {\n\t\treturn sub(weight(j), weight(i));\n\t}\n\n\tvoid unite(int i, int j, W w) {\n\t\tw = add(w, weight(i));\n\t\tw = sub(w, weight(j));\n\t\ti = index(i);\n\t\tj = index(j);\n\t\tif (i == j)\n\t\t\treturn;\n\t\tA r = merger.f(root(i), root(j));\n\t\tif (ranks[i] < ranks[j]) {\n\t\t\ti ^= j;\n\t\t\tj ^= i;\n\t\t\ti ^= j;\n\t\t\tw = inv.f(w);\n\t\t}\n\t\tparents[j] = i;\n\t\troots.set(i, r);\n\t\tif (ranks[i] == ranks[j])\n\t\t\tranks[i]++;\n\t\tweights.set(j, w);\n\t}\n\n\tprivate W add(W a, W b) {\n\t\treturn a == e ? b : b == e ? a : add.f(a, b);\n\t}\n\n\tprivate W sub(W a, W b) {\n\t\treturn b == e ? a : add(a, inv.f(b));\n\t}\n}\n\nclass PQ { // Priority Queue\n\tstatic class E { // Entry\n\t\tprivate Object a;\n\t\tprivate int index;\n\n\t\tprivate E(Object a, int index) {\n\t\t\tthis.a = a;\n\t\t\tthis.index = index;\n\t\t}\n\t}\n\n\tprivate int n;\n\tprivate E[] as;\n\tprivate Comparator comp;\n\n\tPQ(Comparator comp) {\n\t\tthis.comp = comp;\n\t\tas = new E[64];\n\t\tn = 1;\n\t}\n\n\tE add(A a) {\n\t\tE res = addEntry(a);\n\t\tfixUp(n - 1);\n\t\treturn res;\n\t}\n\n\tA pop() {\n\t\tint max = n - 1;\n\t\tif (max == 0)\n\t\t\treturn null;\n\t\tif (max == 1) {\n\t\t\treturn removeLast();\n\t\t}\n\n\t\tE tmp = as[1];\n\t\tas[1] = as[max];\n\t\tas[max] = tmp;\n\t\tas[1].index = 1;\n\t\tas[max].index = max;\n\n\t\tA res = removeLast();\n\t\tfixDown(1);\n\t\treturn res;\n\t}\n\n\t@SuppressWarnings(\"unchecked\")\n\tA get(E e) {\n\t\treturn (A) e.a;\n\t}\n\n\tvoid remove(E e) {\n\t\tint k = ((E) e).index;\n\t\tint max = n - 1;\n\t\tif (k == max) {\n\t\t\tremoveLast();\n\t\t\treturn;\n\t\t}\n\n\t\tE tmp = as[k];\n\t\tas[k] = as[max];\n\t\tas[max] = tmp;\n\t\tas[k].index = k;\n\t\tas[max].index = max;\n\n\t\tremoveLast();\n\t\tif (!fixDown(k))\n\t\t\tfixUp(k);\n\t}\n\n\tvoid update(E e, A a) {\n\t\tint k = e.index;\n\t\tas[k].a = a;\n\t\tif (!fixDown(k))\n\t\t\tfixUp(k);\n\t}\n\n\tboolean isEmpty() {\n\t\treturn n == 1;\n\t}\n\n\t@SuppressWarnings(\"unchecked\")\n\tprivate A removeLast() {\n\t\tn--;\n\t\tE res = as[n];\n\t\tres.index = -1;\n\t\tas[n] = null;\n\t\treturn (A) res.a;\n\t}\n\n\t@SuppressWarnings(\"unchecked\")\n\tprivate boolean fixUp(int k) {\n\t\tboolean res = false;\n\t\twhile (k > 1) {\n\t\t\tint nk = k >> 1;\n\t\t\tif (comp.compare((A) as[k].a, (A) as[nk].a) < 0) {\n\t\t\t\tE tmp = as[k];\n\t\t\t\tas[k] = as[nk];\n\t\t\t\tas[nk] = tmp;\n\t\t\t\tas[k].index = k;\n\t\t\t\tas[nk].index = nk;\n\t\t\t\tk = nk;\n\t\t\t\tres = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\treturn res;\n\t}\n\n\t@SuppressWarnings(\"unchecked\")\n\tprivate boolean fixDown(int k) {\n\t\tboolean res = false;\n\t\twhile (k << 1 < n) {\n\t\t\tA a = (A) as[k].a;\n\t\t\tA l = (A) as[k << 1].a;\n\t\t\tif (k << 1 == n - 1) {\n\t\t\t\tif (comp.compare(a, l) <= 0)\n\t\t\t\t\tbreak;\n\t\t\t\tres = true;\n\t\t\t\tE tmp = as[k];\n\t\t\t\tas[k] = as[k << 1];\n\t\t\t\tas[k << 1] = tmp;\n\t\t\t\tas[k].index = k;\n\t\t\t\tas[k << 1].index = k << 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tA r = (A) as[k << 1 | 1].a;\n\t\t\tif (comp.compare(a, l) <= 0 && comp.compare(a, r) <= 0)\n\t\t\t\tbreak;\n\t\t\tres = true;\n\t\t\tif (comp.compare(l, r) < 0) {\n\t\t\t\tint nk = k << 1;\n\t\t\t\tE tmp = as[k];\n\t\t\t\tas[k] = as[nk];\n\t\t\t\tas[nk] = tmp;\n\t\t\t\tas[k].index = k;\n\t\t\t\tas[nk].index = nk;\n\t\t\t\tk = nk;\n\t\t\t} else {\n\t\t\t\tint nk = k << 1 | 1;\n\t\t\t\tE tmp = as[k];\n\t\t\t\tas[k] = as[nk];\n\t\t\t\tas[nk] = tmp;\n\t\t\t\tas[k].index = k;\n\t\t\t\tas[nk].index = nk;\n\t\t\t\tk = nk;\n\t\t\t}\n\t\t}\n\t\treturn res;\n\t}\n\n\tprivate E addEntry(A a) {\n\t\tif (n == as.length)\n\t\t\tas = U.doubleSize(as);\n\t\treturn as[n] = new E(a, n++);\n\t}\n\n\t@SuppressWarnings(\"unchecked\")\n\tpublic String toString() {\n\t\tif (n == 1)\n\t\t\treturn \"[]\";\n\t\tString s = null;\n\t\tfor (int i = 1; i < n; i++) {\n\t\t\tA a = (A) as[i].a;\n\t\t\tif (s == null)\n\t\t\t\ts = \"[\" + a;\n\t\t\telse\n\t\t\t\ts += \", \" + a;\n\t\t}\n\t\treturn s + \"]\";\n\t}\n}\n\nclass Graph {\n\t/**\n\t * !!多重辺があるとバグる!!\n\t * !!多重辺があるとバグる!!\n\t * !!多重辺があるとバグる!!\n\t * \n\t * @param forEachEdge\n\t * (index:int, (edgeTo:int, edgeCost:long) -> void) -> void\n\t * @return\n\t * [0] = dist, [1] = prev\n\t */\n\tstatic long[][] dijkstraL(int n, int from, F.II numEdges, F.IXV forEachEdge) {\n\t\tlong inf = Long.MAX_VALUE;\n\t\tlong[][] res = new long[n][2];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tres[i][0] = i == from ? 0 : inf;\n\t\t\tres[i][1] = -1;\n\t\t}\n\t\tPQ q = new PQ((a, b) -> Long.compare(a[1], b[1]));\n\n\t\tPQ.E[] qes = new PQ.E[n];\n\t\tArrayList ups = new ArrayList(n);\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tups.add(new long[] { i, inf });\n\t\t}\n\n\t\tboolean[] fixed = new boolean[n];\n\t\tups.get(from)[1] = 0;\n\t\tqes[from] = q.add(ups.get(from));\n\n\t\twhile (!q.isEmpty()) {\n\t\t\tlong[] up = q.pop();\n\t\t\tint i = (int) up[0];\n\t\t\tif (fixed[i])\n\t\t\t\tcontinue;\n\t\t\tfixed[i] = true;\n\t\t\tlong dist = up[1];\n\t\t\tif (dist == inf)\n\t\t\t\tbreak;\n\t\t\tforEachEdge.f(i, (j, weight) -> {\n\t\t\t\tif (fixed[j])\n\t\t\t\t\treturn;\n\t\t\t\tlong[] resj = res[j];\n\t\t\t\tlong newDist = dist + weight;\n\t\t\t\tif (Long.compare(resj[0], newDist) > 0) {\n\t\t\t\t\tresj[0] = newDist;\n\t\t\t\t\tresj[1] = i;\n\t\t\t\t\tq.add(new long[] { j, newDist });\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\treturn res;\n\t}\n\n\t/**\n\t * !!多重辺があるとバグる!!\n\t * !!多重辺があるとバグる!!\n\t * !!多重辺があるとバグる!!\n\t * \n\t * @param forEachEdge\n\t * (index:int, (edgeTo:int, edgeCost:long) -> void) -> void\n\t * @return\n\t * [0] = dist, [1] = prev\n\t */\n\tstatic double[][] dijkstraD(int n, int from, F.II numEdges, F.IXV forEachEdge) {\n\t\tdouble inf = Double.POSITIVE_INFINITY;\n\t\tdouble[][] res = new double[n][2];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tres[i][0] = i == from ? 0 : inf;\n\t\t\tres[i][1] = -1;\n\t\t}\n\t\tPQ q = new PQ((a, b) -> Double.compare(a[1], b[1]));\n\n\t\tPQ.E[] qes = new PQ.E[n];\n\t\tArrayList ups = new ArrayList(n);\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tups.add(new double[] { i, inf });\n\t\t}\n\n\t\tboolean[] fixed = new boolean[n];\n\t\tups.get(from)[1] = 0;\n\t\tqes[from] = q.add(ups.get(from));\n\n\t\twhile (!q.isEmpty()) {\n\t\t\tdouble[] up = q.pop();\n\t\t\tint i = (int) up[0];\n\t\t\tif (fixed[i])\n\t\t\t\tcontinue;\n\t\t\tfixed[i] = true;\n\t\t\tdouble dist = up[1];\n\t\t\tif (dist == inf)\n\t\t\t\tbreak;\n\t\t\tforEachEdge.f(i, (j, weight) -> {\n\t\t\t\tif (fixed[j])\n\t\t\t\t\treturn;\n\t\t\t\tdouble[] resj = res[j];\n\t\t\t\tdouble newDist = dist + weight;\n\t\t\t\tif (Double.compare(resj[0], newDist) > 0) {\n\t\t\t\t\tresj[0] = newDist;\n\t\t\t\t\tresj[1] = i;\n\t\t\t\t\tq.add(new double[] { j, newDist });\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\treturn res;\n\t}\n\n}\n\nclass UP { // Unordered Pair\n\tA a;\n\tB b;\n\n\tUP(A a, B b) {\n\t\tthis.a = a;\n\t\tthis.b = b;\n\t}\n\n\tstatic UP make(A a, B b) {\n\t\treturn new UP(a, b);\n\t}\n\n\tpublic boolean equals(Object o) {\n\t\tif (o == this)\n\t\t\treturn true;\n\t\tif (!(o instanceof UP))\n\t\t\treturn false;\n\t\tUP p = (UP) o;\n\t\tboolean aok = a == null ? p.a == null : a.equals(p.a);\n\t\tboolean bok = b == null ? p.b == null : b.equals(p.b);\n\t\treturn aok && bok;\n\t}\n\n\tpublic String toString() {\n\t\treturn \"(\" + a.toString() + \", \" + b.toString() + \")\";\n\t}\n}\n\nclass P, B extends Comparable> extends UP\n\t\timplements Comparable> { // Pair\n\tP(A a, B b) {\n\t\tsuper(a, b);\n\t}\n\n\tstatic , B extends Comparable> P make(A a, B b) {\n\t\treturn new P(a, b);\n\t}\n\n\tpublic int compareTo(P o) {\n\t\tint sa = a.compareTo(o.a);\n\t\tint sb = b.compareTo(o.b);\n\t\treturn sa != 0 ? sa : sb;\n\t}\n}\n\nclass PI implements Comparable { // Pair int\n\tint a;\n\tint b;\n\n\tPI(int a, int b) {\n\t\tthis.a = a;\n\t\tthis.b = b;\n\t}\n\n\tstatic PI make(int a, int b) {\n\t\treturn new PI(a, b);\n\t}\n\n\tpublic boolean equals(Object o) {\n\t\tif (o == this)\n\t\t\treturn true;\n\t\tif (!(o instanceof PI))\n\t\t\treturn false;\n\t\tPI p = (PI) o;\n\t\treturn a == p.a && b == p.b;\n\t}\n\n\tpublic int compareTo(PI o) {\n\t\tint sa = a - o.a;\n\t\tint sb = b - o.b;\n\t\treturn sa > 0 ? 1 : sa < 0 ? -1 : sb > 0 ? 1 : sb < 0 ? -1 : 0;\n\t}\n\n\tpublic String toString() {\n\t\treturn \"(\" + a + \", \" + b + \")\";\n\t}\n}\n\nclass PL implements Comparable { // Pair long\n\tlong a;\n\tlong b;\n\n\tPL(long a, long b) {\n\t\tthis.a = a;\n\t\tthis.b = b;\n\t}\n\n\tstatic PL make(long a, long b) {\n\t\treturn new PL(a, b);\n\t}\n\n\tpublic boolean equals(Object o) {\n\t\tif (o == this)\n\t\t\treturn true;\n\t\tif (!(o instanceof PL))\n\t\t\treturn false;\n\t\tPL p = (PL) o;\n\t\treturn a == p.a && b == p.b;\n\t}\n\n\tpublic int compareTo(PL o) {\n\t\tlong sa = a - o.a;\n\t\tlong sb = b - o.b;\n\t\treturn sa > 0 ? 1 : sa < 0 ? -1 : sb > 0 ? 1 : sb < 0 ? -1 : 0;\n\t}\n\n\tpublic String toString() {\n\t\treturn \"(\" + a + \", \" + b + \")\";\n\t}\n}\n\nclass UT { // Unordered Tuple\n\tA a;\n\tB b;\n\tC c;\n\n\tUT(A a, B b, C c) {\n\t\tthis.a = a;\n\t\tthis.b = b;\n\t\tthis.c = c;\n\t}\n\n\tstatic UT make(A a, B b, C c) {\n\t\treturn new UT(a, b, c);\n\t}\n\n\tpublic boolean equals(Object o) {\n\t\tif (o == this)\n\t\t\treturn true;\n\t\tif (!(o instanceof UT))\n\t\t\treturn false;\n\t\tUT t = (UT) o;\n\t\tboolean aok = a == null ? t.a == null : a.equals(t.a);\n\t\tboolean bok = b == null ? t.b == null : b.equals(t.b);\n\t\tboolean cok = c == null ? t.c == null : c.equals(t.c);\n\t\treturn aok && bok && cok;\n\t}\n\n\tpublic String toString() {\n\t\treturn \"(\" + a.toString() + \", \" + b.toString() + \", \" + c.toString() + \")\";\n\t}\n}\n\nclass T, B extends Comparable, C extends Comparable>\n\t\textends UT implements Comparable> { // Tuple\n\tT(A a, B b, C c) {\n\t\tsuper(a, b, c);\n\t}\n\n\tstatic , B extends Comparable, C extends Comparable> T make(\n\t\t\tA a, B b, C c) {\n\t\treturn new T(a, b, c);\n\t}\n\n\tpublic int compareTo(T o) {\n\t\tint sa = a.compareTo(o.a);\n\t\tint sb = b.compareTo(o.b);\n\t\tint sc = c.compareTo(o.c);\n\t\treturn sa != 0 ? sa : sb != 0 ? sb : sc;\n\t}\n}\n\nclass TI implements Comparable { // Tuple int\n\tint a;\n\tint b;\n\tint c;\n\n\tTI(int a, int b, int c) {\n\t\tthis.a = a;\n\t\tthis.b = b;\n\t\tthis.c = c;\n\t}\n\n\tstatic TI make(int a, int b, int c) {\n\t\treturn new TI(a, b, c);\n\t}\n\n\tTL toLong() {\n\t\treturn TL.make(a, b, c);\n\t}\n\n\tpublic boolean equals(Object o) {\n\t\tif (o == this)\n\t\t\treturn true;\n\t\tif (!(o instanceof TI))\n\t\t\treturn false;\n\t\tTI t = (TI) o;\n\t\treturn a == t.a && b == t.b && c == t.c;\n\t}\n\n\tpublic int compareTo(TI o) {\n\t\tint sa = a - o.a;\n\t\tint sb = b - o.b;\n\t\tint sc = c - o.c;\n\t\treturn sa > 0 ? 1 : sa < 0 ? -1 : sb > 0 ? 1 : sb < 0 ? -1 : sc > 0 ? 1 : sc < 0 ? -1 : 0;\n\t}\n\n\tpublic String toString() {\n\t\treturn \"(\" + a + \", \" + b + \", \" + c + \")\";\n\t}\n}\n\nclass TL implements Comparable { // Tuple long\n\tlong a;\n\tlong b;\n\tlong c;\n\n\tTL(long a, long b, long c) {\n\t\tthis.a = a;\n\t\tthis.b = b;\n\t\tthis.c = c;\n\t}\n\n\tstatic TL make(long a, long b, long c) {\n\t\treturn new TL(a, b, c);\n\t}\n\n\tTI toInt() {\n\t\treturn TI.make((int) a, (int) b, (int) c);\n\t}\n\n\tpublic boolean equals(Object o) {\n\t\tif (o == this)\n\t\t\treturn true;\n\t\tif (!(o instanceof TL))\n\t\t\treturn false;\n\t\tTL t = (TL) o;\n\t\treturn a == t.a && b == t.b && c == t.c;\n\t}\n\n\tpublic int compareTo(TL o) {\n\t\tlong sa = a - o.a;\n\t\tlong sb = b - o.b;\n\t\tlong sc = c - o.c;\n\t\treturn sa > 0 ? 1 : sa < 0 ? -1 : sb > 0 ? 1 : sb < 0 ? -1 : sc > 0 ? 1 : sc < 0 ? -1 : 0;\n\t}\n\n\tpublic String toString() {\n\t\treturn \"(\" + a + \", \" + b + \", \" + c + \")\";\n\t}\n}\n\nfinal class U { // Utilities\n\tprivate U() {\n\t}\n\n\tstatic ArrayList make(int n, F.IX maker) {\n\t\tArrayList res = new ArrayList();\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tres.add(maker.f(i));\n\t\treturn res;\n\t}\n\n\tstatic boolean[] makeB(int n, F.IB maker) {\n\t\tboolean[] res = new boolean[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tres[i] = maker.f(i);\n\t\treturn res;\n\t}\n\n\tstatic int[] makeI(int n, F.II maker) {\n\t\tint[] res = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tres[i] = maker.f(i);\n\t\treturn res;\n\t}\n\n\tstatic long[] makeL(int n, F.IL maker) {\n\t\tlong[] res = new long[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tres[i] = maker.f(i);\n\t\treturn res;\n\t}\n\n\tstatic A[] makeX(int n, F.IX maker, A[] as) {\n\t\tA[] res = Arrays.copyOf(as, n);\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tres[i] = maker.f(i);\n\t\treturn res;\n\t}\n\n\tstatic ArrayList filter(ArrayList as, F.XB pred) {\n\t\tArrayList res = new ArrayList();\n\t\tfor (A a : as)\n\t\t\tif (pred.f(a))\n\t\t\t\tres.add(a);\n\t\treturn res;\n\t}\n\n\tstatic int count(ArrayList as, F.XB pred) {\n\t\tint res = 0;\n\t\tfor (A a : as)\n\t\t\tif (pred.f(a))\n\t\t\t\tres++;\n\t\treturn res;\n\t}\n\n\tstatic ArrayList concat(ArrayList as, ArrayList bs) {\n\t\tArrayList res = new ArrayList();\n\t\tres.addAll(as);\n\t\tres.addAll(bs);\n\t\treturn res;\n\t}\n\n\tstatic boolean any(ArrayList as, F.XB pred) {\n\t\tfor (A a : as)\n\t\t\tif (pred.f(a))\n\t\t\t\treturn true;\n\t\treturn false;\n\t}\n\n\tstatic boolean all(ArrayList as, F.XB pred) {\n\t\tfor (A a : as)\n\t\t\tif (!pred.f(a))\n\t\t\t\treturn false;\n\t\treturn true;\n\t}\n\n\tstatic ArrayList flatten(ArrayList> ass) {\n\t\tArrayList res = new ArrayList();\n\t\tfor (ArrayList as : ass)\n\t\t\tres.addAll(as);\n\t\treturn res;\n\t}\n\n\tstatic B foldl(ArrayList as, F.XXX f, B e) {\n\t\tB res = e;\n\t\tfor (A a : as)\n\t\t\tres = f.f(res, a);\n\t\treturn res;\n\t}\n\n\tstatic B foldr(ArrayList as, F.XXX f, B e) {\n\t\tB res = e;\n\t\tfor (int i = as.size() - 1; i >= 0; i--)\n\t\t\tres = f.f(as.get(i), res);\n\t\treturn res;\n\t}\n\n\tstatic ArrayList reverse(ArrayList as) {\n\t\tint size = as.size();\n\t\treturn make(size, i -> as.get(size - 1 - i));\n\t}\n\n\tstatic boolean[] reverse(boolean[] as) {\n\t\tint size = as.length;\n\t\treturn makeB(size, i -> as[size - 1 - i]);\n\t}\n\n\tstatic int[] reverse(int[] as) {\n\t\tint size = as.length;\n\t\treturn makeI(size, i -> as[size - 1 - i]);\n\t}\n\n\tstatic long[] reverse(long[] as) {\n\t\tint size = as.length;\n\t\treturn makeL(size, i -> as[size - 1 - i]);\n\t}\n\n\tstatic A[] reverse(A[] as) {\n\t\tint size = as.length;\n\t\treturn makeX(size, i -> as[size - 1 - i], as);\n\t}\n\n\tstatic > UP, ArrayList> compress(ArrayList as) {\n\t\tTreeSet set = new TreeSet(as);\n\t\tTreeMap map = new TreeMap();\n\t\tArrayList imap = new ArrayList();\n\t\tint i = 0;\n\t\tfor (A a : set) {\n\t\t\tmap.put(a, i++);\n\t\t\timap.add(a);\n\t\t}\n\t\treturn UP.make(map, imap);\n\t}\n\n\tstatic ArrayList map(ArrayList as, F.XX f) {\n\t\treturn make(as.size(), (i) -> f.f(as.get(i)));\n\t}\n\n\tstatic ArrayList mapi(ArrayList as, F.XIX f) {\n\t\treturn make(as.size(), (i) -> f.f(as.get(i), i));\n\t}\n\n\tstatic ArrayList> zip(ArrayList as, ArrayList bs) {\n\t\treturn make(min(as.size(), bs.size()), (i) -> UP.make(as.get(i), bs.get(i)));\n\t}\n\n\tstatic int min(int a, int b) {\n\t\treturn a < b ? a : b;\n\t}\n\n\tstatic long min(long a, long b) {\n\t\treturn a < b ? a : b;\n\t}\n\n\tstatic > A min(A a, A b) {\n\t\treturn a.compareTo(b) < 0 ? a : b;\n\t}\n\n\tstatic int max(int a, int b) {\n\t\treturn a > b ? a : b;\n\t}\n\n\tstatic long max(long a, long b) {\n\t\treturn a > b ? a : b;\n\t}\n\n\tstatic > A max(A a, A b) {\n\t\treturn a.compareTo(b) > 0 ? a : b;\n\t}\n\n\tstatic int clamp(int a, int min, int max) {\n\t\treturn a < min ? min : a > max ? max : a;\n\t}\n\n\tstatic long clamp(long a, long min, long max) {\n\t\treturn a < min ? min : a > max ? max : a;\n\t}\n\n\tstatic > A clamp(A a, A min, A max) {\n\t\treturn a.compareTo(min) < 0 ? min : a.compareTo(max) > 0 ? max : a;\n\t}\n\n\tstatic int abs(int a) {\n\t\treturn a < 0 ? -a : a;\n\t}\n\n\tstatic long abs(long a) {\n\t\treturn a < 0 ? -a : a;\n\t}\n\n\tstatic void forEachBitPerm(int n, int k, F.IV f) {\n\t\tfor (int i = (1 << k) - 1; i < 1 << n;) {\n\t\t\tf.f(i);\n\t\t\tint t = (i | i - 1) + 1;\n\t\t\ti = t | ((t & -t) / (i & -i) >> 1) - 1;\n\t\t}\n\t}\n\n\tstatic int nextBitPerm(int a) {\n\t\tint t = (a | a - 1) + 1;\n\t\treturn t | ((t & -t) / (a & -a) >> 1) - 1;\n\t}\n\n\tstatic void mebius(int n, F.IIV f) { // s, i\n\t\tint bit = 1;\n\t\tint exp = 0;\n\t\tfor (int i = 1; i < 1 << n; i++) {\n\t\t\tf.f(i ^ bit, exp);\n\t\t\tif ((i & i + 1) == 0) {\n\t\t\t\tbit <<= 1;\n\t\t\t\texp++;\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic void zeta(int n, F.IIV f) { // s, i\n\t\tint m = (1 << n) - 1;\n\t\tint bit = 1;\n\t\tint exp = 0;\n\t\tfor (int i = (1 << n) - 2; i >= 0; i--) {\n\t\t\tf.f(i ^ bit, exp);\n\t\t\tif ((~i & ~i + 1 & m) == 0) {\n\t\t\t\tbit <<= 1;\n\t\t\t\texp++;\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic ArrayList toAL(A[] as) {\n\t\treturn make(as.length, i -> as[i]);\n\t}\n\n\tstatic A[] doubleSize(A[] as) {\n\t\treturn Arrays.copyOf(as, as.length << 1);\n\t}\n\n\tstatic long searchL(long ng, long ok, F.LB isOk) {\n\t\twhile (ng - ok > 1 || ok - ng > 1) {\n\t\t\tlong mid = ng + ok >> 1;\n\t\t\tif (isOk.f(mid))\n\t\t\t\tok = mid;\n\t\t\telse\n\t\t\t\tng = mid;\n\t\t}\n\t\treturn ok;\n\t}\n\n\tstatic int searchI(int ng, int ok, F.IB isOk) {\n\t\treturn (int) searchL((long) ng, (long) ok, (mid) -> isOk.f((int) mid));\n\t}\n}\n\nfinal class F { // Functions\n\tprivate F() {\n\t}\n\n\tinterface VV {\n\t\tvoid f();\n\t}\n\n\tinterface BV {\n\t\tvoid f(boolean a);\n\t}\n\n\tinterface BXV {\n\t\tvoid f(boolean a, A b);\n\t}\n\n\tinterface BXXV {\n\t\tvoid f(boolean a, A b, B c);\n\t}\n\n\tinterface BXXXV {\n\t\tvoid f(boolean a, A b, B c, C d);\n\t}\n\n\tinterface XBV {\n\t\tvoid f(A a, boolean b);\n\t}\n\n\tinterface XXBV {\n\t\tvoid f(A a, B b, boolean c);\n\t}\n\n\tinterface XXXBV {\n\t\tvoid f(A a, B b, C c, boolean d);\n\t}\n\n\tinterface IV {\n\t\tvoid f(int a);\n\t}\n\n\tinterface IXV {\n\t\tvoid f(int a, A b);\n\t}\n\n\tinterface IXXV {\n\t\tvoid f(int a, A b, B c);\n\t}\n\n\tinterface IXXXV {\n\t\tvoid f(int a, A b, B c, C d);\n\t}\n\n\tinterface XIV {\n\t\tvoid f(A a, int b);\n\t}\n\n\tinterface XXIV {\n\t\tvoid f(A a, B b, int c);\n\t}\n\n\tinterface XXXIV {\n\t\tvoid f(A a, B b, C c, int d);\n\t}\n\n\tinterface LV {\n\t\tvoid f(long a);\n\t}\n\n\tinterface LXV {\n\t\tvoid f(long a, A b);\n\t}\n\n\tinterface LXXV {\n\t\tvoid f(long a, A b, B c);\n\t}\n\n\tinterface LXXXV {\n\t\tvoid f(long a, A b, B c, C d);\n\t}\n\n\tinterface XLV {\n\t\tvoid f(A a, long b);\n\t}\n\n\tinterface XXLV {\n\t\tvoid f(A a, B b, long c);\n\t}\n\n\tinterface XXXLV {\n\t\tvoid f(A a, B b, C c, long d);\n\t}\n\n\tinterface DV {\n\t\tvoid f(double a);\n\t}\n\n\tinterface DXV {\n\t\tvoid f(double a, A b);\n\t}\n\n\tinterface DXXV {\n\t\tvoid f(double a, A b, B c);\n\t}\n\n\tinterface DXXXV {\n\t\tvoid f(double a, A b, B c, C d);\n\t}\n\n\tinterface XDV {\n\t\tvoid f(A a, double b);\n\t}\n\n\tinterface XXDV {\n\t\tvoid f(A a, B b, double c);\n\t}\n\n\tinterface XXXDV {\n\t\tvoid f(A a, B b, C c, double d);\n\t}\n\n\tinterface XV {\n\t\tvoid f(A a);\n\t}\n\n\tinterface XXV {\n\t\tvoid f(A a, B b);\n\t}\n\n\tinterface XXXV {\n\t\tvoid f(A a, B b, C c);\n\t}\n\n\tinterface XXXXV {\n\t\tvoid f(A a, B b, C c, D d);\n\t}\n\n\tinterface BBV {\n\t\tvoid f(boolean a, boolean b);\n\t}\n\n\tinterface BIV {\n\t\tvoid f(boolean a, int b);\n\t}\n\n\tinterface BLV {\n\t\tvoid f(boolean a, long b);\n\t}\n\n\tinterface BDV {\n\t\tvoid f(boolean a, double b);\n\t}\n\n\tinterface IBV {\n\t\tvoid f(int a, boolean b);\n\t}\n\n\tinterface IIV {\n\t\tvoid f(int a, int b);\n\t}\n\n\tinterface ILV {\n\t\tvoid f(int a, long b);\n\t}\n\n\tinterface IDV {\n\t\tvoid f(int a, double b);\n\t}\n\n\tinterface LBV {\n\t\tvoid f(long a, boolean b);\n\t}\n\n\tinterface LIV {\n\t\tvoid f(long a, int b);\n\t}\n\n\tinterface LLV {\n\t\tvoid f(long a, long b);\n\t}\n\n\tinterface LDV {\n\t\tvoid f(long a, double b);\n\t}\n\n\tinterface DBV {\n\t\tvoid f(double a, boolean b);\n\t}\n\n\tinterface DIV {\n\t\tvoid f(double a, int b);\n\t}\n\n\tinterface DLV {\n\t\tvoid f(double a, long b);\n\t}\n\n\tinterface DDV {\n\t\tvoid f(double a, double b);\n\t}\n\n\tinterface VB {\n\t\tboolean f();\n\t}\n\n\tinterface BB {\n\t\tboolean f(boolean a);\n\t}\n\n\tinterface BXB {\n\t\tboolean f(boolean a, A b);\n\t}\n\n\tinterface BXXB {\n\t\tboolean f(boolean a, A b, B c);\n\t}\n\n\tinterface BXXXB {\n\t\tboolean f(boolean a, A b, B c, C d);\n\t}\n\n\tinterface XBB {\n\t\tboolean f(A a, boolean b);\n\t}\n\n\tinterface XXBB {\n\t\tboolean f(A a, B b, boolean c);\n\t}\n\n\tinterface XXXBB {\n\t\tboolean f(A a, B b, C c, boolean d);\n\t}\n\n\tinterface IB {\n\t\tboolean f(int a);\n\t}\n\n\tinterface IXB {\n\t\tboolean f(int a, A b);\n\t}\n\n\tinterface IXXB {\n\t\tboolean f(int a, A b, B c);\n\t}\n\n\tinterface IXXXB {\n\t\tboolean f(int a, A b, B c, C d);\n\t}\n\n\tinterface XIB {\n\t\tboolean f(A a, int b);\n\t}\n\n\tinterface XXIB {\n\t\tboolean f(A a, B b, int c);\n\t}\n\n\tinterface XXXIB {\n\t\tboolean f(A a, B b, C c, int d);\n\t}\n\n\tinterface LB {\n\t\tboolean f(long a);\n\t}\n\n\tinterface LXB {\n\t\tboolean f(long a, A b);\n\t}\n\n\tinterface LXXB {\n\t\tboolean f(long a, A b, B c);\n\t}\n\n\tinterface LXXXB {\n\t\tboolean f(long a, A b, B c, C d);\n\t}\n\n\tinterface XLB {\n\t\tboolean f(A a, long b);\n\t}\n\n\tinterface XXLB {\n\t\tboolean f(A a, B b, long c);\n\t}\n\n\tinterface XXXLB {\n\t\tboolean f(A a, B b, C c, long d);\n\t}\n\n\tinterface DB {\n\t\tboolean f(double a);\n\t}\n\n\tinterface DXB {\n\t\tboolean f(double a, A b);\n\t}\n\n\tinterface DXXB {\n\t\tboolean f(double a, A b, B c);\n\t}\n\n\tinterface DXXXB {\n\t\tboolean f(double a, A b, B c, C d);\n\t}\n\n\tinterface XDB {\n\t\tboolean f(A a, double b);\n\t}\n\n\tinterface XXDB {\n\t\tboolean f(A a, B b, double c);\n\t}\n\n\tinterface XXXDB {\n\t\tboolean f(A a, B b, C c, double d);\n\t}\n\n\tinterface XB {\n\t\tboolean f(A a);\n\t}\n\n\tinterface XXB {\n\t\tboolean f(A a, B b);\n\t}\n\n\tinterface XXXB {\n\t\tboolean f(A a, B b, C c);\n\t}\n\n\tinterface XXXXB {\n\t\tboolean f(A a, B b, C c, D d);\n\t}\n\n\tinterface BBB {\n\t\tboolean f(boolean a, boolean b);\n\t}\n\n\tinterface BIB {\n\t\tboolean f(boolean a, int b);\n\t}\n\n\tinterface BLB {\n\t\tboolean f(boolean a, long b);\n\t}\n\n\tinterface BDB {\n\t\tboolean f(boolean a, double b);\n\t}\n\n\tinterface IBB {\n\t\tboolean f(int a, boolean b);\n\t}\n\n\tinterface IIB {\n\t\tboolean f(int a, int b);\n\t}\n\n\tinterface ILB {\n\t\tboolean f(int a, long b);\n\t}\n\n\tinterface IDB {\n\t\tboolean f(int a, double b);\n\t}\n\n\tinterface LBB {\n\t\tboolean f(long a, boolean b);\n\t}\n\n\tinterface LIB {\n\t\tboolean f(long a, int b);\n\t}\n\n\tinterface LLB {\n\t\tboolean f(long a, long b);\n\t}\n\n\tinterface LDB {\n\t\tboolean f(long a, double b);\n\t}\n\n\tinterface DBB {\n\t\tboolean f(double a, boolean b);\n\t}\n\n\tinterface DIB {\n\t\tboolean f(double a, int b);\n\t}\n\n\tinterface DLB {\n\t\tboolean f(double a, long b);\n\t}\n\n\tinterface DDB {\n\t\tboolean f(double a, double b);\n\t}\n\n\tinterface VI {\n\t\tint f();\n\t}\n\n\tinterface BI {\n\t\tint f(boolean a);\n\t}\n\n\tinterface BXI {\n\t\tint f(boolean a, A b);\n\t}\n\n\tinterface BXXI {\n\t\tint f(boolean a, A b, B c);\n\t}\n\n\tinterface BXXXI {\n\t\tint f(boolean a, A b, B c, C d);\n\t}\n\n\tinterface XBI {\n\t\tint f(A a, boolean b);\n\t}\n\n\tinterface XXBI {\n\t\tint f(A a, B b, boolean c);\n\t}\n\n\tinterface XXXBI {\n\t\tint f(A a, B b, C c, boolean d);\n\t}\n\n\tinterface II {\n\t\tint f(int a);\n\t}\n\n\tinterface IXI {\n\t\tint f(int a, A b);\n\t}\n\n\tinterface IXXI {\n\t\tint f(int a, A b, B c);\n\t}\n\n\tinterface IXXXI {\n\t\tint f(int a, A b, B c, C d);\n\t}\n\n\tinterface XII {\n\t\tint f(A a, int b);\n\t}\n\n\tinterface XXII {\n\t\tint f(A a, B b, int c);\n\t}\n\n\tinterface XXXII {\n\t\tint f(A a, B b, C c, int d);\n\t}\n\n\tinterface LI {\n\t\tint f(long a);\n\t}\n\n\tinterface LXI {\n\t\tint f(long a, A b);\n\t}\n\n\tinterface LXXI {\n\t\tint f(long a, A b, B c);\n\t}\n\n\tinterface LXXXI {\n\t\tint f(long a, A b, B c, C d);\n\t}\n\n\tinterface XLI {\n\t\tint f(A a, long b);\n\t}\n\n\tinterface XXLI {\n\t\tint f(A a, B b, long c);\n\t}\n\n\tinterface XXXLI {\n\t\tint f(A a, B b, C c, long d);\n\t}\n\n\tinterface DI {\n\t\tint f(double a);\n\t}\n\n\tinterface DXI {\n\t\tint f(double a, A b);\n\t}\n\n\tinterface DXXI {\n\t\tint f(double a, A b, B c);\n\t}\n\n\tinterface DXXXI {\n\t\tint f(double a, A b, B c, C d);\n\t}\n\n\tinterface XDI {\n\t\tint f(A a, double b);\n\t}\n\n\tinterface XXDI {\n\t\tint f(A a, B b, double c);\n\t}\n\n\tinterface XXXDI {\n\t\tint f(A a, B b, C c, double d);\n\t}\n\n\tinterface XI {\n\t\tint f(A a);\n\t}\n\n\tinterface XXI {\n\t\tint f(A a, B b);\n\t}\n\n\tinterface XXXI {\n\t\tint f(A a, B b, C c);\n\t}\n\n\tinterface XXXXI {\n\t\tint f(A a, B b, C c, D d);\n\t}\n\n\tinterface BBI {\n\t\tint f(boolean a, boolean b);\n\t}\n\n\tinterface BII {\n\t\tint f(boolean a, int b);\n\t}\n\n\tinterface BLI {\n\t\tint f(boolean a, long b);\n\t}\n\n\tinterface BDI {\n\t\tint f(boolean a, double b);\n\t}\n\n\tinterface IBI {\n\t\tint f(int a, boolean b);\n\t}\n\n\tinterface III {\n\t\tint f(int a, int b);\n\t}\n\n\tinterface ILI {\n\t\tint f(int a, long b);\n\t}\n\n\tinterface IDI {\n\t\tint f(int a, double b);\n\t}\n\n\tinterface LBI {\n\t\tint f(long a, boolean b);\n\t}\n\n\tinterface LII {\n\t\tint f(long a, int b);\n\t}\n\n\tinterface LLI {\n\t\tint f(long a, long b);\n\t}\n\n\tinterface LDI {\n\t\tint f(long a, double b);\n\t}\n\n\tinterface DBI {\n\t\tint f(double a, boolean b);\n\t}\n\n\tinterface DII {\n\t\tint f(double a, int b);\n\t}\n\n\tinterface DLI {\n\t\tint f(double a, long b);\n\t}\n\n\tinterface DDI {\n\t\tint f(double a, double b);\n\t}\n\n\tinterface VL {\n\t\tlong f();\n\t}\n\n\tinterface BL {\n\t\tlong f(boolean a);\n\t}\n\n\tinterface BXL {\n\t\tlong f(boolean a, A b);\n\t}\n\n\tinterface BXXL {\n\t\tlong f(boolean a, A b, B c);\n\t}\n\n\tinterface BXXXL {\n\t\tlong f(boolean a, A b, B c, C d);\n\t}\n\n\tinterface XBL {\n\t\tlong f(A a, boolean b);\n\t}\n\n\tinterface XXBL {\n\t\tlong f(A a, B b, boolean c);\n\t}\n\n\tinterface XXXBL {\n\t\tlong f(A a, B b, C c, boolean d);\n\t}\n\n\tinterface IL {\n\t\tlong f(int a);\n\t}\n\n\tinterface IXL {\n\t\tlong f(int a, A b);\n\t}\n\n\tinterface IXXL {\n\t\tlong f(int a, A b, B c);\n\t}\n\n\tinterface IXXXL {\n\t\tlong f(int a, A b, B c, C d);\n\t}\n\n\tinterface XIL {\n\t\tlong f(A a, int b);\n\t}\n\n\tinterface XXIL {\n\t\tlong f(A a, B b, int c);\n\t}\n\n\tinterface XXXIL {\n\t\tlong f(A a, B b, C c, int d);\n\t}\n\n\tinterface LL {\n\t\tlong f(long a);\n\t}\n\n\tinterface LXL {\n\t\tlong f(long a, A b);\n\t}\n\n\tinterface LXXL {\n\t\tlong f(long a, A b, B c);\n\t}\n\n\tinterface LXXXL {\n\t\tlong f(long a, A b, B c, C d);\n\t}\n\n\tinterface XLL {\n\t\tlong f(A a, long b);\n\t}\n\n\tinterface XXLL {\n\t\tlong f(A a, B b, long c);\n\t}\n\n\tinterface XXXLL {\n\t\tlong f(A a, B b, C c, long d);\n\t}\n\n\tinterface DL {\n\t\tlong f(double a);\n\t}\n\n\tinterface DXL {\n\t\tlong f(double a, A b);\n\t}\n\n\tinterface DXXL {\n\t\tlong f(double a, A b, B c);\n\t}\n\n\tinterface DXXXL {\n\t\tlong f(double a, A b, B c, C d);\n\t}\n\n\tinterface XDL {\n\t\tlong f(A a, double b);\n\t}\n\n\tinterface XXDL {\n\t\tlong f(A a, B b, double c);\n\t}\n\n\tinterface XXXDL {\n\t\tlong f(A a, B b, C c, double d);\n\t}\n\n\tinterface XL {\n\t\tlong f(A a);\n\t}\n\n\tinterface XXL {\n\t\tlong f(A a, B b);\n\t}\n\n\tinterface XXXL {\n\t\tlong f(A a, B b, C c);\n\t}\n\n\tinterface XXXXL {\n\t\tlong f(A a, B b, C c, D d);\n\t}\n\n\tinterface BBL {\n\t\tlong f(boolean a, boolean b);\n\t}\n\n\tinterface BIL {\n\t\tlong f(boolean a, int b);\n\t}\n\n\tinterface BLL {\n\t\tlong f(boolean a, long b);\n\t}\n\n\tinterface BDL {\n\t\tlong f(boolean a, double b);\n\t}\n\n\tinterface IBL {\n\t\tlong f(int a, boolean b);\n\t}\n\n\tinterface IIL {\n\t\tlong f(int a, int b);\n\t}\n\n\tinterface ILL {\n\t\tlong f(int a, long b);\n\t}\n\n\tinterface IDL {\n\t\tlong f(int a, double b);\n\t}\n\n\tinterface LBL {\n\t\tlong f(long a, boolean b);\n\t}\n\n\tinterface LIL {\n\t\tlong f(long a, int b);\n\t}\n\n\tinterface LLL {\n\t\tlong f(long a, long b);\n\t}\n\n\tinterface LDL {\n\t\tlong f(long a, double b);\n\t}\n\n\tinterface DBL {\n\t\tlong f(double a, boolean b);\n\t}\n\n\tinterface DIL {\n\t\tlong f(double a, int b);\n\t}\n\n\tinterface DLL {\n\t\tlong f(double a, long b);\n\t}\n\n\tinterface DDL {\n\t\tlong f(double a, double b);\n\t}\n\n\tinterface VD {\n\t\tdouble f();\n\t}\n\n\tinterface BD {\n\t\tdouble f(boolean a);\n\t}\n\n\tinterface BXD {\n\t\tdouble f(boolean a, A b);\n\t}\n\n\tinterface BXXD {\n\t\tdouble f(boolean a, A b, B c);\n\t}\n\n\tinterface BXXXD {\n\t\tdouble f(boolean a, A b, B c, C d);\n\t}\n\n\tinterface XBD {\n\t\tdouble f(A a, boolean b);\n\t}\n\n\tinterface XXBD {\n\t\tdouble f(A a, B b, boolean c);\n\t}\n\n\tinterface XXXBD {\n\t\tdouble f(A a, B b, C c, boolean d);\n\t}\n\n\tinterface ID {\n\t\tdouble f(int a);\n\t}\n\n\tinterface IXD {\n\t\tdouble f(int a, A b);\n\t}\n\n\tinterface IXXD {\n\t\tdouble f(int a, A b, B c);\n\t}\n\n\tinterface IXXXD {\n\t\tdouble f(int a, A b, B c, C d);\n\t}\n\n\tinterface XID {\n\t\tdouble f(A a, int b);\n\t}\n\n\tinterface XXID {\n\t\tdouble f(A a, B b, int c);\n\t}\n\n\tinterface XXXID {\n\t\tdouble f(A a, B b, C c, int d);\n\t}\n\n\tinterface LD {\n\t\tdouble f(long a);\n\t}\n\n\tinterface LXD {\n\t\tdouble f(long a, A b);\n\t}\n\n\tinterface LXXD {\n\t\tdouble f(long a, A b, B c);\n\t}\n\n\tinterface LXXXD {\n\t\tdouble f(long a, A b, B c, C d);\n\t}\n\n\tinterface XLD {\n\t\tdouble f(A a, long b);\n\t}\n\n\tinterface XXLD {\n\t\tdouble f(A a, B b, long c);\n\t}\n\n\tinterface XXXLD {\n\t\tdouble f(A a, B b, C c, long d);\n\t}\n\n\tinterface DD {\n\t\tdouble f(double a);\n\t}\n\n\tinterface DXD {\n\t\tdouble f(double a, A b);\n\t}\n\n\tinterface DXXD {\n\t\tdouble f(double a, A b, B c);\n\t}\n\n\tinterface DXXXD {\n\t\tdouble f(double a, A b, B c, C d);\n\t}\n\n\tinterface XDD {\n\t\tdouble f(A a, double b);\n\t}\n\n\tinterface XXDD {\n\t\tdouble f(A a, B b, double c);\n\t}\n\n\tinterface XXXDD {\n\t\tdouble f(A a, B b, C c, double d);\n\t}\n\n\tinterface XD {\n\t\tdouble f(A a);\n\t}\n\n\tinterface XXD {\n\t\tdouble f(A a, B b);\n\t}\n\n\tinterface XXXD {\n\t\tdouble f(A a, B b, C c);\n\t}\n\n\tinterface XXXXD {\n\t\tdouble f(A a, B b, C c, D d);\n\t}\n\n\tinterface BBD {\n\t\tdouble f(boolean a, boolean b);\n\t}\n\n\tinterface BID {\n\t\tdouble f(boolean a, int b);\n\t}\n\n\tinterface BLD {\n\t\tdouble f(boolean a, long b);\n\t}\n\n\tinterface BDD {\n\t\tdouble f(boolean a, double b);\n\t}\n\n\tinterface IBD {\n\t\tdouble f(int a, boolean b);\n\t}\n\n\tinterface IID {\n\t\tdouble f(int a, int b);\n\t}\n\n\tinterface ILD {\n\t\tdouble f(int a, long b);\n\t}\n\n\tinterface IDD {\n\t\tdouble f(int a, double b);\n\t}\n\n\tinterface LBD {\n\t\tdouble f(long a, boolean b);\n\t}\n\n\tinterface LID {\n\t\tdouble f(long a, int b);\n\t}\n\n\tinterface LLD {\n\t\tdouble f(long a, long b);\n\t}\n\n\tinterface LDD {\n\t\tdouble f(long a, double b);\n\t}\n\n\tinterface DBD {\n\t\tdouble f(double a, boolean b);\n\t}\n\n\tinterface DID {\n\t\tdouble f(double a, int b);\n\t}\n\n\tinterface DLD {\n\t\tdouble f(double a, long b);\n\t}\n\n\tinterface DDD {\n\t\tdouble f(double a, double b);\n\t}\n\n\tinterface VX {\n\t\tA f();\n\t}\n\n\tinterface BX {\n\t\tA f(boolean a);\n\t}\n\n\tinterface BXX {\n\t\tB f(boolean a, A b);\n\t}\n\n\tinterface BXXX {\n\t\tC f(boolean a, A b, B c);\n\t}\n\n\tinterface BXXXX {\n\t\tD f(boolean a, A b, B c, C d);\n\t}\n\n\tinterface XBX {\n\t\tB f(A a, boolean b);\n\t}\n\n\tinterface XXBX {\n\t\tC f(A a, B b, boolean c);\n\t}\n\n\tinterface XXXBX {\n\t\tD f(A a, B b, C c, boolean d);\n\t}\n\n\tinterface IX {\n\t\tA f(int a);\n\t}\n\n\tinterface IXX {\n\t\tB f(int a, A b);\n\t}\n\n\tinterface IXXX {\n\t\tC f(int a, A b, B c);\n\t}\n\n\tinterface IXXXX {\n\t\tD f(int a, A b, B c, C d);\n\t}\n\n\tinterface XIX {\n\t\tB f(A a, int b);\n\t}\n\n\tinterface XXIX {\n\t\tC f(A a, B b, int c);\n\t}\n\n\tinterface XXXIX {\n\t\tD f(A a, B b, C c, int d);\n\t}\n\n\tinterface LX {\n\t\tA f(long a);\n\t}\n\n\tinterface LXX {\n\t\tB f(long a, A b);\n\t}\n\n\tinterface LXXX {\n\t\tC f(long a, A b, B c);\n\t}\n\n\tinterface LXXXX {\n\t\tD f(long a, A b, B c, C d);\n\t}\n\n\tinterface XLX {\n\t\tB f(A a, long b);\n\t}\n\n\tinterface XXLX {\n\t\tC f(A a, B b, long c);\n\t}\n\n\tinterface XXXLX {\n\t\tD f(A a, B b, C c, long d);\n\t}\n\n\tinterface DX {\n\t\tA f(double a);\n\t}\n\n\tinterface DXX {\n\t\tB f(double a, A b);\n\t}\n\n\tinterface DXXX {\n\t\tC f(double a, A b, B c);\n\t}\n\n\tinterface DXXXX {\n\t\tD f(double a, A b, B c, C d);\n\t}\n\n\tinterface XDX {\n\t\tB f(A a, double b);\n\t}\n\n\tinterface XXDX {\n\t\tC f(A a, B b, double c);\n\t}\n\n\tinterface XXXDX {\n\t\tD f(A a, B b, C c, double d);\n\t}\n\n\tinterface XX {\n\t\tB f(A a);\n\t}\n\n\tinterface XXX {\n\t\tC f(A a, B b);\n\t}\n\n\tinterface XXXX {\n\t\tD f(A a, B b, C c);\n\t}\n\n\tinterface XXXXX {\n\t\tE f(A a, B b, C c, D d);\n\t}\n\n\tinterface BBX {\n\t\tA f(boolean a, boolean b);\n\t}\n\n\tinterface BIX {\n\t\tA f(boolean a, int b);\n\t}\n\n\tinterface BLX {\n\t\tA f(boolean a, long b);\n\t}\n\n\tinterface BDX {\n\t\tA f(boolean a, double b);\n\t}\n\n\tinterface IBX {\n\t\tA f(int a, boolean b);\n\t}\n\n\tinterface IIX {\n\t\tA f(int a, int b);\n\t}\n\n\tinterface ILX {\n\t\tA f(int a, long b);\n\t}\n\n\tinterface IDX {\n\t\tA f(int a, double b);\n\t}\n\n\tinterface LBX {\n\t\tA f(long a, boolean b);\n\t}\n\n\tinterface LIX {\n\t\tA f(long a, int b);\n\t}\n\n\tinterface LLX {\n\t\tA f(long a, long b);\n\t}\n\n\tinterface LDX {\n\t\tA f(long a, double b);\n\t}\n\n\tinterface DBX {\n\t\tA f(double a, boolean b);\n\t}\n\n\tinterface DIX {\n\t\tA f(double a, int b);\n\t}\n\n\tinterface DLX {\n\t\tA f(double a, long b);\n\t}\n\n\tinterface DDX {\n\t\tA f(double a, double b);\n\t}\n}\n\nclass SA { // suffix array\n\tstatic int[] makeSA(String s) {\n\t\tint n = s.length() + 1;\n\t\tint[] cs = new int[n];\n\t\tcs[n - 1] = 0;\n\t\tfor (int i = 0; i < n - 1; i++)\n\t\t\tcs[i] = s.charAt(i) + 1;\n\t\tArrayList acs = U.make(n, i -> cs[i]);\n\t\tTreeMap tm = U.compress(acs).a;\n\t\tint k = tm.size();\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tcs[i] = tm.get(cs[i]);\n\t\treturn makeSA(cs, n, k);\n\t}\n\n\tstatic int[] makeLCP(String s, int[] sa) { // lcp(i, i+1)\n\t\tint n = sa.length;\n\t\tint[] r = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tr[sa[i]] = i;\n\t\tint[] lcp = new int[n];\n\t\tint l = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint idx = r[i];\n\t\t\tif (idx == n - 1) {\n\t\t\t\tlcp[idx] = -1;\n\t\t\t\tl = 0;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tint p = sa[idx];\n\t\t\tint q = sa[idx + 1];\n\t\t\tif (l > 0)\n\t\t\t\tl--;\n\t\t\twhile (p + l < n - 1 && q + l < n - 1 && s.charAt(p + l) == s.charAt(q + l))\n\t\t\t\tl++;\n\t\t\tlcp[idx] = l;\n\t\t}\n\t\treturn lcp;\n\t}\n\n\tstatic F.III lcpQuery(String s) {\n\t\tint n = s.length() + 1;\n\t\tint[] sa = makeSA(s);\n\t\tint[] lcp = makeLCP(s, sa);\n\t\tint[] inv = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tinv[sa[i]] = i;\n\t\t}\n\t\tST st = new ST(n, (a, b) -> a < b ? a : b, Integer.MAX_VALUE);\n\t\tst.init(i -> i < n ? lcp[i] : Integer.MAX_VALUE);\n\t\treturn (i, j) -> {\n\t\t\tif (i == j)\n\t\t\t\treturn n - 1 - i;\n\t\t\ti = inv[i];\n\t\t\tj = inv[j];\n\t\t\tif (i > j) {\n\t\t\t\ti ^= j;\n\t\t\t\tj ^= i;\n\t\t\t\ti ^= j;\n\t\t\t}\n\t\t\treturn st.query(i, j);\n\t\t};\n\t}\n\n\tprivate static int[] makeSA(int[] cs, int n, int k) {\n\t\tboolean[] isS = new boolean[n];\n\t\tboolean[] isLms = new boolean[n];\n\t\tint[] lmss = new int[n];\n\t\tint numLmss = 0;\n\t\tisS[n - 1] = true;\n\t\tfor (int i = n - 2; i >= 0; i--)\n\t\t\tisS[i] = cs[i] < cs[i + 1] || cs[i] == cs[i + 1] && isS[i + 1];\n\t\tfor (int i = 1; i < n; i++)\n\t\t\tif (!isS[i - 1] && isS[i]) {\n\t\t\t\tlmss[numLmss++] = i;\n\t\t\t\tisLms[i] = true;\n\t\t\t}\n\t\tint[] sa = inducedSort(cs, n, numLmss, k, lmss, isS);\n\t\tint[] lmss2 = new int[numLmss];\n\t\tnumLmss = 0;\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tif (isLms[sa[i]])\n\t\t\t\tlmss2[numLmss++] = sa[i];\n\t\tint num = 0;\n\t\tsa[lmss2[0]] = 0;\n\t\tfor (int i = 0; i < numLmss - 1; i++) {\n\t\t\tint p = lmss2[i];\n\t\t\tint q = lmss2[i + 1];\n\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\tif (cs[p] != cs[q] || isLms[p] != isLms[q]) {\n\t\t\t\t\tsa[lmss2[i + 1]] = ++num;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (j > 0 && (isLms[p] || isLms[q])) {\n\t\t\t\t\tsa[lmss2[i + 1]] = num;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tp++;\n\t\t\t\tq++;\n\t\t\t}\n\t\t}\n\t\tif (num + 1 < numLmss) {\n\t\t\tnumLmss = 0;\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tif (isLms[i])\n\t\t\t\t\tlmss2[numLmss++] = sa[i];\n\t\t\tlmss2 = makeSA(lmss2, numLmss, num + 1);\n\t\t\tfor (int i = 0; i < numLmss; i++)\n\t\t\t\tlmss2[i] = lmss[lmss2[i]];\n\t\t}\n\t\treturn inducedSort(cs, n, numLmss, k, lmss2, isS);\n\t}\n\n\tprivate static int[] inducedSort(int[] cs, int n, int numLmss, int k, int[] lmss, boolean[] isS) {\n\t\tint[] sa = new int[n];\n\t\tint[] bin = new int[k + 1];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tbin[cs[i] + 1]++;\n\t\tfor (int i = 0; i < k; i++)\n\t\t\tbin[i + 1] += bin[i];\n\t\tint[] counts = new int[k];\n\t\tfor (int i = numLmss - 1; i >= 0; i--) { // put LMS backward\n\t\t\tint c = cs[lmss[i]];\n\t\t\tsa[bin[c + 1] - 1 - counts[c]++] = lmss[i];\n\t\t}\n\t\tfor (int i = 0; i < k; i++)\n\t\t\tcounts[i] = 0;\n\t\tfor (int i = 0; i < n; i++) { // put L forward\n\t\t\tint s = sa[i] - 1;\n\t\t\tif (s < 0 || isS[s])\n\t\t\t\tcontinue;\n\t\t\tint c = cs[s];\n\t\t\tsa[bin[c] + counts[c]++] = s;\n\t\t}\n\t\tfor (int i = 0; i < k; i++)\n\t\t\tcounts[i] = 0;\n\t\tfor (int i = n - 1; i >= 0; i--) { // put S backward\n\t\t\tint s = sa[i] - 1;\n\t\t\tif (s < 0 || !isS[s])\n\t\t\t\tcontinue;\n\t\t\tint c = cs[s];\n\t\t\tsa[bin[c + 1] - 1 - counts[c]++] = s;\n\t\t}\n\t\treturn sa;\n\t}\n}\n\nclass ST { // Segment Tree\n\tprivate ArrayList as;\n\tprivate int h;\n\tprivate int n;\n\tprivate F.XXX merger;\n\tprivate A e;\n\n\tST(int num, F.XXX merger, A e) {\n\t\tthis.merger = merger;\n\t\tthis.e = e;\n\t\th = 0;\n\t\twhile ((1 << h) < num)\n\t\t\th++;\n\t\tn = 1 << h;\n\t\tas = U.make(2 * n, i -> e);\n\t}\n\n\tvoid init(A a) {\n\t\tinit(i -> a);\n\t}\n\n\tvoid init(A[] as) {\n\t\tinit(i -> i < as.length ? as[i] : e);\n\t}\n\n\tvoid init(F.IX maker) {\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tas.set(n + i, maker.f(i));\n\t\tfor (int i = n - 1; i > 0; i--)\n\t\t\tas.set(i, merge(as.get(i << 1), as.get(i << 1 | 1)));\n\t}\n\n\tA get(int i) {\n\t\treturn query(i, i + 1);\n\t}\n\n\tvoid set(int i, A a) {\n\t\tas.set(i += n, a);\n\t\twhile ((i >>= 1) > 0)\n\t\t\tas.set(i, merge(as.get(i << 1), as.get(i << 1 | 1)));\n\t}\n\n\tA query(int l, int r) {\n\t\tl += n;\n\t\tr += n;\n\t\tA al = e;\n\t\tA ar = e;\n\t\twhile (l < r) {\n\t\t\tif ((l & 1) != 0)\n\t\t\t\tal = merge(al, as.get(l++));\n\t\t\tif ((r & 1) != 0)\n\t\t\t\tar = merge(as.get(--r), ar);\n\t\t\tl >>= 1;\n\t\t\tr >>= 1;\n\t\t}\n\t\treturn merge(al, ar);\n\t}\n\n\tprivate A merge(A a, A b) {\n\t\treturn a == e ? b : b == e ? a : merger.f(a, b);\n\t}\n}\n\nclass LST { // Lazy Segment Tree\n\tprivate ArrayList as;\n\tprivate ArrayList lazy;\n\tprivate F.XXX merger;\n\tprivate F.XXIX applier;\n\tprivate F.XXX opMerger;\n\tprivate A e;\n\tprivate Op id;\n\tprivate int h;\n\tprivate int n;\n\n\tLST(int num, F.XXX merger, F.XXIX applier, F.XXX opMerger, A e, Op id) {\n\t\tthis.merger = merger;\n\t\tthis.applier = applier;\n\t\tthis.opMerger = opMerger;\n\t\tthis.e = e;\n\t\tthis.id = id;\n\t\th = 0;\n\t\twhile ((1 << h) < num)\n\t\t\th++;\n\t\tn = 1 << h;\n\t\tint size = n << 1;\n\t\tas = U.make(size, i -> e);\n\t\tlazy = U.make(size, i -> id);\n\t}\n\n\tvoid init(A a) {\n\t\tinit(i -> a);\n\t}\n\n\tvoid init(A[] as) {\n\t\tinit(i -> i < as.length ? as[i] : e);\n\t}\n\n\tvoid init(F.IX maker) {\n\t\tfor (int i = 0; i < n << 1; i++)\n\t\t\tlazy.set(i, id);\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tas.set(n + i, maker.f(i));\n\t\tfor (int i = n - 1; i > 0; i--)\n\t\t\tas.set(i, merge(as.get(i << 1), as.get(i << 1 | 1)));\n\t}\n\n\tA get(int i) {\n\t\treturn query(i, i + 1);\n\t}\n\n\tvoid set(int i, A a) {\n\t\tprop(i += n);\n\t\tas.set(i, a);\n\t\tlazy.set(i, id);\n\t\tbackprop(i);\n\t}\n\n\tA query(int l, int r) {\n\t\tprop(l += n);\n\t\tprop(r += n - 1);\n\t\tr++;\n\t\tA al = e;\n\t\tA ar = e;\n\t\tint len = 1;\n\t\twhile (l < r) {\n\t\t\tif ((l & 1) != 0)\n\t\t\t\tal = merge(al, eval(l++, len));\n\t\t\tif ((r & 1) != 0)\n\t\t\t\tar = merge(eval(--r, len), ar);\n\t\t\tl >>= 1;\n\t\t\tr >>= 1;\n\t\t\tlen <<= 1;\n\t\t}\n\t\treturn merge(al, ar);\n\t}\n\n\tvoid apply(int l, int r, Op o) {\n\t\tprop(l += n);\n\t\tprop(r += n - 1);\n\t\tint a = l;\n\t\tint b = r;\n\t\tr++;\n\t\twhile (l < r) {\n\t\t\tif ((l & 1) != 0)\n\t\t\t\tlazy.set(l, mergeOp(lazy.get(l++), o));\n\t\t\tif ((r & 1) != 0)\n\t\t\t\tlazy.set(--r, mergeOp(lazy.get(r), o));\n\t\t\tl >>= 1;\n\t\t\tr >>= 1;\n\t\t}\n\t\tbackprop(a);\n\t\tbackprop(b);\n\t}\n\n\tint size() {\n\t\treturn n;\n\t}\n\n\tprivate A merge(A a, A b) {\n\t\treturn a == e ? b : b == e ? a : merger.f(a, b);\n\t}\n\n\tprivate Op mergeOp(Op o, Op p) {\n\t\treturn o == id ? p : p == id ? o : opMerger.f(o, p);\n\t}\n\n\tprivate A apply(A a, Op o, int len) {\n\t\treturn o == id ? a : applier.f(a, o, len);\n\t}\n\n\tprivate A eval(int k, int len) {\n\t\treturn apply(as.get(k), lazy.get(k), len);\n\t}\n\n\tprivate void flush(int k, int len) {\n\t\tOp o = lazy.get(k);\n\t\tif (o == id)\n\t\t\treturn;\n\t\tlazy.set(k << 1, mergeOp(lazy.get(k << 1), o));\n\t\tlazy.set(k << 1 | 1, mergeOp(lazy.get(k << 1 | 1), o));\n\t\tas.set(k, apply(as.get(k), o, len));\n\t\tlazy.set(k, id);\n\t}\n\n\tprivate void prop(int k) {\n\t\tfor (int i = h; i > 0; i--)\n\t\t\tflush(k >> i, 1 << i);\n\t}\n\n\tprivate void backprop(int k) {\n\t\tint len = 1;\n\t\twhile ((k >>= 1) > 0) {\n\t\t\tas.set(k, merge(eval(k << 1, len), eval(k << 1 | 1, len)));\n\t\t\tlen <<= 1;\n\t\t}\n\t}\n}\n\ninterface Magma {\n\tA g(A a, A b);\n}\n\ninterface Associative {\n}\n\ninterface Unital {\n\tA e();\n}\n\ninterface Invertible {\n\tA inv(A a);\n}\n\ninterface Commutative {\n}\n\ninterface SemiGroup extends Magma, Associative {\n}\n\ninterface Monoid extends SemiGroup, Unital {\n\tstatic Monoid make(F.XXX g, A e) {\n\t\treturn new Monoid() {\n\t\t\tpublic A g(A a, A b) {\n\t\t\t\treturn a.equals(e) ? b : b.equals(e) ? a : g.f(a, b);\n\t\t\t}\n\n\t\t\tpublic A e() {\n\t\t\t\treturn e;\n\t\t\t}\n\t\t};\n\t}\n}\n\ninterface CommutativeMonoid extends Monoid, Commutative {\n\tstatic CommutativeMonoid make(F.XXX g, A e) {\n\t\treturn new CommutativeMonoid() {\n\t\t\tpublic A g(A a, A b) {\n\t\t\t\treturn a.equals(e) ? b : b.equals(e) ? a : g.f(a, b);\n\t\t\t}\n\n\t\t\tpublic A e() {\n\t\t\t\treturn e;\n\t\t\t}\n\t\t};\n\t}\n}\n\ninterface Group extends Monoid, Invertible {\n\tstatic Group make(F.XXX g, F.XX inv, A e) {\n\t\treturn new Group() {\n\t\t\tpublic A g(A a, A b) {\n\t\t\t\treturn a.equals(e) ? b : b.equals(e) ? a : g.f(a, b);\n\t\t\t}\n\n\t\t\tpublic A e() {\n\t\t\t\treturn e;\n\t\t\t}\n\n\t\t\tpublic A inv(A a) {\n\t\t\t\treturn a.equals(e) ? e : inv.f(a);\n\t\t\t}\n\t\t};\n\t}\n}\n\ninterface AbelianGroup extends Group, CommutativeMonoid {\n\tstatic AbelianGroup make(F.XXX g, F.XX inv, A e) {\n\t\treturn new AbelianGroup() {\n\t\t\tpublic A g(A a, A b) {\n\t\t\t\treturn a.equals(e) ? b : b.equals(e) ? a : g.f(a, b);\n\t\t\t}\n\n\t\t\tpublic A e() {\n\t\t\t\treturn e;\n\t\t\t}\n\n\t\t\tpublic A inv(A a) {\n\t\t\t\treturn a.equals(e) ? e : inv.f(a);\n\t\t\t}\n\t\t};\n\t}\n}\n\ninterface Ring {\n\tAbelianGroup add();\n\n\tMonoid mul();\n\n\tdefault A zero() {\n\t\treturn add().e();\n\t}\n\n\tdefault A one() {\n\t\treturn mul().e();\n\t}\n\n\tstatic Ring make(F.XXX add, F.XX neg, F.XXX mul, A zero, A one) {\n\t\treturn make(AbelianGroup.make(add, neg, zero), Monoid.make(mul, one));\n\t}\n\n\tstatic Ring make(AbelianGroup add, Monoid mul) {\n\t\treturn new Ring() {\n\t\t\tpublic AbelianGroup add() {\n\t\t\t\treturn add;\n\t\t\t}\n\n\t\t\tpublic Monoid mul() {\n\t\t\t\treturn mul;\n\t\t\t}\n\t\t};\n\t}\n}\n\ninterface CommutativeRing extends Ring {\n\tCommutativeMonoid mul();\n\n\tstatic CommutativeRing make(F.XXX add, F.XX neg, F.XXX mul, A zero, A one) {\n\t\treturn make(AbelianGroup.make(add, neg, zero), CommutativeMonoid.make(mul, one));\n\t}\n\n\tstatic CommutativeRing make(AbelianGroup add, CommutativeMonoid mul) {\n\t\treturn new CommutativeRing() {\n\t\t\tpublic AbelianGroup add() {\n\t\t\t\treturn add;\n\t\t\t}\n\n\t\t\tpublic CommutativeMonoid mul() {\n\t\t\t\treturn mul;\n\t\t\t}\n\t\t};\n\t}\n}\n\ninterface EuclideanRing extends CommutativeRing {\n\tA div(A a, A b);\n\n\tA mod(A a, A b);\n\n\tstatic EuclideanRing make(F.XXX add, F.XX neg, F.XXX mul, F.XXX div,\n\t\t\tF.XXX mod, A zero, A one) {\n\t\treturn make(AbelianGroup.make(add, neg, zero), CommutativeMonoid.make(mul, one), div, mod);\n\t}\n\n\tstatic EuclideanRing make(AbelianGroup add, CommutativeMonoid mul, F.XXX div,\n\t\t\tF.XXX mod) {\n\t\tfinal A zero = add.e();\n\t\tfinal A one = mul.e();\n\t\treturn new EuclideanRing() {\n\t\t\tpublic AbelianGroup add() {\n\t\t\t\treturn add;\n\t\t\t}\n\n\t\t\tpublic CommutativeMonoid mul() {\n\t\t\t\treturn mul;\n\t\t\t}\n\n\t\t\tpublic A div(A a, A b) {\n\t\t\t\tif (b.equals(zero))\n\t\t\t\t\tthrow new ArithmeticException(\"division by zero\");\n\t\t\t\treturn b.equals(one) ? a : div.f(a, b);\n\t\t\t}\n\n\t\t\tpublic A mod(A a, A b) {\n\t\t\t\tif (b.equals(zero))\n\t\t\t\t\tthrow new ArithmeticException(\"division by zero\");\n\t\t\t\treturn b.equals(one) ? zero : mod.f(a, b);\n\t\t\t}\n\t\t};\n\t}\n}\n\ninterface Field extends EuclideanRing {\n\tAbelianGroup mul();\n\n\tstatic Field make(F.XXX add, F.XX neg, F.XXX mul, F.XX inv, A zero, A one) {\n\t\treturn make(AbelianGroup.make(add, neg, zero), AbelianGroup.make(mul, inv, one));\n\t}\n\n\tstatic Field make(AbelianGroup add, AbelianGroup mul) {\n\t\tfinal A zero = add.e();\n\t\tfinal A one = mul.e();\n\t\treturn new Field() {\n\t\t\tpublic AbelianGroup add() {\n\t\t\t\treturn add;\n\t\t\t}\n\n\t\t\tpublic AbelianGroup mul() {\n\t\t\t\treturn mul;\n\t\t\t}\n\n\t\t\tpublic A div(A a, A b) {\n\t\t\t\tif (b.equals(zero))\n\t\t\t\t\tthrow new ArithmeticException(\"division by zero\");\n\t\t\t\treturn b.equals(one) ? a : mul.g(a, mul.inv(b));\n\t\t\t}\n\n\t\t\tpublic A mod(A a, A b) {\n\t\t\t\tif (b.equals(zero))\n\t\t\t\t\tthrow new ArithmeticException(\"division by zero\");\n\t\t\t\treturn zero;\n\t\t\t}\n\t\t};\n\t}\n}\n\nfinal class Alg {\n\tprivate Alg() {\n\t}\n\n\tstatic > A gcd(A a, A b, EuclideanRing ring) {\n\t\tAbelianGroup add = ring.add();\n\t\tA zero = add.e();\n\t\tint sa = a.compareTo(zero);\n\t\tint sb = b.compareTo(zero);\n\t\tif (sa == 0)\n\t\t\treturn b;\n\t\tif (sb == 0)\n\t\t\treturn a;\n\t\tif (sa < 0)\n\t\t\ta = add.inv(a);\n\t\tif (sb < 0)\n\t\t\tb = add.inv(b);\n\t\tif (a.compareTo(b) < 0) {\n\t\t\tA tmp = a;\n\t\t\ta = b;\n\t\t\tb = tmp;\n\t\t}\n\t\twhile (true) {\n\t\t\tA c = ring.mod(a, b);\n\t\t\tif (c.compareTo(zero) == 0)\n\t\t\t\treturn b;\n\t\t\ta = b;\n\t\t\tb = c;\n\t\t}\n\t}\n\n\tstatic long gcd(long a, long b) {\n\t\tif (a == 0)\n\t\t\treturn b;\n\t\tif (b == 0)\n\t\t\treturn a;\n\t\tif (a < 0)\n\t\t\ta = -a;\n\t\tif (b < 0)\n\t\t\tb = -b;\n\t\tif (a < b) {\n\t\t\ta ^= b;\n\t\t\tb ^= a;\n\t\t\ta ^= b;\n\t\t}\n\t\twhile (true) {\n\t\t\tlong c = a % b;\n\t\t\tif (c == 0)\n\t\t\t\treturn b;\n\t\t\ta = b;\n\t\t\tb = c;\n\t\t}\n\t}\n\n\tstatic int gcd(int a, int b) {\n\t\treturn (int) gcd((long) a, (long) b);\n\t}\n\n\tstatic > int[] lis(F.IX access, int size) {\n\t\tObject[] dp = new Object[size];\n\t\tint[][] dpIndices = new int[size][2];\n\t\tdp[0] = access.f(0);\n\t\tint len = 1;\n\t\tint lidx = 0;\n\t\tfor (int i = 1; i < size; i++) {\n\t\t\tA ai = access.f(i);\n\t\t\t@SuppressWarnings(\"unchecked\")\n\t\t\tint idx = U.searchI(-1, len, j -> ai.compareTo((A) dp[j]) <= 0); // replace <= with < to return NLDS\n\t\t\tdp[idx] = ai;\n\t\t\tdpIndices[idx][0] = i;\n\t\t\tif (idx == len) {\n\t\t\t\tlidx = i;\n\t\t\t\tlen++;\n\t\t\t}\n\t\t\tif (idx > 0)\n\t\t\t\tdpIndices[i][1] = dpIndices[idx - 1][0];\n\t\t}\n\t\tint[] res = new int[len];\n\t\tres[len - 1] = lidx;\n\t\tfor (int i = len - 1; i >= 0; i--) {\n\t\t\tres[i] = lidx;\n\t\t\tlidx = dpIndices[lidx][1];\n\t\t}\n\t\treturn res;\n\t}\n\n\tstatic A pow(A a, long b, Monoid monoid) {\n\t\tA res = monoid.e();\n\t\twhile (b > 0) {\n\t\t\tif ((b & 1) != 0)\n\t\t\t\tres = monoid.g(res, a);\n\t\t\ta = monoid.g(a, a);\n\t\t\tb >>= 1;\n\t\t}\n\t\treturn res;\n\t}\n\n\tstatic A pow(A a, BigInteger b, Monoid monoid) {\n\t\tA res = monoid.e();\n\t\twhile (b.compareTo(BigInteger.ZERO) > 0) {\n\t\t\tif ((b.and(BigInteger.ONE)).intValueExact() != 0)\n\t\t\t\tres = monoid.g(res, a);\n\t\t\ta = monoid.g(a, a);\n\t\t\tb = b.divide(BigInteger.valueOf(2));\n\t\t}\n\t\treturn res;\n\t}\n\n\tstatic long pow(long a, long b) {\n\t\tlong res = 1;\n\t\twhile (b > 0) {\n\t\t\tif ((b & 1) != 0)\n\t\t\t\tres *= a;\n\t\t\ta *= a;\n\t\t\tb >>= 1;\n\t\t}\n\t\treturn res;\n\t}\n\n\tstatic > T extgcd(A a, A b, EuclideanRing ring) { // returns (x, y, d) s.t. ax + by = d\n\t\tAbelianGroup add = ring.add();\n\t\tCommutativeMonoid mul = ring.mul();\n\t\tA zero = add.e();\n\t\tA one = mul.e();\n\t\tA sa = a.compareTo(zero) < 0 ? add.inv(one) : one;\n\t\tA sb = b.compareTo(zero) < 0 ? add.inv(one) : one;\n\t\ta = mul.g(a, sa);\n\t\tb = mul.g(b, sb);\n\t\tA x = one;\n\t\tA y = zero;\n\t\tA z = zero;\n\t\tA w = one;\n\t\twhile (b.compareTo(zero) > 0) {\n\t\t\tA q = ring.div(a, b);\n\t\t\tA t = z;\n\t\t\tz = add.g(x, add.inv(mul.g(q, z)));\n\t\t\tx = t;\n\t\t\tt = w;\n\t\t\tw = add.g(y, add.inv(mul.g(q, w)));\n\t\t\ty = t;\n\t\t\tt = b;\n\t\t\tb = add.g(a, add.inv(mul.g(q, b)));\n\t\t\ta = t;\n\t\t}\n\t\treturn T.make(mul.g(x, sa), mul.g(y, sb), a);\n\t}\n\n\tstatic TL extgcd(long a, long b) {\n\t\tint sa = a < 0 ? -1 : 1;\n\t\tint sb = b < 0 ? -1 : 1;\n\t\ta *= sa;\n\t\tb *= sb;\n\t\tlong x = 1;\n\t\tlong y = 0;\n\t\tlong z = 0;\n\t\tlong w = 1;\n\t\twhile (b > 0) {\n\t\t\tlong q = a / b;\n\t\t\tlong t = z;\n\t\t\tz = x - q * z;\n\t\t\tx = t;\n\t\t\tt = w;\n\t\t\tw = y - q * w;\n\t\t\ty = t;\n\t\t\tt = b;\n\t\t\tb = a - q * b;\n\t\t\ta = t;\n\t\t}\n\t\treturn TL.make(x * sa, y * sb, a);\n\t}\n\n\tstatic TI extgcd(int a, int b) {\n\t\treturn extgcd((long) a, (long) b).toInt();\n\t}\n\n\tstatic ArrayList factorize(int n) { // factor, exponent\n\t\tArrayList res = new ArrayList();\n\t\tfor (int i = 2; i * i <= n; i++) {\n\t\t\tint count = 0;\n\t\t\twhile (n % i == 0) {\n\t\t\t\tn /= i;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\tif (count > 0)\n\t\t\t\tres.add(PI.make(i, count));\n\t\t}\n\t\tif (n > 1)\n\t\t\tres.add(PI.make(n, 1));\n\t\treturn res;\n\t}\n\n\tstatic ArrayList factorize(long n) { // factor, exponent\n\t\tArrayList res = new ArrayList();\n\t\tfor (int i = 2; i * i <= n; i++) {\n\t\t\tint count = 0;\n\t\t\twhile (n % i == 0) {\n\t\t\t\tn /= i;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\tif (count > 0)\n\t\t\t\tres.add(PL.make(i, count));\n\t\t}\n\t\tif (n > 1)\n\t\t\tres.add(PL.make(n, 1));\n\t\treturn res;\n\t}\n\n\tstatic A arithSum(A a, A d, long num, Ring ring) {\n\t\treturn arithGeomSum(a, d, ring.one(), ring.one(), num, ring);\n\t}\n\n\tstatic A geomSum(A b, A r, long num, Ring ring) {\n\t\treturn arithGeomSum(ring.one(), ring.zero(), b, r, num, ring);\n\t}\n\n\tstatic A arithGeomSum(A a, A d, A b, A r, long num, Ring ring) { // Σ(a+(i-1)d)br^(i-1)\n\t\tAbelianGroup add = ring.add();\n\t\tMonoid mul = ring.mul();\n\t\tMonoid> matMul = Mat.mulRing(3, ring);\n\t\tA zero = ring.zero();\n\t\tA one = ring.one();\n\t\tMN mat = pow(Mat.make(new Object[][] { { r, d, a }, { zero, r, r }, { zero, zero, one } }), num - 1, matMul);\n\t\treturn mul.g(add.g(add.g(mul.g(mat.at(0, 0), a), mul.g(mat.at(0, 1), r)), mat.at(0, 2)), b);\n\t}\n}\n\nclass MN {\n\tfinal int m;\n\tfinal int n;\n\tprivate final Object[][] as;\n\n\tstatic class Scalar extends MN {\n\t\tfinal long l;\n\t\tA a;\n\n\t\tScalar(int m, int n, long l, A zero, A oneTimesL) {\n\t\t\tsuper(m, n, (i, j) -> i == j ? oneTimesL : zero);\n\t\t\tthis.a = oneTimesL;\n\t\t\tthis.l = l;\n\t\t}\n\t}\n\n\tMN(int m, int n, Mat.Accessor accessor) {\n\t\tthis.m = m;\n\t\tthis.n = n;\n\t\tas = new Object[m][n];\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\tas[i][j] = accessor.at(i, j);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic String toString() {\n\t\tString s = \"\";\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\ts += i == 0 ? \"[[ \" : \" [ \";\n\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\ts += (j == 0 ? \"\" : \", \") + as[i][j];\n\t\t\t}\n\t\t\ts += i == m - 1 ? \" ]]\" : \" ]\\n\";\n\t\t}\n\t\treturn s;\n\t}\n\n\t@SuppressWarnings(\"unchecked\")\n\tA at(int i, int j) {\n\t\treturn (A) as[i][j];\n\t}\n\n\t@SuppressWarnings(\"unchecked\")\n\tA[][] toArray() {\n\t\tA[][] res = (A[][]) Array.newInstance(as[0][0].getClass(), m, n);\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\tres[i][j] = (A) as[i][j];\n\t\t\t}\n\t\t}\n\t\treturn res;\n\t}\n\n\tint[][] toIntArray() {\n\t\tint[][] res = new int[m][n];\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\tres[i][j] = (int) as[i][j];\n\t\t\t}\n\t\t}\n\t\treturn res;\n\t}\n\n\tlong[][] toLongArray() {\n\t\tlong[][] res = new long[m][n];\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\tres[i][j] = (long) as[i][j];\n\t\t\t}\n\t\t}\n\t\treturn res;\n\t}\n\n\tdouble[][] toDoubleArray() {\n\t\tdouble[][] res = new double[m][n];\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\tres[i][j] = (double) as[i][j];\n\t\t\t}\n\t\t}\n\t\treturn res;\n\t}\n}\n\nclass Mat {\n\tinterface Accessor {\n\t\tA at(int i, int j);\n\t}\n\n\tprivate static MN.Scalar make(int m, int n, long l, A zero, A oneTimesL) {\n\t\treturn new MN.Scalar(m, n, l, zero, oneTimesL);\n\t}\n\n\tstatic MN make(int m, int n, Accessor accessor) {\n\t\treturn new MN(m, n, accessor);\n\t}\n\n\tstatic MN make(int m, int n, A[][] as) {\n\t\treturn new MN(m, n, (i, j) -> as[i][j]);\n\t}\n\n\tstatic MN make(int[][] as) {\n\t\treturn new MN(as.length, as.length == 0 ? 0 : as[0].length, (i, j) -> (long) as[i][j]);\n\t}\n\n\tstatic MN make(long[][] as) {\n\t\treturn new MN(as.length, as.length == 0 ? 0 : as[0].length, (i, j) -> as[i][j]);\n\t}\n\n\tstatic MN make(double[][] as) {\n\t\treturn new MN(as.length, as.length == 0 ? 0 : as[0].length, (i, j) -> as[i][j]);\n\t}\n\n\tstatic MN make(int[][] as, F.IX toA) {\n\t\treturn new MN(as.length, as.length == 0 ? 0 : as[0].length, (i, j) -> toA.f(as[i][j]));\n\t}\n\n\tstatic MN make(long[][] as, F.LX toA) {\n\t\treturn new MN(as.length, as.length == 0 ? 0 : as[0].length, (i, j) -> toA.f(as[i][j]));\n\t}\n\n\tstatic MN make(double[][] as, F.DX toA) {\n\t\treturn new MN(as.length, as.length == 0 ? 0 : as[0].length, (i, j) -> toA.f(as[i][j]));\n\t}\n\n\tstatic MN make(B[][] as, F.XX toA) {\n\t\treturn new MN(as.length, as.length == 0 ? 0 : as[0].length, (i, j) -> toA.f(as[i][j]));\n\t}\n\n\t@SuppressWarnings(\"unchecked\")\n\tstatic MN make(Object[][] as) {\n\t\treturn new MN(as.length, as.length == 0 ? 0 : as[0].length, (i, j) -> (A) as[i][j]);\n\t}\n\n\tstatic MN eye(int n, Ring ring) {\n\t\treturn make(n, n, (i, j) -> i == j ? ring.mul().e() : ring.add().e());\n\t}\n\n\tstatic AbelianGroup> add(int m, int n, Ring ring) {\n\t\treturn AbelianGroup.make((a, b) -> add(a, b, ring), a -> neg(a, ring), make(m, n, 0, ring.zero(), ring.zero()));\n\t}\n\n\tstatic Monoid> mulRing(int n, Ring ring) {\n\t\treturn Monoid.make((a, b) -> mul(a, b, ring), make(n, n, 1, ring.zero(), ring.one()));\n\t}\n\n\tstatic AbelianGroup> mulField(int n, Field field) {\n\t\treturn AbelianGroup.make((a, b) -> mul(a, b, field), a -> inv(a, field),\n\t\t\t\tmake(n, n, 1, field.zero(), field.one()));\n\t}\n\n\tstatic MN add(MN a, MN b, Ring ring) {\n\t\tint m = U.max(a.m, b.m);\n\t\tint n = U.max(a.n, b.n);\n\t\tAbelianGroup add = ring.add();\n\t\tif (a instanceof MN.Scalar && b instanceof MN.Scalar) {\n\t\t\tMN.Scalar as = ((MN.Scalar) a);\n\t\t\tMN.Scalar bs = ((MN.Scalar) b);\n\t\t\treturn make(m, n, as.l + bs.l, ring.zero(), add.g(as.a, bs.a));\n\t\t}\n\t\treturn make(m, n, (i, j) -> add.g(a.at(i, j), b.at(i, j)));\n\t}\n\n\tstatic MN neg(MN a, Ring ring) {\n\t\tif (a instanceof MN.Scalar) {\n\t\t\tMN.Scalar as = ((MN.Scalar) a);\n\t\t\treturn make(a.m, a.n, -as.l, ring.zero(), ring.add().inv(as.a));\n\t\t}\n\t\treturn make(a.m, a.n, (i, j) -> ring.add().inv(a.at(i, j)));\n\t}\n\n\tstatic MN mul(MN a, MN b, Ring ring) {\n\t\tint m = a.m;\n\t\tint u = U.max(a.n, b.m);\n\t\tint n = b.n;\n\t\tAbelianGroup add = ring.add();\n\t\tMonoid mul = ring.mul();\n\t\tif (a instanceof MN.Scalar && b instanceof MN.Scalar) {\n\t\t\tMN.Scalar as = ((MN.Scalar) a);\n\t\t\tMN.Scalar bs = ((MN.Scalar) b);\n\t\t\treturn make(m, n, as.l * bs.l, ring.zero(), mul.g(as.a, bs.a));\n\t\t}\n\t\treturn make(m, n, (i, j) -> {\n\t\t\tA res = ring.zero();\n\t\t\tfor (int k = 0; k < u; k++)\n\t\t\t\tres = add.g(res, mul.g(a.at(i, k), b.at(k, j)));\n\t\t\treturn res;\n\t\t});\n\t}\n\n\tstatic A det(MN a, Field field) {\n\t\treturn detInv(a, field).a;\n\t}\n\n\tstatic MN inv(MN a, Field field) {\n\t\tUP> detInv = detInv(a, field);\n\t\tif (detInv.a.equals(field.zero()))\n\t\t\tthrow new ArithmeticException(\"inverse does not exist: det=0\");\n\t\treturn detInv.b;\n\t}\n\n\t@SuppressWarnings(\"unchecked\")\n\tprivate static UP> detInv(MN a, Field field) {\n\t\tif (a.m != a.n)\n\t\t\tthrow new IllegalArgumentException(\"matrix not square\");\n\t\tif (field.zero() instanceof Long) {\n\t\t\tUP> detInv = detInvLong((MN) a, (Field) field);\n\t\t\treturn UP.make((A) detInv.a, (MN) detInv.b);\n\t\t}\n\t\tint n = a.n;\n\t\tAbelianGroup add = field.add();\n\t\tAbelianGroup mul = field.mul();\n\t\tA zero = field.zero();\n\t\tA one = field.one();\n\t\tA[][] m1 = a.toArray();\n\t\tA[][] m2 = eye(n, field).toArray();\n\t\tA res = one;\n\t\tint sign = 1;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint pivot = -1;\n\t\t\tfor (int j = i; j < n; j++) {\n\t\t\t\tif (!m1[j][i].equals(zero)) {\n\t\t\t\t\tpivot = j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (pivot == -1) {\n\t\t\t\treturn UP.make(zero, null);\n\t\t\t}\n\t\t\tif (pivot != i) {\n\t\t\t\tsign = -sign;\n\t\t\t\tA tmp;\n\t\t\t\tfor (int j = i; j < n; j++) { // [0, i) are zero\n\t\t\t\t\ttmp = m1[i][j];\n\t\t\t\t\tm1[i][j] = m1[pivot][j];\n\t\t\t\t\tm1[pivot][j] = tmp;\n\t\t\t\t}\n\t\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\t\ttmp = m2[i][j];\n\t\t\t\t\tm2[i][j] = m2[pivot][j];\n\t\t\t\t\tm2[pivot][j] = tmp;\n\t\t\t\t}\n\t\t\t}\n\t\t\tA d = m1[i][i];\n\t\t\tres = mul.g(res, d);\n\t\t\td = mul.inv(d);\n\t\t\tm1[i][i] = one;\n\t\t\tfor (int j = i + 1; j < n; j++) {\n\t\t\t\tm1[i][j] = mul.g(m1[i][j], d);\n\t\t\t}\n\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\tm2[i][j] = mul.g(m2[i][j], d);\n\t\t\t}\n\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\tif (i == j)\n\t\t\t\t\tcontinue;\n\t\t\t\tA mult = m1[j][i];\n\t\t\t\tm1[j][i] = zero;\n\t\t\t\tfor (int k = i + 1; k < n; k++) {\n\t\t\t\t\tm1[j][k] = add.g(m1[j][k], add.inv(mul.g(m1[i][k], mult)));\n\t\t\t\t}\n\t\t\t\tfor (int k = 0; k < n; k++) {\n\t\t\t\t\tm2[j][k] = add.g(m2[j][k], add.inv(mul.g(m2[i][k], mult)));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn UP.make(sign == 1 ? res : add.inv(res), make(m2));\n\t}\n\n\tprivate static UP> detInvLong(MN a, Field field) {\n\t\tif (a.m != a.n)\n\t\t\tthrow new IllegalArgumentException(\"matrix not square\");\n\t\tint n = a.n;\n\t\tAbelianGroup add = field.add();\n\t\tAbelianGroup mul = field.mul();\n\t\tlong zero = field.zero();\n\t\tlong one = field.one();\n\t\tlong[][] m1 = a.toLongArray();\n\t\tlong[][] m2 = eye(n, field).toLongArray();\n\t\tlong res = one;\n\t\tint sign = 1;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint pivot = -1;\n\t\t\tfor (int j = i; j < n; j++) {\n\t\t\t\tif (m1[j][i] != zero) {\n\t\t\t\t\tpivot = j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (pivot == -1) {\n\t\t\t\treturn UP.make(zero, null);\n\t\t\t}\n\t\t\tif (pivot != i) {\n\t\t\t\tsign = -sign;\n\t\t\t\tlong tmp;\n\t\t\t\tfor (int j = i; j < n; j++) { // [0, i) are zero\n\t\t\t\t\ttmp = m1[i][j];\n\t\t\t\t\tm1[i][j] = m1[pivot][j];\n\t\t\t\t\tm1[pivot][j] = tmp;\n\t\t\t\t}\n\t\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\t\ttmp = m2[i][j];\n\t\t\t\t\tm2[i][j] = m2[pivot][j];\n\t\t\t\t\tm2[pivot][j] = tmp;\n\t\t\t\t}\n\t\t\t}\n\t\t\tlong d = m1[i][i];\n\t\t\tres = mul.g(res, d);\n\t\t\td = mul.inv(d);\n\t\t\tm1[i][i] = one;\n\t\t\tfor (int j = i + 1; j < n; j++) {\n\t\t\t\tm1[i][j] = mul.g(m1[i][j], d);\n\t\t\t}\n\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\tm2[i][j] = mul.g(m2[i][j], d);\n\t\t\t}\n\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\tif (i == j)\n\t\t\t\t\tcontinue;\n\t\t\t\tlong mult = m1[j][i];\n\t\t\t\tm1[j][i] = zero;\n\t\t\t\tfor (int k = i + 1; k < n; k++) {\n\t\t\t\t\tm1[j][k] = add.g(m1[j][k], add.inv(mul.g(m1[i][k], mult)));\n\t\t\t\t}\n\t\t\t\tfor (int k = 0; k < n; k++) {\n\t\t\t\t\tm2[j][k] = add.g(m2[j][k], add.inv(mul.g(m2[i][k], mult)));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn UP.make(sign == 1 ? res : add.inv(res), make(m2));\n\t}\n\n\tstatic Ring> ring(int n, Ring ring) {\n\t\treturn Ring.make(add(n, n, ring), mulRing(n, ring));\n\t}\n\n\tstatic Field> field(int n, Field field) {\n\t\treturn Field.make(add(n, n, field), mulField(n, field));\n\t}\n\n\tstatic VM> vm(int n, Ring ring) {\n\t\tif (ring instanceof Field)\n\t\t\treturn vmField(n, (Field) ring);\n\t\treturn vmRing(n, ring);\n\t}\n\n\tprivate static VM> vmRing(int n, Ring ring) {\n\t\tRing> matRing = ring(n, ring);\n\t\tMonoid> matMul = matRing.mul();\n\t\tAbelianGroup add = ring.add();\n\t\tMonoid mul = ring.mul();\n\t\tA zero = add.e();\n\t\tA one = mul.e();\n\t\treturn new VM>(matRing, null, null, (a, b) -> {\n\t\t\tif (b instanceof MN.Scalar) {\n\t\t\t\tMN.Scalar bs = ((MN.Scalar) b);\n\t\t\t\tif (bs.l < 0)\n\t\t\t\t\tthrow new RuntimeException(\"pow(MN, <0) is not defined\");\n\t\t\t\treturn Alg.pow(a, bs.l, matMul);\n\t\t\t}\n\t\t\tthrow new RuntimeException(\"pow(MN, MN) is not defined\");\n\t\t}, null, l -> make(n, n, l, zero, Alg.pow(one, l, add)), a -> a);\n\t}\n\n\tprivate static VM> vmField(int n, Field field) {\n\t\tField> matField = field(n, field);\n\t\tAbelianGroup> matMul = matField.mul();\n\t\tA zero = field.zero();\n\t\tA one = field.one();\n\t\treturn new VM>(matField, (a, b) -> {\n\t\t\tif (b instanceof MN.Scalar) {\n\t\t\t\tMN.Scalar bs = ((MN.Scalar) b);\n\t\t\t\tif (bs.l < 0)\n\t\t\t\t\treturn Alg.pow(inv(a, field), -bs.l, matMul);\n\t\t\t\treturn Alg.pow(a, bs.l, matMul);\n\t\t\t}\n\t\t\tthrow new RuntimeException(\"pow(MN, MN) is not defined\");\n\t\t}, a -> inv(a, field), l -> make(n, n, l, zero, Alg.pow(one, l, field.add())), a -> a);\n\t}\n}\n\nclass VM {\n\tprivate final HashMap env;\n\tprivate final Evaluator etor;\n\tprivate final F.XX filter;\n\n\tVM(F.XXX add, F.XXX sub, F.XXX mul, F.XXX div, F.XXX mod,\n\t\t\tF.XXX pow, F.XX neg, F.XX fact, F.LX fromInt, F.XX filter) {\n\t\tenv = new HashMap();\n\t\tetor = SimpleLang.makeEvaluator((s, a) -> {\n\t\t\tenv.put(s, a);\n\t\t\treturn a;\n\t\t}, add, sub, mul, div, mod, pow, neg, fact, fromInt, s -> {\n\t\t\tif (env.containsKey(s))\n\t\t\t\treturn env.get(s);\n\t\t\tthrow new RuntimeException(\"no such variable: \" + s);\n\t\t});\n\t\tthis.filter = filter;\n\t}\n\n\tVM(Ring ring, F.XXX div, F.XXX mod, F.XXX pow, F.XX fact, F.LX fromInt,\n\t\t\tF.XX filter) {\n\t\tthis(ring.add()::g, (a, b) -> ring.add().g(a, ring.add().inv(b)), ring.mul()::g, div, mod, pow, ring.add()::inv,\n\t\t\t\tfact, fromInt, filter);\n\t}\n\n\tVM(EuclideanRing ring, F.XXX pow, F.XX fact, F.LX fromInt, F.XX filter) {\n\t\tthis(ring, ring::div, ring::mod, pow, fact, fromInt, filter);\n\t}\n\n\tvoid clear() {\n\t\tenv.clear();\n\t}\n\n\tA get(String id) {\n\t\treturn env.get(id);\n\t}\n\n\tvoid print(String id, F.XV printer) {\n\t\tprinter.f(\"\" + get(id));\n\t}\n\n\t@SafeVarargs\n\tfinal void set(String idsSp, A... as) {\n\t\tString[] ids = idsSp.trim().split(\" +\");\n\t\tint n = ids.length;\n\t\tif (as.length != n)\n\t\t\tthrow new IllegalArgumentException(\"argument size mismatch: \" + n + \" != \" + as.length);\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tset(ids[i], as[i]);\n\t}\n\n\tvoid set(String id, A a) {\n\t\tenv.put(id, filter.f(a));\n\t}\n\n\tA run(String expr) {\n\t\treturn AST.eval(SimpleLang.parse(expr), etor);\n\t}\n}\n\nclass AST { // Abstract Syntax Tree\n\tstatic class AssignOp extends AST {\n\t\tString id;\n\t\tAST r;\n\n\t\tAssignOp(String id, AST r) {\n\t\t\tthis.id = id;\n\t\t\tthis.r = r;\n\t\t}\n\n\t\tpublic String toString() {\n\t\t\treturn \"Assign(\" + id + \", \" + r + \")\";\n\t\t}\n\t}\n\n\tstatic class Multi extends AST {\n\t\tArrayList as;\n\n\t\tMulti(ArrayList as) {\n\t\t\tthis.as = as;\n\t\t}\n\n\t\tpublic String toString() {\n\t\t\tString s = \"\";\n\t\t\tfor (AST a : as)\n\t\t\t\ts += s.isEmpty() ? a : \"; \" + a;\n\t\t\treturn \"Multi(\" + s + \")\";\n\t\t}\n\t}\n\n\tstatic class BinOp extends AST {\n\t\tAST l;\n\t\tAST r;\n\t\tString op;\n\n\t\tBinOp(AST l, String op, AST r) {\n\t\t\tthis.l = l;\n\t\t\tthis.op = op;\n\t\t\tthis.r = r;\n\t\t}\n\n\t\tpublic String toString() {\n\t\t\treturn \"BinOp(\" + l + \", \" + op + \", \" + r + \")\";\n\t\t}\n\t}\n\n\tstatic class UnOp extends AST {\n\t\tAST a;\n\t\tString op;\n\n\t\tUnOp(String op, AST a) {\n\t\t\tthis.op = op;\n\t\t\tthis.a = a;\n\t\t}\n\n\t\tpublic String toString() {\n\t\t\treturn \"UnOp(\" + op + \", \" + a + \")\";\n\t\t}\n\t}\n\n\tstatic class Int extends AST {\n\t\tlong v;\n\n\t\tInt(long v) {\n\t\t\tthis.v = v;\n\t\t}\n\n\t\tpublic String toString() {\n\t\t\treturn \"Int(\" + v + \")\";\n\t\t}\n\t}\n\n\tstatic class Id extends AST {\n\t\tString s;\n\n\t\tId(String s) {\n\t\t\tthis.s = s;\n\t\t}\n\n\t\tpublic String toString() {\n\t\t\treturn \"Id(\" + s + \")\";\n\t\t}\n\t}\n\n\tstatic A eval(AST a, Evaluator etor) {\n\t\tif (a instanceof AssignOp)\n\t\t\treturn etor.assign(((AssignOp) a).id, eval(((AssignOp) a).r, etor));\n\t\tif (a instanceof Multi) {\n\t\t\tA last = null;\n\t\t\tfor (AST a2 : ((Multi) a).as)\n\t\t\t\tlast = eval(a2, etor);\n\t\t\treturn last;\n\t\t}\n\t\tif (a instanceof BinOp)\n\t\t\treturn etor.binOp(((BinOp) a).op, eval(((BinOp) a).l, etor), eval(((BinOp) a).r, etor));\n\t\tif (a instanceof UnOp)\n\t\t\treturn etor.unOp(((UnOp) a).op, eval(((UnOp) a).a, etor));\n\t\tif (a instanceof Int)\n\t\t\treturn etor.fromInt(((Int) a).v);\n\t\tif (a instanceof Id)\n\t\t\treturn etor.id(((Id) a).s);\n\t\tthrow new RuntimeException(\"unexpected ast: \" + a);\n\t}\n}\n\ninterface Evaluator {\n\tA assign(String s, A a);\n\n\tA binOp(String op, A a, A b);\n\n\tA unOp(String op, A a);\n\n\tA fromInt(long a);\n\n\tA id(String s);\n}\n\nclass Seq {\n\tArrayList as;\n\tint ptr;\n\n\tSeq(ArrayList as) {\n\t\tthis.as = as;\n\t\tptr = 0;\n\t}\n\n\tboolean hasNext(int num) {\n\t\treturn ptr + num < as.size();\n\t}\n\n\tboolean hasNext() {\n\t\treturn hasNext(0);\n\t}\n\n\tA next(int num) {\n\t\treturn ptr + num < as.size() ? as.get(ptr + num) : null;\n\t}\n\n\tA next() {\n\t\treturn next(0);\n\t}\n\n\tA read() {\n\t\treturn hasNext() ? as.get(ptr++) : null;\n\t}\n\n\tA read(A a) {\n\t\tif (!hasNext())\n\t\t\tthrow new RuntimeException(\"unexpected EOF\");\n\t\tif (!isNext(a))\n\t\t\tthrow new RuntimeException(\"expected \" + a + \" but got\" + next());\n\t\treturn read();\n\t}\n\n\tA read(F.XX f) {\n\t\tif (!hasNext())\n\t\t\tthrow new RuntimeException(\"unexpected EOF\");\n\t\tif (!f.f(next()))\n\t\t\tthrow new RuntimeException(\"f(\" + next() + \") returned false\");\n\t\treturn read();\n\t}\n\n\tboolean isNext(A a) {\n\t\treturn a.equals(next());\n\t}\n\n\tboolean isNext(@SuppressWarnings(\"unchecked\") A... as) {\n\t\tfor (A a : as)\n\t\t\tif (isNext(a))\n\t\t\t\treturn true;\n\t\treturn false;\n\t}\n\n\tboolean isNext(F.XX f) {\n\t\treturn hasNext() && f.f(next());\n\t}\n\n\tA readIf(F.XX f) {\n\t\tif (isNext(f))\n\t\t\treturn read();\n\t\treturn null;\n\t}\n\n\tA readIf(@SuppressWarnings(\"unchecked\") A... as) {\n\t\tfor (A a : as)\n\t\t\tif (isNext(a)) {\n\t\t\t\tptr++;\n\t\t\t\treturn a;\n\t\t\t}\n\t\treturn null;\n\t}\n\n\tpublic String toString() {\n\t\treturn as.toString();\n\t}\n}\n\nclass Token extends P {\n\tprivate static final int ID = 1;\n\tprivate static final int SYM = 2;\n\tprivate static final int INT = 3;\n\n\tToken(String s, int type) {\n\t\tsuper(s, type);\n\t}\n\n\tboolean is(String s) {\n\t\treturn a.equals(s);\n\t}\n\n\tstatic Token ofId(String s) {\n\t\treturn new Token(s, ID);\n\t}\n\n\tstatic Token ofSym(String s) {\n\t\treturn new Token(s, SYM);\n\t}\n\n\tstatic Token ofInt(String s) {\n\t\treturn new Token(s, INT);\n\t}\n\n\tboolean isId() {\n\t\treturn b == ID;\n\t}\n\n\tboolean isSym() {\n\t\treturn b == SYM;\n\t}\n\n\tboolean isInt() {\n\t\treturn b == INT;\n\t}\n}\n\nclass SimpleLang {\n\tprivate static class Tokenizer {\n\t\tprivate static final String SYMS = \"+-*/%^!()=;\";\n\n\t\tSeq sc;\n\t\tArrayList ts;\n\n\t\tTokenizer(String s) {\n\t\t\tsc = new Seq(U.make(s.length(), i -> s.charAt(i)));\n\t\t}\n\n\t\tSeq parse() {\n\t\t\tts = new ArrayList();\n\t\t\tparseAll();\n\t\t\treturn new Seq(ts);\n\t\t}\n\n\t\tprivate static boolean isSpace(char c) {\n\t\t\treturn c == ' ' || c == '\\t' || c == '\\r' || c == '\\n';\n\t\t}\n\n\t\tprivate static boolean isDigit(char c) {\n\t\t\treturn c >= '0' && c <= '9';\n\t\t}\n\n\t\tprivate static boolean isSymbol(char c) {\n\t\t\treturn SYMS.indexOf(c) != -1;\n\t\t}\n\n\t\tprivate static boolean isAlpha(char c) {\n\t\t\treturn c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c == '_';\n\t\t}\n\n\t\tprivate void parseAll() {\n\t\t\twhile (sc.hasNext()) {\n\t\t\t\twhile (sc.isNext(Tokenizer::isSpace))\n\t\t\t\t\tsc.read();\n\t\t\t\tif (!sc.hasNext())\n\t\t\t\t\tbreak;\n\t\t\t\tif (sc.isNext(Tokenizer::isAlpha)) {\n\t\t\t\t\tparseId();\n\t\t\t\t} else if (sc.isNext(Tokenizer::isDigit)) {\n\t\t\t\t\tparseInt();\n\t\t\t\t} else if (sc.isNext(Tokenizer::isSymbol)) {\n\t\t\t\t\tparseSym();\n\t\t\t\t} else {\n\t\t\t\t\tthrow new RuntimeException(\"invalid character: \" + sc.next());\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tprivate void parseId() {\n\t\t\tString s = sc.read().toString();\n\t\t\twhile (sc.isNext(Tokenizer::isAlpha) || sc.isNext(Tokenizer::isDigit))\n\t\t\t\ts += sc.read().toString();\n\t\t\tts.add(Token.ofId(s));\n\t\t}\n\n\t\tprivate void parseInt() {\n\t\t\tString s = sc.read().toString();\n\t\t\twhile (sc.isNext(Tokenizer::isDigit))\n\t\t\t\ts += sc.read().toString();\n\t\t\tts.add(Token.ofInt(s));\n\t\t}\n\n\t\tprivate void parseSym() {\n\t\t\tString s = sc.read().toString();\n\t\t\tts.add(Token.ofSym(s));\n\t\t}\n\t}\n\n\tprivate static class Parser {\n\t\tSeq ts;\n\n\t\tParser(Seq ts) {\n\t\t\tthis.ts = ts;\n\t\t}\n\n\t\tAST parse() {\n\t\t\treturn parseExpr();\n\t\t}\n\n\t\tprivate AST parseExpr() {\n\t\t\treturn parseMultiExpr();\n\t\t}\n\n\t\tprivate AST parseMultiExpr() {\n\t\t\treadSemicolons();\n\t\t\tAST a = parseAssignExpr();\n\t\t\tif (readSemicolons()) {\n\t\t\t\tArrayList as = new ArrayList();\n\t\t\t\tas.add(a);\n\t\t\t\tdo {\n\t\t\t\t\tif (!ts.hasNext())\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tas.add(parseAssignExpr());\n\t\t\t\t} while (readSemicolons());\n\t\t\t\tif (as.size() == 1)\n\t\t\t\t\treturn a;\n\t\t\t\treturn new AST.Multi(as);\n\t\t\t}\n\t\t\treturn a;\n\t\t}\n\n\t\tprivate boolean readSemicolons() {\n\t\t\tif (!ts.isNext(t -> t.is(\";\")))\n\t\t\t\treturn false;\n\t\t\tdo {\n\t\t\t\tts.read();\n\t\t\t} while (ts.isNext(t -> t.is(\";\")));\n\t\t\treturn true;\n\t\t}\n\n\t\tprivate AST parseAssignExpr() {\n\t\t\tAST a = parseAddSubOp();\n\t\t\tif (ts.isNext(t -> t.is(\"=\"))) {\n\t\t\t\tts.read();\n\t\t\t\tif (!(a instanceof AST.Id))\n\t\t\t\t\tthrow new RuntimeException(\"cannot assign to \" + a);\n\t\t\t\treturn new AST.AssignOp(((AST.Id) a).s, parseAssignExpr());\n\t\t\t}\n\t\t\treturn a;\n\t\t}\n\n\t\tprivate AST parseAddSubOp() {\n\t\t\tAST a = parseMulDivModOp();\n\t\t\twhile (ts.isNext(t -> t.is(\"+\") || t.is(\"-\")))\n\t\t\t\ta = new AST.BinOp(a, ts.read().a, parseMulDivModOp());\n\t\t\treturn a;\n\t\t}\n\n\t\tprivate AST parseMulDivModOp() {\n\t\t\tAST a = parsePowOp();\n\t\t\twhile (ts.isNext(t -> t.is(\"*\") || t.is(\"/\") || t.is(\"%\")))\n\t\t\t\ta = new AST.BinOp(a, ts.read().a, parsePowOp());\n\t\t\treturn a;\n\t\t}\n\n\t\tprivate AST parsePowOp() {\n\t\t\tAST a = parseNegateOp();\n\t\t\tif (ts.isNext(t -> t.is(\"^\")))\n\t\t\t\treturn new AST.BinOp(a, ts.read().a, parsePowOp());\n\t\t\treturn a;\n\t\t}\n\n\t\tprivate AST parseNegateOp() {\n\t\t\tif (ts.isNext(t -> t.is(\"-\")))\n\t\t\t\treturn new AST.UnOp(ts.read().a, parseNegateOp());\n\t\t\treturn parseFactOp();\n\t\t}\n\n\t\tprivate AST parseFactOp() {\n\t\t\tAST a = parsePrimary();\n\t\t\twhile (ts.isNext(t -> t.is(\"!\")))\n\t\t\t\ta = new AST.UnOp(ts.read().a, a);\n\t\t\treturn a;\n\t\t}\n\n\t\tprivate AST parsePrimary() {\n\t\t\tif (ts.isNext(t -> t.isId()))\n\t\t\t\treturn new AST.Id(ts.read().a);\n\t\t\tif (ts.isNext(t -> t.isInt()))\n\t\t\t\treturn new AST.Int(Long.parseLong(ts.read().a));\n\t\t\tif (ts.readIf(t -> t.is(\"(\")) != null) {\n\t\t\t\tAST e = parseExpr();\n\t\t\t\tts.read(t -> t.is(\")\"));\n\t\t\t\treturn e;\n\t\t\t}\n\t\t\tthrow new RuntimeException(\"unexpected token: \" + ts.next());\n\t\t}\n\t}\n\n\tstatic HashMap cache = new HashMap();\n\n\tstatic Evaluator makeEvaluator(F.XXX assign, F.XXX add, F.XXX sub,\n\t\t\tF.XXX mul, F.XXX div, F.XXX mod, F.XXX pow, F.XX neg,\n\t\t\tF.XX fact, F.LX fromInt, F.XX id) {\n\t\treturn new Evaluator() {\n\t\t\tpublic A assign(String s, A a) {\n\t\t\t\treturn assign.f(s, a);\n\t\t\t}\n\n\t\t\tpublic A binOp(String op, A a, A b) {\n\t\t\t\tswitch (op) {\n\t\t\t\tcase \"+\":\n\t\t\t\t\treturn add.f(a, b);\n\t\t\t\tcase \"-\":\n\t\t\t\t\treturn sub.f(a, b);\n\t\t\t\tcase \"*\":\n\t\t\t\t\treturn mul.f(a, b);\n\t\t\t\tcase \"/\":\n\t\t\t\t\treturn div.f(a, b);\n\t\t\t\tcase \"%\":\n\t\t\t\t\treturn mod.f(a, b);\n\t\t\t\tcase \"^\":\n\t\t\t\t\treturn pow.f(a, b);\n\t\t\t\t}\n\t\t\t\tthrow new RuntimeException(\"invalid binOp: \" + op);\n\t\t\t}\n\n\t\t\tpublic A unOp(String op, A a) {\n\t\t\t\tswitch (op) {\n\t\t\t\tcase \"-\":\n\t\t\t\t\treturn neg.f(a);\n\t\t\t\tcase \"!\":\n\t\t\t\t\treturn fact.f(a);\n\t\t\t\t}\n\t\t\t\tthrow new RuntimeException(\"invalid unOp: \" + op);\n\t\t\t}\n\n\t\t\tpublic A fromInt(long a) {\n\t\t\t\treturn fromInt.f(a);\n\t\t\t}\n\n\t\t\tpublic A id(String s) {\n\t\t\t\treturn id.f(s);\n\t\t\t}\n\t\t};\n\t}\n\n\tstatic AST parse(String s) {\n\t\tif (cache.containsKey(cache)) {\n\t\t\treturn cache.get(s);\n\t\t}\n\t\tTokenizer l = new Tokenizer(s);\n\t\tSeq ts = l.parse();\n\t\tParser p = new Parser(ts);\n\t\tAST a = p.parse();\n\t\tcache.put(s, a);\n\t\treturn a;\n\t}\n}\n\nclass Mod {\n\tfinal long mod;\n\tfinal AbelianGroup add;\n\tfinal AbelianGroup mul;\n\tfinal Field field;\n\tfinal VM vm;\n\tprivate final boolean prime;\n\tprivate final HashMap logMap;\n\tprivate long[] facts;\n\tprivate long[] invs;\n\tprivate long[] invFacts;\n\tprivate long[] factors;\n\n\tMod(long mod) {\n\t\tthis.mod = mod;\n\t\tprepareFacts(0);\n\t\tprime = BigInteger.valueOf(mod).isProbablePrime(100);\n\t\tadd = AbelianGroup.make((a, b) -> (a + b) % mod, a -> mod - a, 0l);\n\t\tmul = AbelianGroup.make((a, b) -> (a * b) % mod, a -> {\n\t\t\tif (prime)\n\t\t\t\treturn pow(a, mod - 2);\n\t\t\tTL t = Alg.extgcd(a, mod);\n\t\t\tif (t.c != 1)\n\t\t\t\tthrow new ArithmeticException(\"inv(\" + a + \") does not exist\");\n\t\t\treturn (t.a % mod + mod) % mod;\n\t\t}, 1l);\n\t\tfield = Field.make(add, mul);\n\t\tlogMap = new HashMap();\n\t\tvm = new VM(field, this::pow, this::fact, a -> (a % mod + mod) % mod, a -> (a % mod + mod) % mod);\n\t}\n\n\tlong fact(long a) {\n\t\tif (a >= Integer.MAX_VALUE)\n\t\t\tthrow new RuntimeException(\"fact(\" + a + \") too big\");\n\t\tprepareFacts((int) a);\n\t\treturn facts[(int) (a % mod)];\n\t}\n\n\tlong invFact(int a) {\n\t\tprepareFacts(a);\n\t\treturn invFacts[(int) (a % mod)];\n\t}\n\n\tlong inv(long a) {\n\t\treturn mul.inv(a);\n\t}\n\n\tlong pow(long a, long b) {\n\t\tif (b == 0)\n\t\t\treturn 1;\n\t\tif (b == 1)\n\t\t\treturn a;\n\t\tif (b < 0) {\n\t\t\ta = inv(a);\n\t\t\tb = -b;\n\t\t}\n\t\ta %= mod;\n\t\tlong res = 1;\n\t\twhile (b > 0) {\n\t\t\tif ((b & 1) != 0)\n\t\t\t\tres = res * a % mod;\n\t\t\ta = a * a % mod;\n\t\t\tb >>= 1;\n\t\t}\n\t\treturn res;\n\t}\n\n\tlong order(long a) { // computes the order of `a` in O(sqrt(mod)) time\n\t\ta %= mod;\n\t\tif (a == 0)\n\t\t\treturn 0;\n\t\tif (a == 1)\n\t\t\treturn 1;\n\t\tif (factors == null) {\n\t\t\tArrayList fs = new ArrayList();\n\t\t\tfor (long i = 2; i * i < mod; i++) {\n\t\t\t\tif ((mod - 1) % i == 0)\n\t\t\t\t\tfs.add(i);\n\t\t\t}\n\t\t\tfactors = new long[fs.size()];\n\t\t\tfor (int i = 0; i < fs.size(); i++) {\n\t\t\t\tfactors[i] = fs.get(i);\n\t\t\t}\n\t\t}\n\t\tfor (long f : factors) {\n\t\t\tif (pow(a, f) == 1)\n\t\t\t\treturn f;\n\t\t}\n\t\treturn mod - 1;\n\t}\n\n\tPL log(long a, long b) { // log_b(a) in O(sqrt(mod)) time\n\t\ta %= mod;\n\t\tb %= mod;\n\t\tif (b == 1 || b == 0)\n\t\t\treturn a == b ? PL.make(1, 1) : PL.make(-1, 0);\n\t\tif (a == 0)\n\t\t\treturn PL.make(-1, 0);\n\t\tlong order = order(b);\n\t\tif (a == 1)\n\t\t\treturn PL.make(0, order);\n\t\tlong orderSqrtL = sqrtCeil(order);\n\t\tif (orderSqrtL > Integer.MAX_VALUE)\n\t\t\tthrow new RuntimeException(\"order(\" + b + \") too big: \" + order);\n\t\tint orderSqrt = (int) sqrtCeil(order);\n\t\tlogMap.clear();\n\t\tlogMap.put(1l, 0);\n\t\tlong p = 1;\n\t\tfor (int i = 1; i < orderSqrt; i++) {\n\t\t\tp = p * b % mod;\n\t\t\tlogMap.put(p, i);\n\t\t}\n\t\tlong ib = pow(b, mod - orderSqrt - 1);\n\t\tp = a;\n\t\tfor (int i = 1; i < orderSqrt; i++) {\n\t\t\tp = p * ib % mod;\n\t\t\tif (logMap.containsKey(p))\n\t\t\t\treturn PL.make((i * orderSqrt + logMap.get(p)) % order, order);\n\t\t}\n\t\treturn PL.make(-1, 0);\n\t}\n\n\tprivate long sqrtCeil(long a) {\n\t\treturn U.searchL((long) Math.sqrt(a * 0.9), (long) Math.sqrt(a * 1.1) + 1, mid -> mid * mid >= a);\n\t}\n\n\tprivate void prepareFacts(int n) {\n\t\tif (facts == null) {\n\t\t\tfacts = new long[1024];\n\t\t\tinvs = new long[1024];\n\t\t\tinvFacts = new long[1024];\n\t\t\tprepareFactsIn(0, 1024);\n\t\t}\n\t\tif (n >= mod)\n\t\t\tn = (int) (mod - 1);\n\t\twhile (facts.length <= n) {\n\t\t\tint prevL = facts.length;\n\t\t\tint newL = prevL << 1;\n\t\t\tfacts = Arrays.copyOf(facts, newL);\n\t\t\tinvs = Arrays.copyOf(invs, newL);\n\t\t\tinvFacts = Arrays.copyOf(invFacts, newL);\n\t\t\tprepareFactsIn(prevL, newL);\n\t\t}\n\t}\n\n\tprivate void prepareFactsIn(int from, int until) {\n\t\tif (until > mod)\n\t\t\tuntil = (int) mod;\n\t\tfor (int i = from; i < until; i++) {\n\t\t\tif (i == 0) {\n\t\t\t\tfacts[0] = 1;\n\t\t\t\tinvs[0] = 0;\n\t\t\t\tinvFacts[0] = 1;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (i == 1) {\n\t\t\t\tfacts[1] = 1;\n\t\t\t\tinvs[1] = 1;\n\t\t\t\tinvFacts[1] = 1;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tfacts[i] = facts[i - 1] * i % mod;\n\t\t\tinvs[i] = (mod - mod / i) * invs[(int) (mod % i)] % mod;\n\t\t\tinvFacts[i] = invFacts[i - 1] * invs[i] % mod;\n\t\t}\n\t}\n}\n", "language": "Java", "metadata": {"date": 1598728167, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02572.html", "problem_id": "p02572", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02572/input.txt", "sample_output_relpath": "derived/input_output/data/p02572/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02572/Java/s587414259.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s587414259", "user_id": "u160281075"}, "prompt_components": {"gold_output": "11\n", "input_to_evaluate": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.lang.reflect.Array;\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Comparator;\nimport java.util.HashMap;\nimport java.util.Map.Entry;\nimport java.util.NoSuchElementException;\nimport java.util.Set;\nimport java.util.TreeMap;\nimport java.util.TreeSet;\n\npublic class Main {\n\n\tprivate static void solve() {\n\t\tint n = ni();\n\t\tlong[] as = nls(n);\n\t\tlong m = 1000000007l;\n\t\tMod mod = new Mod(m);\n\t\tlong sum = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tsum += as[i];\n\t\t\tsum %= m;\n\t\t}\n\t\tlong ans = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tans += as[i] * (sum - as[i] + m);\n\t\t\tans %= m;\n\t\t}\n\t\tif (ans % 2 == 0)\n\t\t\tans /= 2;\n\t\telse\n\t\t\tans = (ans + m) / 2 % m;\n\t\tout(ans);\n\t}\n\n\tstatic int min(int a, int b) {\n\t\treturn a < b ? a : b;\n\t}\n\n\tstatic long min(long a, long b) {\n\t\treturn a < b ? a : b;\n\t}\n\n\tstatic > A min(A a, A b) {\n\t\treturn a.compareTo(b) < 0 ? a : b;\n\t}\n\n\tstatic int max(int a, int b) {\n\t\treturn a > b ? a : b;\n\t}\n\n\tstatic long max(long a, long b) {\n\t\treturn a > b ? a : b;\n\t}\n\n\tstatic > A max(A a, A b) {\n\t\treturn a.compareTo(b) > 0 ? a : b;\n\t}\n\n\tstatic int clamp(int a, int min, int max) {\n\t\treturn a < min ? min : a > max ? max : a;\n\t}\n\n\tstatic long clamp(long a, long min, long max) {\n\t\treturn a < min ? min : a > max ? max : a;\n\t}\n\n\tstatic int abs(int a) {\n\t\treturn a < 0 ? -a : a;\n\t}\n\n\tstatic long abs(long a) {\n\t\treturn a < 0 ? -a : a;\n\t}\n\n\tstatic > A clamp(A a, A min, A max) {\n\t\treturn a.compareTo(min) < 0 ? min : a.compareTo(max) > 0 ? max : a;\n\t}\n\n\tstatic void out(String val) {\n\t\tIO.out(val);\n\t}\n\n\tstatic void out(Object val) {\n\t\tIO.out(String.valueOf(val));\n\t}\n\n\tstatic void out(int val) {\n\t\tIO.out(String.valueOf(val));\n\t}\n\n\tstatic void out(long val) {\n\t\tIO.out(String.valueOf(val));\n\t}\n\n\tstatic void out(char val) {\n\t\tIO.out(String.valueOf(val));\n\t}\n\n\tstatic void out(double val) {\n\t\tIO.out(Double.isFinite(val) ? BigDecimal.valueOf(val).toPlainString() : String.valueOf(val));\n\t}\n\n\tstatic void out(boolean val) {\n\t\tIO.out(val ? \"true\" : \"false\");\n\t}\n\n\tstatic void outn(String val) {\n\t\tIO.outn(val);\n\t}\n\n\tstatic void outn(Object val) {\n\t\tIO.outn(String.valueOf(val));\n\t}\n\n\tstatic void outn(int val) {\n\t\tIO.outn(String.valueOf(val));\n\t}\n\n\tstatic void outn(long val) {\n\t\tIO.outn(String.valueOf(val));\n\t}\n\n\tstatic void outn(char val) {\n\t\tIO.outn(String.valueOf(val));\n\t}\n\n\tstatic void outn(double val) {\n\t\tIO.outn(Double.isFinite(val) ? BigDecimal.valueOf(val).toPlainString() : String.valueOf(val));\n\t}\n\n\tstatic void outn(boolean val) {\n\t\tIO.outn(val ? \"true\" : \"false\");\n\t}\n\n\tstatic void kil(String val) {\n\t\tIO.out(val);\n\t\tIO.flush();\n\t\tSystem.exit(0);\n\t}\n\n\tstatic void kil(Object val) {\n\t\tIO.out(String.valueOf(val));\n\t\tIO.flush();\n\t\tSystem.exit(0);\n\t}\n\n\tstatic void kil(int val) {\n\t\tIO.out(String.valueOf(val));\n\t\tIO.flush();\n\t\tSystem.exit(0);\n\t}\n\n\tstatic void kil(long val) {\n\t\tIO.out(String.valueOf(val));\n\t\tIO.flush();\n\t\tSystem.exit(0);\n\t}\n\n\tstatic void kil(char val) {\n\t\tIO.out(String.valueOf(val));\n\t\tIO.flush();\n\t\tSystem.exit(0);\n\t}\n\n\tstatic void kil(double val) {\n\t\tIO.out(Double.isFinite(val) ? BigDecimal.valueOf(val).toPlainString() : String.valueOf(val));\n\t\tIO.flush();\n\t\tSystem.exit(0);\n\t}\n\n\tstatic void kil(boolean val) {\n\t\tIO.out(val ? \"true\" : \"false\");\n\t\tIO.flush();\n\t\tSystem.exit(0);\n\t}\n\n\tstatic String ns() {\n\t\treturn IO.next();\n\t}\n\n\tstatic int ni() {\n\t\treturn IO.nextInt();\n\t}\n\n\tstatic long nl() {\n\t\treturn IO.nextLong();\n\t}\n\n\tstatic double nd() {\n\t\treturn IO.nextDouble();\n\t}\n\n\tstatic char nc() {\n\t\treturn IO.nextChar();\n\t}\n\n\tstatic String[] nss(int n) {\n\t\tString[] as = new String[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tas[i] = IO.next();\n\t\t}\n\t\treturn as;\n\t}\n\n\tstatic int[] nis(int n) {\n\t\tint[] as = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tas[i] = IO.nextInt();\n\t\t}\n\t\treturn as;\n\t}\n\n\tstatic long[] nls(int n) {\n\t\tlong[] as = new long[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tas[i] = IO.nextLong();\n\t\t}\n\t\treturn as;\n\t}\n\n\tstatic double[] nds(int n) {\n\t\tdouble[] as = new double[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tas[i] = IO.nextDouble();\n\t\t}\n\t\treturn as;\n\t}\n\n\tstatic char[] ncs(int n) {\n\t\tchar[] as = new char[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tas[i] = IO.nextChar();\n\t\t}\n\t\treturn as;\n\t}\n\n\tstatic String[][] nss2(int n, int m) {\n\t\tString[][] as = new String[n][m];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tfor (int j = 0; j < m; j++) {\n\t\t\t\tas[i][j] = IO.next();\n\t\t\t}\n\t\t}\n\t\treturn as;\n\t}\n\n\tstatic int[][] nis2(int n, int m) {\n\t\tint[][] as = new int[n][m];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tfor (int j = 0; j < m; j++) {\n\t\t\t\tas[i][j] = IO.nextInt();\n\t\t\t}\n\t\t}\n\t\treturn as;\n\t}\n\n\tstatic long[][] nls2(int n, int m) {\n\t\tlong[][] as = new long[n][m];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tfor (int j = 0; j < m; j++) {\n\t\t\t\tas[i][j] = IO.nextLong();\n\t\t\t}\n\t\t}\n\t\treturn as;\n\t}\n\n\tstatic double[][] nds2(int n, int m) {\n\t\tdouble[][] as = new double[n][m];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tfor (int j = 0; j < m; j++) {\n\t\t\t\tas[i][j] = IO.nextDouble();\n\t\t\t}\n\t\t}\n\t\treturn as;\n\t}\n\n\tstatic char[][] ncs2(int n, int m) {\n\t\tchar[][] as = new char[n][m];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tfor (int j = 0; j < m; j++) {\n\t\t\t\tas[i][j] = IO.nextChar();\n\t\t\t}\n\t\t}\n\t\treturn as;\n\t}\n\n\tstatic int parseInt(String val) {\n\t\treturn Integer.parseInt(val);\n\t}\n\n\tstatic long parseLong(String val) {\n\t\treturn Long.parseLong(val);\n\t}\n\n\tpublic static void main(String[] args) {\n\t\ttry {\n\t\t\tsolve();\n\t\t\tIO.flush();\n\t\t} catch (NumberFormatException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (OutOfMemoryError e) {\n\t\t\te.printStackTrace(); // this will be detected as RE\n\t\t}\n\t}\n}\n\nfinal class IO {\n\tprivate static final InputStream in = System.in;\n\tprivate static final PrintWriter out = new PrintWriter(System.out, false);\n\tprivate static final byte[] buffer = new byte[1024];\n\tprivate static int ptr = 0;\n\tprivate static int len = 0;\n\n\tprivate static boolean hasNextByte() {\n\t\tif (ptr < len)\n\t\t\treturn true;\n\t\tptr = 0;\n\t\ttry {\n\t\t\tlen = in.read(buffer);\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn len > 0;\n\t}\n\n\tprivate static int readByte() {\n\t\tif (hasNextByte())\n\t\t\treturn buffer[ptr++];\n\t\telse\n\t\t\treturn -1;\n\t}\n\n\tstatic boolean hasNext() {\n\t\tbyte c;\n\t\twhile (hasNextByte() && ((c = buffer[ptr]) < '!' || c > '~'))\n\t\t\tptr++;\n\t\treturn hasNextByte();\n\t}\n\n\tstatic String next() {\n\t\tif (!hasNext())\n\t\t\tthrow new NoSuchElementException();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint b = readByte();\n\t\twhile (b >= '!' && b <= '~') {\n\t\t\tsb.append((char) b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\n\tstatic char nextChar() {\n\t\tif (!hasNext())\n\t\t\tthrow new NoSuchElementException();\n\t\treturn (char) readByte();\n\t}\n\n\tstatic long nextLong() {\n\t\tif (!hasNext())\n\t\t\tthrow new NoSuchElementException();\n\t\tlong n = 0;\n\t\tint sign = 1;\n\t\tint b = readByte();\n\t\tif (b == '-') {\n\t\t\tsign = -1;\n\t\t\tb = readByte();\n\t\t}\n\t\tif (b < '0' || '9' < b)\n\t\t\tthrow new NumberFormatException();\n\t\twhile (true) {\n\t\t\tif ('0' <= b && b <= '9')\n\t\t\t\tn = n * 10 + b - '0';\n\t\t\telse if (b == -1 || b < '!' || b > '~')\n\t\t\t\treturn n * sign;\n\t\t\telse\n\t\t\t\tthrow new NumberFormatException();\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n\tstatic int nextInt() {\n\t\tif (!hasNext())\n\t\t\tthrow new NoSuchElementException();\n\t\tint n = 0;\n\t\tint sign = 1;\n\t\tint b = readByte();\n\t\tif (b == '-') {\n\t\t\tsign = -1;\n\t\t\tb = readByte();\n\t\t}\n\t\tif (b < '0' || '9' < b)\n\t\t\tthrow new NumberFormatException();\n\t\twhile (true) {\n\t\t\tif ('0' <= b && b <= '9')\n\t\t\t\tn = n * 10 + b - '0';\n\t\t\telse if (b == -1 || b < '!' || b > '~')\n\t\t\t\treturn n * sign;\n\t\t\telse\n\t\t\t\tthrow new NumberFormatException();\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n\tstatic double nextDouble() {\n\t\treturn Double.parseDouble(next());\n\t}\n\n\tstatic void out(String val) {\n\t\tout.println(val);\n\t}\n\n\tstatic void outn(String val) {\n\t\tout.print(val);\n\t}\n\n\tstatic void flush() {\n\t\tout.flush();\n\t}\n}\n\n// TODO: paste library here\n\nclass UF { // Union Find Tree\n\tprivate int[] parents;\n\tprivate int[] ranks;\n\tprivate ArrayList roots;\n\tprivate F.XXX merger;\n\n\tUF(int n, F.IX maker, F.XXX merger) {\n\t\tthis.merger = merger;\n\t\tparents = new int[n];\n\t\tranks = new int[n];\n\t\troots = U.make(n, maker);\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tparents[i] = i;\n\t\t}\n\t}\n\n\tint index(int i) {\n\t\tint p = parents[i];\n\t\tif (i == p) {\n\t\t\treturn i;\n\t\t}\n\t\treturn parents[i] = index(p);\n\t}\n\n\tboolean same(int i, int j) {\n\t\treturn index(i) == index(j);\n\t}\n\n\tA root(int i) {\n\t\treturn roots.get(index(i));\n\t}\n\n\tvoid unite(int i, int j) {\n\t\ti = index(i);\n\t\tj = index(j);\n\t\tif (i == j)\n\t\t\treturn;\n\t\tA r = merger.f(root(i), root(j));\n\t\tif (ranks[i] < ranks[j]) {\n\t\t\ti ^= j;\n\t\t\tj ^= i;\n\t\t\ti ^= j;\n\t\t}\n\t\tparents[j] = i;\n\t\troots.set(i, r);\n\t\tif (ranks[i] == ranks[j])\n\t\t\tranks[i]++;\n\t}\n}\n\nclass MS {\n\tprivate TreeMap tm;\n\n\tMS() {\n\t\ttm = new TreeMap();\n\t}\n\n\tMS(Comparator comp) {\n\t\ttm = new TreeMap(comp);\n\t}\n\n\tvoid add(A a, long num) {\n\t\tif (tm.containsKey(a))\n\t\t\ttm.put(a, tm.get(a) + num);\n\t\telse\n\t\t\ttm.put(a, num);\n\t}\n\n\tvoid add(A a) {\n\t\tadd(a, 1);\n\t}\n\n\tlong remove(A a, long num) {\n\t\tif (tm.containsKey(a)) {\n\t\t\tlong n = tm.get(a);\n\t\t\tif (n <= num) {\n\t\t\t\ttm.remove(a);\n\t\t\t\treturn n;\n\t\t\t}\n\t\t\ttm.put(a, n - num);\n\t\t\treturn num;\n\t\t}\n\t\treturn 0;\n\t}\n\n\tboolean remove(A a) {\n\t\treturn remove(a, 1) == 1;\n\t}\n\n\tlong removeAll(A a) {\n\t\treturn remove(a, Long.MAX_VALUE);\n\t}\n\n\tlong num(A a) {\n\t\treturn tm.containsKey(a) ? tm.get(a) : 0;\n\t}\n\n\tint size() {\n\t\treturn tm.size();\n\t}\n\n\tA floor(A a) {\n\t\treturn tm.floorKey(a);\n\t}\n\n\tUP floorNum(A a) {\n\t\tEntry e = tm.floorEntry(a);\n\t\treturn e == null ? null : UP.make(e.getKey(), e.getValue());\n\t}\n\n\tA ceil(A a) {\n\t\treturn tm.ceilingKey(a);\n\t}\n\n\tUP ceilNum(A a) {\n\t\tEntry e = tm.ceilingEntry(a);\n\t\treturn e == null ? null : UP.make(e.getKey(), e.getValue());\n\t}\n\n\tvoid clear() {\n\t\ttm.clear();\n\t}\n\n\tSet keySet() {\n\t\treturn tm.keySet();\n\t}\n\n\tCollection valueSet() {\n\t\treturn tm.values();\n\t}\n\n\tSet> entrySet() {\n\t\treturn tm.entrySet();\n\t}\n\n\tpublic String toString() {\n\t\treturn tm.toString();\n\t}\n}\n\nclass WUF { // Weighted Union Find Tree\n\tprivate int[] parents;\n\tprivate int[] ranks;\n\tprivate ArrayList roots;\n\tprivate ArrayList weights;\n\tprivate F.XXX merger;\n\tprivate F.XXX add;\n\tprivate F.XX inv;\n\tprivate W e;\n\n\tWUF(int n, F.IX maker, F.XXX merger, F.XXX add, F.XX inv, W e) {\n\t\tthis.merger = merger;\n\t\tthis.add = add;\n\t\tthis.inv = inv;\n\t\tthis.e = e;\n\t\tparents = new int[n];\n\t\tranks = new int[n];\n\t\troots = U.make(n, maker);\n\t\tweights = U.make(n, i -> e);\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tparents[i] = i;\n\t\t}\n\t}\n\n\tint index(int i) {\n\t\tint p = parents[i];\n\t\tif (i == p) {\n\t\t\treturn i;\n\t\t}\n\t\tint r = index(p);\n\t\tweights.set(i, add.f(weights.get(i), weights.get(p)));\n\t\treturn parents[i] = r;\n\t}\n\n\tboolean same(int i, int j) {\n\t\treturn index(i) == index(j);\n\t}\n\n\tA root(int i) {\n\t\treturn roots.get(index(i));\n\t}\n\n\tW weight(int i) {\n\t\tindex(i);\n\t\treturn weights.get(i);\n\t}\n\n\tW diff(int i, int j) {\n\t\treturn sub(weight(j), weight(i));\n\t}\n\n\tvoid unite(int i, int j, W w) {\n\t\tw = add(w, weight(i));\n\t\tw = sub(w, weight(j));\n\t\ti = index(i);\n\t\tj = index(j);\n\t\tif (i == j)\n\t\t\treturn;\n\t\tA r = merger.f(root(i), root(j));\n\t\tif (ranks[i] < ranks[j]) {\n\t\t\ti ^= j;\n\t\t\tj ^= i;\n\t\t\ti ^= j;\n\t\t\tw = inv.f(w);\n\t\t}\n\t\tparents[j] = i;\n\t\troots.set(i, r);\n\t\tif (ranks[i] == ranks[j])\n\t\t\tranks[i]++;\n\t\tweights.set(j, w);\n\t}\n\n\tprivate W add(W a, W b) {\n\t\treturn a == e ? b : b == e ? a : add.f(a, b);\n\t}\n\n\tprivate W sub(W a, W b) {\n\t\treturn b == e ? a : add(a, inv.f(b));\n\t}\n}\n\nclass PQ { // Priority Queue\n\tstatic class E { // Entry\n\t\tprivate Object a;\n\t\tprivate int index;\n\n\t\tprivate E(Object a, int index) {\n\t\t\tthis.a = a;\n\t\t\tthis.index = index;\n\t\t}\n\t}\n\n\tprivate int n;\n\tprivate E[] as;\n\tprivate Comparator comp;\n\n\tPQ(Comparator comp) {\n\t\tthis.comp = comp;\n\t\tas = new E[64];\n\t\tn = 1;\n\t}\n\n\tE add(A a) {\n\t\tE res = addEntry(a);\n\t\tfixUp(n - 1);\n\t\treturn res;\n\t}\n\n\tA pop() {\n\t\tint max = n - 1;\n\t\tif (max == 0)\n\t\t\treturn null;\n\t\tif (max == 1) {\n\t\t\treturn removeLast();\n\t\t}\n\n\t\tE tmp = as[1];\n\t\tas[1] = as[max];\n\t\tas[max] = tmp;\n\t\tas[1].index = 1;\n\t\tas[max].index = max;\n\n\t\tA res = removeLast();\n\t\tfixDown(1);\n\t\treturn res;\n\t}\n\n\t@SuppressWarnings(\"unchecked\")\n\tA get(E e) {\n\t\treturn (A) e.a;\n\t}\n\n\tvoid remove(E e) {\n\t\tint k = ((E) e).index;\n\t\tint max = n - 1;\n\t\tif (k == max) {\n\t\t\tremoveLast();\n\t\t\treturn;\n\t\t}\n\n\t\tE tmp = as[k];\n\t\tas[k] = as[max];\n\t\tas[max] = tmp;\n\t\tas[k].index = k;\n\t\tas[max].index = max;\n\n\t\tremoveLast();\n\t\tif (!fixDown(k))\n\t\t\tfixUp(k);\n\t}\n\n\tvoid update(E e, A a) {\n\t\tint k = e.index;\n\t\tas[k].a = a;\n\t\tif (!fixDown(k))\n\t\t\tfixUp(k);\n\t}\n\n\tboolean isEmpty() {\n\t\treturn n == 1;\n\t}\n\n\t@SuppressWarnings(\"unchecked\")\n\tprivate A removeLast() {\n\t\tn--;\n\t\tE res = as[n];\n\t\tres.index = -1;\n\t\tas[n] = null;\n\t\treturn (A) res.a;\n\t}\n\n\t@SuppressWarnings(\"unchecked\")\n\tprivate boolean fixUp(int k) {\n\t\tboolean res = false;\n\t\twhile (k > 1) {\n\t\t\tint nk = k >> 1;\n\t\t\tif (comp.compare((A) as[k].a, (A) as[nk].a) < 0) {\n\t\t\t\tE tmp = as[k];\n\t\t\t\tas[k] = as[nk];\n\t\t\t\tas[nk] = tmp;\n\t\t\t\tas[k].index = k;\n\t\t\t\tas[nk].index = nk;\n\t\t\t\tk = nk;\n\t\t\t\tres = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\treturn res;\n\t}\n\n\t@SuppressWarnings(\"unchecked\")\n\tprivate boolean fixDown(int k) {\n\t\tboolean res = false;\n\t\twhile (k << 1 < n) {\n\t\t\tA a = (A) as[k].a;\n\t\t\tA l = (A) as[k << 1].a;\n\t\t\tif (k << 1 == n - 1) {\n\t\t\t\tif (comp.compare(a, l) <= 0)\n\t\t\t\t\tbreak;\n\t\t\t\tres = true;\n\t\t\t\tE tmp = as[k];\n\t\t\t\tas[k] = as[k << 1];\n\t\t\t\tas[k << 1] = tmp;\n\t\t\t\tas[k].index = k;\n\t\t\t\tas[k << 1].index = k << 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tA r = (A) as[k << 1 | 1].a;\n\t\t\tif (comp.compare(a, l) <= 0 && comp.compare(a, r) <= 0)\n\t\t\t\tbreak;\n\t\t\tres = true;\n\t\t\tif (comp.compare(l, r) < 0) {\n\t\t\t\tint nk = k << 1;\n\t\t\t\tE tmp = as[k];\n\t\t\t\tas[k] = as[nk];\n\t\t\t\tas[nk] = tmp;\n\t\t\t\tas[k].index = k;\n\t\t\t\tas[nk].index = nk;\n\t\t\t\tk = nk;\n\t\t\t} else {\n\t\t\t\tint nk = k << 1 | 1;\n\t\t\t\tE tmp = as[k];\n\t\t\t\tas[k] = as[nk];\n\t\t\t\tas[nk] = tmp;\n\t\t\t\tas[k].index = k;\n\t\t\t\tas[nk].index = nk;\n\t\t\t\tk = nk;\n\t\t\t}\n\t\t}\n\t\treturn res;\n\t}\n\n\tprivate E addEntry(A a) {\n\t\tif (n == as.length)\n\t\t\tas = U.doubleSize(as);\n\t\treturn as[n] = new E(a, n++);\n\t}\n\n\t@SuppressWarnings(\"unchecked\")\n\tpublic String toString() {\n\t\tif (n == 1)\n\t\t\treturn \"[]\";\n\t\tString s = null;\n\t\tfor (int i = 1; i < n; i++) {\n\t\t\tA a = (A) as[i].a;\n\t\t\tif (s == null)\n\t\t\t\ts = \"[\" + a;\n\t\t\telse\n\t\t\t\ts += \", \" + a;\n\t\t}\n\t\treturn s + \"]\";\n\t}\n}\n\nclass Graph {\n\t/**\n\t * !!多重辺があるとバグる!!\n\t * !!多重辺があるとバグる!!\n\t * !!多重辺があるとバグる!!\n\t * \n\t * @param forEachEdge\n\t * (index:int, (edgeTo:int, edgeCost:long) -> void) -> void\n\t * @return\n\t * [0] = dist, [1] = prev\n\t */\n\tstatic long[][] dijkstraL(int n, int from, F.II numEdges, F.IXV forEachEdge) {\n\t\tlong inf = Long.MAX_VALUE;\n\t\tlong[][] res = new long[n][2];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tres[i][0] = i == from ? 0 : inf;\n\t\t\tres[i][1] = -1;\n\t\t}\n\t\tPQ q = new PQ((a, b) -> Long.compare(a[1], b[1]));\n\n\t\tPQ.E[] qes = new PQ.E[n];\n\t\tArrayList ups = new ArrayList(n);\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tups.add(new long[] { i, inf });\n\t\t}\n\n\t\tboolean[] fixed = new boolean[n];\n\t\tups.get(from)[1] = 0;\n\t\tqes[from] = q.add(ups.get(from));\n\n\t\twhile (!q.isEmpty()) {\n\t\t\tlong[] up = q.pop();\n\t\t\tint i = (int) up[0];\n\t\t\tif (fixed[i])\n\t\t\t\tcontinue;\n\t\t\tfixed[i] = true;\n\t\t\tlong dist = up[1];\n\t\t\tif (dist == inf)\n\t\t\t\tbreak;\n\t\t\tforEachEdge.f(i, (j, weight) -> {\n\t\t\t\tif (fixed[j])\n\t\t\t\t\treturn;\n\t\t\t\tlong[] resj = res[j];\n\t\t\t\tlong newDist = dist + weight;\n\t\t\t\tif (Long.compare(resj[0], newDist) > 0) {\n\t\t\t\t\tresj[0] = newDist;\n\t\t\t\t\tresj[1] = i;\n\t\t\t\t\tq.add(new long[] { j, newDist });\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\treturn res;\n\t}\n\n\t/**\n\t * !!多重辺があるとバグる!!\n\t * !!多重辺があるとバグる!!\n\t * !!多重辺があるとバグる!!\n\t * \n\t * @param forEachEdge\n\t * (index:int, (edgeTo:int, edgeCost:long) -> void) -> void\n\t * @return\n\t * [0] = dist, [1] = prev\n\t */\n\tstatic double[][] dijkstraD(int n, int from, F.II numEdges, F.IXV forEachEdge) {\n\t\tdouble inf = Double.POSITIVE_INFINITY;\n\t\tdouble[][] res = new double[n][2];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tres[i][0] = i == from ? 0 : inf;\n\t\t\tres[i][1] = -1;\n\t\t}\n\t\tPQ q = new PQ((a, b) -> Double.compare(a[1], b[1]));\n\n\t\tPQ.E[] qes = new PQ.E[n];\n\t\tArrayList ups = new ArrayList(n);\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tups.add(new double[] { i, inf });\n\t\t}\n\n\t\tboolean[] fixed = new boolean[n];\n\t\tups.get(from)[1] = 0;\n\t\tqes[from] = q.add(ups.get(from));\n\n\t\twhile (!q.isEmpty()) {\n\t\t\tdouble[] up = q.pop();\n\t\t\tint i = (int) up[0];\n\t\t\tif (fixed[i])\n\t\t\t\tcontinue;\n\t\t\tfixed[i] = true;\n\t\t\tdouble dist = up[1];\n\t\t\tif (dist == inf)\n\t\t\t\tbreak;\n\t\t\tforEachEdge.f(i, (j, weight) -> {\n\t\t\t\tif (fixed[j])\n\t\t\t\t\treturn;\n\t\t\t\tdouble[] resj = res[j];\n\t\t\t\tdouble newDist = dist + weight;\n\t\t\t\tif (Double.compare(resj[0], newDist) > 0) {\n\t\t\t\t\tresj[0] = newDist;\n\t\t\t\t\tresj[1] = i;\n\t\t\t\t\tq.add(new double[] { j, newDist });\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\treturn res;\n\t}\n\n}\n\nclass UP { // Unordered Pair\n\tA a;\n\tB b;\n\n\tUP(A a, B b) {\n\t\tthis.a = a;\n\t\tthis.b = b;\n\t}\n\n\tstatic UP make(A a, B b) {\n\t\treturn new UP(a, b);\n\t}\n\n\tpublic boolean equals(Object o) {\n\t\tif (o == this)\n\t\t\treturn true;\n\t\tif (!(o instanceof UP))\n\t\t\treturn false;\n\t\tUP p = (UP) o;\n\t\tboolean aok = a == null ? p.a == null : a.equals(p.a);\n\t\tboolean bok = b == null ? p.b == null : b.equals(p.b);\n\t\treturn aok && bok;\n\t}\n\n\tpublic String toString() {\n\t\treturn \"(\" + a.toString() + \", \" + b.toString() + \")\";\n\t}\n}\n\nclass P, B extends Comparable> extends UP\n\t\timplements Comparable> { // Pair\n\tP(A a, B b) {\n\t\tsuper(a, b);\n\t}\n\n\tstatic , B extends Comparable> P make(A a, B b) {\n\t\treturn new P(a, b);\n\t}\n\n\tpublic int compareTo(P o) {\n\t\tint sa = a.compareTo(o.a);\n\t\tint sb = b.compareTo(o.b);\n\t\treturn sa != 0 ? sa : sb;\n\t}\n}\n\nclass PI implements Comparable { // Pair int\n\tint a;\n\tint b;\n\n\tPI(int a, int b) {\n\t\tthis.a = a;\n\t\tthis.b = b;\n\t}\n\n\tstatic PI make(int a, int b) {\n\t\treturn new PI(a, b);\n\t}\n\n\tpublic boolean equals(Object o) {\n\t\tif (o == this)\n\t\t\treturn true;\n\t\tif (!(o instanceof PI))\n\t\t\treturn false;\n\t\tPI p = (PI) o;\n\t\treturn a == p.a && b == p.b;\n\t}\n\n\tpublic int compareTo(PI o) {\n\t\tint sa = a - o.a;\n\t\tint sb = b - o.b;\n\t\treturn sa > 0 ? 1 : sa < 0 ? -1 : sb > 0 ? 1 : sb < 0 ? -1 : 0;\n\t}\n\n\tpublic String toString() {\n\t\treturn \"(\" + a + \", \" + b + \")\";\n\t}\n}\n\nclass PL implements Comparable { // Pair long\n\tlong a;\n\tlong b;\n\n\tPL(long a, long b) {\n\t\tthis.a = a;\n\t\tthis.b = b;\n\t}\n\n\tstatic PL make(long a, long b) {\n\t\treturn new PL(a, b);\n\t}\n\n\tpublic boolean equals(Object o) {\n\t\tif (o == this)\n\t\t\treturn true;\n\t\tif (!(o instanceof PL))\n\t\t\treturn false;\n\t\tPL p = (PL) o;\n\t\treturn a == p.a && b == p.b;\n\t}\n\n\tpublic int compareTo(PL o) {\n\t\tlong sa = a - o.a;\n\t\tlong sb = b - o.b;\n\t\treturn sa > 0 ? 1 : sa < 0 ? -1 : sb > 0 ? 1 : sb < 0 ? -1 : 0;\n\t}\n\n\tpublic String toString() {\n\t\treturn \"(\" + a + \", \" + b + \")\";\n\t}\n}\n\nclass UT { // Unordered Tuple\n\tA a;\n\tB b;\n\tC c;\n\n\tUT(A a, B b, C c) {\n\t\tthis.a = a;\n\t\tthis.b = b;\n\t\tthis.c = c;\n\t}\n\n\tstatic UT make(A a, B b, C c) {\n\t\treturn new UT(a, b, c);\n\t}\n\n\tpublic boolean equals(Object o) {\n\t\tif (o == this)\n\t\t\treturn true;\n\t\tif (!(o instanceof UT))\n\t\t\treturn false;\n\t\tUT t = (UT) o;\n\t\tboolean aok = a == null ? t.a == null : a.equals(t.a);\n\t\tboolean bok = b == null ? t.b == null : b.equals(t.b);\n\t\tboolean cok = c == null ? t.c == null : c.equals(t.c);\n\t\treturn aok && bok && cok;\n\t}\n\n\tpublic String toString() {\n\t\treturn \"(\" + a.toString() + \", \" + b.toString() + \", \" + c.toString() + \")\";\n\t}\n}\n\nclass T, B extends Comparable, C extends Comparable>\n\t\textends UT implements Comparable> { // Tuple\n\tT(A a, B b, C c) {\n\t\tsuper(a, b, c);\n\t}\n\n\tstatic , B extends Comparable, C extends Comparable> T make(\n\t\t\tA a, B b, C c) {\n\t\treturn new T(a, b, c);\n\t}\n\n\tpublic int compareTo(T o) {\n\t\tint sa = a.compareTo(o.a);\n\t\tint sb = b.compareTo(o.b);\n\t\tint sc = c.compareTo(o.c);\n\t\treturn sa != 0 ? sa : sb != 0 ? sb : sc;\n\t}\n}\n\nclass TI implements Comparable { // Tuple int\n\tint a;\n\tint b;\n\tint c;\n\n\tTI(int a, int b, int c) {\n\t\tthis.a = a;\n\t\tthis.b = b;\n\t\tthis.c = c;\n\t}\n\n\tstatic TI make(int a, int b, int c) {\n\t\treturn new TI(a, b, c);\n\t}\n\n\tTL toLong() {\n\t\treturn TL.make(a, b, c);\n\t}\n\n\tpublic boolean equals(Object o) {\n\t\tif (o == this)\n\t\t\treturn true;\n\t\tif (!(o instanceof TI))\n\t\t\treturn false;\n\t\tTI t = (TI) o;\n\t\treturn a == t.a && b == t.b && c == t.c;\n\t}\n\n\tpublic int compareTo(TI o) {\n\t\tint sa = a - o.a;\n\t\tint sb = b - o.b;\n\t\tint sc = c - o.c;\n\t\treturn sa > 0 ? 1 : sa < 0 ? -1 : sb > 0 ? 1 : sb < 0 ? -1 : sc > 0 ? 1 : sc < 0 ? -1 : 0;\n\t}\n\n\tpublic String toString() {\n\t\treturn \"(\" + a + \", \" + b + \", \" + c + \")\";\n\t}\n}\n\nclass TL implements Comparable { // Tuple long\n\tlong a;\n\tlong b;\n\tlong c;\n\n\tTL(long a, long b, long c) {\n\t\tthis.a = a;\n\t\tthis.b = b;\n\t\tthis.c = c;\n\t}\n\n\tstatic TL make(long a, long b, long c) {\n\t\treturn new TL(a, b, c);\n\t}\n\n\tTI toInt() {\n\t\treturn TI.make((int) a, (int) b, (int) c);\n\t}\n\n\tpublic boolean equals(Object o) {\n\t\tif (o == this)\n\t\t\treturn true;\n\t\tif (!(o instanceof TL))\n\t\t\treturn false;\n\t\tTL t = (TL) o;\n\t\treturn a == t.a && b == t.b && c == t.c;\n\t}\n\n\tpublic int compareTo(TL o) {\n\t\tlong sa = a - o.a;\n\t\tlong sb = b - o.b;\n\t\tlong sc = c - o.c;\n\t\treturn sa > 0 ? 1 : sa < 0 ? -1 : sb > 0 ? 1 : sb < 0 ? -1 : sc > 0 ? 1 : sc < 0 ? -1 : 0;\n\t}\n\n\tpublic String toString() {\n\t\treturn \"(\" + a + \", \" + b + \", \" + c + \")\";\n\t}\n}\n\nfinal class U { // Utilities\n\tprivate U() {\n\t}\n\n\tstatic ArrayList make(int n, F.IX maker) {\n\t\tArrayList res = new ArrayList();\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tres.add(maker.f(i));\n\t\treturn res;\n\t}\n\n\tstatic boolean[] makeB(int n, F.IB maker) {\n\t\tboolean[] res = new boolean[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tres[i] = maker.f(i);\n\t\treturn res;\n\t}\n\n\tstatic int[] makeI(int n, F.II maker) {\n\t\tint[] res = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tres[i] = maker.f(i);\n\t\treturn res;\n\t}\n\n\tstatic long[] makeL(int n, F.IL maker) {\n\t\tlong[] res = new long[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tres[i] = maker.f(i);\n\t\treturn res;\n\t}\n\n\tstatic A[] makeX(int n, F.IX maker, A[] as) {\n\t\tA[] res = Arrays.copyOf(as, n);\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tres[i] = maker.f(i);\n\t\treturn res;\n\t}\n\n\tstatic ArrayList filter(ArrayList as, F.XB pred) {\n\t\tArrayList res = new ArrayList();\n\t\tfor (A a : as)\n\t\t\tif (pred.f(a))\n\t\t\t\tres.add(a);\n\t\treturn res;\n\t}\n\n\tstatic int count(ArrayList as, F.XB pred) {\n\t\tint res = 0;\n\t\tfor (A a : as)\n\t\t\tif (pred.f(a))\n\t\t\t\tres++;\n\t\treturn res;\n\t}\n\n\tstatic ArrayList concat(ArrayList as, ArrayList bs) {\n\t\tArrayList res = new ArrayList();\n\t\tres.addAll(as);\n\t\tres.addAll(bs);\n\t\treturn res;\n\t}\n\n\tstatic boolean any(ArrayList as, F.XB pred) {\n\t\tfor (A a : as)\n\t\t\tif (pred.f(a))\n\t\t\t\treturn true;\n\t\treturn false;\n\t}\n\n\tstatic boolean all(ArrayList as, F.XB pred) {\n\t\tfor (A a : as)\n\t\t\tif (!pred.f(a))\n\t\t\t\treturn false;\n\t\treturn true;\n\t}\n\n\tstatic ArrayList flatten(ArrayList> ass) {\n\t\tArrayList res = new ArrayList();\n\t\tfor (ArrayList as : ass)\n\t\t\tres.addAll(as);\n\t\treturn res;\n\t}\n\n\tstatic B foldl(ArrayList as, F.XXX f, B e) {\n\t\tB res = e;\n\t\tfor (A a : as)\n\t\t\tres = f.f(res, a);\n\t\treturn res;\n\t}\n\n\tstatic B foldr(ArrayList as, F.XXX f, B e) {\n\t\tB res = e;\n\t\tfor (int i = as.size() - 1; i >= 0; i--)\n\t\t\tres = f.f(as.get(i), res);\n\t\treturn res;\n\t}\n\n\tstatic ArrayList reverse(ArrayList as) {\n\t\tint size = as.size();\n\t\treturn make(size, i -> as.get(size - 1 - i));\n\t}\n\n\tstatic boolean[] reverse(boolean[] as) {\n\t\tint size = as.length;\n\t\treturn makeB(size, i -> as[size - 1 - i]);\n\t}\n\n\tstatic int[] reverse(int[] as) {\n\t\tint size = as.length;\n\t\treturn makeI(size, i -> as[size - 1 - i]);\n\t}\n\n\tstatic long[] reverse(long[] as) {\n\t\tint size = as.length;\n\t\treturn makeL(size, i -> as[size - 1 - i]);\n\t}\n\n\tstatic A[] reverse(A[] as) {\n\t\tint size = as.length;\n\t\treturn makeX(size, i -> as[size - 1 - i], as);\n\t}\n\n\tstatic > UP, ArrayList> compress(ArrayList as) {\n\t\tTreeSet set = new TreeSet(as);\n\t\tTreeMap map = new TreeMap();\n\t\tArrayList imap = new ArrayList();\n\t\tint i = 0;\n\t\tfor (A a : set) {\n\t\t\tmap.put(a, i++);\n\t\t\timap.add(a);\n\t\t}\n\t\treturn UP.make(map, imap);\n\t}\n\n\tstatic ArrayList map(ArrayList as, F.XX f) {\n\t\treturn make(as.size(), (i) -> f.f(as.get(i)));\n\t}\n\n\tstatic ArrayList mapi(ArrayList as, F.XIX f) {\n\t\treturn make(as.size(), (i) -> f.f(as.get(i), i));\n\t}\n\n\tstatic ArrayList> zip(ArrayList as, ArrayList bs) {\n\t\treturn make(min(as.size(), bs.size()), (i) -> UP.make(as.get(i), bs.get(i)));\n\t}\n\n\tstatic int min(int a, int b) {\n\t\treturn a < b ? a : b;\n\t}\n\n\tstatic long min(long a, long b) {\n\t\treturn a < b ? a : b;\n\t}\n\n\tstatic > A min(A a, A b) {\n\t\treturn a.compareTo(b) < 0 ? a : b;\n\t}\n\n\tstatic int max(int a, int b) {\n\t\treturn a > b ? a : b;\n\t}\n\n\tstatic long max(long a, long b) {\n\t\treturn a > b ? a : b;\n\t}\n\n\tstatic > A max(A a, A b) {\n\t\treturn a.compareTo(b) > 0 ? a : b;\n\t}\n\n\tstatic int clamp(int a, int min, int max) {\n\t\treturn a < min ? min : a > max ? max : a;\n\t}\n\n\tstatic long clamp(long a, long min, long max) {\n\t\treturn a < min ? min : a > max ? max : a;\n\t}\n\n\tstatic > A clamp(A a, A min, A max) {\n\t\treturn a.compareTo(min) < 0 ? min : a.compareTo(max) > 0 ? max : a;\n\t}\n\n\tstatic int abs(int a) {\n\t\treturn a < 0 ? -a : a;\n\t}\n\n\tstatic long abs(long a) {\n\t\treturn a < 0 ? -a : a;\n\t}\n\n\tstatic void forEachBitPerm(int n, int k, F.IV f) {\n\t\tfor (int i = (1 << k) - 1; i < 1 << n;) {\n\t\t\tf.f(i);\n\t\t\tint t = (i | i - 1) + 1;\n\t\t\ti = t | ((t & -t) / (i & -i) >> 1) - 1;\n\t\t}\n\t}\n\n\tstatic int nextBitPerm(int a) {\n\t\tint t = (a | a - 1) + 1;\n\t\treturn t | ((t & -t) / (a & -a) >> 1) - 1;\n\t}\n\n\tstatic void mebius(int n, F.IIV f) { // s, i\n\t\tint bit = 1;\n\t\tint exp = 0;\n\t\tfor (int i = 1; i < 1 << n; i++) {\n\t\t\tf.f(i ^ bit, exp);\n\t\t\tif ((i & i + 1) == 0) {\n\t\t\t\tbit <<= 1;\n\t\t\t\texp++;\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic void zeta(int n, F.IIV f) { // s, i\n\t\tint m = (1 << n) - 1;\n\t\tint bit = 1;\n\t\tint exp = 0;\n\t\tfor (int i = (1 << n) - 2; i >= 0; i--) {\n\t\t\tf.f(i ^ bit, exp);\n\t\t\tif ((~i & ~i + 1 & m) == 0) {\n\t\t\t\tbit <<= 1;\n\t\t\t\texp++;\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic ArrayList toAL(A[] as) {\n\t\treturn make(as.length, i -> as[i]);\n\t}\n\n\tstatic A[] doubleSize(A[] as) {\n\t\treturn Arrays.copyOf(as, as.length << 1);\n\t}\n\n\tstatic long searchL(long ng, long ok, F.LB isOk) {\n\t\twhile (ng - ok > 1 || ok - ng > 1) {\n\t\t\tlong mid = ng + ok >> 1;\n\t\t\tif (isOk.f(mid))\n\t\t\t\tok = mid;\n\t\t\telse\n\t\t\t\tng = mid;\n\t\t}\n\t\treturn ok;\n\t}\n\n\tstatic int searchI(int ng, int ok, F.IB isOk) {\n\t\treturn (int) searchL((long) ng, (long) ok, (mid) -> isOk.f((int) mid));\n\t}\n}\n\nfinal class F { // Functions\n\tprivate F() {\n\t}\n\n\tinterface VV {\n\t\tvoid f();\n\t}\n\n\tinterface BV {\n\t\tvoid f(boolean a);\n\t}\n\n\tinterface BXV {\n\t\tvoid f(boolean a, A b);\n\t}\n\n\tinterface BXXV {\n\t\tvoid f(boolean a, A b, B c);\n\t}\n\n\tinterface BXXXV {\n\t\tvoid f(boolean a, A b, B c, C d);\n\t}\n\n\tinterface XBV {\n\t\tvoid f(A a, boolean b);\n\t}\n\n\tinterface XXBV {\n\t\tvoid f(A a, B b, boolean c);\n\t}\n\n\tinterface XXXBV {\n\t\tvoid f(A a, B b, C c, boolean d);\n\t}\n\n\tinterface IV {\n\t\tvoid f(int a);\n\t}\n\n\tinterface IXV {\n\t\tvoid f(int a, A b);\n\t}\n\n\tinterface IXXV {\n\t\tvoid f(int a, A b, B c);\n\t}\n\n\tinterface IXXXV {\n\t\tvoid f(int a, A b, B c, C d);\n\t}\n\n\tinterface XIV {\n\t\tvoid f(A a, int b);\n\t}\n\n\tinterface XXIV {\n\t\tvoid f(A a, B b, int c);\n\t}\n\n\tinterface XXXIV {\n\t\tvoid f(A a, B b, C c, int d);\n\t}\n\n\tinterface LV {\n\t\tvoid f(long a);\n\t}\n\n\tinterface LXV {\n\t\tvoid f(long a, A b);\n\t}\n\n\tinterface LXXV {\n\t\tvoid f(long a, A b, B c);\n\t}\n\n\tinterface LXXXV {\n\t\tvoid f(long a, A b, B c, C d);\n\t}\n\n\tinterface XLV {\n\t\tvoid f(A a, long b);\n\t}\n\n\tinterface XXLV {\n\t\tvoid f(A a, B b, long c);\n\t}\n\n\tinterface XXXLV {\n\t\tvoid f(A a, B b, C c, long d);\n\t}\n\n\tinterface DV {\n\t\tvoid f(double a);\n\t}\n\n\tinterface DXV {\n\t\tvoid f(double a, A b);\n\t}\n\n\tinterface DXXV {\n\t\tvoid f(double a, A b, B c);\n\t}\n\n\tinterface DXXXV {\n\t\tvoid f(double a, A b, B c, C d);\n\t}\n\n\tinterface XDV {\n\t\tvoid f(A a, double b);\n\t}\n\n\tinterface XXDV {\n\t\tvoid f(A a, B b, double c);\n\t}\n\n\tinterface XXXDV {\n\t\tvoid f(A a, B b, C c, double d);\n\t}\n\n\tinterface XV {\n\t\tvoid f(A a);\n\t}\n\n\tinterface XXV {\n\t\tvoid f(A a, B b);\n\t}\n\n\tinterface XXXV {\n\t\tvoid f(A a, B b, C c);\n\t}\n\n\tinterface XXXXV {\n\t\tvoid f(A a, B b, C c, D d);\n\t}\n\n\tinterface BBV {\n\t\tvoid f(boolean a, boolean b);\n\t}\n\n\tinterface BIV {\n\t\tvoid f(boolean a, int b);\n\t}\n\n\tinterface BLV {\n\t\tvoid f(boolean a, long b);\n\t}\n\n\tinterface BDV {\n\t\tvoid f(boolean a, double b);\n\t}\n\n\tinterface IBV {\n\t\tvoid f(int a, boolean b);\n\t}\n\n\tinterface IIV {\n\t\tvoid f(int a, int b);\n\t}\n\n\tinterface ILV {\n\t\tvoid f(int a, long b);\n\t}\n\n\tinterface IDV {\n\t\tvoid f(int a, double b);\n\t}\n\n\tinterface LBV {\n\t\tvoid f(long a, boolean b);\n\t}\n\n\tinterface LIV {\n\t\tvoid f(long a, int b);\n\t}\n\n\tinterface LLV {\n\t\tvoid f(long a, long b);\n\t}\n\n\tinterface LDV {\n\t\tvoid f(long a, double b);\n\t}\n\n\tinterface DBV {\n\t\tvoid f(double a, boolean b);\n\t}\n\n\tinterface DIV {\n\t\tvoid f(double a, int b);\n\t}\n\n\tinterface DLV {\n\t\tvoid f(double a, long b);\n\t}\n\n\tinterface DDV {\n\t\tvoid f(double a, double b);\n\t}\n\n\tinterface VB {\n\t\tboolean f();\n\t}\n\n\tinterface BB {\n\t\tboolean f(boolean a);\n\t}\n\n\tinterface BXB {\n\t\tboolean f(boolean a, A b);\n\t}\n\n\tinterface BXXB {\n\t\tboolean f(boolean a, A b, B c);\n\t}\n\n\tinterface BXXXB {\n\t\tboolean f(boolean a, A b, B c, C d);\n\t}\n\n\tinterface XBB {\n\t\tboolean f(A a, boolean b);\n\t}\n\n\tinterface XXBB {\n\t\tboolean f(A a, B b, boolean c);\n\t}\n\n\tinterface XXXBB {\n\t\tboolean f(A a, B b, C c, boolean d);\n\t}\n\n\tinterface IB {\n\t\tboolean f(int a);\n\t}\n\n\tinterface IXB {\n\t\tboolean f(int a, A b);\n\t}\n\n\tinterface IXXB {\n\t\tboolean f(int a, A b, B c);\n\t}\n\n\tinterface IXXXB {\n\t\tboolean f(int a, A b, B c, C d);\n\t}\n\n\tinterface XIB {\n\t\tboolean f(A a, int b);\n\t}\n\n\tinterface XXIB {\n\t\tboolean f(A a, B b, int c);\n\t}\n\n\tinterface XXXIB {\n\t\tboolean f(A a, B b, C c, int d);\n\t}\n\n\tinterface LB {\n\t\tboolean f(long a);\n\t}\n\n\tinterface LXB {\n\t\tboolean f(long a, A b);\n\t}\n\n\tinterface LXXB {\n\t\tboolean f(long a, A b, B c);\n\t}\n\n\tinterface LXXXB {\n\t\tboolean f(long a, A b, B c, C d);\n\t}\n\n\tinterface XLB {\n\t\tboolean f(A a, long b);\n\t}\n\n\tinterface XXLB {\n\t\tboolean f(A a, B b, long c);\n\t}\n\n\tinterface XXXLB {\n\t\tboolean f(A a, B b, C c, long d);\n\t}\n\n\tinterface DB {\n\t\tboolean f(double a);\n\t}\n\n\tinterface DXB {\n\t\tboolean f(double a, A b);\n\t}\n\n\tinterface DXXB {\n\t\tboolean f(double a, A b, B c);\n\t}\n\n\tinterface DXXXB {\n\t\tboolean f(double a, A b, B c, C d);\n\t}\n\n\tinterface XDB {\n\t\tboolean f(A a, double b);\n\t}\n\n\tinterface XXDB {\n\t\tboolean f(A a, B b, double c);\n\t}\n\n\tinterface XXXDB {\n\t\tboolean f(A a, B b, C c, double d);\n\t}\n\n\tinterface XB {\n\t\tboolean f(A a);\n\t}\n\n\tinterface XXB {\n\t\tboolean f(A a, B b);\n\t}\n\n\tinterface XXXB {\n\t\tboolean f(A a, B b, C c);\n\t}\n\n\tinterface XXXXB {\n\t\tboolean f(A a, B b, C c, D d);\n\t}\n\n\tinterface BBB {\n\t\tboolean f(boolean a, boolean b);\n\t}\n\n\tinterface BIB {\n\t\tboolean f(boolean a, int b);\n\t}\n\n\tinterface BLB {\n\t\tboolean f(boolean a, long b);\n\t}\n\n\tinterface BDB {\n\t\tboolean f(boolean a, double b);\n\t}\n\n\tinterface IBB {\n\t\tboolean f(int a, boolean b);\n\t}\n\n\tinterface IIB {\n\t\tboolean f(int a, int b);\n\t}\n\n\tinterface ILB {\n\t\tboolean f(int a, long b);\n\t}\n\n\tinterface IDB {\n\t\tboolean f(int a, double b);\n\t}\n\n\tinterface LBB {\n\t\tboolean f(long a, boolean b);\n\t}\n\n\tinterface LIB {\n\t\tboolean f(long a, int b);\n\t}\n\n\tinterface LLB {\n\t\tboolean f(long a, long b);\n\t}\n\n\tinterface LDB {\n\t\tboolean f(long a, double b);\n\t}\n\n\tinterface DBB {\n\t\tboolean f(double a, boolean b);\n\t}\n\n\tinterface DIB {\n\t\tboolean f(double a, int b);\n\t}\n\n\tinterface DLB {\n\t\tboolean f(double a, long b);\n\t}\n\n\tinterface DDB {\n\t\tboolean f(double a, double b);\n\t}\n\n\tinterface VI {\n\t\tint f();\n\t}\n\n\tinterface BI {\n\t\tint f(boolean a);\n\t}\n\n\tinterface BXI {\n\t\tint f(boolean a, A b);\n\t}\n\n\tinterface BXXI {\n\t\tint f(boolean a, A b, B c);\n\t}\n\n\tinterface BXXXI {\n\t\tint f(boolean a, A b, B c, C d);\n\t}\n\n\tinterface XBI {\n\t\tint f(A a, boolean b);\n\t}\n\n\tinterface XXBI {\n\t\tint f(A a, B b, boolean c);\n\t}\n\n\tinterface XXXBI {\n\t\tint f(A a, B b, C c, boolean d);\n\t}\n\n\tinterface II {\n\t\tint f(int a);\n\t}\n\n\tinterface IXI {\n\t\tint f(int a, A b);\n\t}\n\n\tinterface IXXI {\n\t\tint f(int a, A b, B c);\n\t}\n\n\tinterface IXXXI {\n\t\tint f(int a, A b, B c, C d);\n\t}\n\n\tinterface XII {\n\t\tint f(A a, int b);\n\t}\n\n\tinterface XXII {\n\t\tint f(A a, B b, int c);\n\t}\n\n\tinterface XXXII {\n\t\tint f(A a, B b, C c, int d);\n\t}\n\n\tinterface LI {\n\t\tint f(long a);\n\t}\n\n\tinterface LXI {\n\t\tint f(long a, A b);\n\t}\n\n\tinterface LXXI {\n\t\tint f(long a, A b, B c);\n\t}\n\n\tinterface LXXXI {\n\t\tint f(long a, A b, B c, C d);\n\t}\n\n\tinterface XLI {\n\t\tint f(A a, long b);\n\t}\n\n\tinterface XXLI {\n\t\tint f(A a, B b, long c);\n\t}\n\n\tinterface XXXLI {\n\t\tint f(A a, B b, C c, long d);\n\t}\n\n\tinterface DI {\n\t\tint f(double a);\n\t}\n\n\tinterface DXI {\n\t\tint f(double a, A b);\n\t}\n\n\tinterface DXXI {\n\t\tint f(double a, A b, B c);\n\t}\n\n\tinterface DXXXI {\n\t\tint f(double a, A b, B c, C d);\n\t}\n\n\tinterface XDI {\n\t\tint f(A a, double b);\n\t}\n\n\tinterface XXDI {\n\t\tint f(A a, B b, double c);\n\t}\n\n\tinterface XXXDI {\n\t\tint f(A a, B b, C c, double d);\n\t}\n\n\tinterface XI {\n\t\tint f(A a);\n\t}\n\n\tinterface XXI {\n\t\tint f(A a, B b);\n\t}\n\n\tinterface XXXI {\n\t\tint f(A a, B b, C c);\n\t}\n\n\tinterface XXXXI {\n\t\tint f(A a, B b, C c, D d);\n\t}\n\n\tinterface BBI {\n\t\tint f(boolean a, boolean b);\n\t}\n\n\tinterface BII {\n\t\tint f(boolean a, int b);\n\t}\n\n\tinterface BLI {\n\t\tint f(boolean a, long b);\n\t}\n\n\tinterface BDI {\n\t\tint f(boolean a, double b);\n\t}\n\n\tinterface IBI {\n\t\tint f(int a, boolean b);\n\t}\n\n\tinterface III {\n\t\tint f(int a, int b);\n\t}\n\n\tinterface ILI {\n\t\tint f(int a, long b);\n\t}\n\n\tinterface IDI {\n\t\tint f(int a, double b);\n\t}\n\n\tinterface LBI {\n\t\tint f(long a, boolean b);\n\t}\n\n\tinterface LII {\n\t\tint f(long a, int b);\n\t}\n\n\tinterface LLI {\n\t\tint f(long a, long b);\n\t}\n\n\tinterface LDI {\n\t\tint f(long a, double b);\n\t}\n\n\tinterface DBI {\n\t\tint f(double a, boolean b);\n\t}\n\n\tinterface DII {\n\t\tint f(double a, int b);\n\t}\n\n\tinterface DLI {\n\t\tint f(double a, long b);\n\t}\n\n\tinterface DDI {\n\t\tint f(double a, double b);\n\t}\n\n\tinterface VL {\n\t\tlong f();\n\t}\n\n\tinterface BL {\n\t\tlong f(boolean a);\n\t}\n\n\tinterface BXL {\n\t\tlong f(boolean a, A b);\n\t}\n\n\tinterface BXXL {\n\t\tlong f(boolean a, A b, B c);\n\t}\n\n\tinterface BXXXL {\n\t\tlong f(boolean a, A b, B c, C d);\n\t}\n\n\tinterface XBL {\n\t\tlong f(A a, boolean b);\n\t}\n\n\tinterface XXBL {\n\t\tlong f(A a, B b, boolean c);\n\t}\n\n\tinterface XXXBL {\n\t\tlong f(A a, B b, C c, boolean d);\n\t}\n\n\tinterface IL {\n\t\tlong f(int a);\n\t}\n\n\tinterface IXL {\n\t\tlong f(int a, A b);\n\t}\n\n\tinterface IXXL {\n\t\tlong f(int a, A b, B c);\n\t}\n\n\tinterface IXXXL {\n\t\tlong f(int a, A b, B c, C d);\n\t}\n\n\tinterface XIL {\n\t\tlong f(A a, int b);\n\t}\n\n\tinterface XXIL {\n\t\tlong f(A a, B b, int c);\n\t}\n\n\tinterface XXXIL {\n\t\tlong f(A a, B b, C c, int d);\n\t}\n\n\tinterface LL {\n\t\tlong f(long a);\n\t}\n\n\tinterface LXL {\n\t\tlong f(long a, A b);\n\t}\n\n\tinterface LXXL {\n\t\tlong f(long a, A b, B c);\n\t}\n\n\tinterface LXXXL {\n\t\tlong f(long a, A b, B c, C d);\n\t}\n\n\tinterface XLL {\n\t\tlong f(A a, long b);\n\t}\n\n\tinterface XXLL {\n\t\tlong f(A a, B b, long c);\n\t}\n\n\tinterface XXXLL {\n\t\tlong f(A a, B b, C c, long d);\n\t}\n\n\tinterface DL {\n\t\tlong f(double a);\n\t}\n\n\tinterface DXL {\n\t\tlong f(double a, A b);\n\t}\n\n\tinterface DXXL {\n\t\tlong f(double a, A b, B c);\n\t}\n\n\tinterface DXXXL {\n\t\tlong f(double a, A b, B c, C d);\n\t}\n\n\tinterface XDL {\n\t\tlong f(A a, double b);\n\t}\n\n\tinterface XXDL {\n\t\tlong f(A a, B b, double c);\n\t}\n\n\tinterface XXXDL {\n\t\tlong f(A a, B b, C c, double d);\n\t}\n\n\tinterface XL {\n\t\tlong f(A a);\n\t}\n\n\tinterface XXL {\n\t\tlong f(A a, B b);\n\t}\n\n\tinterface XXXL {\n\t\tlong f(A a, B b, C c);\n\t}\n\n\tinterface XXXXL {\n\t\tlong f(A a, B b, C c, D d);\n\t}\n\n\tinterface BBL {\n\t\tlong f(boolean a, boolean b);\n\t}\n\n\tinterface BIL {\n\t\tlong f(boolean a, int b);\n\t}\n\n\tinterface BLL {\n\t\tlong f(boolean a, long b);\n\t}\n\n\tinterface BDL {\n\t\tlong f(boolean a, double b);\n\t}\n\n\tinterface IBL {\n\t\tlong f(int a, boolean b);\n\t}\n\n\tinterface IIL {\n\t\tlong f(int a, int b);\n\t}\n\n\tinterface ILL {\n\t\tlong f(int a, long b);\n\t}\n\n\tinterface IDL {\n\t\tlong f(int a, double b);\n\t}\n\n\tinterface LBL {\n\t\tlong f(long a, boolean b);\n\t}\n\n\tinterface LIL {\n\t\tlong f(long a, int b);\n\t}\n\n\tinterface LLL {\n\t\tlong f(long a, long b);\n\t}\n\n\tinterface LDL {\n\t\tlong f(long a, double b);\n\t}\n\n\tinterface DBL {\n\t\tlong f(double a, boolean b);\n\t}\n\n\tinterface DIL {\n\t\tlong f(double a, int b);\n\t}\n\n\tinterface DLL {\n\t\tlong f(double a, long b);\n\t}\n\n\tinterface DDL {\n\t\tlong f(double a, double b);\n\t}\n\n\tinterface VD {\n\t\tdouble f();\n\t}\n\n\tinterface BD {\n\t\tdouble f(boolean a);\n\t}\n\n\tinterface BXD {\n\t\tdouble f(boolean a, A b);\n\t}\n\n\tinterface BXXD {\n\t\tdouble f(boolean a, A b, B c);\n\t}\n\n\tinterface BXXXD {\n\t\tdouble f(boolean a, A b, B c, C d);\n\t}\n\n\tinterface XBD {\n\t\tdouble f(A a, boolean b);\n\t}\n\n\tinterface XXBD {\n\t\tdouble f(A a, B b, boolean c);\n\t}\n\n\tinterface XXXBD {\n\t\tdouble f(A a, B b, C c, boolean d);\n\t}\n\n\tinterface ID {\n\t\tdouble f(int a);\n\t}\n\n\tinterface IXD {\n\t\tdouble f(int a, A b);\n\t}\n\n\tinterface IXXD {\n\t\tdouble f(int a, A b, B c);\n\t}\n\n\tinterface IXXXD {\n\t\tdouble f(int a, A b, B c, C d);\n\t}\n\n\tinterface XID {\n\t\tdouble f(A a, int b);\n\t}\n\n\tinterface XXID {\n\t\tdouble f(A a, B b, int c);\n\t}\n\n\tinterface XXXID {\n\t\tdouble f(A a, B b, C c, int d);\n\t}\n\n\tinterface LD {\n\t\tdouble f(long a);\n\t}\n\n\tinterface LXD {\n\t\tdouble f(long a, A b);\n\t}\n\n\tinterface LXXD {\n\t\tdouble f(long a, A b, B c);\n\t}\n\n\tinterface LXXXD {\n\t\tdouble f(long a, A b, B c, C d);\n\t}\n\n\tinterface XLD {\n\t\tdouble f(A a, long b);\n\t}\n\n\tinterface XXLD {\n\t\tdouble f(A a, B b, long c);\n\t}\n\n\tinterface XXXLD {\n\t\tdouble f(A a, B b, C c, long d);\n\t}\n\n\tinterface DD {\n\t\tdouble f(double a);\n\t}\n\n\tinterface DXD {\n\t\tdouble f(double a, A b);\n\t}\n\n\tinterface DXXD {\n\t\tdouble f(double a, A b, B c);\n\t}\n\n\tinterface DXXXD {\n\t\tdouble f(double a, A b, B c, C d);\n\t}\n\n\tinterface XDD {\n\t\tdouble f(A a, double b);\n\t}\n\n\tinterface XXDD {\n\t\tdouble f(A a, B b, double c);\n\t}\n\n\tinterface XXXDD {\n\t\tdouble f(A a, B b, C c, double d);\n\t}\n\n\tinterface XD {\n\t\tdouble f(A a);\n\t}\n\n\tinterface XXD {\n\t\tdouble f(A a, B b);\n\t}\n\n\tinterface XXXD {\n\t\tdouble f(A a, B b, C c);\n\t}\n\n\tinterface XXXXD {\n\t\tdouble f(A a, B b, C c, D d);\n\t}\n\n\tinterface BBD {\n\t\tdouble f(boolean a, boolean b);\n\t}\n\n\tinterface BID {\n\t\tdouble f(boolean a, int b);\n\t}\n\n\tinterface BLD {\n\t\tdouble f(boolean a, long b);\n\t}\n\n\tinterface BDD {\n\t\tdouble f(boolean a, double b);\n\t}\n\n\tinterface IBD {\n\t\tdouble f(int a, boolean b);\n\t}\n\n\tinterface IID {\n\t\tdouble f(int a, int b);\n\t}\n\n\tinterface ILD {\n\t\tdouble f(int a, long b);\n\t}\n\n\tinterface IDD {\n\t\tdouble f(int a, double b);\n\t}\n\n\tinterface LBD {\n\t\tdouble f(long a, boolean b);\n\t}\n\n\tinterface LID {\n\t\tdouble f(long a, int b);\n\t}\n\n\tinterface LLD {\n\t\tdouble f(long a, long b);\n\t}\n\n\tinterface LDD {\n\t\tdouble f(long a, double b);\n\t}\n\n\tinterface DBD {\n\t\tdouble f(double a, boolean b);\n\t}\n\n\tinterface DID {\n\t\tdouble f(double a, int b);\n\t}\n\n\tinterface DLD {\n\t\tdouble f(double a, long b);\n\t}\n\n\tinterface DDD {\n\t\tdouble f(double a, double b);\n\t}\n\n\tinterface VX {\n\t\tA f();\n\t}\n\n\tinterface BX {\n\t\tA f(boolean a);\n\t}\n\n\tinterface BXX {\n\t\tB f(boolean a, A b);\n\t}\n\n\tinterface BXXX {\n\t\tC f(boolean a, A b, B c);\n\t}\n\n\tinterface BXXXX {\n\t\tD f(boolean a, A b, B c, C d);\n\t}\n\n\tinterface XBX {\n\t\tB f(A a, boolean b);\n\t}\n\n\tinterface XXBX {\n\t\tC f(A a, B b, boolean c);\n\t}\n\n\tinterface XXXBX {\n\t\tD f(A a, B b, C c, boolean d);\n\t}\n\n\tinterface IX {\n\t\tA f(int a);\n\t}\n\n\tinterface IXX {\n\t\tB f(int a, A b);\n\t}\n\n\tinterface IXXX {\n\t\tC f(int a, A b, B c);\n\t}\n\n\tinterface IXXXX {\n\t\tD f(int a, A b, B c, C d);\n\t}\n\n\tinterface XIX {\n\t\tB f(A a, int b);\n\t}\n\n\tinterface XXIX {\n\t\tC f(A a, B b, int c);\n\t}\n\n\tinterface XXXIX {\n\t\tD f(A a, B b, C c, int d);\n\t}\n\n\tinterface LX {\n\t\tA f(long a);\n\t}\n\n\tinterface LXX {\n\t\tB f(long a, A b);\n\t}\n\n\tinterface LXXX {\n\t\tC f(long a, A b, B c);\n\t}\n\n\tinterface LXXXX {\n\t\tD f(long a, A b, B c, C d);\n\t}\n\n\tinterface XLX {\n\t\tB f(A a, long b);\n\t}\n\n\tinterface XXLX {\n\t\tC f(A a, B b, long c);\n\t}\n\n\tinterface XXXLX {\n\t\tD f(A a, B b, C c, long d);\n\t}\n\n\tinterface DX {\n\t\tA f(double a);\n\t}\n\n\tinterface DXX {\n\t\tB f(double a, A b);\n\t}\n\n\tinterface DXXX {\n\t\tC f(double a, A b, B c);\n\t}\n\n\tinterface DXXXX {\n\t\tD f(double a, A b, B c, C d);\n\t}\n\n\tinterface XDX {\n\t\tB f(A a, double b);\n\t}\n\n\tinterface XXDX {\n\t\tC f(A a, B b, double c);\n\t}\n\n\tinterface XXXDX {\n\t\tD f(A a, B b, C c, double d);\n\t}\n\n\tinterface XX {\n\t\tB f(A a);\n\t}\n\n\tinterface XXX {\n\t\tC f(A a, B b);\n\t}\n\n\tinterface XXXX {\n\t\tD f(A a, B b, C c);\n\t}\n\n\tinterface XXXXX {\n\t\tE f(A a, B b, C c, D d);\n\t}\n\n\tinterface BBX {\n\t\tA f(boolean a, boolean b);\n\t}\n\n\tinterface BIX {\n\t\tA f(boolean a, int b);\n\t}\n\n\tinterface BLX {\n\t\tA f(boolean a, long b);\n\t}\n\n\tinterface BDX {\n\t\tA f(boolean a, double b);\n\t}\n\n\tinterface IBX {\n\t\tA f(int a, boolean b);\n\t}\n\n\tinterface IIX {\n\t\tA f(int a, int b);\n\t}\n\n\tinterface ILX {\n\t\tA f(int a, long b);\n\t}\n\n\tinterface IDX {\n\t\tA f(int a, double b);\n\t}\n\n\tinterface LBX {\n\t\tA f(long a, boolean b);\n\t}\n\n\tinterface LIX {\n\t\tA f(long a, int b);\n\t}\n\n\tinterface LLX {\n\t\tA f(long a, long b);\n\t}\n\n\tinterface LDX {\n\t\tA f(long a, double b);\n\t}\n\n\tinterface DBX {\n\t\tA f(double a, boolean b);\n\t}\n\n\tinterface DIX {\n\t\tA f(double a, int b);\n\t}\n\n\tinterface DLX {\n\t\tA f(double a, long b);\n\t}\n\n\tinterface DDX {\n\t\tA f(double a, double b);\n\t}\n}\n\nclass SA { // suffix array\n\tstatic int[] makeSA(String s) {\n\t\tint n = s.length() + 1;\n\t\tint[] cs = new int[n];\n\t\tcs[n - 1] = 0;\n\t\tfor (int i = 0; i < n - 1; i++)\n\t\t\tcs[i] = s.charAt(i) + 1;\n\t\tArrayList acs = U.make(n, i -> cs[i]);\n\t\tTreeMap tm = U.compress(acs).a;\n\t\tint k = tm.size();\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tcs[i] = tm.get(cs[i]);\n\t\treturn makeSA(cs, n, k);\n\t}\n\n\tstatic int[] makeLCP(String s, int[] sa) { // lcp(i, i+1)\n\t\tint n = sa.length;\n\t\tint[] r = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tr[sa[i]] = i;\n\t\tint[] lcp = new int[n];\n\t\tint l = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint idx = r[i];\n\t\t\tif (idx == n - 1) {\n\t\t\t\tlcp[idx] = -1;\n\t\t\t\tl = 0;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tint p = sa[idx];\n\t\t\tint q = sa[idx + 1];\n\t\t\tif (l > 0)\n\t\t\t\tl--;\n\t\t\twhile (p + l < n - 1 && q + l < n - 1 && s.charAt(p + l) == s.charAt(q + l))\n\t\t\t\tl++;\n\t\t\tlcp[idx] = l;\n\t\t}\n\t\treturn lcp;\n\t}\n\n\tstatic F.III lcpQuery(String s) {\n\t\tint n = s.length() + 1;\n\t\tint[] sa = makeSA(s);\n\t\tint[] lcp = makeLCP(s, sa);\n\t\tint[] inv = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tinv[sa[i]] = i;\n\t\t}\n\t\tST st = new ST(n, (a, b) -> a < b ? a : b, Integer.MAX_VALUE);\n\t\tst.init(i -> i < n ? lcp[i] : Integer.MAX_VALUE);\n\t\treturn (i, j) -> {\n\t\t\tif (i == j)\n\t\t\t\treturn n - 1 - i;\n\t\t\ti = inv[i];\n\t\t\tj = inv[j];\n\t\t\tif (i > j) {\n\t\t\t\ti ^= j;\n\t\t\t\tj ^= i;\n\t\t\t\ti ^= j;\n\t\t\t}\n\t\t\treturn st.query(i, j);\n\t\t};\n\t}\n\n\tprivate static int[] makeSA(int[] cs, int n, int k) {\n\t\tboolean[] isS = new boolean[n];\n\t\tboolean[] isLms = new boolean[n];\n\t\tint[] lmss = new int[n];\n\t\tint numLmss = 0;\n\t\tisS[n - 1] = true;\n\t\tfor (int i = n - 2; i >= 0; i--)\n\t\t\tisS[i] = cs[i] < cs[i + 1] || cs[i] == cs[i + 1] && isS[i + 1];\n\t\tfor (int i = 1; i < n; i++)\n\t\t\tif (!isS[i - 1] && isS[i]) {\n\t\t\t\tlmss[numLmss++] = i;\n\t\t\t\tisLms[i] = true;\n\t\t\t}\n\t\tint[] sa = inducedSort(cs, n, numLmss, k, lmss, isS);\n\t\tint[] lmss2 = new int[numLmss];\n\t\tnumLmss = 0;\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tif (isLms[sa[i]])\n\t\t\t\tlmss2[numLmss++] = sa[i];\n\t\tint num = 0;\n\t\tsa[lmss2[0]] = 0;\n\t\tfor (int i = 0; i < numLmss - 1; i++) {\n\t\t\tint p = lmss2[i];\n\t\t\tint q = lmss2[i + 1];\n\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\tif (cs[p] != cs[q] || isLms[p] != isLms[q]) {\n\t\t\t\t\tsa[lmss2[i + 1]] = ++num;\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (j > 0 && (isLms[p] || isLms[q])) {\n\t\t\t\t\tsa[lmss2[i + 1]] = num;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tp++;\n\t\t\t\tq++;\n\t\t\t}\n\t\t}\n\t\tif (num + 1 < numLmss) {\n\t\t\tnumLmss = 0;\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tif (isLms[i])\n\t\t\t\t\tlmss2[numLmss++] = sa[i];\n\t\t\tlmss2 = makeSA(lmss2, numLmss, num + 1);\n\t\t\tfor (int i = 0; i < numLmss; i++)\n\t\t\t\tlmss2[i] = lmss[lmss2[i]];\n\t\t}\n\t\treturn inducedSort(cs, n, numLmss, k, lmss2, isS);\n\t}\n\n\tprivate static int[] inducedSort(int[] cs, int n, int numLmss, int k, int[] lmss, boolean[] isS) {\n\t\tint[] sa = new int[n];\n\t\tint[] bin = new int[k + 1];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tbin[cs[i] + 1]++;\n\t\tfor (int i = 0; i < k; i++)\n\t\t\tbin[i + 1] += bin[i];\n\t\tint[] counts = new int[k];\n\t\tfor (int i = numLmss - 1; i >= 0; i--) { // put LMS backward\n\t\t\tint c = cs[lmss[i]];\n\t\t\tsa[bin[c + 1] - 1 - counts[c]++] = lmss[i];\n\t\t}\n\t\tfor (int i = 0; i < k; i++)\n\t\t\tcounts[i] = 0;\n\t\tfor (int i = 0; i < n; i++) { // put L forward\n\t\t\tint s = sa[i] - 1;\n\t\t\tif (s < 0 || isS[s])\n\t\t\t\tcontinue;\n\t\t\tint c = cs[s];\n\t\t\tsa[bin[c] + counts[c]++] = s;\n\t\t}\n\t\tfor (int i = 0; i < k; i++)\n\t\t\tcounts[i] = 0;\n\t\tfor (int i = n - 1; i >= 0; i--) { // put S backward\n\t\t\tint s = sa[i] - 1;\n\t\t\tif (s < 0 || !isS[s])\n\t\t\t\tcontinue;\n\t\t\tint c = cs[s];\n\t\t\tsa[bin[c + 1] - 1 - counts[c]++] = s;\n\t\t}\n\t\treturn sa;\n\t}\n}\n\nclass ST { // Segment Tree\n\tprivate ArrayList as;\n\tprivate int h;\n\tprivate int n;\n\tprivate F.XXX merger;\n\tprivate A e;\n\n\tST(int num, F.XXX merger, A e) {\n\t\tthis.merger = merger;\n\t\tthis.e = e;\n\t\th = 0;\n\t\twhile ((1 << h) < num)\n\t\t\th++;\n\t\tn = 1 << h;\n\t\tas = U.make(2 * n, i -> e);\n\t}\n\n\tvoid init(A a) {\n\t\tinit(i -> a);\n\t}\n\n\tvoid init(A[] as) {\n\t\tinit(i -> i < as.length ? as[i] : e);\n\t}\n\n\tvoid init(F.IX maker) {\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tas.set(n + i, maker.f(i));\n\t\tfor (int i = n - 1; i > 0; i--)\n\t\t\tas.set(i, merge(as.get(i << 1), as.get(i << 1 | 1)));\n\t}\n\n\tA get(int i) {\n\t\treturn query(i, i + 1);\n\t}\n\n\tvoid set(int i, A a) {\n\t\tas.set(i += n, a);\n\t\twhile ((i >>= 1) > 0)\n\t\t\tas.set(i, merge(as.get(i << 1), as.get(i << 1 | 1)));\n\t}\n\n\tA query(int l, int r) {\n\t\tl += n;\n\t\tr += n;\n\t\tA al = e;\n\t\tA ar = e;\n\t\twhile (l < r) {\n\t\t\tif ((l & 1) != 0)\n\t\t\t\tal = merge(al, as.get(l++));\n\t\t\tif ((r & 1) != 0)\n\t\t\t\tar = merge(as.get(--r), ar);\n\t\t\tl >>= 1;\n\t\t\tr >>= 1;\n\t\t}\n\t\treturn merge(al, ar);\n\t}\n\n\tprivate A merge(A a, A b) {\n\t\treturn a == e ? b : b == e ? a : merger.f(a, b);\n\t}\n}\n\nclass LST { // Lazy Segment Tree\n\tprivate ArrayList as;\n\tprivate ArrayList lazy;\n\tprivate F.XXX merger;\n\tprivate F.XXIX applier;\n\tprivate F.XXX opMerger;\n\tprivate A e;\n\tprivate Op id;\n\tprivate int h;\n\tprivate int n;\n\n\tLST(int num, F.XXX merger, F.XXIX applier, F.XXX opMerger, A e, Op id) {\n\t\tthis.merger = merger;\n\t\tthis.applier = applier;\n\t\tthis.opMerger = opMerger;\n\t\tthis.e = e;\n\t\tthis.id = id;\n\t\th = 0;\n\t\twhile ((1 << h) < num)\n\t\t\th++;\n\t\tn = 1 << h;\n\t\tint size = n << 1;\n\t\tas = U.make(size, i -> e);\n\t\tlazy = U.make(size, i -> id);\n\t}\n\n\tvoid init(A a) {\n\t\tinit(i -> a);\n\t}\n\n\tvoid init(A[] as) {\n\t\tinit(i -> i < as.length ? as[i] : e);\n\t}\n\n\tvoid init(F.IX maker) {\n\t\tfor (int i = 0; i < n << 1; i++)\n\t\t\tlazy.set(i, id);\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tas.set(n + i, maker.f(i));\n\t\tfor (int i = n - 1; i > 0; i--)\n\t\t\tas.set(i, merge(as.get(i << 1), as.get(i << 1 | 1)));\n\t}\n\n\tA get(int i) {\n\t\treturn query(i, i + 1);\n\t}\n\n\tvoid set(int i, A a) {\n\t\tprop(i += n);\n\t\tas.set(i, a);\n\t\tlazy.set(i, id);\n\t\tbackprop(i);\n\t}\n\n\tA query(int l, int r) {\n\t\tprop(l += n);\n\t\tprop(r += n - 1);\n\t\tr++;\n\t\tA al = e;\n\t\tA ar = e;\n\t\tint len = 1;\n\t\twhile (l < r) {\n\t\t\tif ((l & 1) != 0)\n\t\t\t\tal = merge(al, eval(l++, len));\n\t\t\tif ((r & 1) != 0)\n\t\t\t\tar = merge(eval(--r, len), ar);\n\t\t\tl >>= 1;\n\t\t\tr >>= 1;\n\t\t\tlen <<= 1;\n\t\t}\n\t\treturn merge(al, ar);\n\t}\n\n\tvoid apply(int l, int r, Op o) {\n\t\tprop(l += n);\n\t\tprop(r += n - 1);\n\t\tint a = l;\n\t\tint b = r;\n\t\tr++;\n\t\twhile (l < r) {\n\t\t\tif ((l & 1) != 0)\n\t\t\t\tlazy.set(l, mergeOp(lazy.get(l++), o));\n\t\t\tif ((r & 1) != 0)\n\t\t\t\tlazy.set(--r, mergeOp(lazy.get(r), o));\n\t\t\tl >>= 1;\n\t\t\tr >>= 1;\n\t\t}\n\t\tbackprop(a);\n\t\tbackprop(b);\n\t}\n\n\tint size() {\n\t\treturn n;\n\t}\n\n\tprivate A merge(A a, A b) {\n\t\treturn a == e ? b : b == e ? a : merger.f(a, b);\n\t}\n\n\tprivate Op mergeOp(Op o, Op p) {\n\t\treturn o == id ? p : p == id ? o : opMerger.f(o, p);\n\t}\n\n\tprivate A apply(A a, Op o, int len) {\n\t\treturn o == id ? a : applier.f(a, o, len);\n\t}\n\n\tprivate A eval(int k, int len) {\n\t\treturn apply(as.get(k), lazy.get(k), len);\n\t}\n\n\tprivate void flush(int k, int len) {\n\t\tOp o = lazy.get(k);\n\t\tif (o == id)\n\t\t\treturn;\n\t\tlazy.set(k << 1, mergeOp(lazy.get(k << 1), o));\n\t\tlazy.set(k << 1 | 1, mergeOp(lazy.get(k << 1 | 1), o));\n\t\tas.set(k, apply(as.get(k), o, len));\n\t\tlazy.set(k, id);\n\t}\n\n\tprivate void prop(int k) {\n\t\tfor (int i = h; i > 0; i--)\n\t\t\tflush(k >> i, 1 << i);\n\t}\n\n\tprivate void backprop(int k) {\n\t\tint len = 1;\n\t\twhile ((k >>= 1) > 0) {\n\t\t\tas.set(k, merge(eval(k << 1, len), eval(k << 1 | 1, len)));\n\t\t\tlen <<= 1;\n\t\t}\n\t}\n}\n\ninterface Magma {\n\tA g(A a, A b);\n}\n\ninterface Associative {\n}\n\ninterface Unital {\n\tA e();\n}\n\ninterface Invertible {\n\tA inv(A a);\n}\n\ninterface Commutative {\n}\n\ninterface SemiGroup extends Magma, Associative {\n}\n\ninterface Monoid extends SemiGroup, Unital {\n\tstatic Monoid make(F.XXX g, A e) {\n\t\treturn new Monoid() {\n\t\t\tpublic A g(A a, A b) {\n\t\t\t\treturn a.equals(e) ? b : b.equals(e) ? a : g.f(a, b);\n\t\t\t}\n\n\t\t\tpublic A e() {\n\t\t\t\treturn e;\n\t\t\t}\n\t\t};\n\t}\n}\n\ninterface CommutativeMonoid extends Monoid, Commutative {\n\tstatic CommutativeMonoid make(F.XXX g, A e) {\n\t\treturn new CommutativeMonoid() {\n\t\t\tpublic A g(A a, A b) {\n\t\t\t\treturn a.equals(e) ? b : b.equals(e) ? a : g.f(a, b);\n\t\t\t}\n\n\t\t\tpublic A e() {\n\t\t\t\treturn e;\n\t\t\t}\n\t\t};\n\t}\n}\n\ninterface Group extends Monoid, Invertible {\n\tstatic Group make(F.XXX g, F.XX inv, A e) {\n\t\treturn new Group() {\n\t\t\tpublic A g(A a, A b) {\n\t\t\t\treturn a.equals(e) ? b : b.equals(e) ? a : g.f(a, b);\n\t\t\t}\n\n\t\t\tpublic A e() {\n\t\t\t\treturn e;\n\t\t\t}\n\n\t\t\tpublic A inv(A a) {\n\t\t\t\treturn a.equals(e) ? e : inv.f(a);\n\t\t\t}\n\t\t};\n\t}\n}\n\ninterface AbelianGroup extends Group, CommutativeMonoid {\n\tstatic AbelianGroup make(F.XXX g, F.XX inv, A e) {\n\t\treturn new AbelianGroup() {\n\t\t\tpublic A g(A a, A b) {\n\t\t\t\treturn a.equals(e) ? b : b.equals(e) ? a : g.f(a, b);\n\t\t\t}\n\n\t\t\tpublic A e() {\n\t\t\t\treturn e;\n\t\t\t}\n\n\t\t\tpublic A inv(A a) {\n\t\t\t\treturn a.equals(e) ? e : inv.f(a);\n\t\t\t}\n\t\t};\n\t}\n}\n\ninterface Ring {\n\tAbelianGroup add();\n\n\tMonoid mul();\n\n\tdefault A zero() {\n\t\treturn add().e();\n\t}\n\n\tdefault A one() {\n\t\treturn mul().e();\n\t}\n\n\tstatic Ring make(F.XXX add, F.XX neg, F.XXX mul, A zero, A one) {\n\t\treturn make(AbelianGroup.make(add, neg, zero), Monoid.make(mul, one));\n\t}\n\n\tstatic Ring make(AbelianGroup add, Monoid mul) {\n\t\treturn new Ring() {\n\t\t\tpublic AbelianGroup add() {\n\t\t\t\treturn add;\n\t\t\t}\n\n\t\t\tpublic Monoid mul() {\n\t\t\t\treturn mul;\n\t\t\t}\n\t\t};\n\t}\n}\n\ninterface CommutativeRing extends Ring {\n\tCommutativeMonoid mul();\n\n\tstatic CommutativeRing make(F.XXX add, F.XX neg, F.XXX mul, A zero, A one) {\n\t\treturn make(AbelianGroup.make(add, neg, zero), CommutativeMonoid.make(mul, one));\n\t}\n\n\tstatic CommutativeRing make(AbelianGroup add, CommutativeMonoid mul) {\n\t\treturn new CommutativeRing() {\n\t\t\tpublic AbelianGroup add() {\n\t\t\t\treturn add;\n\t\t\t}\n\n\t\t\tpublic CommutativeMonoid mul() {\n\t\t\t\treturn mul;\n\t\t\t}\n\t\t};\n\t}\n}\n\ninterface EuclideanRing extends CommutativeRing {\n\tA div(A a, A b);\n\n\tA mod(A a, A b);\n\n\tstatic EuclideanRing make(F.XXX add, F.XX neg, F.XXX mul, F.XXX div,\n\t\t\tF.XXX mod, A zero, A one) {\n\t\treturn make(AbelianGroup.make(add, neg, zero), CommutativeMonoid.make(mul, one), div, mod);\n\t}\n\n\tstatic EuclideanRing make(AbelianGroup add, CommutativeMonoid mul, F.XXX div,\n\t\t\tF.XXX mod) {\n\t\tfinal A zero = add.e();\n\t\tfinal A one = mul.e();\n\t\treturn new EuclideanRing() {\n\t\t\tpublic AbelianGroup add() {\n\t\t\t\treturn add;\n\t\t\t}\n\n\t\t\tpublic CommutativeMonoid mul() {\n\t\t\t\treturn mul;\n\t\t\t}\n\n\t\t\tpublic A div(A a, A b) {\n\t\t\t\tif (b.equals(zero))\n\t\t\t\t\tthrow new ArithmeticException(\"division by zero\");\n\t\t\t\treturn b.equals(one) ? a : div.f(a, b);\n\t\t\t}\n\n\t\t\tpublic A mod(A a, A b) {\n\t\t\t\tif (b.equals(zero))\n\t\t\t\t\tthrow new ArithmeticException(\"division by zero\");\n\t\t\t\treturn b.equals(one) ? zero : mod.f(a, b);\n\t\t\t}\n\t\t};\n\t}\n}\n\ninterface Field extends EuclideanRing {\n\tAbelianGroup mul();\n\n\tstatic Field make(F.XXX add, F.XX neg, F.XXX mul, F.XX inv, A zero, A one) {\n\t\treturn make(AbelianGroup.make(add, neg, zero), AbelianGroup.make(mul, inv, one));\n\t}\n\n\tstatic Field make(AbelianGroup add, AbelianGroup mul) {\n\t\tfinal A zero = add.e();\n\t\tfinal A one = mul.e();\n\t\treturn new Field() {\n\t\t\tpublic AbelianGroup add() {\n\t\t\t\treturn add;\n\t\t\t}\n\n\t\t\tpublic AbelianGroup mul() {\n\t\t\t\treturn mul;\n\t\t\t}\n\n\t\t\tpublic A div(A a, A b) {\n\t\t\t\tif (b.equals(zero))\n\t\t\t\t\tthrow new ArithmeticException(\"division by zero\");\n\t\t\t\treturn b.equals(one) ? a : mul.g(a, mul.inv(b));\n\t\t\t}\n\n\t\t\tpublic A mod(A a, A b) {\n\t\t\t\tif (b.equals(zero))\n\t\t\t\t\tthrow new ArithmeticException(\"division by zero\");\n\t\t\t\treturn zero;\n\t\t\t}\n\t\t};\n\t}\n}\n\nfinal class Alg {\n\tprivate Alg() {\n\t}\n\n\tstatic > A gcd(A a, A b, EuclideanRing ring) {\n\t\tAbelianGroup add = ring.add();\n\t\tA zero = add.e();\n\t\tint sa = a.compareTo(zero);\n\t\tint sb = b.compareTo(zero);\n\t\tif (sa == 0)\n\t\t\treturn b;\n\t\tif (sb == 0)\n\t\t\treturn a;\n\t\tif (sa < 0)\n\t\t\ta = add.inv(a);\n\t\tif (sb < 0)\n\t\t\tb = add.inv(b);\n\t\tif (a.compareTo(b) < 0) {\n\t\t\tA tmp = a;\n\t\t\ta = b;\n\t\t\tb = tmp;\n\t\t}\n\t\twhile (true) {\n\t\t\tA c = ring.mod(a, b);\n\t\t\tif (c.compareTo(zero) == 0)\n\t\t\t\treturn b;\n\t\t\ta = b;\n\t\t\tb = c;\n\t\t}\n\t}\n\n\tstatic long gcd(long a, long b) {\n\t\tif (a == 0)\n\t\t\treturn b;\n\t\tif (b == 0)\n\t\t\treturn a;\n\t\tif (a < 0)\n\t\t\ta = -a;\n\t\tif (b < 0)\n\t\t\tb = -b;\n\t\tif (a < b) {\n\t\t\ta ^= b;\n\t\t\tb ^= a;\n\t\t\ta ^= b;\n\t\t}\n\t\twhile (true) {\n\t\t\tlong c = a % b;\n\t\t\tif (c == 0)\n\t\t\t\treturn b;\n\t\t\ta = b;\n\t\t\tb = c;\n\t\t}\n\t}\n\n\tstatic int gcd(int a, int b) {\n\t\treturn (int) gcd((long) a, (long) b);\n\t}\n\n\tstatic > int[] lis(F.IX access, int size) {\n\t\tObject[] dp = new Object[size];\n\t\tint[][] dpIndices = new int[size][2];\n\t\tdp[0] = access.f(0);\n\t\tint len = 1;\n\t\tint lidx = 0;\n\t\tfor (int i = 1; i < size; i++) {\n\t\t\tA ai = access.f(i);\n\t\t\t@SuppressWarnings(\"unchecked\")\n\t\t\tint idx = U.searchI(-1, len, j -> ai.compareTo((A) dp[j]) <= 0); // replace <= with < to return NLDS\n\t\t\tdp[idx] = ai;\n\t\t\tdpIndices[idx][0] = i;\n\t\t\tif (idx == len) {\n\t\t\t\tlidx = i;\n\t\t\t\tlen++;\n\t\t\t}\n\t\t\tif (idx > 0)\n\t\t\t\tdpIndices[i][1] = dpIndices[idx - 1][0];\n\t\t}\n\t\tint[] res = new int[len];\n\t\tres[len - 1] = lidx;\n\t\tfor (int i = len - 1; i >= 0; i--) {\n\t\t\tres[i] = lidx;\n\t\t\tlidx = dpIndices[lidx][1];\n\t\t}\n\t\treturn res;\n\t}\n\n\tstatic A pow(A a, long b, Monoid monoid) {\n\t\tA res = monoid.e();\n\t\twhile (b > 0) {\n\t\t\tif ((b & 1) != 0)\n\t\t\t\tres = monoid.g(res, a);\n\t\t\ta = monoid.g(a, a);\n\t\t\tb >>= 1;\n\t\t}\n\t\treturn res;\n\t}\n\n\tstatic A pow(A a, BigInteger b, Monoid monoid) {\n\t\tA res = monoid.e();\n\t\twhile (b.compareTo(BigInteger.ZERO) > 0) {\n\t\t\tif ((b.and(BigInteger.ONE)).intValueExact() != 0)\n\t\t\t\tres = monoid.g(res, a);\n\t\t\ta = monoid.g(a, a);\n\t\t\tb = b.divide(BigInteger.valueOf(2));\n\t\t}\n\t\treturn res;\n\t}\n\n\tstatic long pow(long a, long b) {\n\t\tlong res = 1;\n\t\twhile (b > 0) {\n\t\t\tif ((b & 1) != 0)\n\t\t\t\tres *= a;\n\t\t\ta *= a;\n\t\t\tb >>= 1;\n\t\t}\n\t\treturn res;\n\t}\n\n\tstatic > T extgcd(A a, A b, EuclideanRing ring) { // returns (x, y, d) s.t. ax + by = d\n\t\tAbelianGroup add = ring.add();\n\t\tCommutativeMonoid mul = ring.mul();\n\t\tA zero = add.e();\n\t\tA one = mul.e();\n\t\tA sa = a.compareTo(zero) < 0 ? add.inv(one) : one;\n\t\tA sb = b.compareTo(zero) < 0 ? add.inv(one) : one;\n\t\ta = mul.g(a, sa);\n\t\tb = mul.g(b, sb);\n\t\tA x = one;\n\t\tA y = zero;\n\t\tA z = zero;\n\t\tA w = one;\n\t\twhile (b.compareTo(zero) > 0) {\n\t\t\tA q = ring.div(a, b);\n\t\t\tA t = z;\n\t\t\tz = add.g(x, add.inv(mul.g(q, z)));\n\t\t\tx = t;\n\t\t\tt = w;\n\t\t\tw = add.g(y, add.inv(mul.g(q, w)));\n\t\t\ty = t;\n\t\t\tt = b;\n\t\t\tb = add.g(a, add.inv(mul.g(q, b)));\n\t\t\ta = t;\n\t\t}\n\t\treturn T.make(mul.g(x, sa), mul.g(y, sb), a);\n\t}\n\n\tstatic TL extgcd(long a, long b) {\n\t\tint sa = a < 0 ? -1 : 1;\n\t\tint sb = b < 0 ? -1 : 1;\n\t\ta *= sa;\n\t\tb *= sb;\n\t\tlong x = 1;\n\t\tlong y = 0;\n\t\tlong z = 0;\n\t\tlong w = 1;\n\t\twhile (b > 0) {\n\t\t\tlong q = a / b;\n\t\t\tlong t = z;\n\t\t\tz = x - q * z;\n\t\t\tx = t;\n\t\t\tt = w;\n\t\t\tw = y - q * w;\n\t\t\ty = t;\n\t\t\tt = b;\n\t\t\tb = a - q * b;\n\t\t\ta = t;\n\t\t}\n\t\treturn TL.make(x * sa, y * sb, a);\n\t}\n\n\tstatic TI extgcd(int a, int b) {\n\t\treturn extgcd((long) a, (long) b).toInt();\n\t}\n\n\tstatic ArrayList factorize(int n) { // factor, exponent\n\t\tArrayList res = new ArrayList();\n\t\tfor (int i = 2; i * i <= n; i++) {\n\t\t\tint count = 0;\n\t\t\twhile (n % i == 0) {\n\t\t\t\tn /= i;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\tif (count > 0)\n\t\t\t\tres.add(PI.make(i, count));\n\t\t}\n\t\tif (n > 1)\n\t\t\tres.add(PI.make(n, 1));\n\t\treturn res;\n\t}\n\n\tstatic ArrayList factorize(long n) { // factor, exponent\n\t\tArrayList res = new ArrayList();\n\t\tfor (int i = 2; i * i <= n; i++) {\n\t\t\tint count = 0;\n\t\t\twhile (n % i == 0) {\n\t\t\t\tn /= i;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\tif (count > 0)\n\t\t\t\tres.add(PL.make(i, count));\n\t\t}\n\t\tif (n > 1)\n\t\t\tres.add(PL.make(n, 1));\n\t\treturn res;\n\t}\n\n\tstatic A arithSum(A a, A d, long num, Ring ring) {\n\t\treturn arithGeomSum(a, d, ring.one(), ring.one(), num, ring);\n\t}\n\n\tstatic A geomSum(A b, A r, long num, Ring ring) {\n\t\treturn arithGeomSum(ring.one(), ring.zero(), b, r, num, ring);\n\t}\n\n\tstatic A arithGeomSum(A a, A d, A b, A r, long num, Ring ring) { // Σ(a+(i-1)d)br^(i-1)\n\t\tAbelianGroup add = ring.add();\n\t\tMonoid mul = ring.mul();\n\t\tMonoid> matMul = Mat.mulRing(3, ring);\n\t\tA zero = ring.zero();\n\t\tA one = ring.one();\n\t\tMN mat = pow(Mat.make(new Object[][] { { r, d, a }, { zero, r, r }, { zero, zero, one } }), num - 1, matMul);\n\t\treturn mul.g(add.g(add.g(mul.g(mat.at(0, 0), a), mul.g(mat.at(0, 1), r)), mat.at(0, 2)), b);\n\t}\n}\n\nclass MN {\n\tfinal int m;\n\tfinal int n;\n\tprivate final Object[][] as;\n\n\tstatic class Scalar extends MN {\n\t\tfinal long l;\n\t\tA a;\n\n\t\tScalar(int m, int n, long l, A zero, A oneTimesL) {\n\t\t\tsuper(m, n, (i, j) -> i == j ? oneTimesL : zero);\n\t\t\tthis.a = oneTimesL;\n\t\t\tthis.l = l;\n\t\t}\n\t}\n\n\tMN(int m, int n, Mat.Accessor accessor) {\n\t\tthis.m = m;\n\t\tthis.n = n;\n\t\tas = new Object[m][n];\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\tas[i][j] = accessor.at(i, j);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic String toString() {\n\t\tString s = \"\";\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\ts += i == 0 ? \"[[ \" : \" [ \";\n\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\ts += (j == 0 ? \"\" : \", \") + as[i][j];\n\t\t\t}\n\t\t\ts += i == m - 1 ? \" ]]\" : \" ]\\n\";\n\t\t}\n\t\treturn s;\n\t}\n\n\t@SuppressWarnings(\"unchecked\")\n\tA at(int i, int j) {\n\t\treturn (A) as[i][j];\n\t}\n\n\t@SuppressWarnings(\"unchecked\")\n\tA[][] toArray() {\n\t\tA[][] res = (A[][]) Array.newInstance(as[0][0].getClass(), m, n);\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\tres[i][j] = (A) as[i][j];\n\t\t\t}\n\t\t}\n\t\treturn res;\n\t}\n\n\tint[][] toIntArray() {\n\t\tint[][] res = new int[m][n];\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\tres[i][j] = (int) as[i][j];\n\t\t\t}\n\t\t}\n\t\treturn res;\n\t}\n\n\tlong[][] toLongArray() {\n\t\tlong[][] res = new long[m][n];\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\tres[i][j] = (long) as[i][j];\n\t\t\t}\n\t\t}\n\t\treturn res;\n\t}\n\n\tdouble[][] toDoubleArray() {\n\t\tdouble[][] res = new double[m][n];\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\tres[i][j] = (double) as[i][j];\n\t\t\t}\n\t\t}\n\t\treturn res;\n\t}\n}\n\nclass Mat {\n\tinterface Accessor {\n\t\tA at(int i, int j);\n\t}\n\n\tprivate static MN.Scalar make(int m, int n, long l, A zero, A oneTimesL) {\n\t\treturn new MN.Scalar(m, n, l, zero, oneTimesL);\n\t}\n\n\tstatic MN make(int m, int n, Accessor accessor) {\n\t\treturn new MN(m, n, accessor);\n\t}\n\n\tstatic MN make(int m, int n, A[][] as) {\n\t\treturn new MN(m, n, (i, j) -> as[i][j]);\n\t}\n\n\tstatic MN make(int[][] as) {\n\t\treturn new MN(as.length, as.length == 0 ? 0 : as[0].length, (i, j) -> (long) as[i][j]);\n\t}\n\n\tstatic MN make(long[][] as) {\n\t\treturn new MN(as.length, as.length == 0 ? 0 : as[0].length, (i, j) -> as[i][j]);\n\t}\n\n\tstatic MN make(double[][] as) {\n\t\treturn new MN(as.length, as.length == 0 ? 0 : as[0].length, (i, j) -> as[i][j]);\n\t}\n\n\tstatic MN make(int[][] as, F.IX toA) {\n\t\treturn new MN(as.length, as.length == 0 ? 0 : as[0].length, (i, j) -> toA.f(as[i][j]));\n\t}\n\n\tstatic MN make(long[][] as, F.LX toA) {\n\t\treturn new MN(as.length, as.length == 0 ? 0 : as[0].length, (i, j) -> toA.f(as[i][j]));\n\t}\n\n\tstatic MN make(double[][] as, F.DX toA) {\n\t\treturn new MN(as.length, as.length == 0 ? 0 : as[0].length, (i, j) -> toA.f(as[i][j]));\n\t}\n\n\tstatic MN make(B[][] as, F.XX toA) {\n\t\treturn new MN(as.length, as.length == 0 ? 0 : as[0].length, (i, j) -> toA.f(as[i][j]));\n\t}\n\n\t@SuppressWarnings(\"unchecked\")\n\tstatic MN make(Object[][] as) {\n\t\treturn new MN(as.length, as.length == 0 ? 0 : as[0].length, (i, j) -> (A) as[i][j]);\n\t}\n\n\tstatic MN eye(int n, Ring ring) {\n\t\treturn make(n, n, (i, j) -> i == j ? ring.mul().e() : ring.add().e());\n\t}\n\n\tstatic AbelianGroup> add(int m, int n, Ring ring) {\n\t\treturn AbelianGroup.make((a, b) -> add(a, b, ring), a -> neg(a, ring), make(m, n, 0, ring.zero(), ring.zero()));\n\t}\n\n\tstatic Monoid> mulRing(int n, Ring ring) {\n\t\treturn Monoid.make((a, b) -> mul(a, b, ring), make(n, n, 1, ring.zero(), ring.one()));\n\t}\n\n\tstatic AbelianGroup> mulField(int n, Field field) {\n\t\treturn AbelianGroup.make((a, b) -> mul(a, b, field), a -> inv(a, field),\n\t\t\t\tmake(n, n, 1, field.zero(), field.one()));\n\t}\n\n\tstatic MN add(MN a, MN b, Ring ring) {\n\t\tint m = U.max(a.m, b.m);\n\t\tint n = U.max(a.n, b.n);\n\t\tAbelianGroup add = ring.add();\n\t\tif (a instanceof MN.Scalar && b instanceof MN.Scalar) {\n\t\t\tMN.Scalar as = ((MN.Scalar) a);\n\t\t\tMN.Scalar bs = ((MN.Scalar) b);\n\t\t\treturn make(m, n, as.l + bs.l, ring.zero(), add.g(as.a, bs.a));\n\t\t}\n\t\treturn make(m, n, (i, j) -> add.g(a.at(i, j), b.at(i, j)));\n\t}\n\n\tstatic MN neg(MN a, Ring ring) {\n\t\tif (a instanceof MN.Scalar) {\n\t\t\tMN.Scalar as = ((MN.Scalar) a);\n\t\t\treturn make(a.m, a.n, -as.l, ring.zero(), ring.add().inv(as.a));\n\t\t}\n\t\treturn make(a.m, a.n, (i, j) -> ring.add().inv(a.at(i, j)));\n\t}\n\n\tstatic MN mul(MN a, MN b, Ring ring) {\n\t\tint m = a.m;\n\t\tint u = U.max(a.n, b.m);\n\t\tint n = b.n;\n\t\tAbelianGroup add = ring.add();\n\t\tMonoid mul = ring.mul();\n\t\tif (a instanceof MN.Scalar && b instanceof MN.Scalar) {\n\t\t\tMN.Scalar as = ((MN.Scalar) a);\n\t\t\tMN.Scalar bs = ((MN.Scalar) b);\n\t\t\treturn make(m, n, as.l * bs.l, ring.zero(), mul.g(as.a, bs.a));\n\t\t}\n\t\treturn make(m, n, (i, j) -> {\n\t\t\tA res = ring.zero();\n\t\t\tfor (int k = 0; k < u; k++)\n\t\t\t\tres = add.g(res, mul.g(a.at(i, k), b.at(k, j)));\n\t\t\treturn res;\n\t\t});\n\t}\n\n\tstatic A det(MN a, Field field) {\n\t\treturn detInv(a, field).a;\n\t}\n\n\tstatic MN inv(MN a, Field field) {\n\t\tUP> detInv = detInv(a, field);\n\t\tif (detInv.a.equals(field.zero()))\n\t\t\tthrow new ArithmeticException(\"inverse does not exist: det=0\");\n\t\treturn detInv.b;\n\t}\n\n\t@SuppressWarnings(\"unchecked\")\n\tprivate static UP> detInv(MN a, Field field) {\n\t\tif (a.m != a.n)\n\t\t\tthrow new IllegalArgumentException(\"matrix not square\");\n\t\tif (field.zero() instanceof Long) {\n\t\t\tUP> detInv = detInvLong((MN) a, (Field) field);\n\t\t\treturn UP.make((A) detInv.a, (MN) detInv.b);\n\t\t}\n\t\tint n = a.n;\n\t\tAbelianGroup add = field.add();\n\t\tAbelianGroup mul = field.mul();\n\t\tA zero = field.zero();\n\t\tA one = field.one();\n\t\tA[][] m1 = a.toArray();\n\t\tA[][] m2 = eye(n, field).toArray();\n\t\tA res = one;\n\t\tint sign = 1;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint pivot = -1;\n\t\t\tfor (int j = i; j < n; j++) {\n\t\t\t\tif (!m1[j][i].equals(zero)) {\n\t\t\t\t\tpivot = j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (pivot == -1) {\n\t\t\t\treturn UP.make(zero, null);\n\t\t\t}\n\t\t\tif (pivot != i) {\n\t\t\t\tsign = -sign;\n\t\t\t\tA tmp;\n\t\t\t\tfor (int j = i; j < n; j++) { // [0, i) are zero\n\t\t\t\t\ttmp = m1[i][j];\n\t\t\t\t\tm1[i][j] = m1[pivot][j];\n\t\t\t\t\tm1[pivot][j] = tmp;\n\t\t\t\t}\n\t\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\t\ttmp = m2[i][j];\n\t\t\t\t\tm2[i][j] = m2[pivot][j];\n\t\t\t\t\tm2[pivot][j] = tmp;\n\t\t\t\t}\n\t\t\t}\n\t\t\tA d = m1[i][i];\n\t\t\tres = mul.g(res, d);\n\t\t\td = mul.inv(d);\n\t\t\tm1[i][i] = one;\n\t\t\tfor (int j = i + 1; j < n; j++) {\n\t\t\t\tm1[i][j] = mul.g(m1[i][j], d);\n\t\t\t}\n\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\tm2[i][j] = mul.g(m2[i][j], d);\n\t\t\t}\n\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\tif (i == j)\n\t\t\t\t\tcontinue;\n\t\t\t\tA mult = m1[j][i];\n\t\t\t\tm1[j][i] = zero;\n\t\t\t\tfor (int k = i + 1; k < n; k++) {\n\t\t\t\t\tm1[j][k] = add.g(m1[j][k], add.inv(mul.g(m1[i][k], mult)));\n\t\t\t\t}\n\t\t\t\tfor (int k = 0; k < n; k++) {\n\t\t\t\t\tm2[j][k] = add.g(m2[j][k], add.inv(mul.g(m2[i][k], mult)));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn UP.make(sign == 1 ? res : add.inv(res), make(m2));\n\t}\n\n\tprivate static UP> detInvLong(MN a, Field field) {\n\t\tif (a.m != a.n)\n\t\t\tthrow new IllegalArgumentException(\"matrix not square\");\n\t\tint n = a.n;\n\t\tAbelianGroup add = field.add();\n\t\tAbelianGroup mul = field.mul();\n\t\tlong zero = field.zero();\n\t\tlong one = field.one();\n\t\tlong[][] m1 = a.toLongArray();\n\t\tlong[][] m2 = eye(n, field).toLongArray();\n\t\tlong res = one;\n\t\tint sign = 1;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint pivot = -1;\n\t\t\tfor (int j = i; j < n; j++) {\n\t\t\t\tif (m1[j][i] != zero) {\n\t\t\t\t\tpivot = j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (pivot == -1) {\n\t\t\t\treturn UP.make(zero, null);\n\t\t\t}\n\t\t\tif (pivot != i) {\n\t\t\t\tsign = -sign;\n\t\t\t\tlong tmp;\n\t\t\t\tfor (int j = i; j < n; j++) { // [0, i) are zero\n\t\t\t\t\ttmp = m1[i][j];\n\t\t\t\t\tm1[i][j] = m1[pivot][j];\n\t\t\t\t\tm1[pivot][j] = tmp;\n\t\t\t\t}\n\t\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\t\ttmp = m2[i][j];\n\t\t\t\t\tm2[i][j] = m2[pivot][j];\n\t\t\t\t\tm2[pivot][j] = tmp;\n\t\t\t\t}\n\t\t\t}\n\t\t\tlong d = m1[i][i];\n\t\t\tres = mul.g(res, d);\n\t\t\td = mul.inv(d);\n\t\t\tm1[i][i] = one;\n\t\t\tfor (int j = i + 1; j < n; j++) {\n\t\t\t\tm1[i][j] = mul.g(m1[i][j], d);\n\t\t\t}\n\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\tm2[i][j] = mul.g(m2[i][j], d);\n\t\t\t}\n\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\tif (i == j)\n\t\t\t\t\tcontinue;\n\t\t\t\tlong mult = m1[j][i];\n\t\t\t\tm1[j][i] = zero;\n\t\t\t\tfor (int k = i + 1; k < n; k++) {\n\t\t\t\t\tm1[j][k] = add.g(m1[j][k], add.inv(mul.g(m1[i][k], mult)));\n\t\t\t\t}\n\t\t\t\tfor (int k = 0; k < n; k++) {\n\t\t\t\t\tm2[j][k] = add.g(m2[j][k], add.inv(mul.g(m2[i][k], mult)));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn UP.make(sign == 1 ? res : add.inv(res), make(m2));\n\t}\n\n\tstatic Ring> ring(int n, Ring ring) {\n\t\treturn Ring.make(add(n, n, ring), mulRing(n, ring));\n\t}\n\n\tstatic Field> field(int n, Field field) {\n\t\treturn Field.make(add(n, n, field), mulField(n, field));\n\t}\n\n\tstatic VM> vm(int n, Ring ring) {\n\t\tif (ring instanceof Field)\n\t\t\treturn vmField(n, (Field) ring);\n\t\treturn vmRing(n, ring);\n\t}\n\n\tprivate static VM> vmRing(int n, Ring ring) {\n\t\tRing> matRing = ring(n, ring);\n\t\tMonoid> matMul = matRing.mul();\n\t\tAbelianGroup add = ring.add();\n\t\tMonoid mul = ring.mul();\n\t\tA zero = add.e();\n\t\tA one = mul.e();\n\t\treturn new VM>(matRing, null, null, (a, b) -> {\n\t\t\tif (b instanceof MN.Scalar) {\n\t\t\t\tMN.Scalar bs = ((MN.Scalar) b);\n\t\t\t\tif (bs.l < 0)\n\t\t\t\t\tthrow new RuntimeException(\"pow(MN, <0) is not defined\");\n\t\t\t\treturn Alg.pow(a, bs.l, matMul);\n\t\t\t}\n\t\t\tthrow new RuntimeException(\"pow(MN, MN) is not defined\");\n\t\t}, null, l -> make(n, n, l, zero, Alg.pow(one, l, add)), a -> a);\n\t}\n\n\tprivate static VM> vmField(int n, Field field) {\n\t\tField> matField = field(n, field);\n\t\tAbelianGroup> matMul = matField.mul();\n\t\tA zero = field.zero();\n\t\tA one = field.one();\n\t\treturn new VM>(matField, (a, b) -> {\n\t\t\tif (b instanceof MN.Scalar) {\n\t\t\t\tMN.Scalar bs = ((MN.Scalar) b);\n\t\t\t\tif (bs.l < 0)\n\t\t\t\t\treturn Alg.pow(inv(a, field), -bs.l, matMul);\n\t\t\t\treturn Alg.pow(a, bs.l, matMul);\n\t\t\t}\n\t\t\tthrow new RuntimeException(\"pow(MN, MN) is not defined\");\n\t\t}, a -> inv(a, field), l -> make(n, n, l, zero, Alg.pow(one, l, field.add())), a -> a);\n\t}\n}\n\nclass VM {\n\tprivate final HashMap env;\n\tprivate final Evaluator etor;\n\tprivate final F.XX filter;\n\n\tVM(F.XXX add, F.XXX sub, F.XXX mul, F.XXX div, F.XXX mod,\n\t\t\tF.XXX pow, F.XX neg, F.XX fact, F.LX fromInt, F.XX filter) {\n\t\tenv = new HashMap();\n\t\tetor = SimpleLang.makeEvaluator((s, a) -> {\n\t\t\tenv.put(s, a);\n\t\t\treturn a;\n\t\t}, add, sub, mul, div, mod, pow, neg, fact, fromInt, s -> {\n\t\t\tif (env.containsKey(s))\n\t\t\t\treturn env.get(s);\n\t\t\tthrow new RuntimeException(\"no such variable: \" + s);\n\t\t});\n\t\tthis.filter = filter;\n\t}\n\n\tVM(Ring ring, F.XXX div, F.XXX mod, F.XXX pow, F.XX fact, F.LX fromInt,\n\t\t\tF.XX filter) {\n\t\tthis(ring.add()::g, (a, b) -> ring.add().g(a, ring.add().inv(b)), ring.mul()::g, div, mod, pow, ring.add()::inv,\n\t\t\t\tfact, fromInt, filter);\n\t}\n\n\tVM(EuclideanRing ring, F.XXX pow, F.XX fact, F.LX fromInt, F.XX filter) {\n\t\tthis(ring, ring::div, ring::mod, pow, fact, fromInt, filter);\n\t}\n\n\tvoid clear() {\n\t\tenv.clear();\n\t}\n\n\tA get(String id) {\n\t\treturn env.get(id);\n\t}\n\n\tvoid print(String id, F.XV printer) {\n\t\tprinter.f(\"\" + get(id));\n\t}\n\n\t@SafeVarargs\n\tfinal void set(String idsSp, A... as) {\n\t\tString[] ids = idsSp.trim().split(\" +\");\n\t\tint n = ids.length;\n\t\tif (as.length != n)\n\t\t\tthrow new IllegalArgumentException(\"argument size mismatch: \" + n + \" != \" + as.length);\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tset(ids[i], as[i]);\n\t}\n\n\tvoid set(String id, A a) {\n\t\tenv.put(id, filter.f(a));\n\t}\n\n\tA run(String expr) {\n\t\treturn AST.eval(SimpleLang.parse(expr), etor);\n\t}\n}\n\nclass AST { // Abstract Syntax Tree\n\tstatic class AssignOp extends AST {\n\t\tString id;\n\t\tAST r;\n\n\t\tAssignOp(String id, AST r) {\n\t\t\tthis.id = id;\n\t\t\tthis.r = r;\n\t\t}\n\n\t\tpublic String toString() {\n\t\t\treturn \"Assign(\" + id + \", \" + r + \")\";\n\t\t}\n\t}\n\n\tstatic class Multi extends AST {\n\t\tArrayList as;\n\n\t\tMulti(ArrayList as) {\n\t\t\tthis.as = as;\n\t\t}\n\n\t\tpublic String toString() {\n\t\t\tString s = \"\";\n\t\t\tfor (AST a : as)\n\t\t\t\ts += s.isEmpty() ? a : \"; \" + a;\n\t\t\treturn \"Multi(\" + s + \")\";\n\t\t}\n\t}\n\n\tstatic class BinOp extends AST {\n\t\tAST l;\n\t\tAST r;\n\t\tString op;\n\n\t\tBinOp(AST l, String op, AST r) {\n\t\t\tthis.l = l;\n\t\t\tthis.op = op;\n\t\t\tthis.r = r;\n\t\t}\n\n\t\tpublic String toString() {\n\t\t\treturn \"BinOp(\" + l + \", \" + op + \", \" + r + \")\";\n\t\t}\n\t}\n\n\tstatic class UnOp extends AST {\n\t\tAST a;\n\t\tString op;\n\n\t\tUnOp(String op, AST a) {\n\t\t\tthis.op = op;\n\t\t\tthis.a = a;\n\t\t}\n\n\t\tpublic String toString() {\n\t\t\treturn \"UnOp(\" + op + \", \" + a + \")\";\n\t\t}\n\t}\n\n\tstatic class Int extends AST {\n\t\tlong v;\n\n\t\tInt(long v) {\n\t\t\tthis.v = v;\n\t\t}\n\n\t\tpublic String toString() {\n\t\t\treturn \"Int(\" + v + \")\";\n\t\t}\n\t}\n\n\tstatic class Id extends AST {\n\t\tString s;\n\n\t\tId(String s) {\n\t\t\tthis.s = s;\n\t\t}\n\n\t\tpublic String toString() {\n\t\t\treturn \"Id(\" + s + \")\";\n\t\t}\n\t}\n\n\tstatic A eval(AST a, Evaluator etor) {\n\t\tif (a instanceof AssignOp)\n\t\t\treturn etor.assign(((AssignOp) a).id, eval(((AssignOp) a).r, etor));\n\t\tif (a instanceof Multi) {\n\t\t\tA last = null;\n\t\t\tfor (AST a2 : ((Multi) a).as)\n\t\t\t\tlast = eval(a2, etor);\n\t\t\treturn last;\n\t\t}\n\t\tif (a instanceof BinOp)\n\t\t\treturn etor.binOp(((BinOp) a).op, eval(((BinOp) a).l, etor), eval(((BinOp) a).r, etor));\n\t\tif (a instanceof UnOp)\n\t\t\treturn etor.unOp(((UnOp) a).op, eval(((UnOp) a).a, etor));\n\t\tif (a instanceof Int)\n\t\t\treturn etor.fromInt(((Int) a).v);\n\t\tif (a instanceof Id)\n\t\t\treturn etor.id(((Id) a).s);\n\t\tthrow new RuntimeException(\"unexpected ast: \" + a);\n\t}\n}\n\ninterface Evaluator {\n\tA assign(String s, A a);\n\n\tA binOp(String op, A a, A b);\n\n\tA unOp(String op, A a);\n\n\tA fromInt(long a);\n\n\tA id(String s);\n}\n\nclass Seq {\n\tArrayList as;\n\tint ptr;\n\n\tSeq(ArrayList as) {\n\t\tthis.as = as;\n\t\tptr = 0;\n\t}\n\n\tboolean hasNext(int num) {\n\t\treturn ptr + num < as.size();\n\t}\n\n\tboolean hasNext() {\n\t\treturn hasNext(0);\n\t}\n\n\tA next(int num) {\n\t\treturn ptr + num < as.size() ? as.get(ptr + num) : null;\n\t}\n\n\tA next() {\n\t\treturn next(0);\n\t}\n\n\tA read() {\n\t\treturn hasNext() ? as.get(ptr++) : null;\n\t}\n\n\tA read(A a) {\n\t\tif (!hasNext())\n\t\t\tthrow new RuntimeException(\"unexpected EOF\");\n\t\tif (!isNext(a))\n\t\t\tthrow new RuntimeException(\"expected \" + a + \" but got\" + next());\n\t\treturn read();\n\t}\n\n\tA read(F.XX f) {\n\t\tif (!hasNext())\n\t\t\tthrow new RuntimeException(\"unexpected EOF\");\n\t\tif (!f.f(next()))\n\t\t\tthrow new RuntimeException(\"f(\" + next() + \") returned false\");\n\t\treturn read();\n\t}\n\n\tboolean isNext(A a) {\n\t\treturn a.equals(next());\n\t}\n\n\tboolean isNext(@SuppressWarnings(\"unchecked\") A... as) {\n\t\tfor (A a : as)\n\t\t\tif (isNext(a))\n\t\t\t\treturn true;\n\t\treturn false;\n\t}\n\n\tboolean isNext(F.XX f) {\n\t\treturn hasNext() && f.f(next());\n\t}\n\n\tA readIf(F.XX f) {\n\t\tif (isNext(f))\n\t\t\treturn read();\n\t\treturn null;\n\t}\n\n\tA readIf(@SuppressWarnings(\"unchecked\") A... as) {\n\t\tfor (A a : as)\n\t\t\tif (isNext(a)) {\n\t\t\t\tptr++;\n\t\t\t\treturn a;\n\t\t\t}\n\t\treturn null;\n\t}\n\n\tpublic String toString() {\n\t\treturn as.toString();\n\t}\n}\n\nclass Token extends P {\n\tprivate static final int ID = 1;\n\tprivate static final int SYM = 2;\n\tprivate static final int INT = 3;\n\n\tToken(String s, int type) {\n\t\tsuper(s, type);\n\t}\n\n\tboolean is(String s) {\n\t\treturn a.equals(s);\n\t}\n\n\tstatic Token ofId(String s) {\n\t\treturn new Token(s, ID);\n\t}\n\n\tstatic Token ofSym(String s) {\n\t\treturn new Token(s, SYM);\n\t}\n\n\tstatic Token ofInt(String s) {\n\t\treturn new Token(s, INT);\n\t}\n\n\tboolean isId() {\n\t\treturn b == ID;\n\t}\n\n\tboolean isSym() {\n\t\treturn b == SYM;\n\t}\n\n\tboolean isInt() {\n\t\treturn b == INT;\n\t}\n}\n\nclass SimpleLang {\n\tprivate static class Tokenizer {\n\t\tprivate static final String SYMS = \"+-*/%^!()=;\";\n\n\t\tSeq sc;\n\t\tArrayList ts;\n\n\t\tTokenizer(String s) {\n\t\t\tsc = new Seq(U.make(s.length(), i -> s.charAt(i)));\n\t\t}\n\n\t\tSeq parse() {\n\t\t\tts = new ArrayList();\n\t\t\tparseAll();\n\t\t\treturn new Seq(ts);\n\t\t}\n\n\t\tprivate static boolean isSpace(char c) {\n\t\t\treturn c == ' ' || c == '\\t' || c == '\\r' || c == '\\n';\n\t\t}\n\n\t\tprivate static boolean isDigit(char c) {\n\t\t\treturn c >= '0' && c <= '9';\n\t\t}\n\n\t\tprivate static boolean isSymbol(char c) {\n\t\t\treturn SYMS.indexOf(c) != -1;\n\t\t}\n\n\t\tprivate static boolean isAlpha(char c) {\n\t\t\treturn c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c == '_';\n\t\t}\n\n\t\tprivate void parseAll() {\n\t\t\twhile (sc.hasNext()) {\n\t\t\t\twhile (sc.isNext(Tokenizer::isSpace))\n\t\t\t\t\tsc.read();\n\t\t\t\tif (!sc.hasNext())\n\t\t\t\t\tbreak;\n\t\t\t\tif (sc.isNext(Tokenizer::isAlpha)) {\n\t\t\t\t\tparseId();\n\t\t\t\t} else if (sc.isNext(Tokenizer::isDigit)) {\n\t\t\t\t\tparseInt();\n\t\t\t\t} else if (sc.isNext(Tokenizer::isSymbol)) {\n\t\t\t\t\tparseSym();\n\t\t\t\t} else {\n\t\t\t\t\tthrow new RuntimeException(\"invalid character: \" + sc.next());\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tprivate void parseId() {\n\t\t\tString s = sc.read().toString();\n\t\t\twhile (sc.isNext(Tokenizer::isAlpha) || sc.isNext(Tokenizer::isDigit))\n\t\t\t\ts += sc.read().toString();\n\t\t\tts.add(Token.ofId(s));\n\t\t}\n\n\t\tprivate void parseInt() {\n\t\t\tString s = sc.read().toString();\n\t\t\twhile (sc.isNext(Tokenizer::isDigit))\n\t\t\t\ts += sc.read().toString();\n\t\t\tts.add(Token.ofInt(s));\n\t\t}\n\n\t\tprivate void parseSym() {\n\t\t\tString s = sc.read().toString();\n\t\t\tts.add(Token.ofSym(s));\n\t\t}\n\t}\n\n\tprivate static class Parser {\n\t\tSeq ts;\n\n\t\tParser(Seq ts) {\n\t\t\tthis.ts = ts;\n\t\t}\n\n\t\tAST parse() {\n\t\t\treturn parseExpr();\n\t\t}\n\n\t\tprivate AST parseExpr() {\n\t\t\treturn parseMultiExpr();\n\t\t}\n\n\t\tprivate AST parseMultiExpr() {\n\t\t\treadSemicolons();\n\t\t\tAST a = parseAssignExpr();\n\t\t\tif (readSemicolons()) {\n\t\t\t\tArrayList as = new ArrayList();\n\t\t\t\tas.add(a);\n\t\t\t\tdo {\n\t\t\t\t\tif (!ts.hasNext())\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tas.add(parseAssignExpr());\n\t\t\t\t} while (readSemicolons());\n\t\t\t\tif (as.size() == 1)\n\t\t\t\t\treturn a;\n\t\t\t\treturn new AST.Multi(as);\n\t\t\t}\n\t\t\treturn a;\n\t\t}\n\n\t\tprivate boolean readSemicolons() {\n\t\t\tif (!ts.isNext(t -> t.is(\";\")))\n\t\t\t\treturn false;\n\t\t\tdo {\n\t\t\t\tts.read();\n\t\t\t} while (ts.isNext(t -> t.is(\";\")));\n\t\t\treturn true;\n\t\t}\n\n\t\tprivate AST parseAssignExpr() {\n\t\t\tAST a = parseAddSubOp();\n\t\t\tif (ts.isNext(t -> t.is(\"=\"))) {\n\t\t\t\tts.read();\n\t\t\t\tif (!(a instanceof AST.Id))\n\t\t\t\t\tthrow new RuntimeException(\"cannot assign to \" + a);\n\t\t\t\treturn new AST.AssignOp(((AST.Id) a).s, parseAssignExpr());\n\t\t\t}\n\t\t\treturn a;\n\t\t}\n\n\t\tprivate AST parseAddSubOp() {\n\t\t\tAST a = parseMulDivModOp();\n\t\t\twhile (ts.isNext(t -> t.is(\"+\") || t.is(\"-\")))\n\t\t\t\ta = new AST.BinOp(a, ts.read().a, parseMulDivModOp());\n\t\t\treturn a;\n\t\t}\n\n\t\tprivate AST parseMulDivModOp() {\n\t\t\tAST a = parsePowOp();\n\t\t\twhile (ts.isNext(t -> t.is(\"*\") || t.is(\"/\") || t.is(\"%\")))\n\t\t\t\ta = new AST.BinOp(a, ts.read().a, parsePowOp());\n\t\t\treturn a;\n\t\t}\n\n\t\tprivate AST parsePowOp() {\n\t\t\tAST a = parseNegateOp();\n\t\t\tif (ts.isNext(t -> t.is(\"^\")))\n\t\t\t\treturn new AST.BinOp(a, ts.read().a, parsePowOp());\n\t\t\treturn a;\n\t\t}\n\n\t\tprivate AST parseNegateOp() {\n\t\t\tif (ts.isNext(t -> t.is(\"-\")))\n\t\t\t\treturn new AST.UnOp(ts.read().a, parseNegateOp());\n\t\t\treturn parseFactOp();\n\t\t}\n\n\t\tprivate AST parseFactOp() {\n\t\t\tAST a = parsePrimary();\n\t\t\twhile (ts.isNext(t -> t.is(\"!\")))\n\t\t\t\ta = new AST.UnOp(ts.read().a, a);\n\t\t\treturn a;\n\t\t}\n\n\t\tprivate AST parsePrimary() {\n\t\t\tif (ts.isNext(t -> t.isId()))\n\t\t\t\treturn new AST.Id(ts.read().a);\n\t\t\tif (ts.isNext(t -> t.isInt()))\n\t\t\t\treturn new AST.Int(Long.parseLong(ts.read().a));\n\t\t\tif (ts.readIf(t -> t.is(\"(\")) != null) {\n\t\t\t\tAST e = parseExpr();\n\t\t\t\tts.read(t -> t.is(\")\"));\n\t\t\t\treturn e;\n\t\t\t}\n\t\t\tthrow new RuntimeException(\"unexpected token: \" + ts.next());\n\t\t}\n\t}\n\n\tstatic HashMap cache = new HashMap();\n\n\tstatic Evaluator makeEvaluator(F.XXX assign, F.XXX add, F.XXX sub,\n\t\t\tF.XXX mul, F.XXX div, F.XXX mod, F.XXX pow, F.XX neg,\n\t\t\tF.XX fact, F.LX fromInt, F.XX id) {\n\t\treturn new Evaluator() {\n\t\t\tpublic A assign(String s, A a) {\n\t\t\t\treturn assign.f(s, a);\n\t\t\t}\n\n\t\t\tpublic A binOp(String op, A a, A b) {\n\t\t\t\tswitch (op) {\n\t\t\t\tcase \"+\":\n\t\t\t\t\treturn add.f(a, b);\n\t\t\t\tcase \"-\":\n\t\t\t\t\treturn sub.f(a, b);\n\t\t\t\tcase \"*\":\n\t\t\t\t\treturn mul.f(a, b);\n\t\t\t\tcase \"/\":\n\t\t\t\t\treturn div.f(a, b);\n\t\t\t\tcase \"%\":\n\t\t\t\t\treturn mod.f(a, b);\n\t\t\t\tcase \"^\":\n\t\t\t\t\treturn pow.f(a, b);\n\t\t\t\t}\n\t\t\t\tthrow new RuntimeException(\"invalid binOp: \" + op);\n\t\t\t}\n\n\t\t\tpublic A unOp(String op, A a) {\n\t\t\t\tswitch (op) {\n\t\t\t\tcase \"-\":\n\t\t\t\t\treturn neg.f(a);\n\t\t\t\tcase \"!\":\n\t\t\t\t\treturn fact.f(a);\n\t\t\t\t}\n\t\t\t\tthrow new RuntimeException(\"invalid unOp: \" + op);\n\t\t\t}\n\n\t\t\tpublic A fromInt(long a) {\n\t\t\t\treturn fromInt.f(a);\n\t\t\t}\n\n\t\t\tpublic A id(String s) {\n\t\t\t\treturn id.f(s);\n\t\t\t}\n\t\t};\n\t}\n\n\tstatic AST parse(String s) {\n\t\tif (cache.containsKey(cache)) {\n\t\t\treturn cache.get(s);\n\t\t}\n\t\tTokenizer l = new Tokenizer(s);\n\t\tSeq ts = l.parse();\n\t\tParser p = new Parser(ts);\n\t\tAST a = p.parse();\n\t\tcache.put(s, a);\n\t\treturn a;\n\t}\n}\n\nclass Mod {\n\tfinal long mod;\n\tfinal AbelianGroup add;\n\tfinal AbelianGroup mul;\n\tfinal Field field;\n\tfinal VM vm;\n\tprivate final boolean prime;\n\tprivate final HashMap logMap;\n\tprivate long[] facts;\n\tprivate long[] invs;\n\tprivate long[] invFacts;\n\tprivate long[] factors;\n\n\tMod(long mod) {\n\t\tthis.mod = mod;\n\t\tprepareFacts(0);\n\t\tprime = BigInteger.valueOf(mod).isProbablePrime(100);\n\t\tadd = AbelianGroup.make((a, b) -> (a + b) % mod, a -> mod - a, 0l);\n\t\tmul = AbelianGroup.make((a, b) -> (a * b) % mod, a -> {\n\t\t\tif (prime)\n\t\t\t\treturn pow(a, mod - 2);\n\t\t\tTL t = Alg.extgcd(a, mod);\n\t\t\tif (t.c != 1)\n\t\t\t\tthrow new ArithmeticException(\"inv(\" + a + \") does not exist\");\n\t\t\treturn (t.a % mod + mod) % mod;\n\t\t}, 1l);\n\t\tfield = Field.make(add, mul);\n\t\tlogMap = new HashMap();\n\t\tvm = new VM(field, this::pow, this::fact, a -> (a % mod + mod) % mod, a -> (a % mod + mod) % mod);\n\t}\n\n\tlong fact(long a) {\n\t\tif (a >= Integer.MAX_VALUE)\n\t\t\tthrow new RuntimeException(\"fact(\" + a + \") too big\");\n\t\tprepareFacts((int) a);\n\t\treturn facts[(int) (a % mod)];\n\t}\n\n\tlong invFact(int a) {\n\t\tprepareFacts(a);\n\t\treturn invFacts[(int) (a % mod)];\n\t}\n\n\tlong inv(long a) {\n\t\treturn mul.inv(a);\n\t}\n\n\tlong pow(long a, long b) {\n\t\tif (b == 0)\n\t\t\treturn 1;\n\t\tif (b == 1)\n\t\t\treturn a;\n\t\tif (b < 0) {\n\t\t\ta = inv(a);\n\t\t\tb = -b;\n\t\t}\n\t\ta %= mod;\n\t\tlong res = 1;\n\t\twhile (b > 0) {\n\t\t\tif ((b & 1) != 0)\n\t\t\t\tres = res * a % mod;\n\t\t\ta = a * a % mod;\n\t\t\tb >>= 1;\n\t\t}\n\t\treturn res;\n\t}\n\n\tlong order(long a) { // computes the order of `a` in O(sqrt(mod)) time\n\t\ta %= mod;\n\t\tif (a == 0)\n\t\t\treturn 0;\n\t\tif (a == 1)\n\t\t\treturn 1;\n\t\tif (factors == null) {\n\t\t\tArrayList fs = new ArrayList();\n\t\t\tfor (long i = 2; i * i < mod; i++) {\n\t\t\t\tif ((mod - 1) % i == 0)\n\t\t\t\t\tfs.add(i);\n\t\t\t}\n\t\t\tfactors = new long[fs.size()];\n\t\t\tfor (int i = 0; i < fs.size(); i++) {\n\t\t\t\tfactors[i] = fs.get(i);\n\t\t\t}\n\t\t}\n\t\tfor (long f : factors) {\n\t\t\tif (pow(a, f) == 1)\n\t\t\t\treturn f;\n\t\t}\n\t\treturn mod - 1;\n\t}\n\n\tPL log(long a, long b) { // log_b(a) in O(sqrt(mod)) time\n\t\ta %= mod;\n\t\tb %= mod;\n\t\tif (b == 1 || b == 0)\n\t\t\treturn a == b ? PL.make(1, 1) : PL.make(-1, 0);\n\t\tif (a == 0)\n\t\t\treturn PL.make(-1, 0);\n\t\tlong order = order(b);\n\t\tif (a == 1)\n\t\t\treturn PL.make(0, order);\n\t\tlong orderSqrtL = sqrtCeil(order);\n\t\tif (orderSqrtL > Integer.MAX_VALUE)\n\t\t\tthrow new RuntimeException(\"order(\" + b + \") too big: \" + order);\n\t\tint orderSqrt = (int) sqrtCeil(order);\n\t\tlogMap.clear();\n\t\tlogMap.put(1l, 0);\n\t\tlong p = 1;\n\t\tfor (int i = 1; i < orderSqrt; i++) {\n\t\t\tp = p * b % mod;\n\t\t\tlogMap.put(p, i);\n\t\t}\n\t\tlong ib = pow(b, mod - orderSqrt - 1);\n\t\tp = a;\n\t\tfor (int i = 1; i < orderSqrt; i++) {\n\t\t\tp = p * ib % mod;\n\t\t\tif (logMap.containsKey(p))\n\t\t\t\treturn PL.make((i * orderSqrt + logMap.get(p)) % order, order);\n\t\t}\n\t\treturn PL.make(-1, 0);\n\t}\n\n\tprivate long sqrtCeil(long a) {\n\t\treturn U.searchL((long) Math.sqrt(a * 0.9), (long) Math.sqrt(a * 1.1) + 1, mid -> mid * mid >= a);\n\t}\n\n\tprivate void prepareFacts(int n) {\n\t\tif (facts == null) {\n\t\t\tfacts = new long[1024];\n\t\t\tinvs = new long[1024];\n\t\t\tinvFacts = new long[1024];\n\t\t\tprepareFactsIn(0, 1024);\n\t\t}\n\t\tif (n >= mod)\n\t\t\tn = (int) (mod - 1);\n\t\twhile (facts.length <= n) {\n\t\t\tint prevL = facts.length;\n\t\t\tint newL = prevL << 1;\n\t\t\tfacts = Arrays.copyOf(facts, newL);\n\t\t\tinvs = Arrays.copyOf(invs, newL);\n\t\t\tinvFacts = Arrays.copyOf(invFacts, newL);\n\t\t\tprepareFactsIn(prevL, newL);\n\t\t}\n\t}\n\n\tprivate void prepareFactsIn(int from, int until) {\n\t\tif (until > mod)\n\t\t\tuntil = (int) mod;\n\t\tfor (int i = from; i < until; i++) {\n\t\t\tif (i == 0) {\n\t\t\t\tfacts[0] = 1;\n\t\t\t\tinvs[0] = 0;\n\t\t\t\tinvFacts[0] = 1;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (i == 1) {\n\t\t\t\tfacts[1] = 1;\n\t\t\t\tinvs[1] = 1;\n\t\t\t\tinvFacts[1] = 1;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tfacts[i] = facts[i - 1] * i % mod;\n\t\t\tinvs[i] = (mod - mod / i) * invs[(int) (mod % i)] % mod;\n\t\t\tinvFacts[i] = invFacts[i - 1] * invs[i] % mod;\n\t\t}\n\t}\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nFind the sum of A_i \\times A_j over all pairs (i,j) such that 1\\leq i < j \\leq N, modulo (10^9+7).\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\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 \\ldots A_N\n\nOutput\n\nPrint \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} A_i A_j, modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n11\n\nWe have 1 \\times 2 + 1 \\times 3 + 2 \\times 3 = 11.\n\nSample Input 2\n\n4\n141421356 17320508 22360679 244949\n\nSample Output 2\n\n437235829", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["11\n"], "source_document_id": "p02572", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nFind the sum of A_i \\times A_j over all pairs (i,j) such that 1\\leq i < j \\leq N, modulo (10^9+7).\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\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 \\ldots A_N\n\nOutput\n\nPrint \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} A_i A_j, modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n11\n\nWe have 1 \\times 2 + 1 \\times 3 + 2 \\times 3 = 11.\n\nSample Input 2\n\n4\n141421356 17320508 22360679 244949\n\nSample Output 2\n\n437235829", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 84484, "cpu_time_ms": 174, "memory_kb": 40120}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s028396012", "group_id": "codeNet:p02574", "input_text": "import java.util.ArrayList;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Scanner;\nimport java.util.Set;\n\nclass Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint arr[] = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarr[i] = sc.nextInt();\n\t\t}\n\t\tboolean primes[] = new boolean[1000001];\n\t\tsieveOfEratosthenes(primes, 1000000);\n\t\tList list = new ArrayList();\n\t\tSet set = new HashSet();\n\t\tfor (int i = 0; i < 1000001; i++) {\n\t\t\tif (primes[i]) {\n\t\t\t\tlist.add(i);\n\t\t\t\tset.add(i);\n\t\t\t}\n\t\t}\n\t\tboolean poss = true;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint temp = arr[i];\n\t\t\tfor (int j = 0; j < n && list.get(j) < temp; j++) {\n\t\t\t\tint div = list.get(j);\n\t\t\t\tif (temp % div == 0) {\n\t\t\t\t\tif (set.contains(div)) {\n\t\t\t\t\t\tset.remove(div);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tposs = false;\n\t\t\t\t\t\ti = n; break;\n\t\t\t\t\t}\n\t\t\t\t\twhile (temp % div == 0) temp = temp / div;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tint gcd = arr[0];\n\t\tfor (int i = 1; i < n; i++) {\n\t\t\tgcd = gcd(arr[i], gcd);\n\t\t}\n\t\tif (poss) {\n\t\t\tSystem.out.println(\"pairwise coprime\");\n\t\t}\n\t\telse if (gcd == 1) {\n\t\t\tSystem.out.println(\"setwise coprime\");\n\t\t}\n\t\telse {\n\t\t\tSystem.out.println(\"not coprime\");\n\t\t}\n\n\t}\n\t\n\t static void sieveOfEratosthenes(boolean prime[], int n) { \n\t for(int i=2;i list = new ArrayList();\n\t\tSet set = new HashSet();\n\t\tfor (int i = 0; i < 1000001; i++) {\n\t\t\tif (primes[i]) {\n\t\t\t\tlist.add(i);\n\t\t\t\tset.add(i);\n\t\t\t}\n\t\t}\n\t\tboolean poss = true;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint temp = arr[i];\n\t\t\tfor (int j = 0; j < n && list.get(j) < temp; j++) {\n\t\t\t\tint div = list.get(j);\n\t\t\t\tif (temp % div == 0) {\n\t\t\t\t\tif (set.contains(div)) {\n\t\t\t\t\t\tset.remove(div);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tposs = false;\n\t\t\t\t\t\ti = n; break;\n\t\t\t\t\t}\n\t\t\t\t\twhile (temp % div == 0) temp = temp / div;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tint gcd = arr[0];\n\t\tfor (int i = 1; i < n; i++) {\n\t\t\tgcd = gcd(arr[i], gcd);\n\t\t}\n\t\tif (poss) {\n\t\t\tSystem.out.println(\"pairwise coprime\");\n\t\t}\n\t\telse if (gcd == 1) {\n\t\t\tSystem.out.println(\"setwise coprime\");\n\t\t}\n\t\telse {\n\t\t\tSystem.out.println(\"not coprime\");\n\t\t}\n\n\t}\n\t\n\t static void sieveOfEratosthenes(boolean prime[], int n) { \n\t for(int i=2;i prevFacts = new HashSet<>();\n boolean checkCoprime = true;\n for (int pos = 0; pos < n; pos++) {\n for (int fact = 2; fact <= Math.sqrt(arr[pos]); fact++) {\n if (arr[pos] % fact == 0) {\n if (!prevFacts.add(fact)) {\n checkCoprime = false;\n break;\n }\n int num = arr[pos];\n while (num % fact == 0)\n num /= fact;\n if (num > 1) {\n if (!prevFacts.add(num)) {\n checkCoprime = false;\n break;\n }\n }\n\n }\n }\n if (!checkCoprime)\n break;\n }\n if (checkCoprime) {\n System.out.println(\"pairwise coprime\");\n } else if (gcdRes == 1)\n System.out.println(\"setwise coprime\");\n else\n System.out.println(\"not coprime\");\n }\n}\n", "language": "Java", "metadata": {"date": 1598920090, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02574.html", "problem_id": "p02574", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02574/input.txt", "sample_output_relpath": "derived/input_output/data/p02574/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02574/Java/s224110942.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s224110942", "user_id": "u857413854"}, "prompt_components": {"gold_output": "pairwise coprime\n", "input_to_evaluate": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n public static int gcd(int a, int b) {\n if (a == 0)\n return b;\n return gcd(b % a, a);\n }\n\n public static void main(String[] args) throws Exception {\n BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));\n StringBuilder sb = new StringBuilder();\n int n = Integer.parseInt(buffer.readLine());\n String[] inp = buffer.readLine().split(\" \");\n int[] arr = new int[n];\n int gcdRes = Integer.parseInt(inp[0]);\n for (int pos = 0; pos < n; pos++) {\n arr[pos] = Integer.parseInt(inp[pos]);\n gcdRes = gcd(gcdRes, arr[pos]);\n }\n\n HashSet prevFacts = new HashSet<>();\n boolean checkCoprime = true;\n for (int pos = 0; pos < n; pos++) {\n for (int fact = 2; fact <= Math.sqrt(arr[pos]); fact++) {\n if (arr[pos] % fact == 0) {\n if (!prevFacts.add(fact)) {\n checkCoprime = false;\n break;\n }\n int num = arr[pos];\n while (num % fact == 0)\n num /= fact;\n if (num > 1) {\n if (!prevFacts.add(num)) {\n checkCoprime = false;\n break;\n }\n }\n\n }\n }\n if (!checkCoprime)\n break;\n }\n if (checkCoprime) {\n System.out.println(\"pairwise coprime\");\n } else if (gcdRes == 1)\n System.out.println(\"setwise coprime\");\n else\n System.out.println(\"not coprime\");\n }\n}\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have N integers. The i-th number is A_i.\n\n\\{A_i\\} is said to be pairwise coprime when GCD(A_i,A_j)=1 holds for every pair (i, j) such that 1\\leq i < j \\leq N.\n\n\\{A_i\\} is said to be setwise coprime when \\{A_i\\} is not pairwise coprime but GCD(A_1,\\ldots,A_N)=1.\n\nDetermine if \\{A_i\\} is pairwise coprime, setwise coprime, or neither.\n\nHere, GCD(\\ldots) denotes greatest common divisor.\n\nConstraints\n\n2 \\leq N \\leq 10^6\n\n1 \\leq A_i\\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 \\ldots A_N\n\nOutput\n\nIf \\{A_i\\} is pairwise coprime, print pairwise coprime; if \\{A_i\\} is setwise coprime, print setwise coprime; if neither, print not coprime.\n\nSample Input 1\n\n3\n3 4 5\n\nSample Output 1\n\npairwise coprime\n\nGCD(3,4)=GCD(3,5)=GCD(4,5)=1, so they are pairwise coprime.\n\nSample Input 2\n\n3\n6 10 15\n\nSample Output 2\n\nsetwise coprime\n\nSince GCD(6,10)=2, they are not pairwise coprime. However, since GCD(6,10,15)=1, they are setwise coprime.\n\nSample Input 3\n\n3\n6 10 16\n\nSample Output 3\n\nnot coprime\n\nGCD(6,10,16)=2, so they are neither pairwise coprime nor setwise coprime.", "sample_input": "3\n3 4 5\n"}, "reference_outputs": ["pairwise coprime\n"], "source_document_id": "p02574", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have N integers. The i-th number is A_i.\n\n\\{A_i\\} is said to be pairwise coprime when GCD(A_i,A_j)=1 holds for every pair (i, j) such that 1\\leq i < j \\leq N.\n\n\\{A_i\\} is said to be setwise coprime when \\{A_i\\} is not pairwise coprime but GCD(A_1,\\ldots,A_N)=1.\n\nDetermine if \\{A_i\\} is pairwise coprime, setwise coprime, or neither.\n\nHere, GCD(\\ldots) denotes greatest common divisor.\n\nConstraints\n\n2 \\leq N \\leq 10^6\n\n1 \\leq A_i\\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 \\ldots A_N\n\nOutput\n\nIf \\{A_i\\} is pairwise coprime, print pairwise coprime; if \\{A_i\\} is setwise coprime, print setwise coprime; if neither, print not coprime.\n\nSample Input 1\n\n3\n3 4 5\n\nSample Output 1\n\npairwise coprime\n\nGCD(3,4)=GCD(3,5)=GCD(4,5)=1, so they are pairwise coprime.\n\nSample Input 2\n\n3\n6 10 15\n\nSample Output 2\n\nsetwise coprime\n\nSince GCD(6,10)=2, they are not pairwise coprime. However, since GCD(6,10,15)=1, they are setwise coprime.\n\nSample Input 3\n\n3\n6 10 16\n\nSample Output 3\n\nnot coprime\n\nGCD(6,10,16)=2, so they are neither pairwise coprime nor setwise coprime.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1775, "cpu_time_ms": 531, "memory_kb": 111232}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s895680862", "group_id": "codeNet:p02574", "input_text": "import java.util.HashSet;\nimport java.util.Scanner;\nimport java.util.Set;\n\npublic class Main {\n\n\tpublic static String Y = \"Yes\";\n\tpublic static String N = \"No\";\n\tpublic static long MOD = (long) (Math.pow(10, 9) + 7);\n\tpublic static Scanner sc = new Scanner(System.in);\n\n\tpublic static void main(String[] args) {\n\n\t\tint n = ni();\n\t\tint[] a = new int[n];\n\t\ta[0] = ni();\n\t\tint gcd = a[0];\n\t\tfor (int i = 1; i < n; i++) {\n\t\t\ta[i] = ni();\n\t\t\tgcd = gcd(gcd, a[i]);\n\t\t}\n\t\tif (gcd != 1) {\n\t\t\tout(\"not coprime\");\n\t\t\treturn;\n\t\t}\n\n\t\tint[] d = kousokusoinnsuubunkaihairetsu(1000009);\n\n\t\tlong count = 0;\n\t\tSet soinnsuu = new HashSet<>();\n\t\tSet soinnsuutmp = null;\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint aa = a[i];\n\t\t\tsoinnsuutmp = new HashSet<>();\n\t\t\t//debug(aa);\n\t\t\tfor (;;) {\n\t\t\t\tsoinnsuutmp.add(aa);\n\t\t\t\tif (aa == d[aa]) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tsoinnsuutmp.add(d[aa]);\n\t\t\t\t\taa /= d[aa];\n\t\t\t\t\tsoinnsuutmp.add(aa);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcount += soinnsuutmp.size();\n\t\t\tsoinnsuu.addAll(soinnsuutmp);\n\t\t\t//debug();\n\t\t}\n\n\t\tif ((int) count != soinnsuu.size()) {\n\t\t\tout(\"setwise coprime\");\n\t\t\treturn;\n\t\t}\n\t\tout(\"pairwise coprime\");\n\t}\n\n\t/*\n\t * 以下メソッド集\n\t */\n\n\tpublic static int[] kousokusoinnsuubunkaihairetsu(int a) {\n\t\tint[] d = new int[a];\n\t\tfor (int i = 0; i < a; i++) {\n\t\t\td[i] = i;\n\t\t}\n\t\tfor (int i = 2; i * i < a; i++) {\n\t\t\tfor (int j = i * i; j < a; j += i) {\n\t\t\t\tif (d[j] == j)\n\t\t\t\t\td[j] = i;\n\t\t\t}\n\n\t\t}\n\n\t\treturn d;\n\t}\n\n\tpublic static void permutation(String q, String ans) {\n\t\t// Base Case\n\t\tif (q.length() <= 1) {\n\t\t\tSystem.out.println(ans + q);\n\t\t}\n\t\t// General Case\n\t\telse {\n\t\t\tfor (int i = 0; i < q.length(); i++) {\n\t\t\t\tpermutation(q.substring(0, i) + q.substring(i + 1),\n\t\t\t\t\t\tans + q.charAt(i));\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic char[][] same(char[][] c, int h, int w) {\n\n\t\tchar[][] a = new char[h][w];\n\t\tfor (int i = 0; i < h; i++) {\n\t\t\tfor (int j = 0; j < w; j++) {\n\t\t\t\ta[i][j] = c[i][j];\n\t\t\t}\n\t\t}\n\t\treturn a;\n\n\t}\n\n\tstatic int countkuro(char[][] c) {\n\n\t\tint count = 0;\n\t\tfor (char[] cc : c) {\n\t\t\tfor (char ccc : cc) {\n\t\t\t\tif ('#' == ccc) {\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn count;\n\t}\n\n\tstatic void debug() {\n\n\t\tout(\"---\");\n\t}\n\n\tstatic void debug(Object a) {\n\n\t\tout(\"-------\");\n\t\tout(a);\n\t\tout(\"-------\");\n\t}\n\n\tstatic int ketasuu(int n) {\n\n\t\tString str = \"\" + n;\n\t\treturn str.length();\n\t}\n\n\tstatic int account(String str) {\n\n\t\tString target = \"AC\";\n\t\tint count = 0;\n\t\tint len = str.length();\n\t\tfor (int i = 0; i < len - 1; i++) {\n\t\t\tif (target.equals(str.substring(i, i + target.length()))) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\treturn count;\n\t}\n\n\tstatic int ni() {\n\n\t\treturn sc.nextInt();\n\t}\n\n\tstatic long nl() {\n\n\t\treturn sc.nextLong();\n\t}\n\n\tstatic double nd() {\n\n\t\treturn sc.nextDouble();\n\t}\n\n\tstatic String n() {\n\n\t\treturn sc.next();\n\t}\n\n\tstatic char[] nc() {\n\n\t\treturn sc.next().toCharArray();\n\t}\n\n\tstatic int kaijo(int n) {\n\n\t\tif (n == 0 || n == 1) {\n\t\t\treturn 1;\n\t\t} else {\n\t\t\treturn n * kaijo(n - 1);\n\t\t}\n\t}\n\n\tstatic int fib(int n) {\n\n\t\treturn (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1);\n\t}\n\n\tstatic long lcm(long m, long n) {\n\n\t\treturn m * n / gcd(m, n);\n\t}\n\n\tstatic int lcm(int m, int n) {\n\n\t\treturn m * n / gcd(m, n);\n\t}\n\n\tstatic long gcd(long a, long b) {\n\n\t\treturn (b == 0) ? a : gcd(b, a % b);\n\t}\n\n\tstatic int gcd(int a, int b) {\n\n\t\treturn (b == 0) ? a : gcd(b, a % b);\n\t}\n\n\tstatic void out(Object obj) {\n\t\tSystem.out.println(obj);\n\t}\n\n\tstatic void outn(Object obj) {\n\t\tSystem.out.print(obj);\n\t}\n\n\tstatic double max(double d, double e) {\n\n\t\treturn Math.max(d, e);\n\t}\n\n\tstatic long max(long a, long b) {\n\n\t\treturn Math.max(a, b);\n\t}\n\n\tstatic long min(long d, long e) {\n\n\t\treturn Math.min(d, e);\n\t}\n\n\tstatic int min(int a, int b) {\n\n\t\treturn Math.min(a, b);\n\t}\n}\n\nclass XY {\n\n\tint h;\n\tint w;\n\tint d;\n\n\tXY(int h, int w, int d) {\n\t\tthis.h = h;\n\t\tthis.w = w;\n\t\tthis.d = d;\n\t}\n}\n", "language": "Java", "metadata": {"date": 1598740897, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02574.html", "problem_id": "p02574", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02574/input.txt", "sample_output_relpath": "derived/input_output/data/p02574/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02574/Java/s895680862.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s895680862", "user_id": "u061406236"}, "prompt_components": {"gold_output": "pairwise coprime\n", "input_to_evaluate": "import java.util.HashSet;\nimport java.util.Scanner;\nimport java.util.Set;\n\npublic class Main {\n\n\tpublic static String Y = \"Yes\";\n\tpublic static String N = \"No\";\n\tpublic static long MOD = (long) (Math.pow(10, 9) + 7);\n\tpublic static Scanner sc = new Scanner(System.in);\n\n\tpublic static void main(String[] args) {\n\n\t\tint n = ni();\n\t\tint[] a = new int[n];\n\t\ta[0] = ni();\n\t\tint gcd = a[0];\n\t\tfor (int i = 1; i < n; i++) {\n\t\t\ta[i] = ni();\n\t\t\tgcd = gcd(gcd, a[i]);\n\t\t}\n\t\tif (gcd != 1) {\n\t\t\tout(\"not coprime\");\n\t\t\treturn;\n\t\t}\n\n\t\tint[] d = kousokusoinnsuubunkaihairetsu(1000009);\n\n\t\tlong count = 0;\n\t\tSet soinnsuu = new HashSet<>();\n\t\tSet soinnsuutmp = null;\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint aa = a[i];\n\t\t\tsoinnsuutmp = new HashSet<>();\n\t\t\t//debug(aa);\n\t\t\tfor (;;) {\n\t\t\t\tsoinnsuutmp.add(aa);\n\t\t\t\tif (aa == d[aa]) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tsoinnsuutmp.add(d[aa]);\n\t\t\t\t\taa /= d[aa];\n\t\t\t\t\tsoinnsuutmp.add(aa);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcount += soinnsuutmp.size();\n\t\t\tsoinnsuu.addAll(soinnsuutmp);\n\t\t\t//debug();\n\t\t}\n\n\t\tif ((int) count != soinnsuu.size()) {\n\t\t\tout(\"setwise coprime\");\n\t\t\treturn;\n\t\t}\n\t\tout(\"pairwise coprime\");\n\t}\n\n\t/*\n\t * 以下メソッド集\n\t */\n\n\tpublic static int[] kousokusoinnsuubunkaihairetsu(int a) {\n\t\tint[] d = new int[a];\n\t\tfor (int i = 0; i < a; i++) {\n\t\t\td[i] = i;\n\t\t}\n\t\tfor (int i = 2; i * i < a; i++) {\n\t\t\tfor (int j = i * i; j < a; j += i) {\n\t\t\t\tif (d[j] == j)\n\t\t\t\t\td[j] = i;\n\t\t\t}\n\n\t\t}\n\n\t\treturn d;\n\t}\n\n\tpublic static void permutation(String q, String ans) {\n\t\t// Base Case\n\t\tif (q.length() <= 1) {\n\t\t\tSystem.out.println(ans + q);\n\t\t}\n\t\t// General Case\n\t\telse {\n\t\t\tfor (int i = 0; i < q.length(); i++) {\n\t\t\t\tpermutation(q.substring(0, i) + q.substring(i + 1),\n\t\t\t\t\t\tans + q.charAt(i));\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic char[][] same(char[][] c, int h, int w) {\n\n\t\tchar[][] a = new char[h][w];\n\t\tfor (int i = 0; i < h; i++) {\n\t\t\tfor (int j = 0; j < w; j++) {\n\t\t\t\ta[i][j] = c[i][j];\n\t\t\t}\n\t\t}\n\t\treturn a;\n\n\t}\n\n\tstatic int countkuro(char[][] c) {\n\n\t\tint count = 0;\n\t\tfor (char[] cc : c) {\n\t\t\tfor (char ccc : cc) {\n\t\t\t\tif ('#' == ccc) {\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn count;\n\t}\n\n\tstatic void debug() {\n\n\t\tout(\"---\");\n\t}\n\n\tstatic void debug(Object a) {\n\n\t\tout(\"-------\");\n\t\tout(a);\n\t\tout(\"-------\");\n\t}\n\n\tstatic int ketasuu(int n) {\n\n\t\tString str = \"\" + n;\n\t\treturn str.length();\n\t}\n\n\tstatic int account(String str) {\n\n\t\tString target = \"AC\";\n\t\tint count = 0;\n\t\tint len = str.length();\n\t\tfor (int i = 0; i < len - 1; i++) {\n\t\t\tif (target.equals(str.substring(i, i + target.length()))) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\treturn count;\n\t}\n\n\tstatic int ni() {\n\n\t\treturn sc.nextInt();\n\t}\n\n\tstatic long nl() {\n\n\t\treturn sc.nextLong();\n\t}\n\n\tstatic double nd() {\n\n\t\treturn sc.nextDouble();\n\t}\n\n\tstatic String n() {\n\n\t\treturn sc.next();\n\t}\n\n\tstatic char[] nc() {\n\n\t\treturn sc.next().toCharArray();\n\t}\n\n\tstatic int kaijo(int n) {\n\n\t\tif (n == 0 || n == 1) {\n\t\t\treturn 1;\n\t\t} else {\n\t\t\treturn n * kaijo(n - 1);\n\t\t}\n\t}\n\n\tstatic int fib(int n) {\n\n\t\treturn (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1);\n\t}\n\n\tstatic long lcm(long m, long n) {\n\n\t\treturn m * n / gcd(m, n);\n\t}\n\n\tstatic int lcm(int m, int n) {\n\n\t\treturn m * n / gcd(m, n);\n\t}\n\n\tstatic long gcd(long a, long b) {\n\n\t\treturn (b == 0) ? a : gcd(b, a % b);\n\t}\n\n\tstatic int gcd(int a, int b) {\n\n\t\treturn (b == 0) ? a : gcd(b, a % b);\n\t}\n\n\tstatic void out(Object obj) {\n\t\tSystem.out.println(obj);\n\t}\n\n\tstatic void outn(Object obj) {\n\t\tSystem.out.print(obj);\n\t}\n\n\tstatic double max(double d, double e) {\n\n\t\treturn Math.max(d, e);\n\t}\n\n\tstatic long max(long a, long b) {\n\n\t\treturn Math.max(a, b);\n\t}\n\n\tstatic long min(long d, long e) {\n\n\t\treturn Math.min(d, e);\n\t}\n\n\tstatic int min(int a, int b) {\n\n\t\treturn Math.min(a, b);\n\t}\n}\n\nclass XY {\n\n\tint h;\n\tint w;\n\tint d;\n\n\tXY(int h, int w, int d) {\n\t\tthis.h = h;\n\t\tthis.w = w;\n\t\tthis.d = d;\n\t}\n}\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have N integers. The i-th number is A_i.\n\n\\{A_i\\} is said to be pairwise coprime when GCD(A_i,A_j)=1 holds for every pair (i, j) such that 1\\leq i < j \\leq N.\n\n\\{A_i\\} is said to be setwise coprime when \\{A_i\\} is not pairwise coprime but GCD(A_1,\\ldots,A_N)=1.\n\nDetermine if \\{A_i\\} is pairwise coprime, setwise coprime, or neither.\n\nHere, GCD(\\ldots) denotes greatest common divisor.\n\nConstraints\n\n2 \\leq N \\leq 10^6\n\n1 \\leq A_i\\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 \\ldots A_N\n\nOutput\n\nIf \\{A_i\\} is pairwise coprime, print pairwise coprime; if \\{A_i\\} is setwise coprime, print setwise coprime; if neither, print not coprime.\n\nSample Input 1\n\n3\n3 4 5\n\nSample Output 1\n\npairwise coprime\n\nGCD(3,4)=GCD(3,5)=GCD(4,5)=1, so they are pairwise coprime.\n\nSample Input 2\n\n3\n6 10 15\n\nSample Output 2\n\nsetwise coprime\n\nSince GCD(6,10)=2, they are not pairwise coprime. However, since GCD(6,10,15)=1, they are setwise coprime.\n\nSample Input 3\n\n3\n6 10 16\n\nSample Output 3\n\nnot coprime\n\nGCD(6,10,16)=2, so they are neither pairwise coprime nor setwise coprime.", "sample_input": "3\n3 4 5\n"}, "reference_outputs": ["pairwise coprime\n"], "source_document_id": "p02574", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have N integers. The i-th number is A_i.\n\n\\{A_i\\} is said to be pairwise coprime when GCD(A_i,A_j)=1 holds for every pair (i, j) such that 1\\leq i < j \\leq N.\n\n\\{A_i\\} is said to be setwise coprime when \\{A_i\\} is not pairwise coprime but GCD(A_1,\\ldots,A_N)=1.\n\nDetermine if \\{A_i\\} is pairwise coprime, setwise coprime, or neither.\n\nHere, GCD(\\ldots) denotes greatest common divisor.\n\nConstraints\n\n2 \\leq N \\leq 10^6\n\n1 \\leq A_i\\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 \\ldots A_N\n\nOutput\n\nIf \\{A_i\\} is pairwise coprime, print pairwise coprime; if \\{A_i\\} is setwise coprime, print setwise coprime; if neither, print not coprime.\n\nSample Input 1\n\n3\n3 4 5\n\nSample Output 1\n\npairwise coprime\n\nGCD(3,4)=GCD(3,5)=GCD(4,5)=1, so they are pairwise coprime.\n\nSample Input 2\n\n3\n6 10 15\n\nSample Output 2\n\nsetwise coprime\n\nSince GCD(6,10)=2, they are not pairwise coprime. However, since GCD(6,10,15)=1, they are setwise coprime.\n\nSample Input 3\n\n3\n6 10 16\n\nSample Output 3\n\nnot coprime\n\nGCD(6,10,16)=2, so they are neither pairwise coprime nor setwise coprime.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3805, "cpu_time_ms": 2209, "memory_kb": 135832}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s749960524", "group_id": "codeNet:p02574", "input_text": "\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tprivate static Scanner in;\n\n\tpublic static void main(String[] args) {\n\t\tin = new Scanner(System.in);\n\n\t\tint n = in.nextInt();\n\t\tint[] a = new int[n];\n\t\t\n\t\tfor(int i=0; i[] primes = new ArrayList[SIZE];\n\t\tfor(int i=0; i();\n\t\t}\n\t\t\n\t\tfor(int i=2; i map = new HashMap<>();\n\t\t\n\t\tfor(int i=0; i1) {\n\t\t\t\tallOnes = false;\n\t\t\t}\n\t\t\tif (map.get(u)==1) {\n\t\t\t\tallMore = false;\n\t\t\t}\n\t\t\tif (map.get(u)==n) {\n\t\t\t\tallEqualtoN = false;\n\t\t\t}\n\t\t}\n\t\tif (allOnes) {\n\t\t\tSystem.out.println(\"pairwise coprime\");\n\t\t} else if (!allEqualtoN) {\n\t\t\tSystem.out.println(\"not coprime\");\n\t\t} else {\n\t\t\tSystem.out.println(\"setwise coprime\");\n\t\t}\n\t}\n\t\n\n}\n", "language": "Java", "metadata": {"date": 1598738232, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02574.html", "problem_id": "p02574", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02574/input.txt", "sample_output_relpath": "derived/input_output/data/p02574/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02574/Java/s749960524.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s749960524", "user_id": "u887200576"}, "prompt_components": {"gold_output": "pairwise coprime\n", "input_to_evaluate": "\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tprivate static Scanner in;\n\n\tpublic static void main(String[] args) {\n\t\tin = new Scanner(System.in);\n\n\t\tint n = in.nextInt();\n\t\tint[] a = new int[n];\n\t\t\n\t\tfor(int i=0; i[] primes = new ArrayList[SIZE];\n\t\tfor(int i=0; i();\n\t\t}\n\t\t\n\t\tfor(int i=2; i map = new HashMap<>();\n\t\t\n\t\tfor(int i=0; i1) {\n\t\t\t\tallOnes = false;\n\t\t\t}\n\t\t\tif (map.get(u)==1) {\n\t\t\t\tallMore = false;\n\t\t\t}\n\t\t\tif (map.get(u)==n) {\n\t\t\t\tallEqualtoN = false;\n\t\t\t}\n\t\t}\n\t\tif (allOnes) {\n\t\t\tSystem.out.println(\"pairwise coprime\");\n\t\t} else if (!allEqualtoN) {\n\t\t\tSystem.out.println(\"not coprime\");\n\t\t} else {\n\t\t\tSystem.out.println(\"setwise coprime\");\n\t\t}\n\t}\n\t\n\n}\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have N integers. The i-th number is A_i.\n\n\\{A_i\\} is said to be pairwise coprime when GCD(A_i,A_j)=1 holds for every pair (i, j) such that 1\\leq i < j \\leq N.\n\n\\{A_i\\} is said to be setwise coprime when \\{A_i\\} is not pairwise coprime but GCD(A_1,\\ldots,A_N)=1.\n\nDetermine if \\{A_i\\} is pairwise coprime, setwise coprime, or neither.\n\nHere, GCD(\\ldots) denotes greatest common divisor.\n\nConstraints\n\n2 \\leq N \\leq 10^6\n\n1 \\leq A_i\\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 \\ldots A_N\n\nOutput\n\nIf \\{A_i\\} is pairwise coprime, print pairwise coprime; if \\{A_i\\} is setwise coprime, print setwise coprime; if neither, print not coprime.\n\nSample Input 1\n\n3\n3 4 5\n\nSample Output 1\n\npairwise coprime\n\nGCD(3,4)=GCD(3,5)=GCD(4,5)=1, so they are pairwise coprime.\n\nSample Input 2\n\n3\n6 10 15\n\nSample Output 2\n\nsetwise coprime\n\nSince GCD(6,10)=2, they are not pairwise coprime. However, since GCD(6,10,15)=1, they are setwise coprime.\n\nSample Input 3\n\n3\n6 10 16\n\nSample Output 3\n\nnot coprime\n\nGCD(6,10,16)=2, so they are neither pairwise coprime nor setwise coprime.", "sample_input": "3\n3 4 5\n"}, "reference_outputs": ["pairwise coprime\n"], "source_document_id": "p02574", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have N integers. The i-th number is A_i.\n\n\\{A_i\\} is said to be pairwise coprime when GCD(A_i,A_j)=1 holds for every pair (i, j) such that 1\\leq i < j \\leq N.\n\n\\{A_i\\} is said to be setwise coprime when \\{A_i\\} is not pairwise coprime but GCD(A_1,\\ldots,A_N)=1.\n\nDetermine if \\{A_i\\} is pairwise coprime, setwise coprime, or neither.\n\nHere, GCD(\\ldots) denotes greatest common divisor.\n\nConstraints\n\n2 \\leq N \\leq 10^6\n\n1 \\leq A_i\\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 \\ldots A_N\n\nOutput\n\nIf \\{A_i\\} is pairwise coprime, print pairwise coprime; if \\{A_i\\} is setwise coprime, print setwise coprime; if neither, print not coprime.\n\nSample Input 1\n\n3\n3 4 5\n\nSample Output 1\n\npairwise coprime\n\nGCD(3,4)=GCD(3,5)=GCD(4,5)=1, so they are pairwise coprime.\n\nSample Input 2\n\n3\n6 10 15\n\nSample Output 2\n\nsetwise coprime\n\nSince GCD(6,10)=2, they are not pairwise coprime. However, since GCD(6,10,15)=1, they are setwise coprime.\n\nSample Input 3\n\n3\n6 10 16\n\nSample Output 3\n\nnot coprime\n\nGCD(6,10,16)=2, so they are neither pairwise coprime nor setwise coprime.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1368, "cpu_time_ms": 2214, "memory_kb": 234636}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s989936788", "group_id": "codeNet:p02574", "input_text": "\n\n/************************************************************************\n AUTH : krishna-3249 \n DATE : 8/29/20\n TIME : 6:12 PM\n\n Everyone’s a whore, Grace. We just sell different parts of ourselves.\n\n Simple can be harder than complex: \n you have to work hard to get your thinking clean to make it simple. \n But it's worth it in the end \n because once you get there, you can move mountains.\n ************************************************************************/\n\nimport java.lang.*;\nimport java.io.*;\nimport java.util.*;\n\npublic class Main {\n\n private static final long MOD = 1_000_000_000 + 7;\n\n private long power(long base, long exponent) {\n long res = 1;\n while (exponent > 0) {\n if ((base & 1) == 1) {\n res = (res * base) % MOD;\n exponent--;\n } else {\n res = (res * res) % MOD;\n exponent >>= 1;\n }\n }\n return res;\n }\n\n private long inverseMod(long number) {\n return power(number, MOD - 2);\n }\n\n private int gcd(int a, int b) {\n if (b == 0) {\n return a;\n }\n return gcd(b, a % b);\n }\n\n private long gcd(long a, long b) {\n if (b == 0) {\n return a;\n }\n return gcd(b, a % b);\n }\n\n private List sieve(int N) {\n boolean[] mark = new boolean[N+1];\n mark[0] = mark[1] = true;\n for (int i=2;i*i<=N;i++) {\n if (!mark[i]) {\n for (int j=2*i;j<=N;j+=i) {\n mark[j] = true;\n }\n }\n }\n List primes = new ArrayList<>();\n for (int i=0;i<=N;i++) {\n if (!mark[i]) {\n primes.add(i);\n }\n }\n return primes;\n }\n public void solve(Read input, Write output) throws Exception {\n List primes = sieve(1000);\n int N = input.readInt();\n int[] arr = input.readIntArray(N);\n int allgcd = -1;\n for (int i=1;i1) {\n if (val%prime==0) {\n val = val/prime;\n taken = true;\n } else {\n break;\n }\n }\n if (taken) {\n if (factorcount[prime]+1>1) {\n found = false;\n break;\n } else {\n factorcount[prime]++;\n }\n }\n }\n if (val>1) {\n if (factorcount[val]+1>1) {\n found = false;\n break;\n } else {\n factorcount[val]++;\n }\n }\n if (!found) {\n break;\n }\n }\n if (found) {\n output.printLine(\"pairwise coprime\");\n } else {\n if (allgcd==1) {\n output.printLine(\"setwise coprime\");\n } else {\n output.printLine(\"not coprime\");\n }\n }\n }\n\n public static void main(String[] args) throws Exception {\n Read input = new Read();\n Write output = new Write();\n Main D = new Main();\n D.solve(input, output);\n output.flush();\n output.close();\n }\n\n // java fast io reader and writer\n // taken from various sources and customized\n\n static class Read {\n\n private byte[] buffer = new byte[10 * 1024];\n private int index;\n private InputStream input_stream;\n private int total;\n\n public Read() {\n input_stream = System.in;\n }\n\n public int read() throws IOException {\n if (total < 0)\n throw new InputMismatchException();\n if (index >= total) {\n index = 0;\n total = input_stream.read(buffer);\n if (total <= 0)\n return -1;\n }\n return buffer[index++];\n }\n\n public long readLong() throws IOException {\n long number = 0;\n int n = read();\n while (isWhiteSpace(n))\n n = read();\n long neg = 1l;\n if (n == '-') {\n neg = -1l;\n n = read();\n }\n while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n number *= 10l;\n number += (long) (n - '0');\n n = read();\n } else throw new InputMismatchException();\n }\n return neg * number;\n }\n\n public int readInt() throws IOException {\n int integer = 0;\n int n = read();\n while (isWhiteSpace(n))\n n = read();\n int neg = 1;\n if (n == '-') {\n neg = -1;\n n = read();\n }\n while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n integer *= 10;\n integer += n - '0';\n n = read();\n } else throw new InputMismatchException();\n }\n return neg * integer;\n }\n\n public double readDouble() throws IOException {\n double doub = 0;\n int n = read();\n while (isWhiteSpace(n))\n n = read();\n int neg = 1;\n if (n == '-') {\n neg = -1;\n n = read();\n }\n while (!isWhiteSpace(n) && n != '.') {\n if (n >= '0' && n <= '9') {\n doub *= 10;\n doub += n - '0';\n n = read();\n } else throw new InputMismatchException();\n }\n\n if (n == '.') {\n n = read();\n double temp = 1;\n while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n temp /= 10;\n doub += (n - '0') * temp;\n n = read();\n } else throw new InputMismatchException();\n }\n }\n return doub * neg;\n }\n\n public String readString() throws IOException {\n StringBuilder sb = new StringBuilder();\n int n = read();\n while (isWhiteSpace(n))\n n = read();\n while (!isWhiteSpace(n)) {\n sb.append((char) n);\n n = read();\n }\n return sb.toString();\n }\n\n public List readDoubleList(int size) throws IOException {\n List res = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n res.add(this.readDouble());\n }\n return res;\n }\n\n public double[] readDoubleArray(int size) throws IOException {\n double[] res = new double[size];\n for (int i = 0; i < size; i++) {\n res[i] = this.readDouble();\n }\n return res;\n }\n\n public List readStringList(int size) throws IOException {\n List res = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n res.add(this.readString());\n }\n return res;\n }\n\n public String[] readStringArray(int size) throws IOException {\n String[] res = new String[size];\n for (int i = 0; i < size; i++) {\n res[i] = this.readString();\n }\n return res;\n }\n\n public List readIntList(int size) throws IOException {\n List res = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n res.add(this.readInt());\n }\n return res;\n }\n\n public List readLongList(int size) throws IOException {\n List res = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n res.add(this.readLong());\n }\n return res;\n }\n\n public int[] readIntArray(int size) throws IOException {\n int[] res = new int[size];\n for (int i = 0; i < size; i++) {\n res[i] = this.readInt();\n }\n return res;\n }\n\n public long[] readLongArray(int size) throws IOException {\n long[] res = new long[size];\n for (int i = 0; i < size; i++) {\n res[i] = this.readLong();\n }\n return res;\n }\n\n private boolean isWhiteSpace(int n) {\n if (n == ' ' || n == '\\n' || n == '\\r' || n == '\\t' || n == -1)\n return true;\n return false;\n }\n }\n\n static class Write {\n\n private final BufferedWriter bw;\n\n public Write() {\n bw = new BufferedWriter(new OutputStreamWriter(System.out));\n }\n\n public void print(Object str) throws IOException {\n bw.append(str + \"\");\n }\n\n public void printLine(Object str) throws IOException {\n print(str);\n bw.append(\"\\n\");\n }\n\n public void close() throws IOException {\n bw.close();\n }\n\n public void flush() throws IOException {\n bw.flush();\n }\n }\n}", "language": "Java", "metadata": {"date": 1598733323, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02574.html", "problem_id": "p02574", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02574/input.txt", "sample_output_relpath": "derived/input_output/data/p02574/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02574/Java/s989936788.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s989936788", "user_id": "u427304938"}, "prompt_components": {"gold_output": "pairwise coprime\n", "input_to_evaluate": "\n\n/************************************************************************\n AUTH : krishna-3249 \n DATE : 8/29/20\n TIME : 6:12 PM\n\n Everyone’s a whore, Grace. We just sell different parts of ourselves.\n\n Simple can be harder than complex: \n you have to work hard to get your thinking clean to make it simple. \n But it's worth it in the end \n because once you get there, you can move mountains.\n ************************************************************************/\n\nimport java.lang.*;\nimport java.io.*;\nimport java.util.*;\n\npublic class Main {\n\n private static final long MOD = 1_000_000_000 + 7;\n\n private long power(long base, long exponent) {\n long res = 1;\n while (exponent > 0) {\n if ((base & 1) == 1) {\n res = (res * base) % MOD;\n exponent--;\n } else {\n res = (res * res) % MOD;\n exponent >>= 1;\n }\n }\n return res;\n }\n\n private long inverseMod(long number) {\n return power(number, MOD - 2);\n }\n\n private int gcd(int a, int b) {\n if (b == 0) {\n return a;\n }\n return gcd(b, a % b);\n }\n\n private long gcd(long a, long b) {\n if (b == 0) {\n return a;\n }\n return gcd(b, a % b);\n }\n\n private List sieve(int N) {\n boolean[] mark = new boolean[N+1];\n mark[0] = mark[1] = true;\n for (int i=2;i*i<=N;i++) {\n if (!mark[i]) {\n for (int j=2*i;j<=N;j+=i) {\n mark[j] = true;\n }\n }\n }\n List primes = new ArrayList<>();\n for (int i=0;i<=N;i++) {\n if (!mark[i]) {\n primes.add(i);\n }\n }\n return primes;\n }\n public void solve(Read input, Write output) throws Exception {\n List primes = sieve(1000);\n int N = input.readInt();\n int[] arr = input.readIntArray(N);\n int allgcd = -1;\n for (int i=1;i1) {\n if (val%prime==0) {\n val = val/prime;\n taken = true;\n } else {\n break;\n }\n }\n if (taken) {\n if (factorcount[prime]+1>1) {\n found = false;\n break;\n } else {\n factorcount[prime]++;\n }\n }\n }\n if (val>1) {\n if (factorcount[val]+1>1) {\n found = false;\n break;\n } else {\n factorcount[val]++;\n }\n }\n if (!found) {\n break;\n }\n }\n if (found) {\n output.printLine(\"pairwise coprime\");\n } else {\n if (allgcd==1) {\n output.printLine(\"setwise coprime\");\n } else {\n output.printLine(\"not coprime\");\n }\n }\n }\n\n public static void main(String[] args) throws Exception {\n Read input = new Read();\n Write output = new Write();\n Main D = new Main();\n D.solve(input, output);\n output.flush();\n output.close();\n }\n\n // java fast io reader and writer\n // taken from various sources and customized\n\n static class Read {\n\n private byte[] buffer = new byte[10 * 1024];\n private int index;\n private InputStream input_stream;\n private int total;\n\n public Read() {\n input_stream = System.in;\n }\n\n public int read() throws IOException {\n if (total < 0)\n throw new InputMismatchException();\n if (index >= total) {\n index = 0;\n total = input_stream.read(buffer);\n if (total <= 0)\n return -1;\n }\n return buffer[index++];\n }\n\n public long readLong() throws IOException {\n long number = 0;\n int n = read();\n while (isWhiteSpace(n))\n n = read();\n long neg = 1l;\n if (n == '-') {\n neg = -1l;\n n = read();\n }\n while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n number *= 10l;\n number += (long) (n - '0');\n n = read();\n } else throw new InputMismatchException();\n }\n return neg * number;\n }\n\n public int readInt() throws IOException {\n int integer = 0;\n int n = read();\n while (isWhiteSpace(n))\n n = read();\n int neg = 1;\n if (n == '-') {\n neg = -1;\n n = read();\n }\n while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n integer *= 10;\n integer += n - '0';\n n = read();\n } else throw new InputMismatchException();\n }\n return neg * integer;\n }\n\n public double readDouble() throws IOException {\n double doub = 0;\n int n = read();\n while (isWhiteSpace(n))\n n = read();\n int neg = 1;\n if (n == '-') {\n neg = -1;\n n = read();\n }\n while (!isWhiteSpace(n) && n != '.') {\n if (n >= '0' && n <= '9') {\n doub *= 10;\n doub += n - '0';\n n = read();\n } else throw new InputMismatchException();\n }\n\n if (n == '.') {\n n = read();\n double temp = 1;\n while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n temp /= 10;\n doub += (n - '0') * temp;\n n = read();\n } else throw new InputMismatchException();\n }\n }\n return doub * neg;\n }\n\n public String readString() throws IOException {\n StringBuilder sb = new StringBuilder();\n int n = read();\n while (isWhiteSpace(n))\n n = read();\n while (!isWhiteSpace(n)) {\n sb.append((char) n);\n n = read();\n }\n return sb.toString();\n }\n\n public List readDoubleList(int size) throws IOException {\n List res = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n res.add(this.readDouble());\n }\n return res;\n }\n\n public double[] readDoubleArray(int size) throws IOException {\n double[] res = new double[size];\n for (int i = 0; i < size; i++) {\n res[i] = this.readDouble();\n }\n return res;\n }\n\n public List readStringList(int size) throws IOException {\n List res = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n res.add(this.readString());\n }\n return res;\n }\n\n public String[] readStringArray(int size) throws IOException {\n String[] res = new String[size];\n for (int i = 0; i < size; i++) {\n res[i] = this.readString();\n }\n return res;\n }\n\n public List readIntList(int size) throws IOException {\n List res = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n res.add(this.readInt());\n }\n return res;\n }\n\n public List readLongList(int size) throws IOException {\n List res = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n res.add(this.readLong());\n }\n return res;\n }\n\n public int[] readIntArray(int size) throws IOException {\n int[] res = new int[size];\n for (int i = 0; i < size; i++) {\n res[i] = this.readInt();\n }\n return res;\n }\n\n public long[] readLongArray(int size) throws IOException {\n long[] res = new long[size];\n for (int i = 0; i < size; i++) {\n res[i] = this.readLong();\n }\n return res;\n }\n\n private boolean isWhiteSpace(int n) {\n if (n == ' ' || n == '\\n' || n == '\\r' || n == '\\t' || n == -1)\n return true;\n return false;\n }\n }\n\n static class Write {\n\n private final BufferedWriter bw;\n\n public Write() {\n bw = new BufferedWriter(new OutputStreamWriter(System.out));\n }\n\n public void print(Object str) throws IOException {\n bw.append(str + \"\");\n }\n\n public void printLine(Object str) throws IOException {\n print(str);\n bw.append(\"\\n\");\n }\n\n public void close() throws IOException {\n bw.close();\n }\n\n public void flush() throws IOException {\n bw.flush();\n }\n }\n}", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have N integers. The i-th number is A_i.\n\n\\{A_i\\} is said to be pairwise coprime when GCD(A_i,A_j)=1 holds for every pair (i, j) such that 1\\leq i < j \\leq N.\n\n\\{A_i\\} is said to be setwise coprime when \\{A_i\\} is not pairwise coprime but GCD(A_1,\\ldots,A_N)=1.\n\nDetermine if \\{A_i\\} is pairwise coprime, setwise coprime, or neither.\n\nHere, GCD(\\ldots) denotes greatest common divisor.\n\nConstraints\n\n2 \\leq N \\leq 10^6\n\n1 \\leq A_i\\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 \\ldots A_N\n\nOutput\n\nIf \\{A_i\\} is pairwise coprime, print pairwise coprime; if \\{A_i\\} is setwise coprime, print setwise coprime; if neither, print not coprime.\n\nSample Input 1\n\n3\n3 4 5\n\nSample Output 1\n\npairwise coprime\n\nGCD(3,4)=GCD(3,5)=GCD(4,5)=1, so they are pairwise coprime.\n\nSample Input 2\n\n3\n6 10 15\n\nSample Output 2\n\nsetwise coprime\n\nSince GCD(6,10)=2, they are not pairwise coprime. However, since GCD(6,10,15)=1, they are setwise coprime.\n\nSample Input 3\n\n3\n6 10 16\n\nSample Output 3\n\nnot coprime\n\nGCD(6,10,16)=2, so they are neither pairwise coprime nor setwise coprime.", "sample_input": "3\n3 4 5\n"}, "reference_outputs": ["pairwise coprime\n"], "source_document_id": "p02574", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have N integers. The i-th number is A_i.\n\n\\{A_i\\} is said to be pairwise coprime when GCD(A_i,A_j)=1 holds for every pair (i, j) such that 1\\leq i < j \\leq N.\n\n\\{A_i\\} is said to be setwise coprime when \\{A_i\\} is not pairwise coprime but GCD(A_1,\\ldots,A_N)=1.\n\nDetermine if \\{A_i\\} is pairwise coprime, setwise coprime, or neither.\n\nHere, GCD(\\ldots) denotes greatest common divisor.\n\nConstraints\n\n2 \\leq N \\leq 10^6\n\n1 \\leq A_i\\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 \\ldots A_N\n\nOutput\n\nIf \\{A_i\\} is pairwise coprime, print pairwise coprime; if \\{A_i\\} is setwise coprime, print setwise coprime; if neither, print not coprime.\n\nSample Input 1\n\n3\n3 4 5\n\nSample Output 1\n\npairwise coprime\n\nGCD(3,4)=GCD(3,5)=GCD(4,5)=1, so they are pairwise coprime.\n\nSample Input 2\n\n3\n6 10 15\n\nSample Output 2\n\nsetwise coprime\n\nSince GCD(6,10)=2, they are not pairwise coprime. However, since GCD(6,10,15)=1, they are setwise coprime.\n\nSample Input 3\n\n3\n6 10 16\n\nSample Output 3\n\nnot coprime\n\nGCD(6,10,16)=2, so they are neither pairwise coprime nor setwise coprime.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 10047, "cpu_time_ms": 273, "memory_kb": 44576}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s225022365", "group_id": "codeNet:p02574", "input_text": "import java.util.*;\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] arr = new int[n];\n for(int i = 0; i < n; i++){\n arr[i] = sc.nextInt();\n }\n Arrays.sort(arr);\n int[] div = new int[arr[0] + 1];\n for(int i = 0; i < n; i++){\n helper(arr[i],div);\n }\n boolean pair = true, set = true;\n for(int i = 2; i < div.length; i++){\n if(div[i] > 1)\n pair = false;\n if(div[i] == n)\n set = false;\n }\n if(pair)\n System.out.println(\"pairwise coprime\");\n else if(set)\n System.out.println(\"setwise coprime\");\n else\n System.out.println(\"not coprime\");\n }\n public static void helper(int num, int[] div){\n for(int i = 2; i <= Math.min(Math.sqrt(num) + 1, div.length - 1); i++){\n if(num % i == 0){\n div[i]++;\n if(i * i < num)\n div[num / i]++;\n }\n }\n }\n}", "language": "Java", "metadata": {"date": 1598733105, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02574.html", "problem_id": "p02574", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02574/input.txt", "sample_output_relpath": "derived/input_output/data/p02574/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02574/Java/s225022365.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s225022365", "user_id": "u953146767"}, "prompt_components": {"gold_output": "pairwise coprime\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] arr = new int[n];\n for(int i = 0; i < n; i++){\n arr[i] = sc.nextInt();\n }\n Arrays.sort(arr);\n int[] div = new int[arr[0] + 1];\n for(int i = 0; i < n; i++){\n helper(arr[i],div);\n }\n boolean pair = true, set = true;\n for(int i = 2; i < div.length; i++){\n if(div[i] > 1)\n pair = false;\n if(div[i] == n)\n set = false;\n }\n if(pair)\n System.out.println(\"pairwise coprime\");\n else if(set)\n System.out.println(\"setwise coprime\");\n else\n System.out.println(\"not coprime\");\n }\n public static void helper(int num, int[] div){\n for(int i = 2; i <= Math.min(Math.sqrt(num) + 1, div.length - 1); i++){\n if(num % i == 0){\n div[i]++;\n if(i * i < num)\n div[num / i]++;\n }\n }\n }\n}", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have N integers. The i-th number is A_i.\n\n\\{A_i\\} is said to be pairwise coprime when GCD(A_i,A_j)=1 holds for every pair (i, j) such that 1\\leq i < j \\leq N.\n\n\\{A_i\\} is said to be setwise coprime when \\{A_i\\} is not pairwise coprime but GCD(A_1,\\ldots,A_N)=1.\n\nDetermine if \\{A_i\\} is pairwise coprime, setwise coprime, or neither.\n\nHere, GCD(\\ldots) denotes greatest common divisor.\n\nConstraints\n\n2 \\leq N \\leq 10^6\n\n1 \\leq A_i\\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 \\ldots A_N\n\nOutput\n\nIf \\{A_i\\} is pairwise coprime, print pairwise coprime; if \\{A_i\\} is setwise coprime, print setwise coprime; if neither, print not coprime.\n\nSample Input 1\n\n3\n3 4 5\n\nSample Output 1\n\npairwise coprime\n\nGCD(3,4)=GCD(3,5)=GCD(4,5)=1, so they are pairwise coprime.\n\nSample Input 2\n\n3\n6 10 15\n\nSample Output 2\n\nsetwise coprime\n\nSince GCD(6,10)=2, they are not pairwise coprime. However, since GCD(6,10,15)=1, they are setwise coprime.\n\nSample Input 3\n\n3\n6 10 16\n\nSample Output 3\n\nnot coprime\n\nGCD(6,10,16)=2, so they are neither pairwise coprime nor setwise coprime.", "sample_input": "3\n3 4 5\n"}, "reference_outputs": ["pairwise coprime\n"], "source_document_id": "p02574", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have N integers. The i-th number is A_i.\n\n\\{A_i\\} is said to be pairwise coprime when GCD(A_i,A_j)=1 holds for every pair (i, j) such that 1\\leq i < j \\leq N.\n\n\\{A_i\\} is said to be setwise coprime when \\{A_i\\} is not pairwise coprime but GCD(A_1,\\ldots,A_N)=1.\n\nDetermine if \\{A_i\\} is pairwise coprime, setwise coprime, or neither.\n\nHere, GCD(\\ldots) denotes greatest common divisor.\n\nConstraints\n\n2 \\leq N \\leq 10^6\n\n1 \\leq A_i\\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 \\ldots A_N\n\nOutput\n\nIf \\{A_i\\} is pairwise coprime, print pairwise coprime; if \\{A_i\\} is setwise coprime, print setwise coprime; if neither, print not coprime.\n\nSample Input 1\n\n3\n3 4 5\n\nSample Output 1\n\npairwise coprime\n\nGCD(3,4)=GCD(3,5)=GCD(4,5)=1, so they are pairwise coprime.\n\nSample Input 2\n\n3\n6 10 15\n\nSample Output 2\n\nsetwise coprime\n\nSince GCD(6,10)=2, they are not pairwise coprime. However, since GCD(6,10,15)=1, they are setwise coprime.\n\nSample Input 3\n\n3\n6 10 16\n\nSample Output 3\n\nnot coprime\n\nGCD(6,10,16)=2, so they are neither pairwise coprime nor setwise coprime.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1121, "cpu_time_ms": 2208, "memory_kb": 67684}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s319361204", "group_id": "codeNet:p02574", "input_text": "import java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.NoSuchElementException;\npublic class Main {\n\tpublic static void main(String[] args)throws Exception{\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tint N=nextInt();\n\t\tArrayList prime=new ArrayList();\n\t\tHashMap map=new HashMap();\n\t\tboolean pair=true;\n\t\tint ans=0;\n\t\tprime.add(2);\n\t\tmap.put(2,false);\n\t\tfor(int i=3;i<=Math.sqrt(1000000);i+=2){\n\t\t\tboolean key=false;\n\t\t\tfor(int j=0;j=prime.get(j);j++){\n\t\t\t\tif(A%prime.get(j)==0){\n\t\t\t\t\twhile(A%prime.get(j)==0){\n\t\t\t\t\t\tA/=prime.get(j);\n\t\t\t\t\t}\n\t\t\t\t\tif(map.get(prime.get(j))==false){\n\t\t\t\t\t\tmap.put(prime.get(j),true);\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tpair=false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(A!=1&&map.containsKey(A)==false){\n\t\t\t\tmap.put(A,true);\n\t\t\t}\n\t\t}\n\t\tif(pair)\n\t\t\tSystem.out.println(\"pairwise coprime\");\n\t\telse if(ans==1)\n\t\t\tSystem.out.println(\"setwise coprime\");\n\t\telse\n\t\t\tSystem.out.println(\"not coprime\");\n\t}\n\tpublic static int gcd(int m, int n) {\n int r;\n while (n > 0) {\n r = m % n;\n m = n;\n n = r;\n }\n return m;\n }\n\tpublic static long lmod(long i, long j) {\n\t return (i%j)<0?(i%j)+0+(j<0?-j:j):(i%j+0);\n\t }\n\tstatic boolean isOK(int index,int key,ArrayList a){\n\t\tif (a.get(index)>=key) return true;\n\t else return false;\n\t}\n\tstatic int binary(int key,ArrayList a) {\n\t int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1\n\t int ok = (int)a.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()\n\t while (Math.abs(ok - ng) > 1) {\n\t int mid = (ok + ng) / 2;\n\t if (isOK(mid,key,a)) ok = mid;\n\t else ng = mid;\n\t }\n\t return ok;\n\t}\n\t//FastScanner\n\tstatic InputStream in = System.in;\n\tstatic byte[] buffer = new byte[1024];\n\tstatic int length = 0, p = 0;\n\tpublic static boolean hasNextByte () {\n\t\tif (p < length) return true;\n\t\telse {\n\t\t\tp = 0;\n\t\t\ttry {length = in.read(buffer);}\n\t\t\tcatch (Exception e) {e.printStackTrace();}\n\t\t\tif (length == 0) return false;\n\t\t}\n\t\treturn true;\n\t}\n\tpublic static int readByte () {\n\t\tif (hasNextByte() == true) return buffer[p++];\n\t\treturn -1;\n\t}\n\tpublic static boolean isPrintable (int n) {return 33<=n&&n<=126;}\n\tpublic static void skip () {\n\t\twhile (hasNextByte() && !isPrintable(buffer[p])) p++;\n\t}\n\tpublic static boolean hasNext () {skip(); return hasNextByte();}\n\tpublic static String next () {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint temp = readByte();\n\t\twhile (isPrintable(temp)) {\n\t\t\tsb.appendCodePoint(temp);\n\t\t\ttemp = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\tpublic static int nextInt () {return Math.toIntExact(nextLong());}\n\tpublic static int[] nextInts (int n) {\n\t\tint[] ar = new int[n];\n\t\tfor (int i=0; i prime=new ArrayList();\n\t\tHashMap map=new HashMap();\n\t\tboolean pair=true;\n\t\tint ans=0;\n\t\tprime.add(2);\n\t\tmap.put(2,false);\n\t\tfor(int i=3;i<=Math.sqrt(1000000);i+=2){\n\t\t\tboolean key=false;\n\t\t\tfor(int j=0;j=prime.get(j);j++){\n\t\t\t\tif(A%prime.get(j)==0){\n\t\t\t\t\twhile(A%prime.get(j)==0){\n\t\t\t\t\t\tA/=prime.get(j);\n\t\t\t\t\t}\n\t\t\t\t\tif(map.get(prime.get(j))==false){\n\t\t\t\t\t\tmap.put(prime.get(j),true);\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tpair=false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(A!=1&&map.containsKey(A)==false){\n\t\t\t\tmap.put(A,true);\n\t\t\t}\n\t\t}\n\t\tif(pair)\n\t\t\tSystem.out.println(\"pairwise coprime\");\n\t\telse if(ans==1)\n\t\t\tSystem.out.println(\"setwise coprime\");\n\t\telse\n\t\t\tSystem.out.println(\"not coprime\");\n\t}\n\tpublic static int gcd(int m, int n) {\n int r;\n while (n > 0) {\n r = m % n;\n m = n;\n n = r;\n }\n return m;\n }\n\tpublic static long lmod(long i, long j) {\n\t return (i%j)<0?(i%j)+0+(j<0?-j:j):(i%j+0);\n\t }\n\tstatic boolean isOK(int index,int key,ArrayList a){\n\t\tif (a.get(index)>=key) return true;\n\t else return false;\n\t}\n\tstatic int binary(int key,ArrayList a) {\n\t int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1\n\t int ok = (int)a.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()\n\t while (Math.abs(ok - ng) > 1) {\n\t int mid = (ok + ng) / 2;\n\t if (isOK(mid,key,a)) ok = mid;\n\t else ng = mid;\n\t }\n\t return ok;\n\t}\n\t//FastScanner\n\tstatic InputStream in = System.in;\n\tstatic byte[] buffer = new byte[1024];\n\tstatic int length = 0, p = 0;\n\tpublic static boolean hasNextByte () {\n\t\tif (p < length) return true;\n\t\telse {\n\t\t\tp = 0;\n\t\t\ttry {length = in.read(buffer);}\n\t\t\tcatch (Exception e) {e.printStackTrace();}\n\t\t\tif (length == 0) return false;\n\t\t}\n\t\treturn true;\n\t}\n\tpublic static int readByte () {\n\t\tif (hasNextByte() == true) return buffer[p++];\n\t\treturn -1;\n\t}\n\tpublic static boolean isPrintable (int n) {return 33<=n&&n<=126;}\n\tpublic static void skip () {\n\t\twhile (hasNextByte() && !isPrintable(buffer[p])) p++;\n\t}\n\tpublic static boolean hasNext () {skip(); return hasNextByte();}\n\tpublic static String next () {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint temp = readByte();\n\t\twhile (isPrintable(temp)) {\n\t\t\tsb.appendCodePoint(temp);\n\t\t\ttemp = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\tpublic static int nextInt () {return Math.toIntExact(nextLong());}\n\tpublic static int[] nextInts (int n) {\n\t\tint[] ar = new int[n];\n\t\tfor (int i=0; i h = new HashMap<>();\n for(int i=0; i 1){\n pc = false;\n }\n }\n \n long gcd = a[0];\n for(int i=1; i0 ? gcd(b,a%b) : a;\n }\n}\n", "language": "Java", "metadata": {"date": 1598732769, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02574.html", "problem_id": "p02574", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02574/input.txt", "sample_output_relpath": "derived/input_output/data/p02574/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02574/Java/s694874660.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s694874660", "user_id": "u397763977"}, "prompt_components": {"gold_output": "pairwise coprime\n", "input_to_evaluate": "import java.util.*;\npublic class Main{\n \n static final int MOD = (int)1e9+7;\n static final int MAX = (int)1e6+1;\n \n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n \n int n = Integer.parseInt(sc.next());\n int[] a = new int[n];\n HashMap h = new HashMap<>();\n for(int i=0; i 1){\n pc = false;\n }\n }\n \n long gcd = a[0];\n for(int i=1; i0 ? gcd(b,a%b) : a;\n }\n}\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have N integers. The i-th number is A_i.\n\n\\{A_i\\} is said to be pairwise coprime when GCD(A_i,A_j)=1 holds for every pair (i, j) such that 1\\leq i < j \\leq N.\n\n\\{A_i\\} is said to be setwise coprime when \\{A_i\\} is not pairwise coprime but GCD(A_1,\\ldots,A_N)=1.\n\nDetermine if \\{A_i\\} is pairwise coprime, setwise coprime, or neither.\n\nHere, GCD(\\ldots) denotes greatest common divisor.\n\nConstraints\n\n2 \\leq N \\leq 10^6\n\n1 \\leq A_i\\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 \\ldots A_N\n\nOutput\n\nIf \\{A_i\\} is pairwise coprime, print pairwise coprime; if \\{A_i\\} is setwise coprime, print setwise coprime; if neither, print not coprime.\n\nSample Input 1\n\n3\n3 4 5\n\nSample Output 1\n\npairwise coprime\n\nGCD(3,4)=GCD(3,5)=GCD(4,5)=1, so they are pairwise coprime.\n\nSample Input 2\n\n3\n6 10 15\n\nSample Output 2\n\nsetwise coprime\n\nSince GCD(6,10)=2, they are not pairwise coprime. However, since GCD(6,10,15)=1, they are setwise coprime.\n\nSample Input 3\n\n3\n6 10 16\n\nSample Output 3\n\nnot coprime\n\nGCD(6,10,16)=2, so they are neither pairwise coprime nor setwise coprime.", "sample_input": "3\n3 4 5\n"}, "reference_outputs": ["pairwise coprime\n"], "source_document_id": "p02574", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have N integers. The i-th number is A_i.\n\n\\{A_i\\} is said to be pairwise coprime when GCD(A_i,A_j)=1 holds for every pair (i, j) such that 1\\leq i < j \\leq N.\n\n\\{A_i\\} is said to be setwise coprime when \\{A_i\\} is not pairwise coprime but GCD(A_1,\\ldots,A_N)=1.\n\nDetermine if \\{A_i\\} is pairwise coprime, setwise coprime, or neither.\n\nHere, GCD(\\ldots) denotes greatest common divisor.\n\nConstraints\n\n2 \\leq N \\leq 10^6\n\n1 \\leq A_i\\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 \\ldots A_N\n\nOutput\n\nIf \\{A_i\\} is pairwise coprime, print pairwise coprime; if \\{A_i\\} is setwise coprime, print setwise coprime; if neither, print not coprime.\n\nSample Input 1\n\n3\n3 4 5\n\nSample Output 1\n\npairwise coprime\n\nGCD(3,4)=GCD(3,5)=GCD(4,5)=1, so they are pairwise coprime.\n\nSample Input 2\n\n3\n6 10 15\n\nSample Output 2\n\nsetwise coprime\n\nSince GCD(6,10)=2, they are not pairwise coprime. However, since GCD(6,10,15)=1, they are setwise coprime.\n\nSample Input 3\n\n3\n6 10 16\n\nSample Output 3\n\nnot coprime\n\nGCD(6,10,16)=2, so they are neither pairwise coprime nor setwise coprime.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1478, "cpu_time_ms": 1652, "memory_kb": 141092}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s839337494", "group_id": "codeNet:p02574", "input_text": "import java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n \n public static void main(String[] args) {\n \n var sc = new Scanner(System.in);\n \n int n = Integer.parseInt(sc.next());\n var a = new int[n];\n var set = new HashSet();\n for(int i = 0; i < n; i++){\n a[i] = Integer.parseInt(sc.next());\n set.add(a[i]);\n }\n \n List list = sieve(1000);\n boolean b = true;\n if(set.size() < n){\n b = false;\n }else{\n for(int x : list){\n int count = 0;\n for(int i = 0; i < n; i++){\n if(a[i] % x == 0){\n count++;\n }\n }\n if(count >= 2){\n b = false;\n break;\n }\n }\n }\n \n if(b){\n System.out.println(\"pairwise coprime\");\n }else{\n long gcd = gcd(a[0], a[1]);\n for(int i = 2; i < n; i++){\n gcd = gcd(gcd, a[i]);\n }\n if(gcd == 1){\n System.out.println(\"setwise coprime\");\n }else{\n System.out.println(\"not coprime\");\n }\n }\n }\n \n static List sieve(int x){\n \n var p = new boolean[x+1];\n Arrays.fill(p, true);\n int sqrt = (int)Math.sqrt(x+1);\n for(int i = 2; i <= sqrt; i++){\n if(!p[i]) continue;\n for(int j = i*i; j <= x; j += i){\n p[j] = false;\n }\n }\n var list = new ArrayList();\n if(x >= 2) list.add(2);\n for(int i = 3; i <= x; i += 2){\n if(p[i]) list.add(i);\n }\n return list;\n }\n \n static long gcd(long a, long b){\n return b == 0 ? a : gcd(b, a%b);\n }\n}", "language": "Java", "metadata": {"date": 1598731059, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02574.html", "problem_id": "p02574", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02574/input.txt", "sample_output_relpath": "derived/input_output/data/p02574/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02574/Java/s839337494.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s839337494", "user_id": "u175752990"}, "prompt_components": {"gold_output": "pairwise coprime\n", "input_to_evaluate": "import java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n \n public static void main(String[] args) {\n \n var sc = new Scanner(System.in);\n \n int n = Integer.parseInt(sc.next());\n var a = new int[n];\n var set = new HashSet();\n for(int i = 0; i < n; i++){\n a[i] = Integer.parseInt(sc.next());\n set.add(a[i]);\n }\n \n List list = sieve(1000);\n boolean b = true;\n if(set.size() < n){\n b = false;\n }else{\n for(int x : list){\n int count = 0;\n for(int i = 0; i < n; i++){\n if(a[i] % x == 0){\n count++;\n }\n }\n if(count >= 2){\n b = false;\n break;\n }\n }\n }\n \n if(b){\n System.out.println(\"pairwise coprime\");\n }else{\n long gcd = gcd(a[0], a[1]);\n for(int i = 2; i < n; i++){\n gcd = gcd(gcd, a[i]);\n }\n if(gcd == 1){\n System.out.println(\"setwise coprime\");\n }else{\n System.out.println(\"not coprime\");\n }\n }\n }\n \n static List sieve(int x){\n \n var p = new boolean[x+1];\n Arrays.fill(p, true);\n int sqrt = (int)Math.sqrt(x+1);\n for(int i = 2; i <= sqrt; i++){\n if(!p[i]) continue;\n for(int j = i*i; j <= x; j += i){\n p[j] = false;\n }\n }\n var list = new ArrayList();\n if(x >= 2) list.add(2);\n for(int i = 3; i <= x; i += 2){\n if(p[i]) list.add(i);\n }\n return list;\n }\n \n static long gcd(long a, long b){\n return b == 0 ? a : gcd(b, a%b);\n }\n}", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have N integers. The i-th number is A_i.\n\n\\{A_i\\} is said to be pairwise coprime when GCD(A_i,A_j)=1 holds for every pair (i, j) such that 1\\leq i < j \\leq N.\n\n\\{A_i\\} is said to be setwise coprime when \\{A_i\\} is not pairwise coprime but GCD(A_1,\\ldots,A_N)=1.\n\nDetermine if \\{A_i\\} is pairwise coprime, setwise coprime, or neither.\n\nHere, GCD(\\ldots) denotes greatest common divisor.\n\nConstraints\n\n2 \\leq N \\leq 10^6\n\n1 \\leq A_i\\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 \\ldots A_N\n\nOutput\n\nIf \\{A_i\\} is pairwise coprime, print pairwise coprime; if \\{A_i\\} is setwise coprime, print setwise coprime; if neither, print not coprime.\n\nSample Input 1\n\n3\n3 4 5\n\nSample Output 1\n\npairwise coprime\n\nGCD(3,4)=GCD(3,5)=GCD(4,5)=1, so they are pairwise coprime.\n\nSample Input 2\n\n3\n6 10 15\n\nSample Output 2\n\nsetwise coprime\n\nSince GCD(6,10)=2, they are not pairwise coprime. However, since GCD(6,10,15)=1, they are setwise coprime.\n\nSample Input 3\n\n3\n6 10 16\n\nSample Output 3\n\nnot coprime\n\nGCD(6,10,16)=2, so they are neither pairwise coprime nor setwise coprime.", "sample_input": "3\n3 4 5\n"}, "reference_outputs": ["pairwise coprime\n"], "source_document_id": "p02574", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have N integers. The i-th number is A_i.\n\n\\{A_i\\} is said to be pairwise coprime when GCD(A_i,A_j)=1 holds for every pair (i, j) such that 1\\leq i < j \\leq N.\n\n\\{A_i\\} is said to be setwise coprime when \\{A_i\\} is not pairwise coprime but GCD(A_1,\\ldots,A_N)=1.\n\nDetermine if \\{A_i\\} is pairwise coprime, setwise coprime, or neither.\n\nHere, GCD(\\ldots) denotes greatest common divisor.\n\nConstraints\n\n2 \\leq N \\leq 10^6\n\n1 \\leq A_i\\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 \\ldots A_N\n\nOutput\n\nIf \\{A_i\\} is pairwise coprime, print pairwise coprime; if \\{A_i\\} is setwise coprime, print setwise coprime; if neither, print not coprime.\n\nSample Input 1\n\n3\n3 4 5\n\nSample Output 1\n\npairwise coprime\n\nGCD(3,4)=GCD(3,5)=GCD(4,5)=1, so they are pairwise coprime.\n\nSample Input 2\n\n3\n6 10 15\n\nSample Output 2\n\nsetwise coprime\n\nSince GCD(6,10)=2, they are not pairwise coprime. However, since GCD(6,10,15)=1, they are setwise coprime.\n\nSample Input 3\n\n3\n6 10 16\n\nSample Output 3\n\nnot coprime\n\nGCD(6,10,16)=2, so they are neither pairwise coprime nor setwise coprime.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1990, "cpu_time_ms": 1173, "memory_kb": 133716}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s671220131", "group_id": "codeNet:p02574", "input_text": "import java.io.BufferedReader;\nimport java.io.Closeable;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Iterator;\nimport java.util.LinkedHashMap;\nimport java.util.LinkedList;\nimport java.util.ListIterator;\nimport java.util.Map.Entry;\n\nimport java.util.PriorityQueue;\nimport java.util.Random;\nimport java.util.StringTokenizer;\nimport java.util.TreeMap;\nimport java.util.TreeSet;\n\n\npublic class Main {\n\t\n\tpublic static long gcd(long a, long b){\n\t\treturn b == 0 ? a : gcd(b, a % b);\n\t}\n\t\n\tpublic static void main(String[] args) throws IOException {\t\n\t\ttry(final Scanner sc = new Scanner(System.in)){\n\t\t\tfinal int N = sc.nextInt();\n\t\t\tint[] as = new int[N];\n\t\t\tfor(int i = 0; i < N; i++) {\n\t\t\t\tas[i] = sc.nextInt();\n\t\t\t}\n\t\t\tArrays.sort(as);\n\t\t\t\n\t\t\tfinal int LIMIT = 1000000;\n\t\t\tboolean[] is_prime = new boolean[LIMIT + 1];\n\t\t\tArrays.fill(is_prime, true);\n\t\t\tis_prime[0] = is_prime[1] = false;\n\t\t\t\n\t\t\tArrayList primes = new ArrayList();\n\t\t\tfor(int i = 2; i <= LIMIT; i++) {\n\t\t\t\tif(!is_prime[i]){ continue; }\n\t\t\t\tprimes.add(i);\n\t\t\t\t\n\t\t\t\tfor(int j = 2 * i; j <= LIMIT; j += i) {\n\t\t\t\t\tis_prime[j] = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tboolean pairwise_coprime = true;\n\t\t\tboolean[] used_primes = new boolean[LIMIT + 1];\n\n\t\t\tLOOP: for(final int a : as) {\t\n\t\t\t\tfor(final int prime : primes) {\n\t\t\t\t\tif(a < prime) { break; }\n\t\t\t\t\tif(a % prime != 0) { continue; }\n\t\t\t\t\t\t\n\t\t\t\t\tif(used_primes[prime]) {\n\t\t\t\t\t\tpairwise_coprime = false;\n\t\t\t\t\t\tbreak LOOP;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tused_primes[prime] = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif(pairwise_coprime) {\n\t\t\t\tSystem.out.println(\"pairwise coprime\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\tlong gcd = as[0];\n\t\t\tfor(int i = 1; i < N; i++) {\n\t\t\t\tgcd = gcd(gcd, as[i]);\n\t\t\t}\n\t\t\t\n\t\t\tif(gcd == 1) {\n\t\t\t\tSystem.out.println(\"setwise coprime\");\n\t\t\t}else {\n\t\t\t\tSystem.out.println(\"not coprime\");\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic static class Scanner implements Closeable {\n\t\tprivate BufferedReader br;\n\t\tprivate StringTokenizer tok;\n\n\t\tpublic Scanner(InputStream is) throws IOException {\n\t\t\tbr = new BufferedReader(new InputStreamReader(is));\n\t\t}\n\n\t\tprivate void getLine() throws IOException {\n\t\t\twhile(!hasNext()){\n\t\t\t\ttok = new StringTokenizer(br.readLine());\n\t\t\t}\n\t\t}\n\n\t\tprivate boolean hasNext() {\n\t\t\treturn tok != null && tok.hasMoreTokens();\n\t\t}\n\n\t\tpublic String next() throws IOException {\n\t\t\tgetLine();\n\t\t\treturn tok.nextToken();\n\t\t}\n\n\t\tpublic int nextInt() throws IOException {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tpublic long nextLong() throws IOException {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\t\t\n\n\t\tpublic double nextDouble() throws IOException {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tpublic int[] nextIntArray(int n) throws IOException {\n\t\t\tfinal int[] ret = new int[n];\n\t\t\tfor(int i = 0; i < n; i++){\n\t\t\t\tret[i] = this.nextInt();\n\t\t\t}\n\t\t\treturn ret;\n\t\t}\n\n\t\tpublic long[] nextLongArray(int n) throws IOException {\n\t\t\tfinal long[] ret = new long[n];\n\t\t\tfor(int i = 0; i < n; i++){\n\t\t\t\tret[i] = this.nextLong();\n\t\t\t}\n\t\t\treturn ret;\n\t\t}\n\n\t\tpublic void close() throws IOException {\n\t\t\tbr.close();\n\t\t}\n\t}\n}\n", "language": "Java", "metadata": {"date": 1598729907, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02574.html", "problem_id": "p02574", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02574/input.txt", "sample_output_relpath": "derived/input_output/data/p02574/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02574/Java/s671220131.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s671220131", "user_id": "u316432228"}, "prompt_components": {"gold_output": "pairwise coprime\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.Closeable;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Iterator;\nimport java.util.LinkedHashMap;\nimport java.util.LinkedList;\nimport java.util.ListIterator;\nimport java.util.Map.Entry;\n\nimport java.util.PriorityQueue;\nimport java.util.Random;\nimport java.util.StringTokenizer;\nimport java.util.TreeMap;\nimport java.util.TreeSet;\n\n\npublic class Main {\n\t\n\tpublic static long gcd(long a, long b){\n\t\treturn b == 0 ? a : gcd(b, a % b);\n\t}\n\t\n\tpublic static void main(String[] args) throws IOException {\t\n\t\ttry(final Scanner sc = new Scanner(System.in)){\n\t\t\tfinal int N = sc.nextInt();\n\t\t\tint[] as = new int[N];\n\t\t\tfor(int i = 0; i < N; i++) {\n\t\t\t\tas[i] = sc.nextInt();\n\t\t\t}\n\t\t\tArrays.sort(as);\n\t\t\t\n\t\t\tfinal int LIMIT = 1000000;\n\t\t\tboolean[] is_prime = new boolean[LIMIT + 1];\n\t\t\tArrays.fill(is_prime, true);\n\t\t\tis_prime[0] = is_prime[1] = false;\n\t\t\t\n\t\t\tArrayList primes = new ArrayList();\n\t\t\tfor(int i = 2; i <= LIMIT; i++) {\n\t\t\t\tif(!is_prime[i]){ continue; }\n\t\t\t\tprimes.add(i);\n\t\t\t\t\n\t\t\t\tfor(int j = 2 * i; j <= LIMIT; j += i) {\n\t\t\t\t\tis_prime[j] = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tboolean pairwise_coprime = true;\n\t\t\tboolean[] used_primes = new boolean[LIMIT + 1];\n\n\t\t\tLOOP: for(final int a : as) {\t\n\t\t\t\tfor(final int prime : primes) {\n\t\t\t\t\tif(a < prime) { break; }\n\t\t\t\t\tif(a % prime != 0) { continue; }\n\t\t\t\t\t\t\n\t\t\t\t\tif(used_primes[prime]) {\n\t\t\t\t\t\tpairwise_coprime = false;\n\t\t\t\t\t\tbreak LOOP;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tused_primes[prime] = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif(pairwise_coprime) {\n\t\t\t\tSystem.out.println(\"pairwise coprime\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\tlong gcd = as[0];\n\t\t\tfor(int i = 1; i < N; i++) {\n\t\t\t\tgcd = gcd(gcd, as[i]);\n\t\t\t}\n\t\t\t\n\t\t\tif(gcd == 1) {\n\t\t\t\tSystem.out.println(\"setwise coprime\");\n\t\t\t}else {\n\t\t\t\tSystem.out.println(\"not coprime\");\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic static class Scanner implements Closeable {\n\t\tprivate BufferedReader br;\n\t\tprivate StringTokenizer tok;\n\n\t\tpublic Scanner(InputStream is) throws IOException {\n\t\t\tbr = new BufferedReader(new InputStreamReader(is));\n\t\t}\n\n\t\tprivate void getLine() throws IOException {\n\t\t\twhile(!hasNext()){\n\t\t\t\ttok = new StringTokenizer(br.readLine());\n\t\t\t}\n\t\t}\n\n\t\tprivate boolean hasNext() {\n\t\t\treturn tok != null && tok.hasMoreTokens();\n\t\t}\n\n\t\tpublic String next() throws IOException {\n\t\t\tgetLine();\n\t\t\treturn tok.nextToken();\n\t\t}\n\n\t\tpublic int nextInt() throws IOException {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tpublic long nextLong() throws IOException {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\t\t\n\n\t\tpublic double nextDouble() throws IOException {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tpublic int[] nextIntArray(int n) throws IOException {\n\t\t\tfinal int[] ret = new int[n];\n\t\t\tfor(int i = 0; i < n; i++){\n\t\t\t\tret[i] = this.nextInt();\n\t\t\t}\n\t\t\treturn ret;\n\t\t}\n\n\t\tpublic long[] nextLongArray(int n) throws IOException {\n\t\t\tfinal long[] ret = new long[n];\n\t\t\tfor(int i = 0; i < n; i++){\n\t\t\t\tret[i] = this.nextLong();\n\t\t\t}\n\t\t\treturn ret;\n\t\t}\n\n\t\tpublic void close() throws IOException {\n\t\t\tbr.close();\n\t\t}\n\t}\n}\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have N integers. The i-th number is A_i.\n\n\\{A_i\\} is said to be pairwise coprime when GCD(A_i,A_j)=1 holds for every pair (i, j) such that 1\\leq i < j \\leq N.\n\n\\{A_i\\} is said to be setwise coprime when \\{A_i\\} is not pairwise coprime but GCD(A_1,\\ldots,A_N)=1.\n\nDetermine if \\{A_i\\} is pairwise coprime, setwise coprime, or neither.\n\nHere, GCD(\\ldots) denotes greatest common divisor.\n\nConstraints\n\n2 \\leq N \\leq 10^6\n\n1 \\leq A_i\\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 \\ldots A_N\n\nOutput\n\nIf \\{A_i\\} is pairwise coprime, print pairwise coprime; if \\{A_i\\} is setwise coprime, print setwise coprime; if neither, print not coprime.\n\nSample Input 1\n\n3\n3 4 5\n\nSample Output 1\n\npairwise coprime\n\nGCD(3,4)=GCD(3,5)=GCD(4,5)=1, so they are pairwise coprime.\n\nSample Input 2\n\n3\n6 10 15\n\nSample Output 2\n\nsetwise coprime\n\nSince GCD(6,10)=2, they are not pairwise coprime. However, since GCD(6,10,15)=1, they are setwise coprime.\n\nSample Input 3\n\n3\n6 10 16\n\nSample Output 3\n\nnot coprime\n\nGCD(6,10,16)=2, so they are neither pairwise coprime nor setwise coprime.", "sample_input": "3\n3 4 5\n"}, "reference_outputs": ["pairwise coprime\n"], "source_document_id": "p02574", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have N integers. The i-th number is A_i.\n\n\\{A_i\\} is said to be pairwise coprime when GCD(A_i,A_j)=1 holds for every pair (i, j) such that 1\\leq i < j \\leq N.\n\n\\{A_i\\} is said to be setwise coprime when \\{A_i\\} is not pairwise coprime but GCD(A_1,\\ldots,A_N)=1.\n\nDetermine if \\{A_i\\} is pairwise coprime, setwise coprime, or neither.\n\nHere, GCD(\\ldots) denotes greatest common divisor.\n\nConstraints\n\n2 \\leq N \\leq 10^6\n\n1 \\leq A_i\\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 \\ldots A_N\n\nOutput\n\nIf \\{A_i\\} is pairwise coprime, print pairwise coprime; if \\{A_i\\} is setwise coprime, print setwise coprime; if neither, print not coprime.\n\nSample Input 1\n\n3\n3 4 5\n\nSample Output 1\n\npairwise coprime\n\nGCD(3,4)=GCD(3,5)=GCD(4,5)=1, so they are pairwise coprime.\n\nSample Input 2\n\n3\n6 10 15\n\nSample Output 2\n\nsetwise coprime\n\nSince GCD(6,10)=2, they are not pairwise coprime. However, since GCD(6,10,15)=1, they are setwise coprime.\n\nSample Input 3\n\n3\n6 10 16\n\nSample Output 3\n\nnot coprime\n\nGCD(6,10,16)=2, so they are neither pairwise coprime nor setwise coprime.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3298, "cpu_time_ms": 2207, "memory_kb": 77604}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s343524065", "group_id": "codeNet:p02574", "input_text": "import java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.Set;\n\npublic class Main {\n\n private static void solve() {\n int n = ni();\n int[] a = na(n);\n\n int g = a[0];\n Set set = new HashSet<>();\n int[] primes = sieveEratosthenes(2000000);\n boolean pairwis = true;\n for (int v : a) {\n g = gcd(g, v);\n\n int[][] f = factor(v, primes);\n for (int[] u : f) {\n int div = u[0];\n if (set.contains(div)) {\n pairwis = false;\n }\n set.add(div);\n }\n }\n\n if (pairwis) {\n System.out.println(\"pairwise coprime\");\n } else if (g == 1) {\n System.out.println(\"setwise coprime\");\n } else {\n System.out.println(\"not coprime\");\n }\n }\n\n public static int gcd(int a, int b) {\n while (b > 0) {\n int c = a;\n a = b;\n b = c % b;\n }\n return a;\n }\n\n public static int[][] factor(int n, int[] primes) {\n int[][] ret = new int[9][2];\n int rp = 0;\n for (int p : primes) {\n if (p * p > n)\n break;\n int i;\n for (i = 0; n % p == 0; n /= p, i++)\n ;\n if (i > 0) {\n ret[rp][0] = p;\n ret[rp][1] = i;\n rp++;\n }\n }\n if (n != 1) {\n ret[rp][0] = n;\n ret[rp][1] = 1;\n rp++;\n }\n return Arrays.copyOf(ret, rp);\n }\n\n public static int[] sieveEratosthenes(int n) {\n if (n <= 32) {\n int[] primes = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31 };\n for (int i = 0; i < primes.length; i++) {\n if (n < primes[i]) {\n return Arrays.copyOf(primes, i);\n }\n }\n return primes;\n }\n\n int u = n + 32;\n double lu = Math.log(u);\n int[] ret = new int[(int) (u / lu + u / lu / lu * 1.5)];\n ret[0] = 2;\n int pos = 1;\n\n int[] isnp = new int[(n + 1) / 32 / 2 + 1];\n int sup = (n + 1) / 32 / 2 + 1;\n\n int[] tprimes = { 3, 5, 7, 11, 13, 17, 19, 23, 29, 31 };\n for (int tp : tprimes) {\n ret[pos++] = tp;\n int[] ptn = new int[tp];\n for (int i = (tp - 3) / 2; i < tp << 5; i += tp)\n ptn[i >> 5] |= 1 << i;\n for (int j = 0; j < sup; j += tp) {\n for (int i = 0; i < tp && i + j < sup; i++) {\n isnp[j + i] |= ptn[i];\n }\n }\n }\n\n // 3,5,7\n // 2x+3=n\n int[] magic = { 0, 1, 23, 2, 29, 24, 19, 3, 30, 27, 25, 11, 20, 8, 4, 13, 31, 22, 28, 18, 26, 10, 7, 12, 21, 17, 9,\n 6, 16, 5, 15, 14 };\n int h = n / 2;\n for (int i = 0; i < sup; i++) {\n for (int j = ~isnp[i]; j != 0; j &= j - 1) {\n int pp = i << 5 | magic[(j & -j) * 0x076be629 >>> 27];\n int p = 2 * pp + 3;\n if (p > n)\n break;\n ret[pos++] = p;\n if ((long) p * p > n)\n continue;\n for (int q = (p * p - 3) / 2; q <= h; q += p)\n isnp[q >> 5] |= 1 << q;\n }\n }\n\n return Arrays.copyOf(ret, pos);\n }\n\n public static void main(String[] args) {\n new Thread(null, new Runnable() {\n @Override\n public void run() {\n long start = System.currentTimeMillis();\n String debug = args.length > 0 ? args[0] : null;\n if (debug != null) {\n try {\n is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));\n } catch (Exception e) {\n throw new RuntimeException(e);\n }\n }\n reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);\n solve();\n out.flush();\n tr((System.currentTimeMillis() - start) + \"ms\");\n }\n }, \"\", 64000000).start();\n }\n\n private static java.io.InputStream is = System.in;\n private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);\n private static java.util.StringTokenizer tokenizer = null;\n private static java.io.BufferedReader reader;\n\n public static String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new java.util.StringTokenizer(reader.readLine());\n } catch (Exception e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n private static double nd() {\n return Double.parseDouble(next());\n }\n\n private static long nl() {\n return Long.parseLong(next());\n }\n\n private static int[] na(int n) {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = ni();\n return a;\n }\n\n private static char[] ns() {\n return next().toCharArray();\n }\n\n private static long[] nal(int n) {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = nl();\n return a;\n }\n\n private static int[][] ntable(int n, int m) {\n int[][] table = new int[n][m];\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n table[i][j] = ni();\n }\n }\n return table;\n }\n\n private static int[][] nlist(int n, int m) {\n int[][] table = new int[m][n];\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n table[j][i] = ni();\n }\n }\n return table;\n }\n\n private static int ni() {\n return Integer.parseInt(next());\n }\n\n private static void tr(Object... o) {\n if (is != System.in)\n System.out.println(java.util.Arrays.deepToString(o));\n }\n}\n", "language": "Java", "metadata": {"date": 1598728546, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02574.html", "problem_id": "p02574", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02574/input.txt", "sample_output_relpath": "derived/input_output/data/p02574/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02574/Java/s343524065.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s343524065", "user_id": "u769201746"}, "prompt_components": {"gold_output": "pairwise coprime\n", "input_to_evaluate": "import java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.Set;\n\npublic class Main {\n\n private static void solve() {\n int n = ni();\n int[] a = na(n);\n\n int g = a[0];\n Set set = new HashSet<>();\n int[] primes = sieveEratosthenes(2000000);\n boolean pairwis = true;\n for (int v : a) {\n g = gcd(g, v);\n\n int[][] f = factor(v, primes);\n for (int[] u : f) {\n int div = u[0];\n if (set.contains(div)) {\n pairwis = false;\n }\n set.add(div);\n }\n }\n\n if (pairwis) {\n System.out.println(\"pairwise coprime\");\n } else if (g == 1) {\n System.out.println(\"setwise coprime\");\n } else {\n System.out.println(\"not coprime\");\n }\n }\n\n public static int gcd(int a, int b) {\n while (b > 0) {\n int c = a;\n a = b;\n b = c % b;\n }\n return a;\n }\n\n public static int[][] factor(int n, int[] primes) {\n int[][] ret = new int[9][2];\n int rp = 0;\n for (int p : primes) {\n if (p * p > n)\n break;\n int i;\n for (i = 0; n % p == 0; n /= p, i++)\n ;\n if (i > 0) {\n ret[rp][0] = p;\n ret[rp][1] = i;\n rp++;\n }\n }\n if (n != 1) {\n ret[rp][0] = n;\n ret[rp][1] = 1;\n rp++;\n }\n return Arrays.copyOf(ret, rp);\n }\n\n public static int[] sieveEratosthenes(int n) {\n if (n <= 32) {\n int[] primes = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31 };\n for (int i = 0; i < primes.length; i++) {\n if (n < primes[i]) {\n return Arrays.copyOf(primes, i);\n }\n }\n return primes;\n }\n\n int u = n + 32;\n double lu = Math.log(u);\n int[] ret = new int[(int) (u / lu + u / lu / lu * 1.5)];\n ret[0] = 2;\n int pos = 1;\n\n int[] isnp = new int[(n + 1) / 32 / 2 + 1];\n int sup = (n + 1) / 32 / 2 + 1;\n\n int[] tprimes = { 3, 5, 7, 11, 13, 17, 19, 23, 29, 31 };\n for (int tp : tprimes) {\n ret[pos++] = tp;\n int[] ptn = new int[tp];\n for (int i = (tp - 3) / 2; i < tp << 5; i += tp)\n ptn[i >> 5] |= 1 << i;\n for (int j = 0; j < sup; j += tp) {\n for (int i = 0; i < tp && i + j < sup; i++) {\n isnp[j + i] |= ptn[i];\n }\n }\n }\n\n // 3,5,7\n // 2x+3=n\n int[] magic = { 0, 1, 23, 2, 29, 24, 19, 3, 30, 27, 25, 11, 20, 8, 4, 13, 31, 22, 28, 18, 26, 10, 7, 12, 21, 17, 9,\n 6, 16, 5, 15, 14 };\n int h = n / 2;\n for (int i = 0; i < sup; i++) {\n for (int j = ~isnp[i]; j != 0; j &= j - 1) {\n int pp = i << 5 | magic[(j & -j) * 0x076be629 >>> 27];\n int p = 2 * pp + 3;\n if (p > n)\n break;\n ret[pos++] = p;\n if ((long) p * p > n)\n continue;\n for (int q = (p * p - 3) / 2; q <= h; q += p)\n isnp[q >> 5] |= 1 << q;\n }\n }\n\n return Arrays.copyOf(ret, pos);\n }\n\n public static void main(String[] args) {\n new Thread(null, new Runnable() {\n @Override\n public void run() {\n long start = System.currentTimeMillis();\n String debug = args.length > 0 ? args[0] : null;\n if (debug != null) {\n try {\n is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));\n } catch (Exception e) {\n throw new RuntimeException(e);\n }\n }\n reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);\n solve();\n out.flush();\n tr((System.currentTimeMillis() - start) + \"ms\");\n }\n }, \"\", 64000000).start();\n }\n\n private static java.io.InputStream is = System.in;\n private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);\n private static java.util.StringTokenizer tokenizer = null;\n private static java.io.BufferedReader reader;\n\n public static String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new java.util.StringTokenizer(reader.readLine());\n } catch (Exception e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n private static double nd() {\n return Double.parseDouble(next());\n }\n\n private static long nl() {\n return Long.parseLong(next());\n }\n\n private static int[] na(int n) {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = ni();\n return a;\n }\n\n private static char[] ns() {\n return next().toCharArray();\n }\n\n private static long[] nal(int n) {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = nl();\n return a;\n }\n\n private static int[][] ntable(int n, int m) {\n int[][] table = new int[n][m];\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n table[i][j] = ni();\n }\n }\n return table;\n }\n\n private static int[][] nlist(int n, int m) {\n int[][] table = new int[m][n];\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n table[j][i] = ni();\n }\n }\n return table;\n }\n\n private static int ni() {\n return Integer.parseInt(next());\n }\n\n private static void tr(Object... o) {\n if (is != System.in)\n System.out.println(java.util.Arrays.deepToString(o));\n }\n}\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have N integers. The i-th number is A_i.\n\n\\{A_i\\} is said to be pairwise coprime when GCD(A_i,A_j)=1 holds for every pair (i, j) such that 1\\leq i < j \\leq N.\n\n\\{A_i\\} is said to be setwise coprime when \\{A_i\\} is not pairwise coprime but GCD(A_1,\\ldots,A_N)=1.\n\nDetermine if \\{A_i\\} is pairwise coprime, setwise coprime, or neither.\n\nHere, GCD(\\ldots) denotes greatest common divisor.\n\nConstraints\n\n2 \\leq N \\leq 10^6\n\n1 \\leq A_i\\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 \\ldots A_N\n\nOutput\n\nIf \\{A_i\\} is pairwise coprime, print pairwise coprime; if \\{A_i\\} is setwise coprime, print setwise coprime; if neither, print not coprime.\n\nSample Input 1\n\n3\n3 4 5\n\nSample Output 1\n\npairwise coprime\n\nGCD(3,4)=GCD(3,5)=GCD(4,5)=1, so they are pairwise coprime.\n\nSample Input 2\n\n3\n6 10 15\n\nSample Output 2\n\nsetwise coprime\n\nSince GCD(6,10)=2, they are not pairwise coprime. However, since GCD(6,10,15)=1, they are setwise coprime.\n\nSample Input 3\n\n3\n6 10 16\n\nSample Output 3\n\nnot coprime\n\nGCD(6,10,16)=2, so they are neither pairwise coprime nor setwise coprime.", "sample_input": "3\n3 4 5\n"}, "reference_outputs": ["pairwise coprime\n"], "source_document_id": "p02574", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have N integers. The i-th number is A_i.\n\n\\{A_i\\} is said to be pairwise coprime when GCD(A_i,A_j)=1 holds for every pair (i, j) such that 1\\leq i < j \\leq N.\n\n\\{A_i\\} is said to be setwise coprime when \\{A_i\\} is not pairwise coprime but GCD(A_1,\\ldots,A_N)=1.\n\nDetermine if \\{A_i\\} is pairwise coprime, setwise coprime, or neither.\n\nHere, GCD(\\ldots) denotes greatest common divisor.\n\nConstraints\n\n2 \\leq N \\leq 10^6\n\n1 \\leq A_i\\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 \\ldots A_N\n\nOutput\n\nIf \\{A_i\\} is pairwise coprime, print pairwise coprime; if \\{A_i\\} is setwise coprime, print setwise coprime; if neither, print not coprime.\n\nSample Input 1\n\n3\n3 4 5\n\nSample Output 1\n\npairwise coprime\n\nGCD(3,4)=GCD(3,5)=GCD(4,5)=1, so they are pairwise coprime.\n\nSample Input 2\n\n3\n6 10 15\n\nSample Output 2\n\nsetwise coprime\n\nSince GCD(6,10)=2, they are not pairwise coprime. However, since GCD(6,10,15)=1, they are setwise coprime.\n\nSample Input 3\n\n3\n6 10 16\n\nSample Output 3\n\nnot coprime\n\nGCD(6,10,16)=2, so they are neither pairwise coprime nor setwise coprime.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 5194, "cpu_time_ms": 1114, "memory_kb": 80700}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s565355820", "group_id": "codeNet:p02580", "input_text": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.*;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tInputReader sc = new InputReader(System.in);\n\t\tPrintWriter pw = new PrintWriter(System.out);\n\t\tint h = sc.nextInt();\n\t\tint w = sc.nextInt();\n\t\tint m = sc.nextInt();\n\t\tHashMap> hmr = new HashMap<>();\n\t\tHashMap hmc = new HashMap<>();\n\t\t\n\t\tfor(int i = 0; i < m ;i ++){\n\t\t\tint r = sc.nextInt();\n\t\t\tint c = sc.nextInt();\n\t\t\tArrayList al = hmr.getOrDefault(r, new ArrayList());\n\t\t\tal.add(c);\n\t\t\thmr.put(r, al);\n\t\t\thmc.put(c, hmc.getOrDefault(c, 0)+1);\n\t\t}\n\t\t\n\t\tint max = 0, maxc = 0;\n\t\tint row = -1;\n\t\tfor(int r : hmr.keySet()){\n\t\t\tif(hmr.get(r).size() > max){\n\t\t\t\tmax = hmr.get(r).size();\n\t\t\t\trow = r;\t\t\t\t\n\t\t\t}else if(hmr.get(r).size() == max){\n\t\t\t\tint max1 = 0;\n\t\t\t\tfor(int c : hmr.get(r)){\n\t\t\t\t\tmax1 = Math.max(max1, hmc.get(c));\n\t\t\t\t}\n\t\t\t\tint max2 = 0;\n\t\t\t\tfor(int c : hmr.get(row)){\n\t\t\t\t\tmax2 = Math.max(max2, hmc.get(c));\n\t\t\t\t}\n\t\t\t\tif(max1 > max2){\n\t\t\t\t\trow = r;\n\t\t\t\t\tmax = max1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(int c : hmr.get(row)){\n\t\t\thmc.put(c, hmc.get(c)-1);\n\t\t}\n\t\tint max2 = 0;\n\t\tfor(int s : hmc.values()){\n\t\t\tmax2 = Math.max(max2, s);\n\t\t}\n\t\t\n\t\tpw.println((max+max2));\n\t\t\n\t\tpw.close();\n\t}\n\n\n\tstatic class InputReader {\n\t\tprivate InputStream stream;\n\t\tprivate byte[] buf = new byte[5];\n\t\tprivate int curChar;\n\t\tprivate int numChars;\n\t\tprivate SpaceCharFilter filter;\n\n\t\tpublic InputReader(InputStream stream) {\n\t\t\tthis.stream = stream;\n\t\t}\n\n\t\tpublic int read() {\n\t\t\tif (numChars == -1)\n\t\t\t\tthrow new InputMismatchException();\n\t\t\tif (curChar >= numChars) {\n\t\t\t\tcurChar = 0;\n\t\t\t\ttry {\n\t\t\t\t\tnumChars = stream.read(buf);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\n\t\t\t\tif (numChars <= 0)\n\t\t\t\t\treturn -1;\n\t\t\t}\n\n\t\t\treturn buf[curChar++];\n\t\t}\n\n\t\tpublic String nextLine() {\n\t\t\tBufferedReader br = new BufferedReader(new InputStreamReader(stream));\n\t\t\tString stock = \"\";\n\t\t\ttry {\n\t\t\t\tstock = br.readLine();\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\treturn stock;\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\tint c = read();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = read();\n\n\t\t\tint sgn = 1;\n\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = read();\n\t\t\t}\n\n\t\t\tint res = 0;\n\t\t\tdo {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres *= 10;\n\t\t\t\tres += c - '0';\n\t\t\t\tc = read();\n\t\t\t} while (!isSpaceChar(c));\n\n\t\t\treturn res * sgn;\n\t\t}\n\n\t\tpublic long nextLong() {\n\t\t\tint c = read();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = read();\n\t\t\tint sgn = 1;\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tlong res = 0;\n\n\t\t\tdo {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres *= 10;\n\t\t\t\tres += c - '0';\n\t\t\t\tc = read();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn res * sgn;\n\t\t}\n\n\t\tpublic double nextDouble() {\n\t\t\tint c = read();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = read();\n\t\t\tint sgn = 1;\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tdouble res = 0;\n\t\t\twhile (!isSpaceChar(c) && c != '.') {\n\t\t\t\tif (c == 'e' || c == 'E')\n\t\t\t\t\treturn res * Math.pow(10, nextInt());\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres *= 10;\n\t\t\t\tres += c - '0';\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tif (c == '.') {\n\t\t\t\tc = read();\n\t\t\t\tdouble m = 1;\n\t\t\t\twhile (!isSpaceChar(c)) {\n\t\t\t\t\tif (c == 'e' || c == 'E')\n\t\t\t\t\t\treturn res * Math.pow(10, nextInt());\n\t\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\tm /= 10;\n\t\t\t\t\tres += (c - '0') * m;\n\t\t\t\t\tc = read();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn res * sgn;\n\t\t}\n\n\t\tpublic String readString() {\n\t\t\tint c = read();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = read();\n\t\t\tStringBuilder res = new StringBuilder();\n\t\t\tdo {\n\t\t\t\tres.appendCodePoint(c);\n\t\t\t\tc = read();\n\t\t\t} while (!isSpaceChar(c));\n\n\t\t\treturn res.toString();\n\t\t}\n\n\t\tpublic boolean isSpaceChar(int c) {\n\t\t\tif (filter != null)\n\t\t\t\treturn filter.isSpaceChar(c);\n\t\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t\t}\n\n\t\tpublic String next() {\n\t\t\treturn readString();\n\t\t}\n\n\t\tpublic interface SpaceCharFilter {\n\t\t\tpublic boolean isSpaceChar(int ch);\n\t\t}\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1598470448, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02580.html", "problem_id": "p02580", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02580/input.txt", "sample_output_relpath": "derived/input_output/data/p02580/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02580/Java/s565355820.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s565355820", "user_id": "u368620227"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.*;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tInputReader sc = new InputReader(System.in);\n\t\tPrintWriter pw = new PrintWriter(System.out);\n\t\tint h = sc.nextInt();\n\t\tint w = sc.nextInt();\n\t\tint m = sc.nextInt();\n\t\tHashMap> hmr = new HashMap<>();\n\t\tHashMap hmc = new HashMap<>();\n\t\t\n\t\tfor(int i = 0; i < m ;i ++){\n\t\t\tint r = sc.nextInt();\n\t\t\tint c = sc.nextInt();\n\t\t\tArrayList al = hmr.getOrDefault(r, new ArrayList());\n\t\t\tal.add(c);\n\t\t\thmr.put(r, al);\n\t\t\thmc.put(c, hmc.getOrDefault(c, 0)+1);\n\t\t}\n\t\t\n\t\tint max = 0, maxc = 0;\n\t\tint row = -1;\n\t\tfor(int r : hmr.keySet()){\n\t\t\tif(hmr.get(r).size() > max){\n\t\t\t\tmax = hmr.get(r).size();\n\t\t\t\trow = r;\t\t\t\t\n\t\t\t}else if(hmr.get(r).size() == max){\n\t\t\t\tint max1 = 0;\n\t\t\t\tfor(int c : hmr.get(r)){\n\t\t\t\t\tmax1 = Math.max(max1, hmc.get(c));\n\t\t\t\t}\n\t\t\t\tint max2 = 0;\n\t\t\t\tfor(int c : hmr.get(row)){\n\t\t\t\t\tmax2 = Math.max(max2, hmc.get(c));\n\t\t\t\t}\n\t\t\t\tif(max1 > max2){\n\t\t\t\t\trow = r;\n\t\t\t\t\tmax = max1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(int c : hmr.get(row)){\n\t\t\thmc.put(c, hmc.get(c)-1);\n\t\t}\n\t\tint max2 = 0;\n\t\tfor(int s : hmc.values()){\n\t\t\tmax2 = Math.max(max2, s);\n\t\t}\n\t\t\n\t\tpw.println((max+max2));\n\t\t\n\t\tpw.close();\n\t}\n\n\n\tstatic class InputReader {\n\t\tprivate InputStream stream;\n\t\tprivate byte[] buf = new byte[5];\n\t\tprivate int curChar;\n\t\tprivate int numChars;\n\t\tprivate SpaceCharFilter filter;\n\n\t\tpublic InputReader(InputStream stream) {\n\t\t\tthis.stream = stream;\n\t\t}\n\n\t\tpublic int read() {\n\t\t\tif (numChars == -1)\n\t\t\t\tthrow new InputMismatchException();\n\t\t\tif (curChar >= numChars) {\n\t\t\t\tcurChar = 0;\n\t\t\t\ttry {\n\t\t\t\t\tnumChars = stream.read(buf);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\n\t\t\t\tif (numChars <= 0)\n\t\t\t\t\treturn -1;\n\t\t\t}\n\n\t\t\treturn buf[curChar++];\n\t\t}\n\n\t\tpublic String nextLine() {\n\t\t\tBufferedReader br = new BufferedReader(new InputStreamReader(stream));\n\t\t\tString stock = \"\";\n\t\t\ttry {\n\t\t\t\tstock = br.readLine();\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\treturn stock;\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\tint c = read();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = read();\n\n\t\t\tint sgn = 1;\n\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = read();\n\t\t\t}\n\n\t\t\tint res = 0;\n\t\t\tdo {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres *= 10;\n\t\t\t\tres += c - '0';\n\t\t\t\tc = read();\n\t\t\t} while (!isSpaceChar(c));\n\n\t\t\treturn res * sgn;\n\t\t}\n\n\t\tpublic long nextLong() {\n\t\t\tint c = read();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = read();\n\t\t\tint sgn = 1;\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tlong res = 0;\n\n\t\t\tdo {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres *= 10;\n\t\t\t\tres += c - '0';\n\t\t\t\tc = read();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn res * sgn;\n\t\t}\n\n\t\tpublic double nextDouble() {\n\t\t\tint c = read();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = read();\n\t\t\tint sgn = 1;\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tdouble res = 0;\n\t\t\twhile (!isSpaceChar(c) && c != '.') {\n\t\t\t\tif (c == 'e' || c == 'E')\n\t\t\t\t\treturn res * Math.pow(10, nextInt());\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres *= 10;\n\t\t\t\tres += c - '0';\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tif (c == '.') {\n\t\t\t\tc = read();\n\t\t\t\tdouble m = 1;\n\t\t\t\twhile (!isSpaceChar(c)) {\n\t\t\t\t\tif (c == 'e' || c == 'E')\n\t\t\t\t\t\treturn res * Math.pow(10, nextInt());\n\t\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t\tm /= 10;\n\t\t\t\t\tres += (c - '0') * m;\n\t\t\t\t\tc = read();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn res * sgn;\n\t\t}\n\n\t\tpublic String readString() {\n\t\t\tint c = read();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = read();\n\t\t\tStringBuilder res = new StringBuilder();\n\t\t\tdo {\n\t\t\t\tres.appendCodePoint(c);\n\t\t\t\tc = read();\n\t\t\t} while (!isSpaceChar(c));\n\n\t\t\treturn res.toString();\n\t\t}\n\n\t\tpublic boolean isSpaceChar(int c) {\n\t\t\tif (filter != null)\n\t\t\t\treturn filter.isSpaceChar(c);\n\t\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t\t}\n\n\t\tpublic String next() {\n\t\t\treturn readString();\n\t\t}\n\n\t\tpublic interface SpaceCharFilter {\n\t\t\tpublic boolean isSpaceChar(int ch);\n\t\t}\n\t}\n\n}\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have a two-dimensional grid with H \\times W squares. There are M targets to destroy in this grid - the position of the i-th target is \\left(h_i, w_i \\right).\n\nTakahashi will choose one square in this grid, place a bomb there, and ignite it. The bomb will destroy all targets that are in the row or the column where the bomb is placed. It is possible to place the bomb at a square with a target.\n\nTakahashi is trying to maximize the number of targets to destroy. Find the maximum number of targets that can be destroyed.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 3 \\times 10^5\n\n1 \\leq M \\leq \\min\\left(H\\times W, 3 \\times 10^5\\right)\n\n1 \\leq h_i \\leq H\n\n1 \\leq w_i \\leq W\n\n\\left(h_i, w_i\\right) \\neq \\left(h_j, w_j\\right) \\left(i \\neq j\\right)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W M\nh_1 w_1\n\\vdots\nh_M w_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2 3 3\n2 2\n1 1\n1 3\n\nSample Output 1\n\n3\n\nWe can destroy all the targets by placing the bomb at \\left(1, 2\\right).\n\nSample Input 2\n\n3 3 4\n3 3\n3 1\n1 1\n1 2\n\nSample Output 2\n\n3\n\nSample Input 3\n\n5 5 10\n2 5\n4 3\n2 3\n5 5\n2 2\n5 4\n5 3\n5 1\n3 5\n1 4\n\nSample Output 3\n\n6", "sample_input": "2 3 3\n2 2\n1 1\n1 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02580", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have a two-dimensional grid with H \\times W squares. There are M targets to destroy in this grid - the position of the i-th target is \\left(h_i, w_i \\right).\n\nTakahashi will choose one square in this grid, place a bomb there, and ignite it. The bomb will destroy all targets that are in the row or the column where the bomb is placed. It is possible to place the bomb at a square with a target.\n\nTakahashi is trying to maximize the number of targets to destroy. Find the maximum number of targets that can be destroyed.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 3 \\times 10^5\n\n1 \\leq M \\leq \\min\\left(H\\times W, 3 \\times 10^5\\right)\n\n1 \\leq h_i \\leq H\n\n1 \\leq w_i \\leq W\n\n\\left(h_i, w_i\\right) \\neq \\left(h_j, w_j\\right) \\left(i \\neq j\\right)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W M\nh_1 w_1\n\\vdots\nh_M w_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2 3 3\n2 2\n1 1\n1 3\n\nSample Output 1\n\n3\n\nWe can destroy all the targets by placing the bomb at \\left(1, 2\\right).\n\nSample Input 2\n\n3 3 4\n3 3\n3 1\n1 1\n1 2\n\nSample Output 2\n\n3\n\nSample Input 3\n\n5 5 10\n2 5\n4 3\n2 3\n5 5\n2 2\n5 4\n5 3\n5 1\n3 5\n1 4\n\nSample Output 3\n\n6", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 4235, "cpu_time_ms": 943, "memory_kb": 130184}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s083758880", "group_id": "codeNet:p02580", "input_text": "import java.util.ArrayDeque;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Comparator;\nimport java.util.Deque;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Queue;\nimport java.util.Scanner;\nimport java.util.Set;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\texecute20_3();\n\t}\n\n\tprivate static void execute20_3() {\n\t\ttry (Scanner sc = new Scanner(System.in)) {\n\t\t\tint h = sc.nextInt();\n\t\t\tint w = sc.nextInt();\n\t\t\tint m = sc.nextInt();\n\t\t\t\n\t\t\tint[] hnum= new int[h];\n\t\t\tint[] wnum= new int[w];\n\t\t\tint[][] put = new int[h][w];\n\t\t\tfor (int i = 0; i < m; i++) {\n\t\t\t\tint hb = sc.nextInt()-1;\n\t\t\t\tint wb = sc.nextInt()-1;\n\t\t\t\thnum[hb]++;\n\t\t\t\twnum[wb]++;\n\t\t\t\tput[hb][wb]=1;\n\t\t\t}\n\t\t\tint ans=0;\n\t\t\tfor (int i = 0; i < h; i++) {\n\t\t\t\tfor (int j = 0; j < w; j++) {\n\t\t\t\t\tans = Math.max(ans, hnum[i]+wnum[j]-put[i][j]);\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t}\n}", "language": "Java", "metadata": {"date": 1598199148, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02580.html", "problem_id": "p02580", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02580/input.txt", "sample_output_relpath": "derived/input_output/data/p02580/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02580/Java/s083758880.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s083758880", "user_id": "u924807180"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.ArrayDeque;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Comparator;\nimport java.util.Deque;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Queue;\nimport java.util.Scanner;\nimport java.util.Set;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\texecute20_3();\n\t}\n\n\tprivate static void execute20_3() {\n\t\ttry (Scanner sc = new Scanner(System.in)) {\n\t\t\tint h = sc.nextInt();\n\t\t\tint w = sc.nextInt();\n\t\t\tint m = sc.nextInt();\n\t\t\t\n\t\t\tint[] hnum= new int[h];\n\t\t\tint[] wnum= new int[w];\n\t\t\tint[][] put = new int[h][w];\n\t\t\tfor (int i = 0; i < m; i++) {\n\t\t\t\tint hb = sc.nextInt()-1;\n\t\t\t\tint wb = sc.nextInt()-1;\n\t\t\t\thnum[hb]++;\n\t\t\t\twnum[wb]++;\n\t\t\t\tput[hb][wb]=1;\n\t\t\t}\n\t\t\tint ans=0;\n\t\t\tfor (int i = 0; i < h; i++) {\n\t\t\t\tfor (int j = 0; j < w; j++) {\n\t\t\t\t\tans = Math.max(ans, hnum[i]+wnum[j]-put[i][j]);\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t}\n}", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have a two-dimensional grid with H \\times W squares. There are M targets to destroy in this grid - the position of the i-th target is \\left(h_i, w_i \\right).\n\nTakahashi will choose one square in this grid, place a bomb there, and ignite it. The bomb will destroy all targets that are in the row or the column where the bomb is placed. It is possible to place the bomb at a square with a target.\n\nTakahashi is trying to maximize the number of targets to destroy. Find the maximum number of targets that can be destroyed.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 3 \\times 10^5\n\n1 \\leq M \\leq \\min\\left(H\\times W, 3 \\times 10^5\\right)\n\n1 \\leq h_i \\leq H\n\n1 \\leq w_i \\leq W\n\n\\left(h_i, w_i\\right) \\neq \\left(h_j, w_j\\right) \\left(i \\neq j\\right)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W M\nh_1 w_1\n\\vdots\nh_M w_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2 3 3\n2 2\n1 1\n1 3\n\nSample Output 1\n\n3\n\nWe can destroy all the targets by placing the bomb at \\left(1, 2\\right).\n\nSample Input 2\n\n3 3 4\n3 3\n3 1\n1 1\n1 2\n\nSample Output 2\n\n3\n\nSample Input 3\n\n5 5 10\n2 5\n4 3\n2 3\n5 5\n2 2\n5 4\n5 3\n5 1\n3 5\n1 4\n\nSample Output 3\n\n6", "sample_input": "2 3 3\n2 2\n1 1\n1 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02580", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have a two-dimensional grid with H \\times W squares. There are M targets to destroy in this grid - the position of the i-th target is \\left(h_i, w_i \\right).\n\nTakahashi will choose one square in this grid, place a bomb there, and ignite it. The bomb will destroy all targets that are in the row or the column where the bomb is placed. It is possible to place the bomb at a square with a target.\n\nTakahashi is trying to maximize the number of targets to destroy. Find the maximum number of targets that can be destroyed.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 3 \\times 10^5\n\n1 \\leq M \\leq \\min\\left(H\\times W, 3 \\times 10^5\\right)\n\n1 \\leq h_i \\leq H\n\n1 \\leq w_i \\leq W\n\n\\left(h_i, w_i\\right) \\neq \\left(h_j, w_j\\right) \\left(i \\neq j\\right)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W M\nh_1 w_1\n\\vdots\nh_M w_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2 3 3\n2 2\n1 1\n1 3\n\nSample Output 1\n\n3\n\nWe can destroy all the targets by placing the bomb at \\left(1, 2\\right).\n\nSample Input 2\n\n3 3 4\n3 3\n3 1\n1 1\n1 2\n\nSample Output 2\n\n3\n\nSample Input 3\n\n5 5 10\n2 5\n4 3\n2 3\n5 5\n2 2\n5 4\n5 3\n5 1\n3 5\n1 4\n\nSample Output 3\n\n6", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 918, "memory_kb": 951456}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s336113194", "group_id": "codeNet:p02580", "input_text": "\timport java.util.*;\n\timport java.util.Map.Entry;\n\t \n\t \n\t class Main {\n\t\t static int mod = (int) (Math.pow(10,9)+7);\n//\t\t static int mod = (int) 998244353;\n\t\t static List> list= new ArrayList>();\n\t\t static int a_dist[];\n\t\t public static void main(String[] args) {\n\t \t\n\t Scanner sc = new Scanner(System.in);\n\t int H = sc.nextInt();\n\t int W = sc.nextInt();\n\t int M = sc.nextInt();\n\t long[] m = new long[M];\n\t int[][] h = new int[H][2];\n\t int[][] w = new int[W][2];\n\t int ans=0;\n\t for(int i=0;i Integer.compare(b[0], c[0]));\n\t Arrays.sort(w, (b, c) -> Integer.compare(b[0], c[0]));\n\t Arrays.sort(m);\n\t for(int i=H-1;i>=0&&h[i][0]>=h[H-1][0]-1;i--) {\n\t \tfor(int j=W-1;j>=0&&w[j][0]+h[i][0]>=w[W-1][0]+h[H-1][0]-1;j--) {\n\t \t\tlong t=1000000*h[i][1]+w[j][1];\n\t \t\tint right = M-1;\n\t \t\tint left = 0;\n\t \t\tint n =0;\n\t \t\twhile(right>=left) {\n\t \t\t\tint mid = (right+left)/2;\n\t \t\t\tif(m[mid]==t) {\n\t \t\t\t\tn++;\n\t \t\t\t\tbreak;\n\t \t\t\t}\n\t \t\t\telse if(m[mid]>t)right=mid-1;\n\t \t\t\telse left=mid+1;\n\t \t\t}\n\t \t\t\n\t \t\tans=Math.max(ans, h[i][0]+w[j][0]-n);\n\t \t\t\n\t \t}\n\t }\n\t System.out.println(ans);\n\t\t }\n\t\t \n\t}", "language": "Java", "metadata": {"date": 1598194759, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02580.html", "problem_id": "p02580", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02580/input.txt", "sample_output_relpath": "derived/input_output/data/p02580/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02580/Java/s336113194.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s336113194", "user_id": "u795978684"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "\timport java.util.*;\n\timport java.util.Map.Entry;\n\t \n\t \n\t class Main {\n\t\t static int mod = (int) (Math.pow(10,9)+7);\n//\t\t static int mod = (int) 998244353;\n\t\t static List> list= new ArrayList>();\n\t\t static int a_dist[];\n\t\t public static void main(String[] args) {\n\t \t\n\t Scanner sc = new Scanner(System.in);\n\t int H = sc.nextInt();\n\t int W = sc.nextInt();\n\t int M = sc.nextInt();\n\t long[] m = new long[M];\n\t int[][] h = new int[H][2];\n\t int[][] w = new int[W][2];\n\t int ans=0;\n\t for(int i=0;i Integer.compare(b[0], c[0]));\n\t Arrays.sort(w, (b, c) -> Integer.compare(b[0], c[0]));\n\t Arrays.sort(m);\n\t for(int i=H-1;i>=0&&h[i][0]>=h[H-1][0]-1;i--) {\n\t \tfor(int j=W-1;j>=0&&w[j][0]+h[i][0]>=w[W-1][0]+h[H-1][0]-1;j--) {\n\t \t\tlong t=1000000*h[i][1]+w[j][1];\n\t \t\tint right = M-1;\n\t \t\tint left = 0;\n\t \t\tint n =0;\n\t \t\twhile(right>=left) {\n\t \t\t\tint mid = (right+left)/2;\n\t \t\t\tif(m[mid]==t) {\n\t \t\t\t\tn++;\n\t \t\t\t\tbreak;\n\t \t\t\t}\n\t \t\t\telse if(m[mid]>t)right=mid-1;\n\t \t\t\telse left=mid+1;\n\t \t\t}\n\t \t\t\n\t \t\tans=Math.max(ans, h[i][0]+w[j][0]-n);\n\t \t\t\n\t \t}\n\t }\n\t System.out.println(ans);\n\t\t }\n\t\t \n\t}", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have a two-dimensional grid with H \\times W squares. There are M targets to destroy in this grid - the position of the i-th target is \\left(h_i, w_i \\right).\n\nTakahashi will choose one square in this grid, place a bomb there, and ignite it. The bomb will destroy all targets that are in the row or the column where the bomb is placed. It is possible to place the bomb at a square with a target.\n\nTakahashi is trying to maximize the number of targets to destroy. Find the maximum number of targets that can be destroyed.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 3 \\times 10^5\n\n1 \\leq M \\leq \\min\\left(H\\times W, 3 \\times 10^5\\right)\n\n1 \\leq h_i \\leq H\n\n1 \\leq w_i \\leq W\n\n\\left(h_i, w_i\\right) \\neq \\left(h_j, w_j\\right) \\left(i \\neq j\\right)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W M\nh_1 w_1\n\\vdots\nh_M w_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2 3 3\n2 2\n1 1\n1 3\n\nSample Output 1\n\n3\n\nWe can destroy all the targets by placing the bomb at \\left(1, 2\\right).\n\nSample Input 2\n\n3 3 4\n3 3\n3 1\n1 1\n1 2\n\nSample Output 2\n\n3\n\nSample Input 3\n\n5 5 10\n2 5\n4 3\n2 3\n5 5\n2 2\n5 4\n5 3\n5 1\n3 5\n1 4\n\nSample Output 3\n\n6", "sample_input": "2 3 3\n2 2\n1 1\n1 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02580", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have a two-dimensional grid with H \\times W squares. There are M targets to destroy in this grid - the position of the i-th target is \\left(h_i, w_i \\right).\n\nTakahashi will choose one square in this grid, place a bomb there, and ignite it. The bomb will destroy all targets that are in the row or the column where the bomb is placed. It is possible to place the bomb at a square with a target.\n\nTakahashi is trying to maximize the number of targets to destroy. Find the maximum number of targets that can be destroyed.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 3 \\times 10^5\n\n1 \\leq M \\leq \\min\\left(H\\times W, 3 \\times 10^5\\right)\n\n1 \\leq h_i \\leq H\n\n1 \\leq w_i \\leq W\n\n\\left(h_i, w_i\\right) \\neq \\left(h_j, w_j\\right) \\left(i \\neq j\\right)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W M\nh_1 w_1\n\\vdots\nh_M w_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2 3 3\n2 2\n1 1\n1 3\n\nSample Output 1\n\n3\n\nWe can destroy all the targets by placing the bomb at \\left(1, 2\\right).\n\nSample Input 2\n\n3 3 4\n3 3\n3 1\n1 1\n1 2\n\nSample Output 2\n\n3\n\nSample Input 3\n\n5 5 10\n2 5\n4 3\n2 3\n5 5\n2 2\n5 4\n5 3\n5 1\n3 5\n1 4\n\nSample Output 3\n\n6", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1623, "cpu_time_ms": 3310, "memory_kb": 83620}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s498106097", "group_id": "codeNet:p02580", "input_text": "\timport java.util.*;\n\timport java.util.Map.Entry;\n\t \n\t \n\t class Main {\n\t\t static int mod = (int) (Math.pow(10,9)+7);\n//\t\t static int mod = (int) 998244353;\n\t\t static List> list= new ArrayList>();\n\t\t static int a_dist[];\n\t\t public static void main(String[] args) {\n\t \t\n\t Scanner sc = new Scanner(System.in);\n\t int H = sc.nextInt();\n\t int W = sc.nextInt();\n\t int M = sc.nextInt();\n\t int[][] m = new int[H][W];\n\t int[][] h = new int[H][2];\n\t int[][] w = new int[W][2];\n\t int ans=0;\n\t for(int i=0;i Integer.compare(b[0], c[0]));\n\t Arrays.sort(w, (b, c) -> Integer.compare(b[0], c[0]));\n\t for(int i=H-1;i>=0&&h[i][0]>=h[H-1][0]-1;i--) {\n\t \tfor(int j=W-1;j>=0&&w[j][0]>=w[W-1][0];j--) {\n\t \t\tans=Math.max(ans, h[i][0]+w[j][0]-m[h[i][1]][w[j][1]]);\n\t \t\t\n\t \t}\n\t }\n\t System.out.println(ans);\n\t\t }\n\t\t \n\t}", "language": "Java", "metadata": {"date": 1598193018, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02580.html", "problem_id": "p02580", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02580/input.txt", "sample_output_relpath": "derived/input_output/data/p02580/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02580/Java/s498106097.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s498106097", "user_id": "u795978684"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "\timport java.util.*;\n\timport java.util.Map.Entry;\n\t \n\t \n\t class Main {\n\t\t static int mod = (int) (Math.pow(10,9)+7);\n//\t\t static int mod = (int) 998244353;\n\t\t static List> list= new ArrayList>();\n\t\t static int a_dist[];\n\t\t public static void main(String[] args) {\n\t \t\n\t Scanner sc = new Scanner(System.in);\n\t int H = sc.nextInt();\n\t int W = sc.nextInt();\n\t int M = sc.nextInt();\n\t int[][] m = new int[H][W];\n\t int[][] h = new int[H][2];\n\t int[][] w = new int[W][2];\n\t int ans=0;\n\t for(int i=0;i Integer.compare(b[0], c[0]));\n\t Arrays.sort(w, (b, c) -> Integer.compare(b[0], c[0]));\n\t for(int i=H-1;i>=0&&h[i][0]>=h[H-1][0]-1;i--) {\n\t \tfor(int j=W-1;j>=0&&w[j][0]>=w[W-1][0];j--) {\n\t \t\tans=Math.max(ans, h[i][0]+w[j][0]-m[h[i][1]][w[j][1]]);\n\t \t\t\n\t \t}\n\t }\n\t System.out.println(ans);\n\t\t }\n\t\t \n\t}", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have a two-dimensional grid with H \\times W squares. There are M targets to destroy in this grid - the position of the i-th target is \\left(h_i, w_i \\right).\n\nTakahashi will choose one square in this grid, place a bomb there, and ignite it. The bomb will destroy all targets that are in the row or the column where the bomb is placed. It is possible to place the bomb at a square with a target.\n\nTakahashi is trying to maximize the number of targets to destroy. Find the maximum number of targets that can be destroyed.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 3 \\times 10^5\n\n1 \\leq M \\leq \\min\\left(H\\times W, 3 \\times 10^5\\right)\n\n1 \\leq h_i \\leq H\n\n1 \\leq w_i \\leq W\n\n\\left(h_i, w_i\\right) \\neq \\left(h_j, w_j\\right) \\left(i \\neq j\\right)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W M\nh_1 w_1\n\\vdots\nh_M w_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2 3 3\n2 2\n1 1\n1 3\n\nSample Output 1\n\n3\n\nWe can destroy all the targets by placing the bomb at \\left(1, 2\\right).\n\nSample Input 2\n\n3 3 4\n3 3\n3 1\n1 1\n1 2\n\nSample Output 2\n\n3\n\nSample Input 3\n\n5 5 10\n2 5\n4 3\n2 3\n5 5\n2 2\n5 4\n5 3\n5 1\n3 5\n1 4\n\nSample Output 3\n\n6", "sample_input": "2 3 3\n2 2\n1 1\n1 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02580", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have a two-dimensional grid with H \\times W squares. There are M targets to destroy in this grid - the position of the i-th target is \\left(h_i, w_i \\right).\n\nTakahashi will choose one square in this grid, place a bomb there, and ignite it. The bomb will destroy all targets that are in the row or the column where the bomb is placed. It is possible to place the bomb at a square with a target.\n\nTakahashi is trying to maximize the number of targets to destroy. Find the maximum number of targets that can be destroyed.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 3 \\times 10^5\n\n1 \\leq M \\leq \\min\\left(H\\times W, 3 \\times 10^5\\right)\n\n1 \\leq h_i \\leq H\n\n1 \\leq w_i \\leq W\n\n\\left(h_i, w_i\\right) \\neq \\left(h_j, w_j\\right) \\left(i \\neq j\\right)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W M\nh_1 w_1\n\\vdots\nh_M w_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2 3 3\n2 2\n1 1\n1 3\n\nSample Output 1\n\n3\n\nWe can destroy all the targets by placing the bomb at \\left(1, 2\\right).\n\nSample Input 2\n\n3 3 4\n3 3\n3 1\n1 1\n1 2\n\nSample Output 2\n\n3\n\nSample Input 3\n\n5 5 10\n2 5\n4 3\n2 3\n5 5\n2 2\n5 4\n5 3\n5 1\n3 5\n1 4\n\nSample Output 3\n\n6", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1218, "cpu_time_ms": 983, "memory_kb": 960152}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s439952669", "group_id": "codeNet:p02580", "input_text": "import java.util.HashSet;\nimport java.util.Scanner;\nimport java.util.Set;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\ttry (Scanner sc = new Scanner(System.in)) {\n\t\t\tint H = sc.nextInt();\n\t\t\tint W = sc.nextInt();\n\t\t\tint M = sc.nextInt();\n\t\t\tint[] h = new int[H];\n\t\t\tint[] w = new int[W];\n\t\t\tSet hset = new HashSet<>();\n\t\t\tSet wset = new HashSet<>();\n\t\t\tSet pset = new HashSet<>();\n\t\t\tfor (int i = 0; i < M; i++) {\n\t\t\t\tint tmph = sc.nextInt() - 1;\n\t\t\t\tint tmpw = sc.nextInt() - 1;\n\t\t\t\thset.add(tmph);\n\t\t\t\twset.add(tmpw);\n\t\t\t\th[tmph]++;\n\t\t\t\tw[tmpw]++;\n\t\t\t\tpset.add(new Point(tmph, tmpw));\n\t\t\t}\n\t\t\tint max = 0;\n\t\t\tfor (int i : hset) {\n\t\t\t\tfor (int j : wset) {\n\t\t\t\t\tint tmp = h[i] + w[j];\n\t\t\t\t\tif (pset.contains(new Point(i, j))) {\n\t\t\t\t\t\ttmp--;\n\t\t\t\t\t}\n\t\t\t\t\tmax = Math.max(max, tmp);\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(max);\n\t\t}\n\t}\n\n\tstatic class Point {\n\t\tint h;\n\t\tint w;\n\n\t\tpublic Point(int h, int w) {\n\t\t\tthis.h = h;\n\t\t\tthis.w = w;\n\t\t}\n\n\t\t@Override\n\t\tpublic boolean equals(Object o) {\n\t\t\tPoint p = (Point) o;\n\t\t\treturn this.h == p.h && this.w == p.w;\n\t\t}\n\n\t\t@Override\n\t\tpublic int hashCode() {\n\t\t\tint val = 31;\n\t\t\tval += 31 * val + h;\n\t\t\tval += 31 * val + w;\n\t\t\treturn val;\n\t\t}\n\t}\n}", "language": "Java", "metadata": {"date": 1598132853, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02580.html", "problem_id": "p02580", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02580/input.txt", "sample_output_relpath": "derived/input_output/data/p02580/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02580/Java/s439952669.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s439952669", "user_id": "u770423799"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.HashSet;\nimport java.util.Scanner;\nimport java.util.Set;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\ttry (Scanner sc = new Scanner(System.in)) {\n\t\t\tint H = sc.nextInt();\n\t\t\tint W = sc.nextInt();\n\t\t\tint M = sc.nextInt();\n\t\t\tint[] h = new int[H];\n\t\t\tint[] w = new int[W];\n\t\t\tSet hset = new HashSet<>();\n\t\t\tSet wset = new HashSet<>();\n\t\t\tSet pset = new HashSet<>();\n\t\t\tfor (int i = 0; i < M; i++) {\n\t\t\t\tint tmph = sc.nextInt() - 1;\n\t\t\t\tint tmpw = sc.nextInt() - 1;\n\t\t\t\thset.add(tmph);\n\t\t\t\twset.add(tmpw);\n\t\t\t\th[tmph]++;\n\t\t\t\tw[tmpw]++;\n\t\t\t\tpset.add(new Point(tmph, tmpw));\n\t\t\t}\n\t\t\tint max = 0;\n\t\t\tfor (int i : hset) {\n\t\t\t\tfor (int j : wset) {\n\t\t\t\t\tint tmp = h[i] + w[j];\n\t\t\t\t\tif (pset.contains(new Point(i, j))) {\n\t\t\t\t\t\ttmp--;\n\t\t\t\t\t}\n\t\t\t\t\tmax = Math.max(max, tmp);\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(max);\n\t\t}\n\t}\n\n\tstatic class Point {\n\t\tint h;\n\t\tint w;\n\n\t\tpublic Point(int h, int w) {\n\t\t\tthis.h = h;\n\t\t\tthis.w = w;\n\t\t}\n\n\t\t@Override\n\t\tpublic boolean equals(Object o) {\n\t\t\tPoint p = (Point) o;\n\t\t\treturn this.h == p.h && this.w == p.w;\n\t\t}\n\n\t\t@Override\n\t\tpublic int hashCode() {\n\t\t\tint val = 31;\n\t\t\tval += 31 * val + h;\n\t\t\tval += 31 * val + w;\n\t\t\treturn val;\n\t\t}\n\t}\n}", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have a two-dimensional grid with H \\times W squares. There are M targets to destroy in this grid - the position of the i-th target is \\left(h_i, w_i \\right).\n\nTakahashi will choose one square in this grid, place a bomb there, and ignite it. The bomb will destroy all targets that are in the row or the column where the bomb is placed. It is possible to place the bomb at a square with a target.\n\nTakahashi is trying to maximize the number of targets to destroy. Find the maximum number of targets that can be destroyed.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 3 \\times 10^5\n\n1 \\leq M \\leq \\min\\left(H\\times W, 3 \\times 10^5\\right)\n\n1 \\leq h_i \\leq H\n\n1 \\leq w_i \\leq W\n\n\\left(h_i, w_i\\right) \\neq \\left(h_j, w_j\\right) \\left(i \\neq j\\right)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W M\nh_1 w_1\n\\vdots\nh_M w_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2 3 3\n2 2\n1 1\n1 3\n\nSample Output 1\n\n3\n\nWe can destroy all the targets by placing the bomb at \\left(1, 2\\right).\n\nSample Input 2\n\n3 3 4\n3 3\n3 1\n1 1\n1 2\n\nSample Output 2\n\n3\n\nSample Input 3\n\n5 5 10\n2 5\n4 3\n2 3\n5 5\n2 2\n5 4\n5 3\n5 1\n3 5\n1 4\n\nSample Output 3\n\n6", "sample_input": "2 3 3\n2 2\n1 1\n1 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02580", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have a two-dimensional grid with H \\times W squares. There are M targets to destroy in this grid - the position of the i-th target is \\left(h_i, w_i \\right).\n\nTakahashi will choose one square in this grid, place a bomb there, and ignite it. The bomb will destroy all targets that are in the row or the column where the bomb is placed. It is possible to place the bomb at a square with a target.\n\nTakahashi is trying to maximize the number of targets to destroy. Find the maximum number of targets that can be destroyed.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 3 \\times 10^5\n\n1 \\leq M \\leq \\min\\left(H\\times W, 3 \\times 10^5\\right)\n\n1 \\leq h_i \\leq H\n\n1 \\leq w_i \\leq W\n\n\\left(h_i, w_i\\right) \\neq \\left(h_j, w_j\\right) \\left(i \\neq j\\right)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W M\nh_1 w_1\n\\vdots\nh_M w_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2 3 3\n2 2\n1 1\n1 3\n\nSample Output 1\n\n3\n\nWe can destroy all the targets by placing the bomb at \\left(1, 2\\right).\n\nSample Input 2\n\n3 3 4\n3 3\n3 1\n1 1\n1 2\n\nSample Output 2\n\n3\n\nSample Input 3\n\n5 5 10\n2 5\n4 3\n2 3\n5 5\n2 2\n5 4\n5 3\n5 1\n3 5\n1 4\n\nSample Output 3\n\n6", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1224, "cpu_time_ms": 3311, "memory_kb": 125692}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s901312461", "group_id": "codeNet:p02580", "input_text": "\n\n\nimport java.util.*;\nimport java.io.*;\n\npublic class Main \n\n{ \n\n\t static FastReader sc=new FastReader(); \n\t \n\t\t public static void main(String[] args) \n {\n\t\t\t \n\t\t\t long h=l();\n\t\t\t long w=l();\n\t\t\t long m=l();\n\t\t\t int A[][]=new int[3000001][3000001];\n\t\t\t long row[]=new long[3000001];\n\t\t\t long col[]=new long[3000001];\n\t\t\t while(m-- > 0) {\n\t\t\t\t long r=l();\n\t\t\t\t long c=l();\n\t\t\t\t row[(int)r]++;\n\t\t\t\t col[(int)c]++;\n\t\t\t\t A[(int)r][(int)c]=1;\n\t\t\t\t \n\t\t\t }\n\t\t\t long maxr=Integer.MIN_VALUE,maxc=Integer.MIN_VALUE;\n\t\t\t int indr=-1,indc=-1;\n\t\t\t int cc=-1;\n\t\t\t for(int i=0;imaxr) {\n\t\t\t\t\t maxr=row[i];\n\t\t\t\t\t indr=i;\n\t\t\t\t }\n\t\t\t }\n\t\t\t for(int i=0;i=maxc) {\n\t\t\t\t\t maxc=col[i];\n\t\t\t\t\t indc=i;\n\t\t\t\t\t if(cc==-1)\n\t\t\t\t\t\t cc=indc;\n\t\t\t\t\t if(A[indr][indc]!=1)\n\t\t\t\t\t\t cc=indc;\n\t\t\t\t\t if(col[cc]!=maxc)\n\t\t\t\t\t\t cc=i;\n\t\t\t\t }\n\t\t\t }\n\t\t\t if(indr>0&&indr0&&ccmaxr) {\n//\t\t\t\t\t maxr=g;\n//\t\t\t\t\t keyr=i;\n//\t\t\t\t }\n//\t\t\t }\n//\n//\t\t\t long maxc=0;\n//\t\t\t int keyc=-1;\n//\t\t\t int keycc=ccc[0];\n//\t\t\t for(int i : ccc) {\n//\t\t\t\t long cc=col.get(i);\n//\t\t\t\t if(cc>=maxc) {\n//\t\t\t\t\tkeyc=i;\n//\t\t\t\t\tif(keycc==-1)\n//\t\t\t\t\t\tkeycc=i;\n//\t\t\t\t\t maxc=cc;\n//\t\t\t\t\tif(A[keyr][i]!=1)\n//\t\t\t\t\t\tkeycc=i;\n//\t\t\t\t\tif(col.get(keycc)!=maxc)\n//\t\t\t\t\t\tkeycc=i;\n//\t\t\t\t }\n//\t\t\t\t \n//\t\t\t }\n////\t\t\t if(keycc==-1)\n////\t\t\t\t keycc=keyc;\n////\t\t\t //System.out.println(keyr+\" \"+keycc);\n////\t\t\t long res=maxc+maxr;\n////\t\t\t if(A[keyr][keycc]!=1)\n////\t\t\t System.out.println(res);\n////\t\t\t else\n//\t\t\t\t System.out.println(res-1); \n//\t\t\t \n\t\t\t \n }\n\n\t\t static int gcd(int a, int b) \n\t\t { \n\t\t if (b == 0) \n\t\t return a; \n\t\t return gcd(b, a % b); \n\t\t } \n\n\t\t static boolean is(int x) \n\t\t { \n\t\t double sr = Math.sqrt(x); \n\t\t \n\t\t return ((sr - Math.floor(sr)) == 0); \n\t\t } \n\nstatic void input(int A[]) {\n\t for(int i=0;i 0) {\n\t\t\t\t long r=l();\n\t\t\t\t long c=l();\n\t\t\t\t row[(int)r]++;\n\t\t\t\t col[(int)c]++;\n\t\t\t\t A[(int)r][(int)c]=1;\n\t\t\t\t \n\t\t\t }\n\t\t\t long maxr=Integer.MIN_VALUE,maxc=Integer.MIN_VALUE;\n\t\t\t int indr=-1,indc=-1;\n\t\t\t int cc=-1;\n\t\t\t for(int i=0;imaxr) {\n\t\t\t\t\t maxr=row[i];\n\t\t\t\t\t indr=i;\n\t\t\t\t }\n\t\t\t }\n\t\t\t for(int i=0;i=maxc) {\n\t\t\t\t\t maxc=col[i];\n\t\t\t\t\t indc=i;\n\t\t\t\t\t if(cc==-1)\n\t\t\t\t\t\t cc=indc;\n\t\t\t\t\t if(A[indr][indc]!=1)\n\t\t\t\t\t\t cc=indc;\n\t\t\t\t\t if(col[cc]!=maxc)\n\t\t\t\t\t\t cc=i;\n\t\t\t\t }\n\t\t\t }\n\t\t\t if(indr>0&&indr0&&ccmaxr) {\n//\t\t\t\t\t maxr=g;\n//\t\t\t\t\t keyr=i;\n//\t\t\t\t }\n//\t\t\t }\n//\n//\t\t\t long maxc=0;\n//\t\t\t int keyc=-1;\n//\t\t\t int keycc=ccc[0];\n//\t\t\t for(int i : ccc) {\n//\t\t\t\t long cc=col.get(i);\n//\t\t\t\t if(cc>=maxc) {\n//\t\t\t\t\tkeyc=i;\n//\t\t\t\t\tif(keycc==-1)\n//\t\t\t\t\t\tkeycc=i;\n//\t\t\t\t\t maxc=cc;\n//\t\t\t\t\tif(A[keyr][i]!=1)\n//\t\t\t\t\t\tkeycc=i;\n//\t\t\t\t\tif(col.get(keycc)!=maxc)\n//\t\t\t\t\t\tkeycc=i;\n//\t\t\t\t }\n//\t\t\t\t \n//\t\t\t }\n////\t\t\t if(keycc==-1)\n////\t\t\t\t keycc=keyc;\n////\t\t\t //System.out.println(keyr+\" \"+keycc);\n////\t\t\t long res=maxc+maxr;\n////\t\t\t if(A[keyr][keycc]!=1)\n////\t\t\t System.out.println(res);\n////\t\t\t else\n//\t\t\t\t System.out.println(res-1); \n//\t\t\t \n\t\t\t \n }\n\n\t\t static int gcd(int a, int b) \n\t\t { \n\t\t if (b == 0) \n\t\t return a; \n\t\t return gcd(b, a % b); \n\t\t } \n\n\t\t static boolean is(int x) \n\t\t { \n\t\t double sr = Math.sqrt(x); \n\t\t \n\t\t return ((sr - Math.floor(sr)) == 0); \n\t\t } \n\nstatic void input(int A[]) {\n\t for(int i=0;i hmaxidx = new ArrayList<>();\n for(int i=0; i mapw = new ArrayList<>();\n for(int i=0; i hmaxidx = new ArrayList<>();\n for(int i=0; i mapw = new ArrayList<>();\n for(int i=0; i[] mines = new ArrayList[H];\n for (int i = 0; i < M; i++) {\n int hi = Integer.parseInt(sc.next()) - 1;\n int wi = Integer.parseInt(sc.next()) - 1;\n hnum[hi]++;\n wnum[wi]++;\n\n if (mines[hi] == null) {\n mines[hi] = new ArrayList();\n mines[hi].add(wi);\n } else {\n mines[hi].add(wi);\n }\n }\n\n // # Solve\n int hmax = 0, wmax = 0;\n List hmax_index = new ArrayList<>();\n List wmax_index = new ArrayList<>();\n for (int i = 0; i < H; i++) {\n if (hmax < hnum[i]) {\n hmax = hnum[i];\n hmax_index.clear();\n hmax_index.add(i);\n } else if (hmax == hnum[i]) {\n hmax_index.add(i);\n }\n }\n for (int i = 0; i < W; i++) {\n if (wmax < wnum[i]) {\n wmax = wnum[i];\n wmax_index.clear();\n wmax_index.add(i);\n } else if (wmax == wnum[i]) {\n wmax_index.add(i);\n }\n }\n\n boolean hit = false;\n for (int h : hmax_index) {\n for (int maxw : wmax_index) {\n if (!mines[h].contains(maxw)) {\n hit = true;\n }\n }\n if (hit) break;\n }\n System.out.println(hmax + wmax + (hit ? 0 : -1));\n }\n }\n}", "language": "Java", "metadata": {"date": 1598128409, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02580.html", "problem_id": "p02580", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02580/input.txt", "sample_output_relpath": "derived/input_output/data/p02580/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02580/Java/s756557500.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s756557500", "user_id": "u266250594"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n try (Scanner sc = new Scanner(System.in)) {\n // # In\n // area\n int H = Integer.parseInt(sc.next()); // height\n int W = Integer.parseInt(sc.next()); // width\n\n // mine\n int M = Integer.parseInt(sc.next());\n int[] hnum = new int[H];\n int[] wnum = new int[W];\n List[] mines = new ArrayList[H];\n for (int i = 0; i < M; i++) {\n int hi = Integer.parseInt(sc.next()) - 1;\n int wi = Integer.parseInt(sc.next()) - 1;\n hnum[hi]++;\n wnum[wi]++;\n\n if (mines[hi] == null) {\n mines[hi] = new ArrayList();\n mines[hi].add(wi);\n } else {\n mines[hi].add(wi);\n }\n }\n\n // # Solve\n int hmax = 0, wmax = 0;\n List hmax_index = new ArrayList<>();\n List wmax_index = new ArrayList<>();\n for (int i = 0; i < H; i++) {\n if (hmax < hnum[i]) {\n hmax = hnum[i];\n hmax_index.clear();\n hmax_index.add(i);\n } else if (hmax == hnum[i]) {\n hmax_index.add(i);\n }\n }\n for (int i = 0; i < W; i++) {\n if (wmax < wnum[i]) {\n wmax = wnum[i];\n wmax_index.clear();\n wmax_index.add(i);\n } else if (wmax == wnum[i]) {\n wmax_index.add(i);\n }\n }\n\n boolean hit = false;\n for (int h : hmax_index) {\n for (int maxw : wmax_index) {\n if (!mines[h].contains(maxw)) {\n hit = true;\n }\n }\n if (hit) break;\n }\n System.out.println(hmax + wmax + (hit ? 0 : -1));\n }\n }\n}", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have a two-dimensional grid with H \\times W squares. There are M targets to destroy in this grid - the position of the i-th target is \\left(h_i, w_i \\right).\n\nTakahashi will choose one square in this grid, place a bomb there, and ignite it. The bomb will destroy all targets that are in the row or the column where the bomb is placed. It is possible to place the bomb at a square with a target.\n\nTakahashi is trying to maximize the number of targets to destroy. Find the maximum number of targets that can be destroyed.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 3 \\times 10^5\n\n1 \\leq M \\leq \\min\\left(H\\times W, 3 \\times 10^5\\right)\n\n1 \\leq h_i \\leq H\n\n1 \\leq w_i \\leq W\n\n\\left(h_i, w_i\\right) \\neq \\left(h_j, w_j\\right) \\left(i \\neq j\\right)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W M\nh_1 w_1\n\\vdots\nh_M w_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2 3 3\n2 2\n1 1\n1 3\n\nSample Output 1\n\n3\n\nWe can destroy all the targets by placing the bomb at \\left(1, 2\\right).\n\nSample Input 2\n\n3 3 4\n3 3\n3 1\n1 1\n1 2\n\nSample Output 2\n\n3\n\nSample Input 3\n\n5 5 10\n2 5\n4 3\n2 3\n5 5\n2 2\n5 4\n5 3\n5 1\n3 5\n1 4\n\nSample Output 3\n\n6", "sample_input": "2 3 3\n2 2\n1 1\n1 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02580", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have a two-dimensional grid with H \\times W squares. There are M targets to destroy in this grid - the position of the i-th target is \\left(h_i, w_i \\right).\n\nTakahashi will choose one square in this grid, place a bomb there, and ignite it. The bomb will destroy all targets that are in the row or the column where the bomb is placed. It is possible to place the bomb at a square with a target.\n\nTakahashi is trying to maximize the number of targets to destroy. Find the maximum number of targets that can be destroyed.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 3 \\times 10^5\n\n1 \\leq M \\leq \\min\\left(H\\times W, 3 \\times 10^5\\right)\n\n1 \\leq h_i \\leq H\n\n1 \\leq w_i \\leq W\n\n\\left(h_i, w_i\\right) \\neq \\left(h_j, w_j\\right) \\left(i \\neq j\\right)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W M\nh_1 w_1\n\\vdots\nh_M w_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2 3 3\n2 2\n1 1\n1 3\n\nSample Output 1\n\n3\n\nWe can destroy all the targets by placing the bomb at \\left(1, 2\\right).\n\nSample Input 2\n\n3 3 4\n3 3\n3 1\n1 1\n1 2\n\nSample Output 2\n\n3\n\nSample Input 3\n\n5 5 10\n2 5\n4 3\n2 3\n5 5\n2 2\n5 4\n5 3\n5 1\n3 5\n1 4\n\nSample Output 3\n\n6", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2120, "cpu_time_ms": 3310, "memory_kb": 103772}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s645237395", "group_id": "codeNet:p02580", "input_text": "// Submitted By Subhash Yadav\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.math.BigInteger;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Scanner;\n\n\n\nimport java.util.*;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner();\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tint h=sc.nextInt(),w=sc.nextInt(),m=sc.nextInt();\n\t\tint a[][]=new int[m][2];\n\t\t\n\t\tint row[]=new int[h+1];\n\t\tint col[]=new int[w+1];\n\t\tfor(int i=0;i q;\n\tstatic int H;\n\tstatic int W;\n\tstatic int Dh;\n\tstatic int Dw;\n\tstatic char[][] S;\n\n\tpublic static void main(String[] args) throws IOException {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint H = sc.nextInt();\n\t\tint W = sc.nextInt();\n\t\tint M = sc.nextInt();\n\n\t\tint[] h = new int[H];\n\t\tint[] w = new int[W];\n\t\tHashSet exists = new HashSet<>();\n\n\t\tfor(int i = 0;i selectedH = new ArrayList();\n\t\tList selectedW = new ArrayList();\n\n\t\tfor(int i = 0;i= H || nowW <0 || nowW >= W || S[nowH][nowW] == '#' || warped >= warp[nowH][nowW]) {\n//\t\t\treturn;\n//\t\t}\n//\t\tif(nowH == Dh && nowW == Dw && ans > warped) {\n//\t\t\tans = warped;\n//\t\t}\n//\t\tint[] now = {nowH, nowW, warped};\n//\t\tq.add(now);\n//\t\twarp[nowH][nowW] = warped;\n//\t\tfor(int i = 0;i<4 ; i++) {\n//\t\t\twalk(nowH+directions4[i][0], nowW+directions4[i][1], warped);\n//\t\t}\n//\t}\n\t//\tpublic static void warp(int nowH, int nowW, int warped) {\n\t//\n\t//\n\t//\n\t//\n\t//\t}\n\n\t//素数判定\n\tpublic static boolean isPrime(long num) {\n\t\tif (num < 2) return false;\n\t\telse if (num == 2) return true;\n\t\telse if (num % 2 == 0) return false; // 偶数はあらかじめ除く\n\n\t\tdouble sqrtNum = Math.sqrt(num);\n\t\tfor (int i = 3; i <= sqrtNum; i += 2)\n\t\t{\n\t\t\tif (num % i == 0)\n\t\t\t{\n\t\t\t\t// 素数ではない\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\t// 素数である\n\t\treturn true;\n\t}\n\n\t//BFS用に二つの配列を足し算する\n\tstatic int[] addArrayElms(int[] a, int[] b) {\n\t\tint[] c = new int[a.length];\n\t\tfor(int i = 0; i < a.length; i++) {\n\t\t\tc[i] = a[i] + b[i];\n\t\t}\n\t\treturn c;\n\t}\n\n\t//\t//二分探索\n\t//k <= num となる最小の配列要素kのインデックスを返す\n\tstatic private int binarySearch(long num, long[] orderedArray){\n\t\tint lowerBorder = -1;\n\t\tint upperBorder = orderedArray.length;\n\t\tint mid;\n\n\t\twhile(upperBorder - lowerBorder >1) {\n\t\t\tmid = (upperBorder + lowerBorder)/2;\n\t\t\tif(orderedArray[mid]<=num) {\n\t\t\t\tlowerBorder = mid;\n\t\t\t}else {\n\t\t\t\tupperBorder = mid;\n\t\t\t}\n\t\t}\n\t\treturn lowerBorder;\n\t}\n\n\t//二分探索\n\t//k <= num となる最小のList要素kのインデックスを返す\n\tstatic private int binarySearch(long num, ArrayList orderedList){\n\t\tint lowerBorder = -1;\n\t\tint upperBorder = orderedList.size();\n\t\tint mid;\n\n\t\twhile(upperBorder - lowerBorder >1) {\n\t\t\tmid = (upperBorder + lowerBorder)/2;\n\t\t\tif(orderedList.get(mid)<=num) {\n\t\t\t\tlowerBorder = mid;\n\t\t\t}else {\n\t\t\t\tupperBorder = mid;\n\t\t\t}\n\t\t}\n\t\treturn lowerBorder;\n\t}\n\n\t//aとbの最小公倍数を求める\n\tpublic static int gcd(int a, int b) {\n\t\treturn b == 0 ? a: gcd(b, a % b);\n\t}\n\tpublic static long gcd(long a, long b) {\n\t\treturn b == 0 ? a: gcd(b, a % b);\n\t}\n\n\t//Union-Find用の配列を要素数nで初期化\n\tstatic void ufInit(int n){\n\t\tparent = new int[n];\n\t\trank = new int[n];\n\t}\n\n\t//Union-Findの要素の最上位の親(グループ名)を返す\n\tstatic int ufFind(int a) {\n\t\tif(parent[a]==a) {\n\t\t\treturn a;\n\t\t}else {\n\t\t\treturn ufFind(parent[a]);\n\t\t}\n\t}\n\n\t//Union-Find木を連結する\n\tstatic void ufUnite(int a, int b) {\n\t\ta = parent[a];\n\t\tb = parent[b];\n\n\t\tif(a==b) {\n\t\t\treturn;\n\t\t}\n\t\tif(rank[a] > rank[b]){\n\t\t\tparent[b]=a;\n\t\t}else {\n\t\t\tparent[a]=b;\n\t\t\tif(rank[a]==rank[b]) {\n\t\t\t\trank[b]++;\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic boolean ufSame(int a, int b) {\n\t\treturn ufFind(a)==ufFind(b);\n\t}\n}\n", "language": "Java", "metadata": {"date": 1598127874, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02580.html", "problem_id": "p02580", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02580/input.txt", "sample_output_relpath": "derived/input_output/data/p02580/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02580/Java/s894499100.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s894499100", "user_id": "u784982404"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.io.IOException;\nimport java.util.ArrayList;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Queue;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tstatic int[][] map;\n\tstatic int[][] directions8= {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};\n\tstatic int[][] directions25= {{-2,-2},{-2,-1},{-2,0},{-2,1},{-2,2},{-1,-2},{-1,-1},{-1,1},{-1, 2}\n\t,{0,-2},{0,2},{1,-2},{1,-1},{1,1},{1,2},{2,-2},{2, -1},{2,0},{2,1},{2,2}};\n\tstatic int[][] directions4= {{-1,0},{1,0},{0,-1},{0,1}};\n\tstatic int ans;\n\tstatic int[] parent;//union-find用\n\tstatic int[] rank;//union-find用\n\tstatic int[][] warp;\n\tstatic Queue q;\n\tstatic int H;\n\tstatic int W;\n\tstatic int Dh;\n\tstatic int Dw;\n\tstatic char[][] S;\n\n\tpublic static void main(String[] args) throws IOException {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint H = sc.nextInt();\n\t\tint W = sc.nextInt();\n\t\tint M = sc.nextInt();\n\n\t\tint[] h = new int[H];\n\t\tint[] w = new int[W];\n\t\tHashSet exists = new HashSet<>();\n\n\t\tfor(int i = 0;i selectedH = new ArrayList();\n\t\tList selectedW = new ArrayList();\n\n\t\tfor(int i = 0;i= H || nowW <0 || nowW >= W || S[nowH][nowW] == '#' || warped >= warp[nowH][nowW]) {\n//\t\t\treturn;\n//\t\t}\n//\t\tif(nowH == Dh && nowW == Dw && ans > warped) {\n//\t\t\tans = warped;\n//\t\t}\n//\t\tint[] now = {nowH, nowW, warped};\n//\t\tq.add(now);\n//\t\twarp[nowH][nowW] = warped;\n//\t\tfor(int i = 0;i<4 ; i++) {\n//\t\t\twalk(nowH+directions4[i][0], nowW+directions4[i][1], warped);\n//\t\t}\n//\t}\n\t//\tpublic static void warp(int nowH, int nowW, int warped) {\n\t//\n\t//\n\t//\n\t//\n\t//\t}\n\n\t//素数判定\n\tpublic static boolean isPrime(long num) {\n\t\tif (num < 2) return false;\n\t\telse if (num == 2) return true;\n\t\telse if (num % 2 == 0) return false; // 偶数はあらかじめ除く\n\n\t\tdouble sqrtNum = Math.sqrt(num);\n\t\tfor (int i = 3; i <= sqrtNum; i += 2)\n\t\t{\n\t\t\tif (num % i == 0)\n\t\t\t{\n\t\t\t\t// 素数ではない\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\t// 素数である\n\t\treturn true;\n\t}\n\n\t//BFS用に二つの配列を足し算する\n\tstatic int[] addArrayElms(int[] a, int[] b) {\n\t\tint[] c = new int[a.length];\n\t\tfor(int i = 0; i < a.length; i++) {\n\t\t\tc[i] = a[i] + b[i];\n\t\t}\n\t\treturn c;\n\t}\n\n\t//\t//二分探索\n\t//k <= num となる最小の配列要素kのインデックスを返す\n\tstatic private int binarySearch(long num, long[] orderedArray){\n\t\tint lowerBorder = -1;\n\t\tint upperBorder = orderedArray.length;\n\t\tint mid;\n\n\t\twhile(upperBorder - lowerBorder >1) {\n\t\t\tmid = (upperBorder + lowerBorder)/2;\n\t\t\tif(orderedArray[mid]<=num) {\n\t\t\t\tlowerBorder = mid;\n\t\t\t}else {\n\t\t\t\tupperBorder = mid;\n\t\t\t}\n\t\t}\n\t\treturn lowerBorder;\n\t}\n\n\t//二分探索\n\t//k <= num となる最小のList要素kのインデックスを返す\n\tstatic private int binarySearch(long num, ArrayList orderedList){\n\t\tint lowerBorder = -1;\n\t\tint upperBorder = orderedList.size();\n\t\tint mid;\n\n\t\twhile(upperBorder - lowerBorder >1) {\n\t\t\tmid = (upperBorder + lowerBorder)/2;\n\t\t\tif(orderedList.get(mid)<=num) {\n\t\t\t\tlowerBorder = mid;\n\t\t\t}else {\n\t\t\t\tupperBorder = mid;\n\t\t\t}\n\t\t}\n\t\treturn lowerBorder;\n\t}\n\n\t//aとbの最小公倍数を求める\n\tpublic static int gcd(int a, int b) {\n\t\treturn b == 0 ? a: gcd(b, a % b);\n\t}\n\tpublic static long gcd(long a, long b) {\n\t\treturn b == 0 ? a: gcd(b, a % b);\n\t}\n\n\t//Union-Find用の配列を要素数nで初期化\n\tstatic void ufInit(int n){\n\t\tparent = new int[n];\n\t\trank = new int[n];\n\t}\n\n\t//Union-Findの要素の最上位の親(グループ名)を返す\n\tstatic int ufFind(int a) {\n\t\tif(parent[a]==a) {\n\t\t\treturn a;\n\t\t}else {\n\t\t\treturn ufFind(parent[a]);\n\t\t}\n\t}\n\n\t//Union-Find木を連結する\n\tstatic void ufUnite(int a, int b) {\n\t\ta = parent[a];\n\t\tb = parent[b];\n\n\t\tif(a==b) {\n\t\t\treturn;\n\t\t}\n\t\tif(rank[a] > rank[b]){\n\t\t\tparent[b]=a;\n\t\t}else {\n\t\t\tparent[a]=b;\n\t\t\tif(rank[a]==rank[b]) {\n\t\t\t\trank[b]++;\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic boolean ufSame(int a, int b) {\n\t\treturn ufFind(a)==ufFind(b);\n\t}\n}\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have a two-dimensional grid with H \\times W squares. There are M targets to destroy in this grid - the position of the i-th target is \\left(h_i, w_i \\right).\n\nTakahashi will choose one square in this grid, place a bomb there, and ignite it. The bomb will destroy all targets that are in the row or the column where the bomb is placed. It is possible to place the bomb at a square with a target.\n\nTakahashi is trying to maximize the number of targets to destroy. Find the maximum number of targets that can be destroyed.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 3 \\times 10^5\n\n1 \\leq M \\leq \\min\\left(H\\times W, 3 \\times 10^5\\right)\n\n1 \\leq h_i \\leq H\n\n1 \\leq w_i \\leq W\n\n\\left(h_i, w_i\\right) \\neq \\left(h_j, w_j\\right) \\left(i \\neq j\\right)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W M\nh_1 w_1\n\\vdots\nh_M w_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2 3 3\n2 2\n1 1\n1 3\n\nSample Output 1\n\n3\n\nWe can destroy all the targets by placing the bomb at \\left(1, 2\\right).\n\nSample Input 2\n\n3 3 4\n3 3\n3 1\n1 1\n1 2\n\nSample Output 2\n\n3\n\nSample Input 3\n\n5 5 10\n2 5\n4 3\n2 3\n5 5\n2 2\n5 4\n5 3\n5 1\n3 5\n1 4\n\nSample Output 3\n\n6", "sample_input": "2 3 3\n2 2\n1 1\n1 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02580", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have a two-dimensional grid with H \\times W squares. There are M targets to destroy in this grid - the position of the i-th target is \\left(h_i, w_i \\right).\n\nTakahashi will choose one square in this grid, place a bomb there, and ignite it. The bomb will destroy all targets that are in the row or the column where the bomb is placed. It is possible to place the bomb at a square with a target.\n\nTakahashi is trying to maximize the number of targets to destroy. Find the maximum number of targets that can be destroyed.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 3 \\times 10^5\n\n1 \\leq M \\leq \\min\\left(H\\times W, 3 \\times 10^5\\right)\n\n1 \\leq h_i \\leq H\n\n1 \\leq w_i \\leq W\n\n\\left(h_i, w_i\\right) \\neq \\left(h_j, w_j\\right) \\left(i \\neq j\\right)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W M\nh_1 w_1\n\\vdots\nh_M w_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2 3 3\n2 2\n1 1\n1 3\n\nSample Output 1\n\n3\n\nWe can destroy all the targets by placing the bomb at \\left(1, 2\\right).\n\nSample Input 2\n\n3 3 4\n3 3\n3 1\n1 1\n1 2\n\nSample Output 2\n\n3\n\nSample Input 3\n\n5 5 10\n2 5\n4 3\n2 3\n5 5\n2 2\n5 4\n5 3\n5 1\n3 5\n1 4\n\nSample Output 3\n\n6", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 4765, "cpu_time_ms": 3312, "memory_kb": 114332}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s330882217", "group_id": "codeNet:p02580", "input_text": "\nimport java.util.*;\nimport java.io.*;\n\npublic class Main \n\n{ \n\n\t static FastReader sc=new FastReader(); \n\t \n\t\t public static void main(String[] args) \n {\n\t\t\t HashMap row=new HashMap();\n\t\t\t HashMap col=new HashMap();\n\t\t\t int h=i();\n\t\t\t int w=i();\n\t\t\t int m=i();\n\t\t\t int A[][]=new int[h+1][w+1];\n\t\t\t for(int i=0;imaxr) {\n\t\t\t\t\t maxr=g;\n\t\t\t\t\t keyr=i;\n\t\t\t\t }\n\t\t\t }\n\n\t\t\t int maxc=0;\n\t\t\t int keyc=-1;\n\t\t\t int keycc=-1;\n\t\t\t for(int i : col.keySet()) {\n\t\t\t\t int cc=col.get(i);\n\t\t\t\t if(cc>=maxc) {\n\t\t\t\t\tkeyc=i;\n\t\t\t\t\tif(keycc==-1)\n\t\t\t\t\t\tkeycc=keyc;\n\t\t\t\t\t maxc=cc;\n\t\t\t\t\tif(A[keyr][i]!=1)\n\t\t\t\t\t\tkeycc=i;\n\t\t\t\t\tif(col.get(keycc)!=maxc)\n\t\t\t\t\t\tkeycc=i;\n\t\t\t\t }\n\t\t\t\t \n\t\t\t }\n\t\t\t if(keycc==-1)\n\t\t\t\t keycc=keyc;\n\t\t\t //System.out.println(keyr+\" \"+keycc);\n\t\t\t if(A[keyr][keycc]!=1)\n\t\t\t System.out.println(maxc+maxr);\n\t\t\t else\n\t\t\t\t System.out.println(maxc+maxr-1); \n\t\t\t \n\t\t\t \n }\n\n\t\t static int gcd(int a, int b) \n\t\t { \n\t\t if (b == 0) \n\t\t return a; \n\t\t return gcd(b, a % b); \n\t\t } \n\n\t\t static boolean is(int x) \n\t\t { \n\t\t double sr = Math.sqrt(x); \n\t\t \n\t\t return ((sr - Math.floor(sr)) == 0); \n\t\t } \n\nstatic void input(int A[]) {\n\t for(int i=0;i row=new HashMap();\n\t\t\t HashMap col=new HashMap();\n\t\t\t int h=i();\n\t\t\t int w=i();\n\t\t\t int m=i();\n\t\t\t int A[][]=new int[h+1][w+1];\n\t\t\t for(int i=0;imaxr) {\n\t\t\t\t\t maxr=g;\n\t\t\t\t\t keyr=i;\n\t\t\t\t }\n\t\t\t }\n\n\t\t\t int maxc=0;\n\t\t\t int keyc=-1;\n\t\t\t int keycc=-1;\n\t\t\t for(int i : col.keySet()) {\n\t\t\t\t int cc=col.get(i);\n\t\t\t\t if(cc>=maxc) {\n\t\t\t\t\tkeyc=i;\n\t\t\t\t\tif(keycc==-1)\n\t\t\t\t\t\tkeycc=keyc;\n\t\t\t\t\t maxc=cc;\n\t\t\t\t\tif(A[keyr][i]!=1)\n\t\t\t\t\t\tkeycc=i;\n\t\t\t\t\tif(col.get(keycc)!=maxc)\n\t\t\t\t\t\tkeycc=i;\n\t\t\t\t }\n\t\t\t\t \n\t\t\t }\n\t\t\t if(keycc==-1)\n\t\t\t\t keycc=keyc;\n\t\t\t //System.out.println(keyr+\" \"+keycc);\n\t\t\t if(A[keyr][keycc]!=1)\n\t\t\t System.out.println(maxc+maxr);\n\t\t\t else\n\t\t\t\t System.out.println(maxc+maxr-1); \n\t\t\t \n\t\t\t \n }\n\n\t\t static int gcd(int a, int b) \n\t\t { \n\t\t if (b == 0) \n\t\t return a; \n\t\t return gcd(b, a % b); \n\t\t } \n\n\t\t static boolean is(int x) \n\t\t { \n\t\t double sr = Math.sqrt(x); \n\t\t \n\t\t return ((sr - Math.floor(sr)) == 0); \n\t\t } \n\nstatic void input(int A[]) {\n\t for(int i=0;i[]adj=new ArrayList[n];\n\t\tInteger[] row = new Integer[n], col = new Integer[m], indices = new Integer[m];\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tindices[i] = i;\n\t\t\tcol[i]=0;\n\t\t}\n\t\tfor(int i=0;iset=new HashSet();\n\t\twhile (q-- > 0) {\n\t\t\tint i=sc.nextInt()-1,j=sc.nextInt()-1;\n\t\t\trow[i]++;\n\t\t\tcol[j]++;\n//\t\t\tset.add(i*1L*m+j);\n\t\t\tadj[i].add(j);\n\t\t}\n\t\t\n\t\tArrays.sort(indices, Comparator.comparingInt(i -> -col[i]));\n\t\tint options=0;\n\t\tint bestCol=col[indices[0]];\n\t\tfor(int i=0;i[]adj=new ArrayList[n];\n\t\tInteger[] row = new Integer[n], col = new Integer[m], indices = new Integer[m];\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tindices[i] = i;\n\t\t\tcol[i]=0;\n\t\t}\n\t\tfor(int i=0;iset=new HashSet();\n\t\twhile (q-- > 0) {\n\t\t\tint i=sc.nextInt()-1,j=sc.nextInt()-1;\n\t\t\trow[i]++;\n\t\t\tcol[j]++;\n//\t\t\tset.add(i*1L*m+j);\n\t\t\tadj[i].add(j);\n\t\t}\n\t\t\n\t\tArrays.sort(indices, Comparator.comparingInt(i -> -col[i]));\n\t\tint options=0;\n\t\tint bestCol=col[indices[0]];\n\t\tfor(int i=0;i 0 && args[0].equals(\"-DEBUG\");\n\t\tThread.setDefaultUncaughtExceptionHandler((t, e) -> { e.printStackTrace(); System.exit(1); });\n\t\tnew Thread(null, new Main(), \"\", 1 << 31).start();\n\t}\n\n\tpublic void run() {\n\t\tSolver solver = new Solver();\n\t\tsolver.solve();\n\t\tsolver.exit();\n\t}\n\n\tstatic class FastScanner {\n\t\tprivate final InputStream in = System.in;\n\t\tprivate final byte[] buffer = new byte[1024];\n\t\tprivate int pointer = 0;\n\t\tprivate int buflen = 0;\n\t\tprivate boolean hasNextByte() {\n\t\t\tif(pointer < buflen) return true;\n\t\t\telse {\n\t\t\t\tpointer = 0;\n\t\t\t\ttry {\n\t\t\t\t\tbuflen = in.read(buffer);\n\t\t\t\t}catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t\treturn buflen > 0;\n\t\t\t}\n\t\t}\n\t\tprivate int readByte() { if(hasNextByte()) return buffer[pointer ++]; else return -1; }\n\t\tprivate boolean isPrintableChar(int c) { return isPrintableChar(c, false); }\n\t\tprivate boolean isPrintableChar(int c, boolean includingSpace) { return (includingSpace ? 32 : 33) <= c && c <= 126; }\n\t\tprivate void skipUnprintable() { skipUnprintable(false); }\n\t\tprivate void skipUnprintable(boolean includingSpace) { while(hasNextByte() && !isPrintableChar(buffer[pointer], includingSpace)) pointer++; }\n\t\tprivate boolean hasNext() { return hasNext(false); }\n\t\tprivate boolean hasNext(boolean includingSpace) { skipUnprintable(includingSpace); return hasNextByte(); }\n\t\tprivate StringBuilder sb = new StringBuilder();\n\t\tpublic String next() { return next(false); }\n\t\tpublic String next(boolean includingSpace) {\n\t\t\tif(!hasNext(includingSpace)) throw new NoSuchElementException();\n\t\t\tsb.setLength(0);\n\t\t\tint b = readByte();\n\t\t\twhile(isPrintableChar(b, includingSpace)) {\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\treturn sb.toString();\n\t\t}\n\t\tpublic long nextLong() {\n\t\t\tif(!hasNext()) throw new NoSuchElementException();\n\t\t\tlong n = 0;\n\t\t\tboolean minus = false;\n\t\t\tint b = readByte();\n\t\t\tif(b == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\tif(b < '0' || '9' < b) throw new NumberFormatException();\n\t\t\twhile(true) {\n\t\t\t\tif('0' <= b && b <= '9') n = n * 10 + b - '0';\n\t\t\t\telse if(b == -1 || !isPrintableChar(b)) return minus ? -n : n;\n\t\t\t\telse throw new NumberFormatException();\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic class Solver {\n\t\tFastScanner sc = new FastScanner();\n\t\tpublic Solver() { }\n\n\t\tString ns() { return ns(false); }\n\t\tString ns(boolean includingSpace) { return sc.next(includingSpace); }\n\t\tString[] ns(int n) { return ns(n, false); }\n\t\tString[] ns(int n, boolean includingSpace) {\n\t\t\tString a[] = new String[n];\n\t\t\tfor(int i = 0; i < n; i ++) a[i] = ns(includingSpace);\n\t\t\treturn a;\n\t\t}\n\t\tString[][] ns(int n, int m) { return ns(n, m, false); }\n\t\tString[][] ns(int n, int m, boolean includingSpace) {\n\t\t\tString a[][] = new String[n][m];\n\t\t\tfor(int i = 0; i < n; i ++) a[i] = ns(m, includingSpace);\n\t\t\treturn a;\n\t\t}\n\t\tchar nc() { return ns().charAt(0); }\n\t\tchar[] nc(int n) {\n\t\t\tString str = ns();\n\t\t\tif(n < 0) n = str.length();\n\t\t\tchar a[] = new char[n];\n\t\t\tfor(int i = 0; i < n; i ++) a[i] = str.charAt(i);\n\t\t\treturn a;\n\t\t}\n\t\tchar[][] nc(int n, int m) {\n\t\t\tchar a[][] = new char[n][m];\n\t\t\tfor(int i = 0; i < n; i ++) a[i] = nc(m);\n\t\t\treturn a;\n\t\t}\n\t\tboolean[] nb(int n, char t) {\n\t\t\tchar c[] = nc(-1);\n\t\t\tif(n < 0) n = c.length;\n\t\t\tboolean a[] = new boolean[n];\n\t\t\tfor(int i = 0; i < n; i ++) a[i] = c[i] == t;\n\t\t\treturn a;\n\t\t}\n\t\tboolean[][] nb(int n, int m, char t) {\n\t\t\tboolean a[][] = new boolean[n][m];\n\t\t\tfor(int i = 0; i < n; i ++) a[i] = nb(m, t);\n\t\t\treturn a;\n\t\t}\n\t\tint ni() { return Math.toIntExact(sc.nextLong()); }\n\t\tint[] ni(int n) {\n\t\t\tint a[] = new int[n];\n\t\t\tfor(int i = 0; i < n; i ++) a[i] = ni();\n\t\t\treturn a;\n\t\t}\n\t\tint[][] ni(int n, int m) {\n\t\t\tint a[][] = new int[n][m];\n\t\t\tfor(int i = 0; i < n; i ++) a[i] = ni(m);\n\t\t\treturn a;\n\t\t}\n\t\tlong nl() { return sc.nextLong(); }\n\t\tlong[] nl(int n) {\n\t\t\tlong a[] = new long[n];\n\t\t\tfor(int i = 0; i < n; i ++) a[i] = nl();\n\t\t\treturn a;\n\t\t}\n\t\tlong[][] nl(int n, int m) {\n\t\t\tlong a[][] = new long[n][m];\n\t\t\tfor(int i = 0; i < n; i ++) a[i] = nl(m);\n\t\t\treturn a;\n\t\t}\n\t\tdouble nd() { return Double.parseDouble(sc.next()); }\n\t\tdouble[] nd(int n) {\n\t\t\tdouble a[] = new double[n];\n\t\t\tfor(int i = 0; i < n; i ++) a[i] = nd();\n\t\t\treturn a;\n\t\t}\n\t\tdouble[][] nd(int n, int m) {\n\t\t\tdouble a[][] = new double[n][m];\n\t\t\tfor(int i = 0; i < n; i ++) a[i] = nd(m);\n\t\t\treturn a;\n\t\t}\n\n\n\t\tString booleanToString(boolean b) { return b ? \"#\" : \".\"; }\n\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tPrintWriter err = new PrintWriter(System.err);\n\t\tStringBuilder sb4prtln = new StringBuilder();\n\t\tvoid prt() { out.print(\"\"); }\n\t\t void prt(T a) { out.print(a); }\n\t\tvoid prtln() { out.println(\"\"); }\n\t\t void prtln(T a) { out.println(a); }\n\t\tvoid prtln(int... a) {\n\t\t\tsb4prtln.setLength(0);\n\t\t\tfor(int element : a) sb4prtln.append(element+\" \");\n\t\t\tprtln(sb4prtln.toString().trim());\n\t\t}\n\t\tvoid prtln(long... a) {\n\t\t\tsb4prtln.setLength(0);\n\t\t\tfor(long element : a) sb4prtln.append(element+\" \");\n\t\t\tprtln(sb4prtln.toString().trim());\n\t\t}\n\t\tvoid prtln(double... a) {\n\t\t\tsb4prtln.setLength(0);\n\t\t\tfor(double element : a) sb4prtln.append(element+\" \");\n\t\t\tprtln(sb4prtln.toString().trim());\n\t\t}\n\t\tvoid prtln(String... a) {\n\t\t\tsb4prtln.setLength(0);\n\t\t\tfor(String element : a) sb4prtln.append(element+\" \");\n\t\t\tprtln(sb4prtln.toString().trim());\n\t\t}\n\t\tvoid prtln(char... a) {\n\t\t\tsb4prtln.setLength(0);\n\t\t\tfor(char element : a) sb4prtln.append(element);\n\t\t\tprtln(sb4prtln.toString());\n\t\t}\n\t\tvoid prtln(boolean... a) {\n\t\t\tsb4prtln.setLength(0);\n\t\t\tfor(boolean element : a) sb4prtln.append(booleanToString(element));\n\t\t\tprtln(sb4prtln.toString());\n\t\t}\n\t\tvoid prtln(int[][] a) { for(int[] element : a) prtln(element); }\n\t\tvoid prtln(long[][] a) { for(long[] element : a) prtln(element); }\n\t\tvoid prtln(double[][] a) { for(double[] element : a) prtln(element); }\n\t\tvoid prtln(String[][] a) { for(String[] element : a) prtln(element); }\n\t\tvoid prtln(char[][] a) { for(char[] element : a) prtln(element); }\n\t\tvoid prtln(boolean[][] a) { for(boolean[] element : a) prtln(element); }\n\n\t\tString errconvert(int a) { return isINF(a) ? \"_\" : String.valueOf(a); }\n\t\tString errconvert(long a) { return isINF(a) ? \"_\" : String.valueOf(a); }\n\t\tvoid errprt(int a) { if(DEBUG) err.print(errconvert(a)); }\n\t\tvoid errprt(long a) { if(DEBUG) err.print(errconvert(a)); }\n\t\tvoid errprt() { if(DEBUG) err.print(\"\"); }\n\t\t void errprt(T a) { if(DEBUG) err.print(a); }\n\t\tvoid errprt(boolean a) { if(DEBUG) errprt(booleanToString(a)); }\n\t\tvoid errprtln() { if(DEBUG) err.println(\"\"); }\n\t\tvoid errprtln(int a) { if(DEBUG) err.println(errconvert(a)); }\n\t\tvoid errprtln(long a) { if(DEBUG) err.println(errconvert(a)); }\n\t\t void errprtln(T a) { if(DEBUG) err.println(a); }\n\t\tvoid errprtln(boolean a) { if(DEBUG) errprtln(booleanToString(a)); }\n\t\tvoid errprtln(int... a) {\n\t\t\tif(DEBUG) {\n\t\t\t\tsb4prtln.setLength(0);\n\t\t\t\tfor(int element : a) sb4prtln.append(errconvert(element)+\" \");\n\t\t\t\terrprtln(sb4prtln.toString().trim());\n\t\t\t}\n\t\t}\n\t\tvoid errprtln(long... a) {\n\t\t\tif(DEBUG) {\n\t\t\t\tsb4prtln.setLength(0);\n\t\t\t\tfor(long element : a) sb4prtln.append(errconvert(element)+\" \");\n\t\t\t\terrprtln(sb4prtln.toString().trim());\n\t\t\t}\n\t\t}\n\t\tvoid errprtln(double... a) {\n\t\t\tif(DEBUG) {\n\t\t\t\tsb4prtln.setLength(0);\n\t\t\t\tfor(double element : a) sb4prtln.append(element+\" \");\n\t\t\t\terrprtln(sb4prtln.toString().trim());\n\t\t\t}\n\t\t}\n\t\tvoid errprtln(String... a) {\n\t\t\tif(DEBUG) {\n\t\t\t\tsb4prtln.setLength(0);\n\t\t\t\tfor(String element : a) sb4prtln.append(element+\" \");\n\t\t\t\terrprtln(sb4prtln.toString().trim());\n\t\t\t}\n\t\t}\n\t\tvoid errprtln(char... a) {\n\t\t\tif(DEBUG) {\n\t\t\t\tsb4prtln.setLength(0);\n\t\t\t\tfor(char element : a) sb4prtln.append(element);\n\t\t\t\terrprtln(sb4prtln.toString());\n\t\t\t}\n\t\t}\n\t\tvoid errprtln(boolean... a) {\n\t\t\tif(DEBUG) {\n\t\t\t\tsb4prtln.setLength(0);\n\t\t\t\tfor(boolean element : a) sb4prtln.append(booleanToString(element));\n\t\t\t\terrprtln(sb4prtln.toString());\n\t\t\t}\n\t\t}\n\t\tvoid errprtln(Object[] a) { if(DEBUG) for(Object element : a) errprtln(element); }\n\t\tvoid errprtln(int[][] a) { if(DEBUG) for(int[] element : a) errprtln(element); }\n\t\tvoid errprtln(long[][] a) { if(DEBUG) for(long[] element : a) errprtln(element); }\n\t\tvoid errprtln(double[][] a) { if(DEBUG) for(double[] element : a) errprtln(element); }\n\t\tvoid errprtln(String[][] a) { if(DEBUG) for(String[] element : a) errprtln(element); }\n\t\tvoid errprtln(char[][] a) { if(DEBUG) for(char[] element : a) errprtln(element); }\n\t\tvoid errprtln(boolean[][] a) { if(DEBUG) for(boolean[] element : a) errprtln(element); }\n\t\tvoid errprtln(Object[][] a) { if(DEBUG) for(Object element : a) { errprtln(element); errprtln(); } }\n\n\t\tvoid reply(boolean b) { prtln(b ? \"Yes\" : \"No\"); }\n\t\tvoid REPLY(boolean b) { prtln(b ? \"YES\" : \"NO\"); }\n\n\t\tvoid flush() { out.flush(); if(DEBUG) err.flush(); }\n\t\tvoid assertion(boolean b) { if(!b) { flush(); throw new AssertionError(); } }\n\n\t\tvoid exit() { flush(); System.exit(0); }\n\t\t void exit(T a) { prtln(a); exit(); }\n\t\tvoid exit(int... a) { prtln(a); exit(); }\n\t\tvoid exit(long... a) { prtln(a); exit(); }\n\t\tvoid exit(double... a) { prtln(a); exit(); }\n\t\tvoid exit(String... a) { prtln(a); exit(); }\n\t\tvoid exit(char... a) { prtln(a); exit(); }\n\t\tvoid exit(boolean... a) { prtln(a); exit(); }\n\t\tvoid exit(int[][] a) { prtln(a); exit(); }\n\t\tvoid exit(long[][] a) { prtln(a); exit(); }\n\t\tvoid exit(double[][] a) { prtln(a); exit(); }\n\t\tvoid exit(String[][] a) { prtln(a); exit(); }\n\t\tvoid exit(char[][] a) { prtln(a); exit(); }\n\t\tvoid exit(boolean[][] a) { prtln(a); exit(); }\n\n\n\t\tfinal long INF = (long)1e18 + 7;\n\t\tboolean isPlusINF(long a) { return a > INF / 10; }\n\t\tboolean isMinusINF(long a) { return isPlusINF(- a); }\n\t\tboolean isINF(long a) { return isPlusINF(a) || isMinusINF(a); }\n\t\tfinal int I_INF = (int)1e9 + 7;\n\t\tboolean isPlusINF(int a) { return a > I_INF / 10; }\n\t\tboolean isMinusINF(int a) { return isPlusINF(- a); }\n\t\tboolean isINF(int a) { return isPlusINF(a) || isMinusINF(a); }\n\n\n\t\tint min(int a, int b) { return Math.min(a, b); }\n\t\tlong min(long a, long b) { return Math.min(a, b); }\n\t\tdouble min(double a, double b) { return Math.min(a, b); }\n\t\t> T min(T a, T b) { return a.compareTo(b) <= 0 ? a : b; }\n\t\tint min(int... x) {\n\t\t\tint min = x[0];\n\t\t\tfor(int val : x) min = min(min, val);\n\t\t\treturn min;\n\t\t}\n\t\tlong min(long... x) {\n\t\t\tlong min = x[0];\n\t\t\tfor(long val : x) min = min(min, val);\n\t\t\treturn min;\n\t\t}\n\t\tdouble min(double... x) {\n\t\t\tdouble min = x[0];\n\t\t\tfor(double val : x) min = min(min, val);\n\t\t\treturn min;\n\t\t}\n\t\tint max(int a, int b) { return Math.max(a, b); }\n\t\tlong max(long a, long b) { return Math.max(a, b); }\n\t\tdouble max(double a, double b) { return Math.max(a, b); }\n\t\t> T max(T a, T b) { return a.compareTo(b) >= 0 ? a : b; }\n\t\tint max(int... x) {\n\t\t\tint max = x[0];\n\t\t\tfor(int val : x) max = max(max, val);\n\t\t\treturn max;\n\t\t}\n\t\tlong max(long... x) {\n\t\t\tlong max = x[0];\n\t\t\tfor(long val : x) max = max(max, val);\n\t\t\treturn max;\n\t\t}\n\t\tdouble max(double... x) {\n\t\t\tdouble max = x[0];\n\t\t\tfor(double val : x) max = max(max, val);\n\t\t\treturn max;\n\t\t}\n\t\tlong sum(int... a) {\n\t\t\tlong sum = 0;\n\t\t\tfor(int element : a) sum += element;\n\t\t\treturn sum;\n\t\t}\n\t\tlong sum(long... a) {\n\t\t\tlong sum = 0;\n\t\t\tfor(long element : a) sum += element;\n\t\t\treturn sum;\n\t\t}\n\t\tdouble sum(double... a) {\n\t\t\tdouble sum = 0;\n\t\t\tfor(double element : a) sum += element;\n\t\t\treturn sum;\n\t\t}\n\t\tlong sum(boolean... a) {\n\t\t\tlong sum = 0;\n\t\t\tfor(boolean element : a) sum += element ? 1 : 0;\n\t\t\treturn sum;\n\t\t}\n\t\tlong[] sums(int[] a) {\n\t\t\tlong sum[] = new long[a.length + 1];\n\t\t\tsum[0] = 0;\n\t\t\tfor(int i = 0; i < a.length; i ++) sum[i + 1] = sum[i] + a[i];\n\t\t\treturn sum;\n\t\t}\n\t\tlong[] sums(long[] a) {\n\t\t\tlong sum[] = new long[a.length + 1];\n\t\t\tsum[0] = 0;\n\t\t\tfor(int i = 0; i < a.length; i ++) sum[i + 1] = sum[i] + a[i];\n\t\t\treturn sum;\n\t\t}\n\t\tdouble[] sums(double[] a) {\n\t\t\tdouble sum[] = new double[a.length + 1];\n\t\t\tsum[0] = 0;\n\t\t\tfor(int i = 0; i < a.length; i ++) sum[i + 1] = sum[i] + a[i];\n\t\t\treturn sum;\n\t\t}\n\t\tlong[] sums(boolean[] a) {\n\t\t\tlong sum[] = new long[a.length + 1];\n\t\t\tsum[0] = 0;\n\t\t\tfor(int i = 0; i < a.length; i ++) sum[i + 1] = sum[i] + (a[i] ? 1 : 0);\n\t\t\treturn sum;\n\t\t}\n\t\tlong[][] sums(int[][] a) {\n\t\t\tlong sum[][] = new long[a.length + 1][a[0].length + 1];\n\t\t\tfill(sum, 0);\n\t\t\tfor(int i = 0; i < a.length; i ++) {\n\t\t\t\tfor(int j = 0; j < a[i].length; j ++) {\n\t\t\t\t\tsum[i + 1][j + 1] = sum[i + 1][j] + sum[i][j + 1] - sum[i][j] + a[i][j];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn sum;\n\t\t}\n\t\tlong[][] sums(long[][] a) {\n\t\t\tlong sum[][] = new long[a.length + 1][a[0].length + 1];\n\t\t\tfill(sum, 0);\n\t\t\tfor(int i = 0; i < a.length; i ++) {\n\t\t\t\tfor(int j = 0; j < a[i].length; j ++) {\n\t\t\t\t\tsum[i + 1][j + 1] = sum[i + 1][j] + sum[i][j + 1] - sum[i][j] + a[i][j];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn sum;\n\t\t}\n\t\tdouble[][] sums(double[][] a) {\n\t\t\tdouble sum[][] = new double[a.length + 1][a[0].length + 1];\n\t\t\tfill(sum, 0);\n\t\t\tfor(int i = 0; i < a.length; i ++) {\n\t\t\t\tfor(int j = 0; j < a[i].length; j ++) {\n\t\t\t\t\tsum[i + 1][j + 1] = sum[i + 1][j] + sum[i][j + 1] - sum[i][j] + a[i][j];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn sum;\n\t\t}\n\t\tlong[][] sums(boolean[][] a) {\n\t\t\tlong sum[][] = new long[a.length + 1][a[0].length + 1];\n\t\t\tfill(sum, 0);\n\t\t\tfor(int i = 0; i < a.length; i ++) {\n\t\t\t\tfor(int j = 0; j < a[i].length; j ++) {\n\t\t\t\t\tsum[i + 1][j + 1] = sum[i + 1][j] + sum[i][j + 1] - sum[i][j] + (a[i][j] ? 1 : 0);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn sum;\n\t\t}\n\t\tint constrain(int x, int l, int r) { return min(max(x, min(l, r)), max(l, r)); }\n\t\tlong constrain(long x, long l, long r) { return min(max(x, min(l, r)), max(l, r)); }\n\t\tdouble constrain(double x, double l, double r) { return min(max(x, min(l, r)), max(l, r)); }\n\t\tint abs(int x) { return x >= 0 ? x : - x; }\n\t\tlong abs(long x) { return x >= 0 ? x : - x; }\n\t\tdouble abs(double x) { return x >= 0 ? x : - x; }\n\t\tint signum(int x) { return x > 0 ? 1 : x < 0 ? -1 : 0; }\n\t\tint signum(long x) { return x > 0 ? 1 : x < 0 ? -1 : 0; }\n\t\tint signum(double x) { return x > 0 ? 1 : x < 0 ? -1 : 0; }\n\t\tlong round(double x) { return Math.round(x); }\n\t\tlong floor(double x) { return (long)Math.floor(x); }\n\t\tint divfloor(int a, int b) { return signum(a) == signum(b) ? a / b : - divceil(abs(a), abs(b)); }\n\t\tlong divfloor(long a, long b) { return signum(a) == signum(b) ? a / b : - divceil(abs(a), abs(b)); }\n\t\tlong ceil(double x) { return (long)Math.ceil(x); }\n\t\tint divceil(int a, int b) { return a >= 0 && b > 0 ? (a + b - 1) / b\n\t\t\t\t\t\t\t\t\t\t\t: a < 0 && b < 0 ? divceil(abs(a), abs(b))\n\t\t\t\t\t\t\t\t\t\t\t: - divfloor(abs(a), abs(b)); }\n\t\tlong divceil(long a, long b) { return a >= 0 && b > 0 ? (a + b - 1) / b\n\t\t\t\t\t\t\t\t\t\t\t: a < 0 && b < 0 ? divceil(abs(a), abs(b))\n\t\t\t\t\t\t\t\t\t\t\t: - divfloor(abs(a), abs(b)); }\n\t\tdouble sqrt(int x) { return Math.sqrt((double)x); }\n\t\tdouble sqrt(long x) { return Math.sqrt((double)x); }\n\t\tdouble sqrt(double x) { return Math.sqrt(x); }\n\t\tlong fact(int n) {\n\t\t\tlong ans = 1;\n\t\t\tfor(int i = 1; i <= n; i ++) ans = Math.multiplyExact(ans, i);\n\t\t\treturn ans;\n\t\t}\n\t\tdouble pow(double x, double y) { return Math.pow(x, y); }\n\t\tlong pow(long x, long y) {\n\t\t\tlong ans = 1;\n\t\t\twhile(true) {\n\t\t\t\tif(y % 2 != 0) ans = Math.multiplyExact(ans, x);\n\t\t\t\ty /= 2;\n\t\t\t\tif(y <= 0) return ans;\n\t\t\t\tx = Math.multiplyExact(x, x);\n\t\t\t}\n\t\t}\n\t\tint gcd(int a, int b) {\n\t\t\twhile(true) {\n\t\t\t\tif(b == 0) return a;\n\t\t\t\tint tmp = a;\n\t\t\t\ta = b;\n\t\t\t\tb = tmp % b;\n\t\t\t}\n\t\t}\n\t\tlong gcd(long a, long b) {\n\t\t\twhile(true) {\n\t\t\t\tif(b == 0) return a;\n\t\t\t\tlong tmp = a;\n\t\t\t\ta = b;\n\t\t\t\tb = tmp % b;\n\t\t\t}\n\t\t}\n\t\tlong lcm(long a, long b) { return a / gcd(a, b) * b; }\n\t\tint gcd(int... a) {\n\t\t\tint gcd = 0;\n\t\t\tfor(int i = 0; i < a.length; i ++) gcd = gcd(gcd, a[i]);\n\t\t\treturn gcd;\n\t\t}\n\t\tlong gcd(long... a) {\n\t\t\tlong gcd = 0;\n\t\t\tfor(int i = 0; i < a.length; i ++) gcd = gcd(gcd, a[i]);\n\t\t\treturn gcd;\n\t\t}\n\t\tdouble random() { return Math.random(); }\n\t\tint random(int max) { return (int)floor(random() * max); }\n\t\tlong random(long max) { return floor(random() * max); }\n\t\tdouble random(double max) { return random() * max; }\n\t\tint random(int min, int max) { return random(max - min) + min; }\n\t\tlong random(long min, long max) { return random(max - min) + min; }\n\t\tdouble random(double min, double max) { return random(max - min) + min; }\n\n\t\tboolean isUpper(char a) { return a >= 'A' && a <= 'Z'; }\n\t\tboolean isLower(char a) { return a >= 'a' && a <= 'z'; }\n\t\tint upperToInt(char a) { return a - 'A'; }\n\t\tint lowerToInt(char a) { return a - 'a'; }\n\t\tint numToInt(char a) { return a - '0'; }\n\t\tint charToInt(char a) { return a >= 'a' ? lowerToInt(a) : a >= 'A' ? upperToInt(a) : numToInt(a); }\n\t\tchar intToUpper(int a) { return (char)(a + 'A'); }\n\t\tchar intToLower(int a) { return (char)(a + 'a'); }\n\t\tchar intToNum(int a) { return (char)(a + '0'); }\n\t\tint[] charToInt(char[] a) {\n\t\t\tint array[] = new int[a.length];\n\t\t\tfor(int i = 0; i < a.length; i ++) array[i] = charToInt(a[i]);\n\t\t\treturn array;\n\t\t}\n\n\t\tlong[] div(long a) {\n\t\t\tList divList = new ArrayList();\n\t\t\tfor(long i = 1; i * i <= a; i ++) {\n\t\t\t\tif(a % i == 0) {\n\t\t\t\t\tdivList.add(i);\n\t\t\t\t\tif(i * i != a) divList.add(a / i);\n\t\t\t\t}\n\t\t\t}\n\t\t\tlong div[] = new long[divList.size()];\n\t\t\tfor(int i = 0; i < divList.size(); i ++) div[i] = divList.get(i);\n\t\t\tArrays.sort(div);\n\t\t\treturn div;\n\t\t}\n\n\t\tlong[][] factor(long a) {\n\t\t\tList factorList = new ArrayList();\n\t\t\tList degreeList = new ArrayList();\n\t\t\tfor(long i = 2; i * i <= a; i ++) {\n\t\t\t\tif(a % i == 0) {\n\t\t\t\t\tlong count = 0;\n\t\t\t\t\twhile(a % i == 0) { a /= i; count ++; }\n\t\t\t\t\tfactorList.add(i);\n\t\t\t\t\tdegreeList.add(count);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(a > 1) { factorList.add(a); degreeList.add(1L); }\n\t\t\tlong factor[][] = new long[factorList.size()][2];\n\t\t\tfor(int i = 0; i < factorList.size(); i ++) {\n\t\t\t\tfactor[i][0] = factorList.get(i);\n\t\t\t\tfactor[i][1] = degreeList.get(i);\n\t\t\t}\n\t\t\tArrays.sort(factor, (sort1, sort2) -> Long.compare(sort1[0], sort2[0]));\n\t\t\treturn factor;\n\t\t}\n\n\t\tboolean isPrime(long x) {\n\t\t\tboolean ok = x > 1;\n\t\t\tfor(long i = 2; i * i <= x; i ++) {\n\t\t\t\tok &= x % i != 0;\n\t\t\t\tif(!ok) return ok;\n\t\t\t}\n\t\t\treturn ok;\n\t\t}\n\t\tboolean[] prime(int num) {\n\t\t\tboolean prime[] = new boolean[num];\n\t\t\tfill(prime, true);\n\t\t\tif(num > 0) prime[0] = false;\n\t\t\tif(num > 1) prime[1] = false;\n\t\t\tfor(int i = 2; i < num; i ++) if(prime[i]) for(int j = 2; i * j < num; j ++) prime[i * j] = false;\n\t\t\treturn prime;\n\t\t}\n\n\t\tlong[][] countElements(long[] a, boolean sort) {\n\t\t\tint len = a.length;\n\t\t\tlong array[] = new long[len];\n\t\t\tfor(int i = 0; i < len; i ++) array[i] = a[i];\n\t\t\tif(sort) Arrays.sort(array);\n\t\t\tList elem = new ArrayList();\n\t\t\tList cnt = new ArrayList();\n\t\t\tlong tmp = 1;\n\t\t\tfor(int i = 1; i <= len; i ++) {\n\t\t\t\tif(i == len || array[i] != array[i - 1]) {\n\t\t\t\t\telem.add(array[i - 1]);\n\t\t\t\t\tcnt.add(tmp);\n\t\t\t\t\ttmp = 1;\n\t\t\t\t}else tmp ++;\n\t\t\t}\n\t\t\tlong counts[][] = new long[elem.size()][2];\n\t\t\tfor(int i = 0; i < elem.size(); i ++) {\n\t\t\t\tcounts[i][0] = elem.get(i);\n\t\t\t\tcounts[i][1] = cnt.get(i);\n\t\t\t}\n\t\t\treturn counts;\n\t\t}\n\t\tlong[][] countElements(String str, boolean sort) {\n\t\t\tint len = str.length();\n\t\t\tchar array[] = str.toCharArray();\n\t\t\tif(sort) Arrays.sort(array);\n\t\t\tList elem = new ArrayList();\n\t\t\tList cnt = new ArrayList();\n\t\t\tlong tmp = 1;\n\t\t\tfor(int i = 1; i <= len; i ++) {\n\t\t\t\tif(i == len || array[i] != array[i - 1]) {\n\t\t\t\t\telem.add((long)array[i - 1]);\n\t\t\t\t\tcnt.add(tmp);\n\t\t\t\t\ttmp = 1;\n\t\t\t\t}else tmp ++;\n\t\t\t}\n\t\t\tlong counts[][] = new long[elem.size()][2];\n\t\t\tfor(int i = 0; i < elem.size(); i ++) {\n\t\t\t\tcounts[i][0] = elem.get(i);\n\t\t\t\tcounts[i][1] = cnt.get(i);\n\t\t\t}\n\t\t\treturn counts;\n\t\t}\n\n\t\tint[] baseConvert(long x, int n, int len) {\n\t\t\tint digit[] = new int[len];\n\t\t\tint i = 0;\n\t\t\tlong tmp = x;\n\t\t\twhile(tmp > 0 && i < len) { digit[i ++] = (int)(tmp % n); tmp /= n; }\n\t\t\treturn digit;\n\t\t}\n\t\tint[] baseConvert(long x, int n) {\n\t\t\tlong tmp = x;\n\t\t\tint len = 0;\n\t\t\twhile(tmp > 0) { tmp /= n; len ++; }\n\t\t\treturn baseConvert(x, n, len);\n\t\t}\n\t\tint[] baseConvert(int x, int n, int len) {\n\t\t\tint digit[] = new int[len];\n\t\t\tint i = 0;\n\t\t\tint tmp = x;\n\t\t\twhile(tmp > 0 && i < len) { digit[i ++] = (int)(tmp % n); tmp /= n; }\n\t\t\treturn digit;\n\t\t}\n\t\tint[] baseConvert(int x, int n) {\n\t\t\tint tmp = x;\n\t\t\tint len = 0;\n\t\t\twhile(tmp > 0) { tmp /= n; len ++; }\n\t\t\treturn baseConvert(x, n, len);\n\t\t}\n\t\tlong[] baseConvert(long x, long n, int len) {\n\t\t\tlong digit[] = new long[len];\n\t\t\tint i = 0;\n\t\t\tlong tmp = x;\n\t\t\twhile(tmp > 0 && i < len) { digit[i ++] = tmp % n; tmp /= n; }\n\t\t\treturn digit;\n\t\t}\n\t\tlong[] baseConvert(long x, long n) {\n\t\t\tlong tmp = x;\n\t\t\tint len = 0;\n\t\t\twhile(tmp > 0) { tmp /= n; len ++; }\n\t\t\treturn baseConvert(x, n, len);\n\t\t}\n\n\t\tint numDigits(long a) { return Long.toString(a).length(); }\n\t\tlong bitFlag(int a) { return 1L << (long)a; }\n\t\tboolean isFlagged(long x, int a) { return (x & bitFlag(a)) != 0; }\n\n\t\tlong countString(String str, String a) { return (str.length() - str.replace(a, \"\").length()) / a.length(); }\n\t\tlong countStringAll(String str, String a) { return str.length() - str.replaceAll(a, \"\").length(); }\n\n\n\t\tString reverse(String str) { return (new StringBuilder(str)).reverse().toString(); }\n\t\tvoid reverse(String[] array) { for(int i = 0; i < array.length / 2; i ++) swap(array, i, array.length - i - 1); }\n\t\tvoid reverse(int[] array) { for(int i = 0; i < array.length / 2; i ++) swap(array, i, array.length - i - 1); }\n\t\tvoid reverse(long[] array) { for(int i = 0; i < array.length / 2; i ++) swap(array, i, array.length - i - 1); }\n\t\tvoid reverse(double[] array) { for(int i = 0; i < array.length / 2; i ++) swap(array, i, array.length - i - 1); }\n\t\tvoid reverse(char[] array) { for(int i = 0; i < array.length / 2; i ++) swap(array, i, array.length - i - 1); }\n\t\tvoid reverse(boolean[] array) { for(int i = 0; i < array.length / 2; i ++) swap(array, i, array.length - i - 1); }\n\t\t void reverse(T[] array) { for(int i = 0; i < array.length / 2; i ++) swap(array, i, array.length - i - 1); }\n\t\tvoid fill(int[] array, int x) { Arrays.fill(array, x); }\n\t\tvoid fill(long[] array, long x) { Arrays.fill(array, x); }\n\t\tvoid fill(double[] array, double x) { Arrays.fill(array, x); }\n\t\tvoid fill(char[] array, char x) { Arrays.fill(array, x); }\n\t\tvoid fill(boolean[] array, boolean x) { Arrays.fill(array, x); }\n\t\tvoid fill(int[][] array, int x) { for(int[] a : array) fill(a, x); }\n\t\tvoid fill(long[][] array, long x) { for(long[] a : array) fill(a, x); }\n\t\tvoid fill(double[][] array, double x) { for(double[] a : array) fill(a, x); }\n\t\tvoid fill(char[][] array, char x) { for(char[] a : array) fill(a, x); }\n\t\tvoid fill(boolean[][] array, boolean x) { for(boolean[] a : array) fill(a, x); }\n\t\tvoid fill(int[][][] array, int x) { for(int[][] a : array) fill(a, x); }\n\t\tvoid fill(long[][][] array, long x) { for(long[][] a : array) fill(a, x); }\n\t\tvoid fill(double[][][] array, double x) { for(double[][] a : array) fill(a, x); }\n\t\tvoid fill(char[][][] array, char x) { for(char[][] a : array) fill(a, x); }\n\t\tvoid fill(boolean[][][] array, boolean x) { for(boolean[][] a : array) fill(a, x); }\n\n\t\tint[] resize(int[] array, int m, int x) {\n\t\t\tint resized[] = new int[m];\n\t\t\tfor(int i = max(0, - x); i < array.length && i + x < m; i ++) resized[i + x] = array[i];\n\t\t\treturn resized;\n\t\t}\n\t\tlong[] resize(long[] array, int m, int x) {\n\t\t\tlong resized[] = new long[m];\n\t\t\tfor(int i = max(0, - x); i < array.length && i + x < m; i ++) resized[i + x] = array[i];\n\t\t\treturn resized;\n\t\t}\n\t\tdouble[] resize(double[] array, int m, int x) {\n\t\t\tdouble resized[] = new double[m];\n\t\t\tfor(int i = max(0, - x); i < array.length && i + x < m; i ++) resized[i + x] = array[i];\n\t\t\treturn resized;\n\t\t}\n\t\tchar[] resize(char[] array, int m, int x) {\n\t\t\tchar resized[] = new char[m];\n\t\t\tfor(int i = max(0, - x); i < array.length && i + x < m; i ++) resized[i + x] = array[i];\n\t\t\treturn resized;\n\t\t}\n\t\tboolean[] resize(boolean[] array, int m, int x) {\n\t\t\tboolean resized[] = new boolean[m];\n\t\t\tfor(int i = max(0, - x); i < array.length && i + x < m; i ++) resized[i + x] = array[i];\n\t\t\treturn resized;\n\t\t}\n\t\tObject[] resize(Object[] array, int m, int x) {\n\t\t\tObject resized[] = new Object[m];\n\t\t\tfor(int i = max(0, - x); i < array.length && i + x < m; i ++) resized[i + x] = array[i];\n\t\t\treturn resized;\n\t\t}\n\n\t\tvoid shuffleArray(int[] array){\n\t\t\tfor(int i = 0; i < array.length; i ++){\n\t\t\t\tint tmp = array[i];\n\t\t\t\tint randomPos = random(i, array.length);\n\t\t\t\tarray[i] = array[randomPos];\n\t\t\t\tarray[randomPos] = tmp;\n\t\t\t}\n\t\t}\n\t\tvoid shuffleArray(long[] array){\n\t\t\tfor(int i = 0; i < array.length; i ++){\n\t\t\t\tlong tmp = array[i];\n\t\t\t\tint randomPos = random(i, array.length);\n\t\t\t\tarray[i] = array[randomPos];\n\t\t\t\tarray[randomPos] = tmp;\n\t\t\t}\n\t\t}\n\t\tvoid shuffleArray(double[] array){\n\t\t\tfor(int i = 0; i < array.length; i ++){\n\t\t\t\tdouble tmp = array[i];\n\t\t\t\tint randomPos = random(i, array.length);\n\t\t\t\tarray[i] = array[randomPos];\n\t\t\t\tarray[randomPos] = tmp;\n\t\t\t}\n\t\t}\n\t\tint[] randomi(int num, int max){\n\t\t\tint array[] = new int[num];\n\t\t\tfor(int i = 0; i < num; i ++) array[i] = random(max);\n\t\t\treturn array;\n\t\t}\n\t\tlong[] randoml(int num, long max){\n\t\t\tlong array[] = new long[num];\n\t\t\tfor(int i = 0; i < num; i ++) array[i] = random(max);\n\t\t\treturn array;\n\t\t}\n\t\tdouble[] randomd(int num, double max){\n\t\t\tdouble array[] = new double[num];\n\t\t\tfor(int i = 0; i < num; i ++) array[i] = random(max);\n\t\t\treturn array;\n\t\t}\n\t\tint[] randomi(int num, int min, int max){\n\t\t\tint array[] = new int[num];\n\t\t\tfor(int i = 0; i < num; i ++) array[i] = random(min, max);\n\t\t\treturn array;\n\t\t}\n\t\tlong[] randoml(int num, long min, long max){\n\t\t\tlong array[] = new long[num];\n\t\t\tfor(int i = 0; i < num; i ++) array[i] = random(min, max);\n\t\t\treturn array;\n\t\t}\n\t\tdouble[] randomd(int num, double min, double max){\n\t\t\tdouble array[] = new double[num];\n\t\t\tfor(int i = 0; i < num; i ++) array[i] = random(min, max);\n\t\t\treturn array;\n\t\t}\n\n\t\tvoid swap(String[] array, int i, int j) {\n\t\t\tString tmp = array[i];\n\t\t\tarray[i] = array[j];\n\t\t\tarray[j] = tmp;\n\t\t}\n\t\tvoid swap(int[] array, int i, int j) {\n\t\t\tint tmp = array[i];\n\t\t\tarray[i] = array[j];\n\t\t\tarray[j] = tmp;\n\t\t}\n\t\tvoid swap(long[] array, int i, int j) {\n\t\t\tlong tmp = array[i];\n\t\t\tarray[i] = array[j];\n\t\t\tarray[j] = tmp;\n\t\t}\n\t\tvoid swap(double[] array, int i, int j) {\n\t\t\tdouble tmp = array[i];\n\t\t\tarray[i] = array[j];\n\t\t\tarray[j] = tmp;\n\t\t}\n\t\tvoid swap(char[] array, int i, int j) {\n\t\t\tchar tmp = array[i];\n\t\t\tarray[i] = array[j];\n\t\t\tarray[j] = tmp;\n\t\t}\n\t\tvoid swap(boolean[] array, int i, int j) {\n\t\t\tboolean tmp = array[i];\n\t\t\tarray[i] = array[j];\n\t\t\tarray[j] = tmp;\n\t\t}\n\t\t void swap(T[] array, int i, int j) {\n\t\t\tT tmp = array[i];\n\t\t\tarray[i] = array[j];\n\t\t\tarray[j] = tmp;\n\t\t}\n\n\t\tint[] compress(int[] a) {\n\t\t\tint num = a.length;\n\t\t\tSet ss = new TreeSet<>();\n\t\t\tfor(int i = 0; i < num; i ++) ss.add(a[i]);\n\t\t\tint compressed[] = new int[ss.size()];\n\t\t\tint j = 0;\n\t\t\tfor(Integer x : ss) compressed[j ++] = x;\n\t\t\tfor(int i = 0; i < num; i ++) a[i] = lowerBound(compressed, a[i]);\n\t\t\treturn compressed;\n\t\t}\n\t\tlong[] compress(long[] a) {\n\t\t\tint num = a.length;\n\t\t\tSet ss = new TreeSet<>();\n\t\t\tfor(int i = 0; i < num; i ++) ss.add(a[i]);\n\t\t\tlong compressed[] = new long[ss.size()];\n\t\t\tint j = 0;\n\t\t\tfor(Long x : ss) compressed[j ++] = x;\n\t\t\tfor(int i = 0; i < num; i ++) a[i] = lowerBound(compressed, a[i]);\n\t\t\treturn compressed;\n\t\t}\n\t\tdouble[] compress(double[] a) {\n\t\t\tint num = a.length;\n\t\t\tSet ss = new TreeSet<>();\n\t\t\tfor(int i = 0; i < num; i ++) ss.add(a[i]);\n\t\t\tdouble compressed[] = new double[ss.size()];\n\t\t\tint j = 0;\n\t\t\tfor(Double x : ss) compressed[j ++] = x;\n\t\t\tfor(int i = 0; i < num; i ++) a[i] = lowerBound(compressed, a[i]);\n\t\t\treturn compressed;\n\t\t}\n\n\n\t\tint lowerBound(int[] array, int key) {\n\t\t\treturn BS(array, key, true, true, true);\n\t\t}\n\t\tint lowerBound(int[] array, int key, int ng, int ok) {\n\t\t\treturn BS(array, key, true, true, true, ng, ok);\n\t\t}\n\t\tint upperBound(int[] array, int key) {\n\t\t\treturn BS(array, key, true, true, false);\n\t\t}\n\t\tint upperBound(int[] array, int key, int ng, int ok) {\n\t\t\treturn BS(array, key, true, true, false, ng, ok);\n\t\t}\n\t\tint cntBS(int[] array, int key, boolean ascending, boolean greater, boolean equals) {\n\t\t\treturn BS(array, key, ascending, greater, equals, true);\n\t\t}\n\t\tint cntBS(int[] array, int key, boolean ascending, boolean greater, boolean equals, int ng, int ok) {\n\t\t\treturn BS(array, key, ascending, greater, equals, true, ng, ok);\n\t\t}\n\t\tint BS(int[] array, int key, boolean ascending, boolean greater, boolean equals) {\n\t\t\treturn BS(array, key, ascending, greater, equals, false);\n\t\t}\n\t\tint BS(int[] array, int key, boolean ascending, boolean greater, boolean equals, int ng, int ok) {\n\t\t\treturn BS(array, key, ascending, greater, equals, false, ng, ok);\n\t\t}\n\t\tint BS(int[] array, int key, boolean ascending, boolean greater, boolean equals, boolean count) {\n\t\t\tint ng = ascending ^ greater ? array.length : -1;\n\t\t\tint ok = ascending ^ greater ? -1 : array.length;\n\t\t\treturn BS(array, key, ascending, greater, equals, count, ng, ok);\n\t\t}\n\t\tint BS(int[] array, int key, boolean ascending, boolean greater, boolean equals, boolean count, int ng, int ok) {\n\t\t\tint index = binarySearch(array, key, greater, equals, ng, ok);\n\t\t\treturn count ? (int)abs(ok - index) : index;\n\t\t}\n\t\tint binarySearch(int[] array, int key, boolean greater, boolean equals, int ng, int ok) {\n\t\t\twhile (abs(ok - ng) > 1) {\n\t\t\t\tint mid = (ok + ng) / 2;\n\t\t\t\tif(isOKforBinarySearch(array, mid, key, greater, equals)) ok = mid; else ng = mid;\n\t\t\t}\n\t\t\treturn ok;\n\t\t}\n\t\tboolean isOKforBinarySearch(int[] array, int index, int key, boolean greater, boolean equals) {\n\t\t\treturn (array[index] > key && greater) || (array[index] < key && !greater) || (array[index] == key && equals);\n\t\t}\n\t\tint lowerBound(long[] array, long key) {\n\t\t\treturn BS(array, key, true, true, true);\n\t\t}\n\t\tint lowerBound(long[] array, long key, int ng, int ok) {\n\t\t\treturn BS(array, key, true, true, true, ng, ok);\n\t\t}\n\t\tint upperBound(long[] array, long key) {\n\t\t\treturn BS(array, key, true, true, false);\n\t\t}\n\t\tint upperBound(long[] array, long key, int ng, int ok) {\n\t\t\treturn BS(array, key, true, true, false, ng, ok);\n\t\t}\n\t\tint cntBS(long[] array, long key, boolean ascending, boolean greater, boolean equals) {\n\t\t\treturn BS(array, key, ascending, greater, equals, true);\n\t\t}\n\t\tint cntBS(long[] array, long key, boolean ascending, boolean greater, boolean equals, int ng, int ok) {\n\t\t\treturn BS(array, key, ascending, greater, equals, true, ng, ok);\n\t\t}\n\t\tint BS(long[] array, long key, boolean ascending, boolean greater, boolean equals) {\n\t\t\treturn BS(array, key, ascending, greater, equals, false);\n\t\t}\n\t\tint BS(long[] array, long key, boolean ascending, boolean greater, boolean equals, int ng, int ok) {\n\t\t\treturn BS(array, key, ascending, greater, equals, false, ng, ok);\n\t\t}\n\t\tint BS(long[] array, long key, boolean ascending, boolean greater, boolean equals, boolean count) {\n\t\t\tint ng = ascending ^ greater ? array.length : -1;\n\t\t\tint ok = ascending ^ greater ? -1 : array.length;\n\t\t\treturn BS(array, key, ascending, greater, equals, count, ng, ok);\n\t\t}\n\t\tint BS(long[] array, long key, boolean ascending, boolean greater, boolean equals, boolean count, int ng, int ok) {\n\t\t\tint index = binarySearch(array, key, greater, equals, ng, ok);\n\t\t\treturn count ? (int)abs(ok - index) : index;\n\t\t}\n\t\tint binarySearch(long[] array, long key, boolean greater, boolean equals, int ng, int ok) {\n\t\t\twhile (abs(ok - ng) > 1) {\n\t\t\t\tint mid = (ok + ng) / 2;\n\t\t\t\tif(isOKforBinarySearch(array, mid, key, greater, equals)) ok = mid; else ng = mid;\n\t\t\t}\n\t\t\treturn ok;\n\t\t}\n\t\tboolean isOKforBinarySearch(long[] array, int index, long key, boolean greater, boolean equals) {\n\t\t\treturn (array[index] > key && greater) || (array[index] < key && !greater) || (array[index] == key && equals);\n\t\t}\n\t\tint lowerBound(double[] array, double key) {\n\t\t\treturn BS(array, key, true, true, true);\n\t\t}\n\t\tint lowerBound(double[] array, double key, int ng, int ok) {\n\t\t\treturn BS(array, key, true, true, true, ng, ok);\n\t\t}\n\t\tint upperBound(double[] array, double key) {\n\t\t\treturn BS(array, key, true, true, false);\n\t\t}\n\t\tint upperBound(double[] array, double key, int ng, int ok) {\n\t\t\treturn BS(array, key, true, true, false, ng, ok);\n\t\t}\n\t\tint cntBS(double[] array, double key, boolean ascending, boolean greater, boolean equals) {\n\t\t\treturn BS(array, key, ascending, greater, equals, true);\n\t\t}\n\t\tint cntBS(double[] array, double key, boolean ascending, boolean greater, boolean equals, int ng, int ok) {\n\t\t\treturn BS(array, key, ascending, greater, equals, true, ng, ok);\n\t\t}\n\t\tint BS(double[] array, double key, boolean ascending, boolean greater, boolean equals) {\n\t\t\treturn BS(array, key, ascending, greater, equals, false);\n\t\t}\n\t\tint BS(double[] array, double key, boolean ascending, boolean greater, boolean equals, int ng, int ok) {\n\t\t\treturn BS(array, key, ascending, greater, equals, false, ng, ok);\n\t\t}\n\t\tint BS(double[] array, double key, boolean ascending, boolean greater, boolean equals, boolean count) {\n\t\t\tint ng = ascending ^ greater ? array.length : -1;\n\t\t\tint ok = ascending ^ greater ? -1 : array.length;\n\t\t\treturn BS(array, key, ascending, greater, equals, count, ng, ok);\n\t\t}\n\t\tint BS(double[] array, double key, boolean ascending, boolean greater, boolean equals, boolean count, int ng, int ok) {\n\t\t\tint index = binarySearch(array, key, greater, equals, ng, ok);\n\t\t\treturn count ? (int)abs(ok - index) : index;\n\t\t}\n\t\tint binarySearch(double[] array, double key, boolean greater, boolean equals, int ng, int ok) {\n\t\t\twhile (abs(ok - ng) > 1) {\n\t\t\t\tint mid = (ok + ng) / 2;\n\t\t\t\tif(isOKforBinarySearch(array, mid, key, greater, equals)) ok = mid; else ng = mid;\n\t\t\t}\n\t\t\treturn ok;\n\t\t}\n\t\tboolean isOKforBinarySearch(double[] array, int index, double key, boolean greater, boolean equals) {\n\t\t\treturn (array[index] > key && greater) || (array[index] < key && !greater) || (array[index] == key && equals);\n\t\t}\n\t\t> int lowerBound(T[] array, T key) {\n\t\t\treturn BS(array, key, true, true, true);\n\t\t}\n\t\t> int lowerBound(T[] array, T key, int ng, int ok) {\n\t\t\treturn BS(array, key, true, true, true, ng, ok);\n\t\t}\n\t\t> int upperBound(T[] array, T key) {\n\t\t\treturn BS(array, key, true, true, false);\n\t\t}\n\t\t> int upperBound(T[] array, T key, int ng, int ok) {\n\t\t\treturn BS(array, key, true, true, false, ng, ok);\n\t\t}\n\t\t> int cntBS(T[] array, T key, boolean ascending, boolean greater, boolean equals) {\n\t\t\treturn BS(array, key, ascending, greater, equals, true);\n\t\t}\n\t\t> int cntBS(T[] array, T key, boolean ascending, boolean greater, boolean equals, int ng, int ok) {\n\t\t\treturn BS(array, key, ascending, greater, equals, true, ng, ok);\n\t\t}\n\t\t> int BS(T[] array, T key, boolean ascending, boolean greater, boolean equals) {\n\t\t\treturn BS(array, key, ascending, greater, equals, false);\n\t\t}\n\t\t> int BS(T[] array, T key, boolean ascending, boolean greater, boolean equals, int ng, int ok) {\n\t\t\treturn BS(array, key, ascending, greater, equals, false, ng, ok);\n\t\t}\n\t\t> int BS(T[] array, T key, boolean ascending, boolean greater, boolean equals, boolean count) {\n\t\t\tint ng = ascending ^ greater ? array.length : -1;\n\t\t\tint ok = ascending ^ greater ? -1 : array.length;\n\t\t\treturn BS(array, key, ascending, greater, equals, count, ng, ok);\n\t\t}\n\t\t> int BS(T[] array, T key, boolean ascending, boolean greater, boolean equals, boolean count, int ng, int ok) {\n\t\t\tint index = binarySearch(array, key, greater, equals, ng, ok);\n\t\t\treturn count ? (int)abs(ok - index) : index;\n\t\t}\n\t\t> int binarySearch(T[] array, T key, boolean greater, boolean equals, int ng, int ok) {\n\t\t\twhile (abs(ok - ng) > 1) {\n\t\t\t\tint mid = (ok + ng) / 2;\n\t\t\t\tif(isOKforBinarySearch(array, mid, key, greater, equals)) ok = mid; else ng = mid;\n\t\t\t}\n\t\t\treturn ok;\n\t\t}\n\t\t> boolean isOKforBinarySearch(T[] array, int index, T key, boolean greater, boolean equals) {\n\t\t\tint compare = array[index].compareTo(key);\n\t\t\treturn (compare > 0 && greater) || (compare < 0 && !greater) || (compare == 0 && equals);\n\t\t}\n\t\t int lowerBound(T[] array, T key, Comparator c) {\n\t\t\treturn BS(array, key, true, true, true, c);\n\t\t}\n\t\t int lowerBound(T[] array, T key, int ng, int ok, Comparator c) {\n\t\t\treturn BS(array, key, true, true, true, ng, ok, c);\n\t\t}\n\t\t int upperBound(T[] array, T key, Comparator c) {\n\t\t\treturn BS(array, key, true, true, false, c);\n\t\t}\n\t\t int upperBound(T[] array, T key, int ng, int ok, Comparator c) {\n\t\t\treturn BS(array, key, true, true, false, ng, ok, c);\n\t\t}\n\t\t int cntBS(T[] array, T key, boolean ascending, boolean greater, boolean equals, Comparator c) {\n\t\t\treturn BS(array, key, ascending, greater, equals, true, c);\n\t\t}\n\t\t int cntBS(T[] array, T key, boolean ascending, boolean greater, boolean equals, int ng, int ok, Comparator c) {\n\t\t\treturn BS(array, key, ascending, greater, equals, true, ng, ok, c);\n\t\t}\n\t\t int BS(T[] array, T key, boolean ascending, boolean greater, boolean equals, Comparator c) {\n\t\t\treturn BS(array, key, ascending, greater, equals, false, c);\n\t\t}\n\t\t int BS(T[] array, T key, boolean ascending, boolean greater, boolean equals, int ng, int ok, Comparator c) {\n\t\t\treturn BS(array, key, ascending, greater, equals, false, ng, ok, c);\n\t\t}\n\t\t int BS(T[] array, T key, boolean ascending, boolean greater, boolean equals, boolean count, Comparator c) {\n\t\t\tint ng = ascending ^ greater ? array.length : -1;\n\t\t\tint ok = ascending ^ greater ? -1 : array.length;\n\t\t\treturn BS(array, key, ascending, greater, equals, count, ng, ok, c);\n\t\t}\n\t\t int BS(T[] array, T key, boolean ascending, boolean greater, boolean equals, boolean count, int ng, int ok, Comparator c) {\n\t\t\tint index = binarySearch(array, key, greater, equals, ng, ok, c);\n\t\t\treturn count ? (int)abs(ok - index) : index;\n\t\t}\n\t\t int binarySearch(T[] array, T key, boolean greater, boolean equals, int ng, int ok, Comparator c) {\n\t\t\twhile (abs(ok - ng) > 1) {\n\t\t\t\tint mid = (ok + ng) / 2;\n\t\t\t\tif(isOKforBinarySearch(array, mid, key, greater, equals, c)) ok = mid; else ng = mid;\n\t\t\t}\n\t\t\treturn ok;\n\t\t}\n\t\t boolean isOKforBinarySearch(T[] array, int index, T key, boolean greater, boolean equals, Comparator c) {\n\t\t\tint compare = c.compare(array[index], key);\n\t\t\treturn (compare > 0 && greater) || (compare < 0 && !greater) || (compare == 0 && equals);\n\t\t}\n\t\t> int lowerBound(List array, T key) {\n\t\t\treturn BS(array, key, true, true, true);\n\t\t}\n\t\t> int lowerBound(List array, T key, int ng, int ok) {\n\t\t\treturn BS(array, key, true, true, true, ng, ok);\n\t\t}\n\t\t> int upperBound(List array, T key) {\n\t\t\treturn BS(array, key, true, true, false);\n\t\t}\n\t\t> int upperBound(List array, T key, int ng, int ok) {\n\t\t\treturn BS(array, key, true, true, false, ng, ok);\n\t\t}\n\t\t> int cntBS(List array, T key, boolean ascending, boolean greater, boolean equals) {\n\t\t\treturn BS(array, key, ascending, greater, equals, true);\n\t\t}\n\t\t> int cntBS(List array, T key, boolean ascending, boolean greater, boolean equals, int ng, int ok) {\n\t\t\treturn BS(array, key, ascending, greater, equals, true, ng, ok);\n\t\t}\n\t\t> int BS(List array, T key, boolean ascending, boolean greater, boolean equals) {\n\t\t\treturn BS(array, key, ascending, greater, equals, false);\n\t\t}\n\t\t> int BS(List array, T key, boolean ascending, boolean greater, boolean equals, int ng, int ok) {\n\t\t\treturn BS(array, key, ascending, greater, equals, false, ng, ok);\n\t\t}\n\t\t> int BS(List array, T key, boolean ascending, boolean greater, boolean equals, boolean count) {\n\t\t\tint ng = ascending ^ greater ? array.size() : -1;\n\t\t\tint ok = ascending ^ greater ? -1 : array.size();\n\t\t\treturn BS(array, key, ascending, greater, equals, count, ng, ok);\n\t\t}\n\t\t> int BS(List array, T key, boolean ascending, boolean greater, boolean equals, boolean count, int ng, int ok) {\n\t\t\tint index = binarySearch(array, key, greater, equals, ng, ok);\n\t\t\treturn count ? (int)abs(ok - index) : index;\n\t\t}\n\t\t> int binarySearch(List array, T key, boolean greater, boolean equals, int ng, int ok) {\n\t\t\twhile (abs(ok - ng) > 1) {\n\t\t\t\tint mid = (ok + ng) / 2;\n\t\t\t\tif(isOKforBinarySearch(array, mid, key, greater, equals)) ok = mid; else ng = mid;\n\t\t\t}\n\t\t\treturn ok;\n\t\t}\n\t\t> boolean isOKforBinarySearch(List array, int index, T key, boolean greater, boolean equals) {\n\t\t\tint compare = array.get(index).compareTo(key);\n\t\t\treturn (compare > 0 && greater) || (compare < 0 && !greater) || (compare == 0 && equals);\n\t\t}\n\t\t int lowerBound(List array, T key, Comparator c) {\n\t\t\treturn BS(array, key, true, true, true, c);\n\t\t}\n\t\t int lowerBound(List array, T key, int ng, int ok, Comparator c) {\n\t\t\treturn BS(array, key, true, true, true, ng, ok, c);\n\t\t}\n\t\t int upperBound(List array, T key, Comparator c) {\n\t\t\treturn BS(array, key, true, true, false, c);\n\t\t}\n\t\t int upperBound(List array, T key, int ng, int ok, Comparator c) {\n\t\t\treturn BS(array, key, true, true, false, ng, ok, c);\n\t\t}\n\t\t int cntBS(List array, T key, boolean ascending, boolean greater, boolean equals, Comparator c) {\n\t\t\treturn BS(array, key, ascending, greater, equals, true, c);\n\t\t}\n\t\t int cntBS(List array, T key, boolean ascending, boolean greater, boolean equals, int ng, int ok, Comparator c) {\n\t\t\treturn BS(array, key, ascending, greater, equals, true, ng, ok, c);\n\t\t}\n\t\t int BS(List array, T key, boolean ascending, boolean greater, boolean equals, Comparator c) {\n\t\t\treturn BS(array, key, ascending, greater, equals, false, c);\n\t\t}\n\t\t int BS(List array, T key, boolean ascending, boolean greater, boolean equals, int ng, int ok, Comparator c) {\n\t\t\treturn BS(array, key, ascending, greater, equals, false, ng, ok, c);\n\t\t}\n\t\t int BS(List array, T key, boolean ascending, boolean greater, boolean equals, boolean count, Comparator c) {\n\t\t\tint ng = ascending ^ greater ? array.size() : -1;\n\t\t\tint ok = ascending ^ greater ? -1 : array.size();\n\t\t\treturn BS(array, key, ascending, greater, equals, count, ng, ok, c);\n\t\t}\n\t\t int BS(List array, T key, boolean ascending, boolean greater, boolean equals, boolean count, int ng, int ok, Comparator c) {\n\t\t\tint index = binarySearch(array, key, greater, equals, ng, ok, c);\n\t\t\treturn count ? (int)abs(ok - index) : index;\n\t\t}\n\t\t int binarySearch(List array, T key, boolean greater, boolean equals, int ng, int ok, Comparator c) {\n\t\t\twhile (abs(ok - ng) > 1) {\n\t\t\t\tint mid = (ok + ng) / 2;\n\t\t\t\tif(isOKforBinarySearch(array, mid, key, greater, equals, c)) ok = mid; else ng = mid;\n\t\t\t}\n\t\t\treturn ok;\n\t\t}\n\t\t boolean isOKforBinarySearch(List array, int index, T key, boolean greater, boolean equals, Comparator c) {\n\t\t\tint compare = c.compare(array.get(index), key);\n\t\t\treturn (compare > 0 && greater) || (compare < 0 && !greater) || (compare == 0 && equals);\n\t\t}\n\n\t\tPairLL binaryRangeSearch(long left, long right, UnaryOperator op, boolean minimize) {\n\t\t\tlong ok1 = right, ng1 = left;\n\t\t\twhile(abs(ok1 - ng1) > 1) {\n\t\t\t\tlong mid = (ok1 + ng1) / 2;\n\t\t\t\tboolean isOK = (op.apply(mid + 1) - op.apply(mid)) * (minimize ? 1 : -1) >= 0;\n\t\t\t\tif(isOK) ok1 = mid; else ng1 = mid;\n\t\t\t}\n\t\t\tlong ok2 = left, ng2 = right;\n\t\t\twhile(abs(ok2 - ng2) > 1) {\n\t\t\t\tlong mid = (ok2 + ng2) / 2;\n\t\t\t\tboolean isOK = (op.apply(mid - 1) - op.apply(mid)) * (minimize ? 1 : -1) >= 0;\n\t\t\t\tif(isOK) ok2 = mid; else ng2 = mid;\n\t\t\t}\n\t\t\treturn new PairLL(ok1, ok2); //[l, r]\n\t\t}\n\n\t\tdouble ternarySearch(double left, double right, UnaryOperator op, boolean minimize, int loop) {\n\t\t\tfor(int cnt = 0; cnt < loop; cnt ++) {\n\t\t\t\tdouble m1 = (left * 2 + right) / 3.0;\n\t\t\t\tdouble m2 = (left + right * 2) / 3.0;\n\t\t\t\tif(op.apply(m1) > op.apply(m2) ^ minimize) right = m2; else left = m1;\n\t\t\t}\n\t\t\treturn (left + right) / 2.0;\n\t\t}\n\n\n\t\t// mods\n\t\tfinal long MOD = (long)1e9 + 7; // 998244353;\n\t\tlong mod(long i) { i %= MOD; return i + (i < 0 ? MOD : 0); }\n\t\tvoid mod(long[] a) { for(int i = 0; i < a.length; i ++) a[i] = mod(a[i]); }\n\t\tvoid mod(long[][] a) { for(int i = 0; i < a.length; i ++) mod(a[i]); }\n\t\tvoid mod(long[][][] a) { for(int i = 0; i < a.length; i ++) mod(a[i]); }\n\n\t\tlong pow_m(long x, long y) {\n\t\t\tlong ans = 1;\n\t\t\tfor(; y > 0; y /= 2) {\n\t\t\t\tif(y % 2 != 0) ans = mod(ans * x);\n\t\t\t\tx = mod(x * x);\n\t\t\t}\n\t\t\treturn ans;\n\t\t}\n\t\tlong[] pows_m(long x, int max) {\n\t\t\tlong pow[] = new long[max + 1];\n\t\t\tpow[0] = 1;\n\t\t\tfor(int i = 0; i < max; i ++) pow[i + 1] = mod(pow[i] * x);\n\t\t\treturn pow;\n\t\t}\n\t\tlong fact_m(int n) {\n\t\t\tlong ans = 1;\n\t\t\tfor(int i = 1; i <= n; i ++) ans = mod(ans * i);\n\t\t\treturn ans;\n\t\t}\n\n\t\tfinal int MAX_INV_SIZE = 100_100;\n\t\tMap invMap = new HashMap<>();\n\t\tlong inv(long x) {\n\t\t\tx = mod(x);\n\t\t\tif(invMap.containsKey(x)) return invMap.get(x);\n\t\t\tif(invMap.size() >= MAX_INV_SIZE) return calInv(x);\n\t\t\tinvMap.put(x, calInv(x));\n\t\t\treturn invMap.get(x);\n\t\t}\n\t\tlong calInv(long x) { return pow_m(x, MOD - 2); }\n\n\t\tfinal int MAX_FACT = 5_000_100;\n\t\tlong fact[];\n\t\tlong invFact[];\n\t\tboolean isFactPrepared = false;\n\t\tMap factMap;\n\t\tvoid prepareFact() {\n\t\t\tfact = new long[MAX_FACT];\n\t\t\tfill(fact, 0);\n\t\t\tinvFact = new long[MAX_FACT];\n\t\t\tfill(invFact, 0);\n\t\t\tfact[0] = 1;\n\t\t\tint maxIndex = min(MAX_FACT, (int)MOD);\n\t\t\tfor(int i = 1; i < maxIndex; i ++) fact[i] = mod(fact[i - 1] * i);\n\t\t\tinvFact[maxIndex - 1] = inv(fact[maxIndex - 1]);\n\t\t\tfor(int i = maxIndex - 1; i > 0; i --) invFact[i - 1] = mod(invFact[i] * i);\n\n\t\t\tfactMap = new HashMap<>();\n\t\t\tisFactPrepared = true;\n\t\t}\n\n\t\tlong P(int n, int r) {\n\t\t\tif(!isFactPrepared) { prepareFact(); }\n\t\t\tif(n < 0 || r < 0 || n < r) { return 0; }\n\t\t\tif(n >= MAX_FACT) {\n\t\t\t\tif(!factMap.containsKey(n)) {\n\t\t\t\t\tlong largeFact[] = new long[MAX_FACT];\n\t\t\t\t\tfactMap.put(n, largeFact);\n\t\t\t\t\tfill(largeFact, -INF);\n\t\t\t\t\tlargeFact[0] = 1;\n\t\t\t\t}\n\t\t\t\tlong largeFact[] = factMap.get(n);\n\t\t\t\tint i = r;\n\t\t\t\twhile(isINF(largeFact[i])) i --;\n\t\t\t\tfor(; i < r; i ++) largeFact[i + 1] = mod(largeFact[i] * (n - i));\n\t\t\t\treturn largeFact[r];\n\t\t\t}\n\t\t\treturn mod(fact[n] * invFact[n - r]);\n\t\t}\n\t\tlong C(int n, int r) {\n\t\t\tif(!isFactPrepared) prepareFact();\n\t\t\tif(n < 0 || r < 0 || n < r) return 0;\n\t\t\treturn mod(P(n, r) * invFact[r]);\n\t\t}\n\t\tlong H(int n, int r) { return C((n - 1) + r, r); }\n\n\n\t\t// grid\n\t\tclass Grids {\n\t\t\tint h;\n\t\t\tint w;\n\t\t\tGrid[][] gs;\n\t\t\tGrid[] gi;\n\t\t\tGrids(int h, int w) {\n\t\t\t\tthis.h = h;\n\t\t\t\tthis.w = w;\n\t\t\t\tgs = new Grid[h][w];\n\t\t\t\tgi = new Grid[h * w];\n\t\t\t\tfor(int i = 0; i < h; i ++) {\n\t\t\t\t\tfor(int j = 0; j < w; j ++) {\n\t\t\t\t\t\tgs[i][j] = new Grid(i, j, h, w);\n\t\t\t\t\t\tgi[gs[i][j].i] = gs[i][j];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvoid init(boolean[][] b) {\n\t\t\t\tfor(int i = 0; i < h; i ++) for(int j = 0; j < w; j ++) gs[i][j].b = b[i][j];\n\t\t\t}\n\t\t\tvoid init(long[][] val) {\n\t\t\t\tfor(int i = 0; i < h; i ++) for(int j = 0; j < w; j ++) gs[i][j].val = val[i][j];\n\t\t\t}\n\n\t\t\tGrid get(int x, int y) { return isValid(x, y, h, w) ? gs[x][y] : null; }\n\t\t\tGrid get(int i) { return get(i / w, i % w); }\n\n\t\t\tint dx[] = {0, -1, 1, 0, 0, -1, 1, -1, 1};\n\t\t\tint dy[] = {0, 0, 0, -1, 1, -1, -1, 1, 1};\n\t\t\tGrid next(int x, int y, int i) { return next(gs[x][y], i); }\n\t\t\tGrid next(Grid g, int i) {\n\t\t\t\treturn isValid(g.x + dx[i], g.y + dy[i], g.h, g.w)\n\t\t\t\t\t? gs[g.x + dx[i]][g.y + dy[i]]\n\t\t\t\t\t: null;\n\t\t\t}\n\t\t}\n\t\tclass Grid implements Comparable {\n\t\t\tint x;\n\t\t\tint y;\n\t\t\tint h;\n\t\t\tint w;\n\t\t\tint i;\n\t\t\tboolean b;\n\t\t\tlong val;\n\n\t\t\tGrid() { }\n\t\t\tGrid(int x, int y, int h, int w) { init(x, y, h, w, false, 0); }\n\t\t\tGrid(int x, int y, int h, int w, boolean b) { init(x, y, h, w, b, 0); }\n\t\t\tGrid(int x, int y, int h, int w, long val) { init(x, y, h, w, false, val); }\n\t\t\tGrid(int x, int y, int h, int w, boolean b, long val) { init(x, y, h, w, b, val); }\n\n\t\t\tvoid init(int x, int y, int h, int w, boolean b, long val) {\n\t\t\t\tthis.x = x;\n\t\t\t\tthis.y = y;\n\t\t\t\tthis.h = h;\n\t\t\t\tthis.w = w;\n\t\t\t\tthis.b = b;\n\t\t\t\tthis.val = val;\n\t\t\t\tthis.i = x * w + y;\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic String toString() { return \"(\"+x+\", \"+y+\")\"+\" \"+booleanToString(b)+\" \"+val; }\n\t\t\t@Override\n\t\t\tpublic int hashCode() { return Objects.hash(x, y, h, w, b, val); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null) return false;\n\t\t\t\tif(this.getClass() != obj.getClass()) return false;\n\t\t\t\tGrid that = (Grid) obj;\n\t\t\t\tif(this.x != that.x) return false;\n\t\t\t\tif(this.y != that.y) return false;\n\t\t\t\tif(this.h != that.h) return false;\n\t\t\t\tif(this.w != that.w) return false;\n\t\t\t\tif(this.b != that.b) return false;\n\t\t\t\tif(this.val != that.val) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(Grid that) {\n\t\t\t\tint c = Long.compare(this.val, that.val);\n\t\t\t\tif(c == 0) c = Integer.compare(this.x, that.x);\n\t\t\t\tif(c == 0) c = Integer.compare(this.y, that.y);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\n\t\tboolean isValid(int x, int y, int h, int w) { return x >= 0 && x < h && y >= 0 && y < w; }\n\t\tboolean isValid(Grid g) { return isValid(g.x, g.y, g.h, g.w); }\n\n\t\t// graph\n\t\tclass Graph {\n\t\t\tint numNode;\n\t\t\tint numEdge;\n\t\t\tboolean directed;\n\t\t\tSet edges = new HashSet<>();\n\t\t\tNode nodes[];\n\t\t\tNode reversedNodes[];\n\n\t\t\tGraph(int numNode, int numEdge, boolean directed) {\n\t\t\t\tthis.numNode = numNode;\n\t\t\t\tthis.numEdge = numEdge;\n\t\t\t\tthis.directed = directed;\n\t\t\t\tnodes = new Node[numNode];\n\t\t\t\treversedNodes = new Node[numNode];\n\t\t\t\tfor(int i = 0; i < numNode; i ++) {\n\t\t\t\t\tnodes[i] = new Node(i);\n\t\t\t\t\treversedNodes[i] = new Node(i);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvoid init(Set edges) {\n\t\t\t\tthis.edges = edges;\n\t\t\t\tfor(Edge e : edges) add(e);\n\t\t\t}\n\n\t\t\tvoid add(Edge e) {\n\t\t\t\tedges.add(e);\n\t\t\t\tnodes[e.source].add(e.target, e.cost);\n\t\t\t\tif(directed) reversedNodes[e.target].add(e.source, e.cost);\n\t\t\t\telse nodes[e.target].add(e.source, e.cost);\n\t\t\t}\n\n\t\t\tvoid remove(Edge e) {\n\t\t\t\tedges.remove(e);\n\t\t\t\tnodes[e.source].remove(e.target, e.cost);\n\t\t\t\tif(directed) reversedNodes[e.target].remove(e.source, e.cost);\n\t\t\t\telse nodes[e.target].remove(e.source, e.cost);\n\t\t\t}\n\n\t\t\tvoid update(Edge e, long cost) {\n\t\t\t\tnodes[e.source].update(e.target, cost);\n\t\t\t\tif(directed) reversedNodes[e.target].update(e.source, cost);\n\t\t\t\telse nodes[e.target].update(e.source, cost);\n\t\t\t\te.cost = cost;\n\t\t\t}\n\t\t\tvoid update(int source, int target, long cost) { update(new Edge(source, target, cost), cost); }\n\n\t\t\tvoid clearNodes() {\n\t\t\t\tfor(Node n : nodes) n.clear();\n\t\t\t\tfor(Node n : reversedNodes) n.clear();\n\t\t\t}\n\t\t}\n\n\t\tclass Node extends HashSet {\n\t\t\tint id;\n\n\t\t\tNode(int id) { this.id = id; }\n\t\t\tvoid add(int target, long cost) { add(new Edge(id, target, cost)); }\n\t\t\tvoid remove(int target, long cost) { remove(new Edge(id, target, cost)); }\n\t\t\tvoid update(int target, long cost) { remove(target, cost); add(target, cost); }\n\t\t}\n\n\t\tclass Edge implements Comparable {\n\t\t\tint source;\n\t\t\tint target;\n\t\t\tlong cost;\n\t\t\tEdge(int source, int target, long cost) {\n\t\t\t\tthis.source = source;\n\t\t\t\tthis.target = target;\n\t\t\t\tthis.cost = cost;\n\t\t\t}\n\n\n\t\t\t@Override\n\t\t\tpublic String toString() { return source+\" - \"+cost+\" -> \"+target; }\n\t\t\t@Override\n\t\t\tpublic int hashCode() { return Objects.hash(source, target); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null) return false;\n\t\t\t\tif(this.getClass() != obj.getClass()) return false;\n\t\t\t\tEdge that = (Edge) obj;\n\t\t\t\tif(this.source != that.source) return false;\n\t\t\t\tif(this.target != that.target) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(Edge that) {\n\t\t\t\tint c = Long.compare(this.cost, that.cost);\n\t\t\t\tif(c == 0) c = Integer.compare(this.source, that.source);\n\t\t\t\tif(c == 0) c = Integer.compare(this.target, that.target);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\n\t\t// Pair, Tuple\n\t\tclass Pair, U extends Comparable> implements Comparable> {\n\t\t\tT a;\n\t\t\tU b;\n\t\t\tPair() { }\n\t\t\tPair(T a, U b) {\n\t\t\t\tthis.a = a;\n\t\t\t\tthis.b = b;\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic String toString() { return \"(\"+a.toString()+\", \"+b.toString()+\")\"; }\n\t\t\t@Override\n\t\t\tpublic int hashCode() { return Objects.hash(a, b); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null) return false;\n\t\t\t\tif(this.getClass() != obj.getClass()) return false;\n\t\t\t\tPair that = (Pair) obj;\n\t\t\t\tif(this.a.getClass() != that.a.getClass()) return false;\n\t\t\t\tif(this.b.getClass() != that.b.getClass()) return false;\n\t\t\t\tif(!this.a.equals(that.a)) return false;\n\t\t\t\tif(!this.b.equals(that.b)) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(Pair that) {\n\t\t\t\tint c = (this.a).compareTo(that.a);\n\t\t\t\tif(c == 0) c = (this.b).compareTo(that.b);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass PairII implements Comparable {\n\t\t\tint a; int b;\n\t\t\tPairII() { }\n\t\t\tPairII(int a, int b) { this.a = a; this.b = b; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null) return false;\n\t\t\t\tif(this.getClass() != obj.getClass()) return false;\n\t\t\t\tPairII that = (PairII) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(PairII that) {\n\t\t\t\tint c = Integer.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Integer.compare(this.b, that.b);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass PairIL implements Comparable {\n\t\t\tint a; long b;\n\t\t\tPairIL() { }\n\t\t\tPairIL(int a, long b) { this.a = a; this.b = b; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null) return false;\n\t\t\t\tif(this.getClass() != obj.getClass()) return false;\n\t\t\t\tPairIL that = (PairIL) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(PairIL that) {\n\t\t\t\tint c = Integer.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Long.compare(this.b, that.b);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass PairID implements Comparable {\n\t\t\tint a; double b;\n\t\t\tPairID() { }\n\t\t\tPairID(int a, double b) { this.a = a; this.b = b; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null) return false;\n\t\t\t\tif(this.getClass() != obj.getClass()) return false;\n\t\t\t\tPairID that = (PairID) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(PairID that) {\n\t\t\t\tint c = Integer.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Double.compare(this.b, that.b);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass PairLI implements Comparable {\n\t\t\tlong a; int b;\n\t\t\tPairLI() { }\n\t\t\tPairLI(long a, int b) { this.a = a; this.b = b; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null) return false;\n\t\t\t\tif(this.getClass() != obj.getClass()) return false;\n\t\t\t\tPairLI that = (PairLI) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(PairLI that) {\n\t\t\t\tint c = Long.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Integer.compare(this.b, that.b);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass PairLL implements Comparable {\n\t\t\tlong a; long b;\n\t\t\tPairLL() { }\n\t\t\tPairLL(long a, long b) { this.a = a; this.b = b; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null) return false;\n\t\t\t\tif(this.getClass() != obj.getClass()) return false;\n\t\t\t\tPairLL that = (PairLL) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(PairLL that) {\n\t\t\t\tint c = Long.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Long.compare(this.b, that.b);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass PairLD implements Comparable {\n\t\t\tlong a; double b;\n\t\t\tPairLD() { }\n\t\t\tPairLD(long a, double b) { this.a = a; this.b = b; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null) return false;\n\t\t\t\tif(this.getClass() != obj.getClass()) return false;\n\t\t\t\tPairLD that = (PairLD) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(PairLD that) {\n\t\t\t\tint c = Long.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Double.compare(this.b, that.b);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass PairDI implements Comparable {\n\t\t\tdouble a; int b;\n\t\t\tPairDI() { }\n\t\t\tPairDI(double a, int b) { this.a = a; this.b = b; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null) return false;\n\t\t\t\tif(this.getClass() != obj.getClass()) return false;\n\t\t\t\tPairDI that = (PairDI) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(PairDI that) {\n\t\t\t\tint c = Double.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Integer.compare(this.b, that.b);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass PairDL implements Comparable {\n\t\t\tdouble a; long b;\n\t\t\tPairDL() { }\n\t\t\tPairDL(double a, long b) { this.a = a; this.b = b; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null) return false;\n\t\t\t\tif(this.getClass() != obj.getClass()) return false;\n\t\t\t\tPairDL that = (PairDL) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(PairDL that) {\n\t\t\t\tint c = Double.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Long.compare(this.b, that.b);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass PairDD implements Comparable {\n\t\t\tdouble a; double b;\n\t\t\tPairDD() { }\n\t\t\tPairDD(double a, double b) { this.a = a; this.b = b; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null) return false;\n\t\t\t\tif(this.getClass() != obj.getClass()) return false;\n\t\t\t\tPairDD that = (PairDD) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(PairDD that) {\n\t\t\t\tint c = Double.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Double.compare(this.b, that.b);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\n\t\tinterface ITuple {\n\t\t\tpublic StringBuilder toStringBuilder();\n\t\t\t@Override\n\t\t\tpublic String toString();\n\t\t\t@Override\n\t\t\tpublic int hashCode();\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj);\n\t\t}\n\t\tclass BasicTuple, V extends Comparable> implements Comparable {\n\t\t\tT t;\n\t\t\tV a;\n\t\t\tBasicTuple() { }\n\n\t\t\tStringBuilder sbTuple = new StringBuilder();\n\t\t\tpublic StringBuilder toStringBuilder() {\n\t\t\t\tsbTuple.setLength(0);\n\t\t\t\treturn sbTuple.append(t.toStringBuilder()).append(\", \").append(a);\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic String toString() { return \"(\"+toStringBuilder().toString()+\")\"; }\n\t\t\t@Override\n\t\t\tpublic int hashCode() { return Objects.hash(t, a); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null) return false;\n\t\t\t\tif(this.getClass() != obj.getClass()) return false;\n\t\t\t\tBasicTuple that = (BasicTuple) obj;\n\t\t\t\tif(this.t.getClass() != that.t.getClass()) return false;\n\t\t\t\tif(this.a.getClass() != that.a.getClass()) return false;\n\t\t\t\tif(!this.t.equals(that.t)) return false;\n\t\t\t\tif(!this.a.equals(that.a)) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\t@SuppressWarnings(\"unchecked\")\n\t\t\tpublic int compareTo(BasicTuple that) {\n\t\t\t\tint c = (this.t).compareTo((T) (Object) that.t);\n\t\t\t\tif(c == 0) c = (this.a).compareTo((V) (Object) that.a);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass UniqueTuple> implements ITuple, Comparable {\n\t\t\tV a;\n\t\t\tUniqueTuple() { }\n\n\t\t\tStringBuilder sbTuple = new StringBuilder();\n\t\t\tpublic StringBuilder toStringBuilder() {\n\t\t\t\tsbTuple.setLength(0);\n\t\t\t\treturn sbTuple.append(a);\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic String toString() { return \"(\"+toStringBuilder().toString()+\")\"; }\n\t\t\t@Override\n\t\t\tpublic int hashCode() { return Objects.hash(a); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null) return false;\n\t\t\t\tif(this.getClass() != obj.getClass()) return false;\n\t\t\t\tUniqueTuple that = (UniqueTuple) obj;\n\t\t\t\tif(this.a.getClass() != that.a.getClass()) return false;\n\t\t\t\tif(!this.a.equals(that.a)) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\t@SuppressWarnings(\"unchecked\")\n\t\t\tpublic int compareTo(UniqueTuple that) {\n\t\t\t\treturn (this.a).compareTo((V) (Object) that.a);\n\t\t\t}\n\t\t}\n\n\t\tclass Tuple1> extends UniqueTuple implements ITuple {\n\t\t\tTuple1() { super(); }\n\t\t\tTuple1(T0 a0) {\n\t\t\t\tsuper();\n\t\t\t\tthis.a = a0;\n\t\t\t}\n\t\t\tT0 get0() { return a; }\n\t\t\tvoid set0(T0 x) { a = x; }\n\t\t}\n\t\tclass Tuple2<\n\t\t\t\tT0 extends Comparable,\n\t\t\t\tT1 extends Comparable>\n\t\t\t\textends BasicTuple, T1> implements ITuple {\n\t\t\tTuple2() { super(); }\n\t\t\t@SuppressWarnings(\"unchecked\")\n\t\t\tTuple2(T0 a0, T1 a1) {\n\t\t\t\tsuper();\n\t\t\t\tthis.t = new Tuple1(a0);\n\t\t\t\tthis.a = a1;\n\t\t\t}\n\t\t\tT0 get0() { return t.get0(); }\n\t\t\tT1 get1() { return a; }\n\t\t\tvoid set0(T0 x) { t.set0(x); }\n\t\t\tvoid set1(T1 x) { a = x; }\n\t\t}\n\t\tclass Tuple3<\n\t\t\t\tT0 extends Comparable,\n\t\t\t\tT1 extends Comparable,\n\t\t\t\tT2 extends Comparable>\n\t\t\t\textends BasicTuple, T2> implements ITuple {\n\t\t\tTuple3() { super(); }\n\t\t\t@SuppressWarnings(\"unchecked\")\n\t\t\tTuple3(T0 a0, T1 a1, T2 a2) {\n\t\t\t\tsuper();\n\t\t\t\tthis.t = new Tuple2(a0, a1);\n\t\t\t\tthis.a = a2;\n\t\t\t}\n\t\t\tT0 get0() { return t.get0(); }\n\t\t\tT1 get1() { return t.get1(); }\n\t\t\tT2 get2() { return a; }\n\t\t\tvoid set0(T0 x) { t.set0(x); }\n\t\t\tvoid set1(T1 x) { t.set1(x); }\n\t\t\tvoid set2(T2 x) { a = x; }\n\t\t}\n\t\tclass Tuple4<\n\t\t\t\tT0 extends Comparable,\n\t\t\t\tT1 extends Comparable,\n\t\t\t\tT2 extends Comparable,\n\t\t\t\tT3 extends Comparable>\n\t\t\t\textends BasicTuple, T3> implements ITuple {\n\t\t\tTuple4() { super(); }\n\t\t\t@SuppressWarnings(\"unchecked\")\n\t\t\tTuple4(T0 a0, T1 a1, T2 a2, T3 a3) {\n\t\t\t\tsuper();\n\t\t\t\tthis.t = new Tuple3(a0, a1, a2);\n\t\t\t\tthis.a = a3;\n\t\t\t}\n\t\t\tT0 get0() { return t.get0(); }\n\t\t\tT1 get1() { return t.get1(); }\n\t\t\tT2 get2() { return t.get2(); }\n\t\t\tT3 get3() { return a; }\n\t\t\tvoid set0(T0 x) { t.set0(x); }\n\t\t\tvoid set1(T1 x) { t.set1(x); }\n\t\t\tvoid set2(T2 x) { t.set2(x); }\n\t\t\tvoid set3(T3 x) { a = x; }\n\t\t}\n\t\tclass Tuple5<\n\t\t\t\tT0 extends Comparable,\n\t\t\t\tT1 extends Comparable,\n\t\t\t\tT2 extends Comparable,\n\t\t\t\tT3 extends Comparable,\n\t\t\t\tT4 extends Comparable>\n\t\t\t\textends BasicTuple, T4> implements ITuple {\n\t\t\tTuple5() { super(); }\n\t\t\t@SuppressWarnings(\"unchecked\")\n\t\t\tTuple5(T0 a0, T1 a1, T2 a2, T3 a3, T4 a4) {\n\t\t\t\tsuper();\n\t\t\t\tthis.t = new Tuple4(a0, a1, a2, a3);\n\t\t\t\tthis.a = a4;\n\t\t\t}\n\t\t\tT0 get0() { return t.get0(); }\n\t\t\tT1 get1() { return t.get1(); }\n\t\t\tT2 get2() { return t.get2(); }\n\t\t\tT3 get3() { return t.get3(); }\n\t\t\tT4 get4() { return a; }\n\t\t\tvoid set0(T0 x) { t.set0(x); }\n\t\t\tvoid set1(T1 x) { t.set1(x); }\n\t\t\tvoid set2(T2 x) { t.set2(x); }\n\t\t\tvoid set3(T3 x) { t.set3(x); }\n\t\t\tvoid set4(T4 x) { a = x; }\n\t\t}\n\t\tclass Tuple6<\n\t\t\t\tT0 extends Comparable,\n\t\t\t\tT1 extends Comparable,\n\t\t\t\tT2 extends Comparable,\n\t\t\t\tT3 extends Comparable,\n\t\t\t\tT4 extends Comparable,\n\t\t\t\tT5 extends Comparable>\n\t\t\t\textends BasicTuple, T5> implements ITuple {\n\t\t\tTuple6() { super(); }\n\t\t\t@SuppressWarnings(\"unchecked\")\n\t\t\tTuple6(T0 a0, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) {\n\t\t\t\tsuper();\n\t\t\t\tthis.t = new Tuple5(a0, a1, a2, a3, a4);\n\t\t\t\tthis.a = a5;\n\t\t\t}\n\t\t\tT0 get0() { return t.get0(); }\n\t\t\tT1 get1() { return t.get1(); }\n\t\t\tT2 get2() { return t.get2(); }\n\t\t\tT3 get3() { return t.get3(); }\n\t\t\tT4 get4() { return t.get4(); }\n\t\t\tT5 get5() { return a; }\n\t\t\tvoid set0(T0 x) { t.set0(x); }\n\t\t\tvoid set1(T1 x) { t.set1(x); }\n\t\t\tvoid set2(T2 x) { t.set2(x); }\n\t\t\tvoid set3(T3 x) { t.set3(x); }\n\t\t\tvoid set4(T4 x) { t.set4(x); }\n\t\t\tvoid set5(T5 x) { a = x; }\n\t\t}\n\t\tclass Tuple7<\n\t\t\t\tT0 extends Comparable,\n\t\t\t\tT1 extends Comparable,\n\t\t\t\tT2 extends Comparable,\n\t\t\t\tT3 extends Comparable,\n\t\t\t\tT4 extends Comparable,\n\t\t\t\tT5 extends Comparable,\n\t\t\t\tT6 extends Comparable>\n\t\t\t\textends BasicTuple, T6> implements ITuple {\n\t\t\tTuple7() { super(); }\n\t\t\t@SuppressWarnings(\"unchecked\")\n\t\t\tTuple7(T0 a0, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) {\n\t\t\t\tsuper();\n\t\t\t\tthis.t = new Tuple6(a0, a1, a2, a3, a4, a5);\n\t\t\t\tthis.a = a6;\n\t\t\t}\n\t\t\tT0 get0() { return t.get0(); }\n\t\t\tT1 get1() { return t.get1(); }\n\t\t\tT2 get2() { return t.get2(); }\n\t\t\tT3 get3() { return t.get3(); }\n\t\t\tT4 get4() { return t.get4(); }\n\t\t\tT5 get5() { return t.get5(); }\n\t\t\tT6 get6() { return a; }\n\t\t\tvoid set0(T0 x) { t.set0(x); }\n\t\t\tvoid set1(T1 x) { t.set1(x); }\n\t\t\tvoid set2(T2 x) { t.set2(x); }\n\t\t\tvoid set3(T3 x) { t.set3(x); }\n\t\t\tvoid set4(T4 x) { t.set4(x); }\n\t\t\tvoid set5(T5 x) { t.set5(x); }\n\t\t\tvoid set6(T6 x) { a = x; }\n\t\t}\n\t\tclass Tuple8<\n\t\t\t\tT0 extends Comparable,\n\t\t\t\tT1 extends Comparable,\n\t\t\t\tT2 extends Comparable,\n\t\t\t\tT3 extends Comparable,\n\t\t\t\tT4 extends Comparable,\n\t\t\t\tT5 extends Comparable,\n\t\t\t\tT6 extends Comparable,\n\t\t\t\tT7 extends Comparable>\n\t\t\t\textends BasicTuple, T7> implements ITuple {\n\t\t\tTuple8() { super(); }\n\t\t\t@SuppressWarnings(\"unchecked\")\n\t\t\tTuple8(T0 a0, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) {\n\t\t\t\tsuper();\n\t\t\t\tthis.t = new Tuple7(a0, a1, a2, a3, a4, a5, a6);\n\t\t\t\tthis.a = a7;\n\t\t\t}\n\t\t\tT0 get0() { return t.get0(); }\n\t\t\tT1 get1() { return t.get1(); }\n\t\t\tT2 get2() { return t.get2(); }\n\t\t\tT3 get3() { return t.get3(); }\n\t\t\tT4 get4() { return t.get4(); }\n\t\t\tT5 get5() { return t.get5(); }\n\t\t\tT6 get6() { return t.get6(); }\n\t\t\tT7 get7() { return a; }\n\t\t\tvoid set0(T0 x) { t.set0(x); }\n\t\t\tvoid set1(T1 x) { t.set1(x); }\n\t\t\tvoid set2(T2 x) { t.set2(x); }\n\t\t\tvoid set3(T3 x) { t.set3(x); }\n\t\t\tvoid set4(T4 x) { t.set4(x); }\n\t\t\tvoid set5(T5 x) { t.set5(x); }\n\t\t\tvoid set6(T6 x) { t.set6(x); }\n\t\t\tvoid set7(T7 x) { a = x; }\n\t\t}\n\n\t\tclass TupleIII implements Comparable {\n\t\t\tint a; int b; int c;\n\t\t\tTupleIII() { }\n\t\t\tTupleIII(int a, int b, int c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleIII that = (TupleIII) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleIII that) {\n\t\t\t\tint c = Integer.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Integer.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Integer.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleIIL implements Comparable {\n\t\t\tint a; int b; long c;\n\t\t\tTupleIIL() { }\n\t\t\tTupleIIL(int a, int b, long c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleIIL that = (TupleIIL) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleIIL that) {\n\t\t\t\tint c = Integer.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Integer.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Long.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleIID implements Comparable {\n\t\t\tint a; int b; double c;\n\t\t\tTupleIID() { }\n\t\t\tTupleIID(int a, int b, double c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleIID that = (TupleIID) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleIID that) {\n\t\t\t\tint c = Integer.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Integer.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Double.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleILI implements Comparable {\n\t\t\tint a; long b; int c;\n\t\t\tTupleILI() { }\n\t\t\tTupleILI(int a, long b, int c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleILI that = (TupleILI) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleILI that) {\n\t\t\t\tint c = Integer.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Long.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Integer.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleILL implements Comparable {\n\t\t\tint a; long b; long c;\n\t\t\tTupleILL() { }\n\t\t\tTupleILL(int a, long b, long c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleILL that = (TupleILL) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleILL that) {\n\t\t\t\tint c = Integer.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Long.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Long.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleILD implements Comparable {\n\t\t\tint a; long b; double c;\n\t\t\tTupleILD() { }\n\t\t\tTupleILD(int a, long b, double c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleILD that = (TupleILD) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleILD that) {\n\t\t\t\tint c = Integer.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Long.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Double.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleIDI implements Comparable {\n\t\t\tint a; double b; int c;\n\t\t\tTupleIDI() { }\n\t\t\tTupleIDI(int a, double b, int c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleIDI that = (TupleIDI) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleIDI that) {\n\t\t\t\tint c = Integer.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Double.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Integer.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleIDL implements Comparable {\n\t\t\tint a; double b; long c;\n\t\t\tTupleIDL() { }\n\t\t\tTupleIDL(int a, double b, long c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleIDL that = (TupleIDL) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleIDL that) {\n\t\t\t\tint c = Integer.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Double.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Long.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleIDD implements Comparable {\n\t\t\tint a; double b; double c;\n\t\t\tTupleIDD() { }\n\t\t\tTupleIDD(int a, double b, double c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleIDD that = (TupleIDD) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleIDD that) {\n\t\t\t\tint c = Integer.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Double.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Double.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleLII implements Comparable {\n\t\t\tlong a; int b; int c;\n\t\t\tTupleLII() { }\n\t\t\tTupleLII(long a, int b, int c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleLII that = (TupleLII) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleLII that) {\n\t\t\t\tint c = Long.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Integer.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Integer.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleLIL implements Comparable {\n\t\t\tlong a; int b; long c;\n\t\t\tTupleLIL() { }\n\t\t\tTupleLIL(long a, int b, long c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleLIL that = (TupleLIL) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleLIL that) {\n\t\t\t\tint c = Long.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Integer.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Long.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleLID implements Comparable {\n\t\t\tlong a; int b; double c;\n\t\t\tTupleLID() { }\n\t\t\tTupleLID(long a, int b, double c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleLID that = (TupleLID) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleLID that) {\n\t\t\t\tint c = Long.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Integer.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Double.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleLLI implements Comparable {\n\t\t\tlong a; long b; int c;\n\t\t\tTupleLLI() { }\n\t\t\tTupleLLI(long a, long b, int c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleLLI that = (TupleLLI) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleLLI that) {\n\t\t\t\tint c = Long.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Long.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Integer.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleLLL implements Comparable {\n\t\t\tlong a; long b; long c;\n\t\t\tTupleLLL() { }\n\t\t\tTupleLLL(long a, long b, long c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleLLL that = (TupleLLL) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleLLL that) {\n\t\t\t\tint c = Long.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Long.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Long.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleLLD implements Comparable {\n\t\t\tlong a; long b; double c;\n\t\t\tTupleLLD() { }\n\t\t\tTupleLLD(long a, long b, double c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleLLD that = (TupleLLD) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleLLD that) {\n\t\t\t\tint c = Long.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Long.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Double.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleLDI implements Comparable {\n\t\t\tlong a; double b; int c;\n\t\t\tTupleLDI() { }\n\t\t\tTupleLDI(long a, double b, int c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleLDI that = (TupleLDI) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleLDI that) {\n\t\t\t\tint c = Long.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Double.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Integer.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleLDL implements Comparable {\n\t\t\tlong a; double b; long c;\n\t\t\tTupleLDL() { }\n\t\t\tTupleLDL(long a, double b, long c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleLDL that = (TupleLDL) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleLDL that) {\n\t\t\t\tint c = Long.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Double.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Long.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleLDD implements Comparable {\n\t\t\tlong a; double b; double c;\n\t\t\tTupleLDD() { }\n\t\t\tTupleLDD(long a, double b, double c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleLDD that = (TupleLDD) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleLDD that) {\n\t\t\t\tint c = Long.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Double.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Double.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleDII implements Comparable {\n\t\t\tdouble a; int b; int c;\n\t\t\tTupleDII() { }\n\t\t\tTupleDII(double a, int b, int c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleDII that = (TupleDII) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleDII that) {\n\t\t\t\tint c = Double.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Integer.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Integer.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleDIL implements Comparable {\n\t\t\tdouble a; int b; long c;\n\t\t\tTupleDIL() { }\n\t\t\tTupleDIL(double a, int b, long c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleDIL that = (TupleDIL) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleDIL that) {\n\t\t\t\tint c = Double.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Integer.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Long.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleDID implements Comparable {\n\t\t\tdouble a; int b; double c;\n\t\t\tTupleDID() { }\n\t\t\tTupleDID(double a, int b, double c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleDID that = (TupleDID) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleDID that) {\n\t\t\t\tint c = Double.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Integer.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Double.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleDLI implements Comparable {\n\t\t\tdouble a; long b; int c;\n\t\t\tTupleDLI() { }\n\t\t\tTupleDLI(double a, long b, int c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleDLI that = (TupleDLI) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleDLI that) {\n\t\t\t\tint c = Double.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Long.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Integer.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleDLL implements Comparable {\n\t\t\tdouble a; long b; long c;\n\t\t\tTupleDLL() { }\n\t\t\tTupleDLL(double a, long b, long c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleDLL that = (TupleDLL) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleDLL that) {\n\t\t\t\tint c = Double.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Long.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Long.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleDLD implements Comparable {\n\t\t\tdouble a; long b; double c;\n\t\t\tTupleDLD() { }\n\t\t\tTupleDLD(double a, long b, double c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleDLD that = (TupleDLD) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleDLD that) {\n\t\t\t\tint c = Double.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Long.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Double.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleDDI implements Comparable {\n\t\t\tdouble a; double b; int c;\n\t\t\tTupleDDI() { }\n\t\t\tTupleDDI(double a, double b, int c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleDDI that = (TupleDDI) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleDDI that) {\n\t\t\t\tint c = Double.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Double.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Integer.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleDDL implements Comparable {\n\t\t\tdouble a; double b; long c;\n\t\t\tTupleDDL() { }\n\t\t\tTupleDDL(double a, double b, long c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleDDL that = (TupleDDL) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleDDL that) {\n\t\t\t\tint c = Double.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Double.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Long.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleDDD implements Comparable {\n\t\t\tdouble a; double b; double c;\n\t\t\tTupleDDD() { }\n\t\t\tTupleDDD(double a, double b, double c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleDDD that = (TupleDDD) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleDDD that) {\n\t\t\t\tint c = Double.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Double.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Double.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\npublic void solve() {\n\tint h = ni();\n\tint w = ni();\n\tint num = ni();\n\tPairII p[] = new PairII[num];\n\tfor(int i = 0; i < num; i ++) {\n\t\tp[i] = new PairII(ni() - 1, ni() - 1);\n\t}\n\tSet hs = new HashSet<>();\n\tfor(int i = 0; i < num; i ++) {\n\t\ths.add(p[i]);\n\t}\n\tint cntH[] = new int[h];\n\tint cntW[] = new int[w];\n\tfor(int i = 0; i < num; i ++) {\n\t\tcntH[p[i].a] ++;\n\t\tcntW[p[i].b] ++;\n\t}\n\tlong maxH = max(cntH);\n\tList indexH = new ArrayList<>();\n\tfor(int i = 0; i < h; i ++) {\n\t\tif(maxH == cntH[i]) indexH.add(i);\n\t}\n\tlong maxW = max(cntW);\n\tList indexW = new ArrayList<>();\n\tfor(int i = 0; i < w; i ++) {\n\t\tif(maxW == cntW[i]) indexW.add(i);\n\t}\n\tfor(int crtH : indexH) {\n\t\tfor(int crtW : indexW) {\n\t\t\tif(!hs.contains(new PairII(crtH, crtW))) exit(maxH + maxW);\n\t\t}\n\t}\n\t\n\tlong max = 0;\n\tfor(int i = 0; i < num; i ++) {\n\t\tmax = max(max, cntH[p[i].a] + cntW[p[i].b] - 1);\n\t}\n\tprtln(max);\n}\n\n\n\t}\n}\n", "language": "Java", "metadata": {"date": 1598124230, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02580.html", "problem_id": "p02580", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02580/input.txt", "sample_output_relpath": "derived/input_output/data/p02580/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02580/Java/s037216496.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s037216496", "user_id": "u137087473"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\nimport java.math.*;\nimport java.util.function.*;\npublic class Main implements Runnable {\n\tstatic boolean DEBUG;\n\tpublic static void main(String[] args) {\n\t\tDEBUG = args.length > 0 && args[0].equals(\"-DEBUG\");\n\t\tThread.setDefaultUncaughtExceptionHandler((t, e) -> { e.printStackTrace(); System.exit(1); });\n\t\tnew Thread(null, new Main(), \"\", 1 << 31).start();\n\t}\n\n\tpublic void run() {\n\t\tSolver solver = new Solver();\n\t\tsolver.solve();\n\t\tsolver.exit();\n\t}\n\n\tstatic class FastScanner {\n\t\tprivate final InputStream in = System.in;\n\t\tprivate final byte[] buffer = new byte[1024];\n\t\tprivate int pointer = 0;\n\t\tprivate int buflen = 0;\n\t\tprivate boolean hasNextByte() {\n\t\t\tif(pointer < buflen) return true;\n\t\t\telse {\n\t\t\t\tpointer = 0;\n\t\t\t\ttry {\n\t\t\t\t\tbuflen = in.read(buffer);\n\t\t\t\t}catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t\treturn buflen > 0;\n\t\t\t}\n\t\t}\n\t\tprivate int readByte() { if(hasNextByte()) return buffer[pointer ++]; else return -1; }\n\t\tprivate boolean isPrintableChar(int c) { return isPrintableChar(c, false); }\n\t\tprivate boolean isPrintableChar(int c, boolean includingSpace) { return (includingSpace ? 32 : 33) <= c && c <= 126; }\n\t\tprivate void skipUnprintable() { skipUnprintable(false); }\n\t\tprivate void skipUnprintable(boolean includingSpace) { while(hasNextByte() && !isPrintableChar(buffer[pointer], includingSpace)) pointer++; }\n\t\tprivate boolean hasNext() { return hasNext(false); }\n\t\tprivate boolean hasNext(boolean includingSpace) { skipUnprintable(includingSpace); return hasNextByte(); }\n\t\tprivate StringBuilder sb = new StringBuilder();\n\t\tpublic String next() { return next(false); }\n\t\tpublic String next(boolean includingSpace) {\n\t\t\tif(!hasNext(includingSpace)) throw new NoSuchElementException();\n\t\t\tsb.setLength(0);\n\t\t\tint b = readByte();\n\t\t\twhile(isPrintableChar(b, includingSpace)) {\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\treturn sb.toString();\n\t\t}\n\t\tpublic long nextLong() {\n\t\t\tif(!hasNext()) throw new NoSuchElementException();\n\t\t\tlong n = 0;\n\t\t\tboolean minus = false;\n\t\t\tint b = readByte();\n\t\t\tif(b == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\tif(b < '0' || '9' < b) throw new NumberFormatException();\n\t\t\twhile(true) {\n\t\t\t\tif('0' <= b && b <= '9') n = n * 10 + b - '0';\n\t\t\t\telse if(b == -1 || !isPrintableChar(b)) return minus ? -n : n;\n\t\t\t\telse throw new NumberFormatException();\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic class Solver {\n\t\tFastScanner sc = new FastScanner();\n\t\tpublic Solver() { }\n\n\t\tString ns() { return ns(false); }\n\t\tString ns(boolean includingSpace) { return sc.next(includingSpace); }\n\t\tString[] ns(int n) { return ns(n, false); }\n\t\tString[] ns(int n, boolean includingSpace) {\n\t\t\tString a[] = new String[n];\n\t\t\tfor(int i = 0; i < n; i ++) a[i] = ns(includingSpace);\n\t\t\treturn a;\n\t\t}\n\t\tString[][] ns(int n, int m) { return ns(n, m, false); }\n\t\tString[][] ns(int n, int m, boolean includingSpace) {\n\t\t\tString a[][] = new String[n][m];\n\t\t\tfor(int i = 0; i < n; i ++) a[i] = ns(m, includingSpace);\n\t\t\treturn a;\n\t\t}\n\t\tchar nc() { return ns().charAt(0); }\n\t\tchar[] nc(int n) {\n\t\t\tString str = ns();\n\t\t\tif(n < 0) n = str.length();\n\t\t\tchar a[] = new char[n];\n\t\t\tfor(int i = 0; i < n; i ++) a[i] = str.charAt(i);\n\t\t\treturn a;\n\t\t}\n\t\tchar[][] nc(int n, int m) {\n\t\t\tchar a[][] = new char[n][m];\n\t\t\tfor(int i = 0; i < n; i ++) a[i] = nc(m);\n\t\t\treturn a;\n\t\t}\n\t\tboolean[] nb(int n, char t) {\n\t\t\tchar c[] = nc(-1);\n\t\t\tif(n < 0) n = c.length;\n\t\t\tboolean a[] = new boolean[n];\n\t\t\tfor(int i = 0; i < n; i ++) a[i] = c[i] == t;\n\t\t\treturn a;\n\t\t}\n\t\tboolean[][] nb(int n, int m, char t) {\n\t\t\tboolean a[][] = new boolean[n][m];\n\t\t\tfor(int i = 0; i < n; i ++) a[i] = nb(m, t);\n\t\t\treturn a;\n\t\t}\n\t\tint ni() { return Math.toIntExact(sc.nextLong()); }\n\t\tint[] ni(int n) {\n\t\t\tint a[] = new int[n];\n\t\t\tfor(int i = 0; i < n; i ++) a[i] = ni();\n\t\t\treturn a;\n\t\t}\n\t\tint[][] ni(int n, int m) {\n\t\t\tint a[][] = new int[n][m];\n\t\t\tfor(int i = 0; i < n; i ++) a[i] = ni(m);\n\t\t\treturn a;\n\t\t}\n\t\tlong nl() { return sc.nextLong(); }\n\t\tlong[] nl(int n) {\n\t\t\tlong a[] = new long[n];\n\t\t\tfor(int i = 0; i < n; i ++) a[i] = nl();\n\t\t\treturn a;\n\t\t}\n\t\tlong[][] nl(int n, int m) {\n\t\t\tlong a[][] = new long[n][m];\n\t\t\tfor(int i = 0; i < n; i ++) a[i] = nl(m);\n\t\t\treturn a;\n\t\t}\n\t\tdouble nd() { return Double.parseDouble(sc.next()); }\n\t\tdouble[] nd(int n) {\n\t\t\tdouble a[] = new double[n];\n\t\t\tfor(int i = 0; i < n; i ++) a[i] = nd();\n\t\t\treturn a;\n\t\t}\n\t\tdouble[][] nd(int n, int m) {\n\t\t\tdouble a[][] = new double[n][m];\n\t\t\tfor(int i = 0; i < n; i ++) a[i] = nd(m);\n\t\t\treturn a;\n\t\t}\n\n\n\t\tString booleanToString(boolean b) { return b ? \"#\" : \".\"; }\n\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tPrintWriter err = new PrintWriter(System.err);\n\t\tStringBuilder sb4prtln = new StringBuilder();\n\t\tvoid prt() { out.print(\"\"); }\n\t\t void prt(T a) { out.print(a); }\n\t\tvoid prtln() { out.println(\"\"); }\n\t\t void prtln(T a) { out.println(a); }\n\t\tvoid prtln(int... a) {\n\t\t\tsb4prtln.setLength(0);\n\t\t\tfor(int element : a) sb4prtln.append(element+\" \");\n\t\t\tprtln(sb4prtln.toString().trim());\n\t\t}\n\t\tvoid prtln(long... a) {\n\t\t\tsb4prtln.setLength(0);\n\t\t\tfor(long element : a) sb4prtln.append(element+\" \");\n\t\t\tprtln(sb4prtln.toString().trim());\n\t\t}\n\t\tvoid prtln(double... a) {\n\t\t\tsb4prtln.setLength(0);\n\t\t\tfor(double element : a) sb4prtln.append(element+\" \");\n\t\t\tprtln(sb4prtln.toString().trim());\n\t\t}\n\t\tvoid prtln(String... a) {\n\t\t\tsb4prtln.setLength(0);\n\t\t\tfor(String element : a) sb4prtln.append(element+\" \");\n\t\t\tprtln(sb4prtln.toString().trim());\n\t\t}\n\t\tvoid prtln(char... a) {\n\t\t\tsb4prtln.setLength(0);\n\t\t\tfor(char element : a) sb4prtln.append(element);\n\t\t\tprtln(sb4prtln.toString());\n\t\t}\n\t\tvoid prtln(boolean... a) {\n\t\t\tsb4prtln.setLength(0);\n\t\t\tfor(boolean element : a) sb4prtln.append(booleanToString(element));\n\t\t\tprtln(sb4prtln.toString());\n\t\t}\n\t\tvoid prtln(int[][] a) { for(int[] element : a) prtln(element); }\n\t\tvoid prtln(long[][] a) { for(long[] element : a) prtln(element); }\n\t\tvoid prtln(double[][] a) { for(double[] element : a) prtln(element); }\n\t\tvoid prtln(String[][] a) { for(String[] element : a) prtln(element); }\n\t\tvoid prtln(char[][] a) { for(char[] element : a) prtln(element); }\n\t\tvoid prtln(boolean[][] a) { for(boolean[] element : a) prtln(element); }\n\n\t\tString errconvert(int a) { return isINF(a) ? \"_\" : String.valueOf(a); }\n\t\tString errconvert(long a) { return isINF(a) ? \"_\" : String.valueOf(a); }\n\t\tvoid errprt(int a) { if(DEBUG) err.print(errconvert(a)); }\n\t\tvoid errprt(long a) { if(DEBUG) err.print(errconvert(a)); }\n\t\tvoid errprt() { if(DEBUG) err.print(\"\"); }\n\t\t void errprt(T a) { if(DEBUG) err.print(a); }\n\t\tvoid errprt(boolean a) { if(DEBUG) errprt(booleanToString(a)); }\n\t\tvoid errprtln() { if(DEBUG) err.println(\"\"); }\n\t\tvoid errprtln(int a) { if(DEBUG) err.println(errconvert(a)); }\n\t\tvoid errprtln(long a) { if(DEBUG) err.println(errconvert(a)); }\n\t\t void errprtln(T a) { if(DEBUG) err.println(a); }\n\t\tvoid errprtln(boolean a) { if(DEBUG) errprtln(booleanToString(a)); }\n\t\tvoid errprtln(int... a) {\n\t\t\tif(DEBUG) {\n\t\t\t\tsb4prtln.setLength(0);\n\t\t\t\tfor(int element : a) sb4prtln.append(errconvert(element)+\" \");\n\t\t\t\terrprtln(sb4prtln.toString().trim());\n\t\t\t}\n\t\t}\n\t\tvoid errprtln(long... a) {\n\t\t\tif(DEBUG) {\n\t\t\t\tsb4prtln.setLength(0);\n\t\t\t\tfor(long element : a) sb4prtln.append(errconvert(element)+\" \");\n\t\t\t\terrprtln(sb4prtln.toString().trim());\n\t\t\t}\n\t\t}\n\t\tvoid errprtln(double... a) {\n\t\t\tif(DEBUG) {\n\t\t\t\tsb4prtln.setLength(0);\n\t\t\t\tfor(double element : a) sb4prtln.append(element+\" \");\n\t\t\t\terrprtln(sb4prtln.toString().trim());\n\t\t\t}\n\t\t}\n\t\tvoid errprtln(String... a) {\n\t\t\tif(DEBUG) {\n\t\t\t\tsb4prtln.setLength(0);\n\t\t\t\tfor(String element : a) sb4prtln.append(element+\" \");\n\t\t\t\terrprtln(sb4prtln.toString().trim());\n\t\t\t}\n\t\t}\n\t\tvoid errprtln(char... a) {\n\t\t\tif(DEBUG) {\n\t\t\t\tsb4prtln.setLength(0);\n\t\t\t\tfor(char element : a) sb4prtln.append(element);\n\t\t\t\terrprtln(sb4prtln.toString());\n\t\t\t}\n\t\t}\n\t\tvoid errprtln(boolean... a) {\n\t\t\tif(DEBUG) {\n\t\t\t\tsb4prtln.setLength(0);\n\t\t\t\tfor(boolean element : a) sb4prtln.append(booleanToString(element));\n\t\t\t\terrprtln(sb4prtln.toString());\n\t\t\t}\n\t\t}\n\t\tvoid errprtln(Object[] a) { if(DEBUG) for(Object element : a) errprtln(element); }\n\t\tvoid errprtln(int[][] a) { if(DEBUG) for(int[] element : a) errprtln(element); }\n\t\tvoid errprtln(long[][] a) { if(DEBUG) for(long[] element : a) errprtln(element); }\n\t\tvoid errprtln(double[][] a) { if(DEBUG) for(double[] element : a) errprtln(element); }\n\t\tvoid errprtln(String[][] a) { if(DEBUG) for(String[] element : a) errprtln(element); }\n\t\tvoid errprtln(char[][] a) { if(DEBUG) for(char[] element : a) errprtln(element); }\n\t\tvoid errprtln(boolean[][] a) { if(DEBUG) for(boolean[] element : a) errprtln(element); }\n\t\tvoid errprtln(Object[][] a) { if(DEBUG) for(Object element : a) { errprtln(element); errprtln(); } }\n\n\t\tvoid reply(boolean b) { prtln(b ? \"Yes\" : \"No\"); }\n\t\tvoid REPLY(boolean b) { prtln(b ? \"YES\" : \"NO\"); }\n\n\t\tvoid flush() { out.flush(); if(DEBUG) err.flush(); }\n\t\tvoid assertion(boolean b) { if(!b) { flush(); throw new AssertionError(); } }\n\n\t\tvoid exit() { flush(); System.exit(0); }\n\t\t void exit(T a) { prtln(a); exit(); }\n\t\tvoid exit(int... a) { prtln(a); exit(); }\n\t\tvoid exit(long... a) { prtln(a); exit(); }\n\t\tvoid exit(double... a) { prtln(a); exit(); }\n\t\tvoid exit(String... a) { prtln(a); exit(); }\n\t\tvoid exit(char... a) { prtln(a); exit(); }\n\t\tvoid exit(boolean... a) { prtln(a); exit(); }\n\t\tvoid exit(int[][] a) { prtln(a); exit(); }\n\t\tvoid exit(long[][] a) { prtln(a); exit(); }\n\t\tvoid exit(double[][] a) { prtln(a); exit(); }\n\t\tvoid exit(String[][] a) { prtln(a); exit(); }\n\t\tvoid exit(char[][] a) { prtln(a); exit(); }\n\t\tvoid exit(boolean[][] a) { prtln(a); exit(); }\n\n\n\t\tfinal long INF = (long)1e18 + 7;\n\t\tboolean isPlusINF(long a) { return a > INF / 10; }\n\t\tboolean isMinusINF(long a) { return isPlusINF(- a); }\n\t\tboolean isINF(long a) { return isPlusINF(a) || isMinusINF(a); }\n\t\tfinal int I_INF = (int)1e9 + 7;\n\t\tboolean isPlusINF(int a) { return a > I_INF / 10; }\n\t\tboolean isMinusINF(int a) { return isPlusINF(- a); }\n\t\tboolean isINF(int a) { return isPlusINF(a) || isMinusINF(a); }\n\n\n\t\tint min(int a, int b) { return Math.min(a, b); }\n\t\tlong min(long a, long b) { return Math.min(a, b); }\n\t\tdouble min(double a, double b) { return Math.min(a, b); }\n\t\t> T min(T a, T b) { return a.compareTo(b) <= 0 ? a : b; }\n\t\tint min(int... x) {\n\t\t\tint min = x[0];\n\t\t\tfor(int val : x) min = min(min, val);\n\t\t\treturn min;\n\t\t}\n\t\tlong min(long... x) {\n\t\t\tlong min = x[0];\n\t\t\tfor(long val : x) min = min(min, val);\n\t\t\treturn min;\n\t\t}\n\t\tdouble min(double... x) {\n\t\t\tdouble min = x[0];\n\t\t\tfor(double val : x) min = min(min, val);\n\t\t\treturn min;\n\t\t}\n\t\tint max(int a, int b) { return Math.max(a, b); }\n\t\tlong max(long a, long b) { return Math.max(a, b); }\n\t\tdouble max(double a, double b) { return Math.max(a, b); }\n\t\t> T max(T a, T b) { return a.compareTo(b) >= 0 ? a : b; }\n\t\tint max(int... x) {\n\t\t\tint max = x[0];\n\t\t\tfor(int val : x) max = max(max, val);\n\t\t\treturn max;\n\t\t}\n\t\tlong max(long... x) {\n\t\t\tlong max = x[0];\n\t\t\tfor(long val : x) max = max(max, val);\n\t\t\treturn max;\n\t\t}\n\t\tdouble max(double... x) {\n\t\t\tdouble max = x[0];\n\t\t\tfor(double val : x) max = max(max, val);\n\t\t\treturn max;\n\t\t}\n\t\tlong sum(int... a) {\n\t\t\tlong sum = 0;\n\t\t\tfor(int element : a) sum += element;\n\t\t\treturn sum;\n\t\t}\n\t\tlong sum(long... a) {\n\t\t\tlong sum = 0;\n\t\t\tfor(long element : a) sum += element;\n\t\t\treturn sum;\n\t\t}\n\t\tdouble sum(double... a) {\n\t\t\tdouble sum = 0;\n\t\t\tfor(double element : a) sum += element;\n\t\t\treturn sum;\n\t\t}\n\t\tlong sum(boolean... a) {\n\t\t\tlong sum = 0;\n\t\t\tfor(boolean element : a) sum += element ? 1 : 0;\n\t\t\treturn sum;\n\t\t}\n\t\tlong[] sums(int[] a) {\n\t\t\tlong sum[] = new long[a.length + 1];\n\t\t\tsum[0] = 0;\n\t\t\tfor(int i = 0; i < a.length; i ++) sum[i + 1] = sum[i] + a[i];\n\t\t\treturn sum;\n\t\t}\n\t\tlong[] sums(long[] a) {\n\t\t\tlong sum[] = new long[a.length + 1];\n\t\t\tsum[0] = 0;\n\t\t\tfor(int i = 0; i < a.length; i ++) sum[i + 1] = sum[i] + a[i];\n\t\t\treturn sum;\n\t\t}\n\t\tdouble[] sums(double[] a) {\n\t\t\tdouble sum[] = new double[a.length + 1];\n\t\t\tsum[0] = 0;\n\t\t\tfor(int i = 0; i < a.length; i ++) sum[i + 1] = sum[i] + a[i];\n\t\t\treturn sum;\n\t\t}\n\t\tlong[] sums(boolean[] a) {\n\t\t\tlong sum[] = new long[a.length + 1];\n\t\t\tsum[0] = 0;\n\t\t\tfor(int i = 0; i < a.length; i ++) sum[i + 1] = sum[i] + (a[i] ? 1 : 0);\n\t\t\treturn sum;\n\t\t}\n\t\tlong[][] sums(int[][] a) {\n\t\t\tlong sum[][] = new long[a.length + 1][a[0].length + 1];\n\t\t\tfill(sum, 0);\n\t\t\tfor(int i = 0; i < a.length; i ++) {\n\t\t\t\tfor(int j = 0; j < a[i].length; j ++) {\n\t\t\t\t\tsum[i + 1][j + 1] = sum[i + 1][j] + sum[i][j + 1] - sum[i][j] + a[i][j];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn sum;\n\t\t}\n\t\tlong[][] sums(long[][] a) {\n\t\t\tlong sum[][] = new long[a.length + 1][a[0].length + 1];\n\t\t\tfill(sum, 0);\n\t\t\tfor(int i = 0; i < a.length; i ++) {\n\t\t\t\tfor(int j = 0; j < a[i].length; j ++) {\n\t\t\t\t\tsum[i + 1][j + 1] = sum[i + 1][j] + sum[i][j + 1] - sum[i][j] + a[i][j];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn sum;\n\t\t}\n\t\tdouble[][] sums(double[][] a) {\n\t\t\tdouble sum[][] = new double[a.length + 1][a[0].length + 1];\n\t\t\tfill(sum, 0);\n\t\t\tfor(int i = 0; i < a.length; i ++) {\n\t\t\t\tfor(int j = 0; j < a[i].length; j ++) {\n\t\t\t\t\tsum[i + 1][j + 1] = sum[i + 1][j] + sum[i][j + 1] - sum[i][j] + a[i][j];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn sum;\n\t\t}\n\t\tlong[][] sums(boolean[][] a) {\n\t\t\tlong sum[][] = new long[a.length + 1][a[0].length + 1];\n\t\t\tfill(sum, 0);\n\t\t\tfor(int i = 0; i < a.length; i ++) {\n\t\t\t\tfor(int j = 0; j < a[i].length; j ++) {\n\t\t\t\t\tsum[i + 1][j + 1] = sum[i + 1][j] + sum[i][j + 1] - sum[i][j] + (a[i][j] ? 1 : 0);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn sum;\n\t\t}\n\t\tint constrain(int x, int l, int r) { return min(max(x, min(l, r)), max(l, r)); }\n\t\tlong constrain(long x, long l, long r) { return min(max(x, min(l, r)), max(l, r)); }\n\t\tdouble constrain(double x, double l, double r) { return min(max(x, min(l, r)), max(l, r)); }\n\t\tint abs(int x) { return x >= 0 ? x : - x; }\n\t\tlong abs(long x) { return x >= 0 ? x : - x; }\n\t\tdouble abs(double x) { return x >= 0 ? x : - x; }\n\t\tint signum(int x) { return x > 0 ? 1 : x < 0 ? -1 : 0; }\n\t\tint signum(long x) { return x > 0 ? 1 : x < 0 ? -1 : 0; }\n\t\tint signum(double x) { return x > 0 ? 1 : x < 0 ? -1 : 0; }\n\t\tlong round(double x) { return Math.round(x); }\n\t\tlong floor(double x) { return (long)Math.floor(x); }\n\t\tint divfloor(int a, int b) { return signum(a) == signum(b) ? a / b : - divceil(abs(a), abs(b)); }\n\t\tlong divfloor(long a, long b) { return signum(a) == signum(b) ? a / b : - divceil(abs(a), abs(b)); }\n\t\tlong ceil(double x) { return (long)Math.ceil(x); }\n\t\tint divceil(int a, int b) { return a >= 0 && b > 0 ? (a + b - 1) / b\n\t\t\t\t\t\t\t\t\t\t\t: a < 0 && b < 0 ? divceil(abs(a), abs(b))\n\t\t\t\t\t\t\t\t\t\t\t: - divfloor(abs(a), abs(b)); }\n\t\tlong divceil(long a, long b) { return a >= 0 && b > 0 ? (a + b - 1) / b\n\t\t\t\t\t\t\t\t\t\t\t: a < 0 && b < 0 ? divceil(abs(a), abs(b))\n\t\t\t\t\t\t\t\t\t\t\t: - divfloor(abs(a), abs(b)); }\n\t\tdouble sqrt(int x) { return Math.sqrt((double)x); }\n\t\tdouble sqrt(long x) { return Math.sqrt((double)x); }\n\t\tdouble sqrt(double x) { return Math.sqrt(x); }\n\t\tlong fact(int n) {\n\t\t\tlong ans = 1;\n\t\t\tfor(int i = 1; i <= n; i ++) ans = Math.multiplyExact(ans, i);\n\t\t\treturn ans;\n\t\t}\n\t\tdouble pow(double x, double y) { return Math.pow(x, y); }\n\t\tlong pow(long x, long y) {\n\t\t\tlong ans = 1;\n\t\t\twhile(true) {\n\t\t\t\tif(y % 2 != 0) ans = Math.multiplyExact(ans, x);\n\t\t\t\ty /= 2;\n\t\t\t\tif(y <= 0) return ans;\n\t\t\t\tx = Math.multiplyExact(x, x);\n\t\t\t}\n\t\t}\n\t\tint gcd(int a, int b) {\n\t\t\twhile(true) {\n\t\t\t\tif(b == 0) return a;\n\t\t\t\tint tmp = a;\n\t\t\t\ta = b;\n\t\t\t\tb = tmp % b;\n\t\t\t}\n\t\t}\n\t\tlong gcd(long a, long b) {\n\t\t\twhile(true) {\n\t\t\t\tif(b == 0) return a;\n\t\t\t\tlong tmp = a;\n\t\t\t\ta = b;\n\t\t\t\tb = tmp % b;\n\t\t\t}\n\t\t}\n\t\tlong lcm(long a, long b) { return a / gcd(a, b) * b; }\n\t\tint gcd(int... a) {\n\t\t\tint gcd = 0;\n\t\t\tfor(int i = 0; i < a.length; i ++) gcd = gcd(gcd, a[i]);\n\t\t\treturn gcd;\n\t\t}\n\t\tlong gcd(long... a) {\n\t\t\tlong gcd = 0;\n\t\t\tfor(int i = 0; i < a.length; i ++) gcd = gcd(gcd, a[i]);\n\t\t\treturn gcd;\n\t\t}\n\t\tdouble random() { return Math.random(); }\n\t\tint random(int max) { return (int)floor(random() * max); }\n\t\tlong random(long max) { return floor(random() * max); }\n\t\tdouble random(double max) { return random() * max; }\n\t\tint random(int min, int max) { return random(max - min) + min; }\n\t\tlong random(long min, long max) { return random(max - min) + min; }\n\t\tdouble random(double min, double max) { return random(max - min) + min; }\n\n\t\tboolean isUpper(char a) { return a >= 'A' && a <= 'Z'; }\n\t\tboolean isLower(char a) { return a >= 'a' && a <= 'z'; }\n\t\tint upperToInt(char a) { return a - 'A'; }\n\t\tint lowerToInt(char a) { return a - 'a'; }\n\t\tint numToInt(char a) { return a - '0'; }\n\t\tint charToInt(char a) { return a >= 'a' ? lowerToInt(a) : a >= 'A' ? upperToInt(a) : numToInt(a); }\n\t\tchar intToUpper(int a) { return (char)(a + 'A'); }\n\t\tchar intToLower(int a) { return (char)(a + 'a'); }\n\t\tchar intToNum(int a) { return (char)(a + '0'); }\n\t\tint[] charToInt(char[] a) {\n\t\t\tint array[] = new int[a.length];\n\t\t\tfor(int i = 0; i < a.length; i ++) array[i] = charToInt(a[i]);\n\t\t\treturn array;\n\t\t}\n\n\t\tlong[] div(long a) {\n\t\t\tList divList = new ArrayList();\n\t\t\tfor(long i = 1; i * i <= a; i ++) {\n\t\t\t\tif(a % i == 0) {\n\t\t\t\t\tdivList.add(i);\n\t\t\t\t\tif(i * i != a) divList.add(a / i);\n\t\t\t\t}\n\t\t\t}\n\t\t\tlong div[] = new long[divList.size()];\n\t\t\tfor(int i = 0; i < divList.size(); i ++) div[i] = divList.get(i);\n\t\t\tArrays.sort(div);\n\t\t\treturn div;\n\t\t}\n\n\t\tlong[][] factor(long a) {\n\t\t\tList factorList = new ArrayList();\n\t\t\tList degreeList = new ArrayList();\n\t\t\tfor(long i = 2; i * i <= a; i ++) {\n\t\t\t\tif(a % i == 0) {\n\t\t\t\t\tlong count = 0;\n\t\t\t\t\twhile(a % i == 0) { a /= i; count ++; }\n\t\t\t\t\tfactorList.add(i);\n\t\t\t\t\tdegreeList.add(count);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(a > 1) { factorList.add(a); degreeList.add(1L); }\n\t\t\tlong factor[][] = new long[factorList.size()][2];\n\t\t\tfor(int i = 0; i < factorList.size(); i ++) {\n\t\t\t\tfactor[i][0] = factorList.get(i);\n\t\t\t\tfactor[i][1] = degreeList.get(i);\n\t\t\t}\n\t\t\tArrays.sort(factor, (sort1, sort2) -> Long.compare(sort1[0], sort2[0]));\n\t\t\treturn factor;\n\t\t}\n\n\t\tboolean isPrime(long x) {\n\t\t\tboolean ok = x > 1;\n\t\t\tfor(long i = 2; i * i <= x; i ++) {\n\t\t\t\tok &= x % i != 0;\n\t\t\t\tif(!ok) return ok;\n\t\t\t}\n\t\t\treturn ok;\n\t\t}\n\t\tboolean[] prime(int num) {\n\t\t\tboolean prime[] = new boolean[num];\n\t\t\tfill(prime, true);\n\t\t\tif(num > 0) prime[0] = false;\n\t\t\tif(num > 1) prime[1] = false;\n\t\t\tfor(int i = 2; i < num; i ++) if(prime[i]) for(int j = 2; i * j < num; j ++) prime[i * j] = false;\n\t\t\treturn prime;\n\t\t}\n\n\t\tlong[][] countElements(long[] a, boolean sort) {\n\t\t\tint len = a.length;\n\t\t\tlong array[] = new long[len];\n\t\t\tfor(int i = 0; i < len; i ++) array[i] = a[i];\n\t\t\tif(sort) Arrays.sort(array);\n\t\t\tList elem = new ArrayList();\n\t\t\tList cnt = new ArrayList();\n\t\t\tlong tmp = 1;\n\t\t\tfor(int i = 1; i <= len; i ++) {\n\t\t\t\tif(i == len || array[i] != array[i - 1]) {\n\t\t\t\t\telem.add(array[i - 1]);\n\t\t\t\t\tcnt.add(tmp);\n\t\t\t\t\ttmp = 1;\n\t\t\t\t}else tmp ++;\n\t\t\t}\n\t\t\tlong counts[][] = new long[elem.size()][2];\n\t\t\tfor(int i = 0; i < elem.size(); i ++) {\n\t\t\t\tcounts[i][0] = elem.get(i);\n\t\t\t\tcounts[i][1] = cnt.get(i);\n\t\t\t}\n\t\t\treturn counts;\n\t\t}\n\t\tlong[][] countElements(String str, boolean sort) {\n\t\t\tint len = str.length();\n\t\t\tchar array[] = str.toCharArray();\n\t\t\tif(sort) Arrays.sort(array);\n\t\t\tList elem = new ArrayList();\n\t\t\tList cnt = new ArrayList();\n\t\t\tlong tmp = 1;\n\t\t\tfor(int i = 1; i <= len; i ++) {\n\t\t\t\tif(i == len || array[i] != array[i - 1]) {\n\t\t\t\t\telem.add((long)array[i - 1]);\n\t\t\t\t\tcnt.add(tmp);\n\t\t\t\t\ttmp = 1;\n\t\t\t\t}else tmp ++;\n\t\t\t}\n\t\t\tlong counts[][] = new long[elem.size()][2];\n\t\t\tfor(int i = 0; i < elem.size(); i ++) {\n\t\t\t\tcounts[i][0] = elem.get(i);\n\t\t\t\tcounts[i][1] = cnt.get(i);\n\t\t\t}\n\t\t\treturn counts;\n\t\t}\n\n\t\tint[] baseConvert(long x, int n, int len) {\n\t\t\tint digit[] = new int[len];\n\t\t\tint i = 0;\n\t\t\tlong tmp = x;\n\t\t\twhile(tmp > 0 && i < len) { digit[i ++] = (int)(tmp % n); tmp /= n; }\n\t\t\treturn digit;\n\t\t}\n\t\tint[] baseConvert(long x, int n) {\n\t\t\tlong tmp = x;\n\t\t\tint len = 0;\n\t\t\twhile(tmp > 0) { tmp /= n; len ++; }\n\t\t\treturn baseConvert(x, n, len);\n\t\t}\n\t\tint[] baseConvert(int x, int n, int len) {\n\t\t\tint digit[] = new int[len];\n\t\t\tint i = 0;\n\t\t\tint tmp = x;\n\t\t\twhile(tmp > 0 && i < len) { digit[i ++] = (int)(tmp % n); tmp /= n; }\n\t\t\treturn digit;\n\t\t}\n\t\tint[] baseConvert(int x, int n) {\n\t\t\tint tmp = x;\n\t\t\tint len = 0;\n\t\t\twhile(tmp > 0) { tmp /= n; len ++; }\n\t\t\treturn baseConvert(x, n, len);\n\t\t}\n\t\tlong[] baseConvert(long x, long n, int len) {\n\t\t\tlong digit[] = new long[len];\n\t\t\tint i = 0;\n\t\t\tlong tmp = x;\n\t\t\twhile(tmp > 0 && i < len) { digit[i ++] = tmp % n; tmp /= n; }\n\t\t\treturn digit;\n\t\t}\n\t\tlong[] baseConvert(long x, long n) {\n\t\t\tlong tmp = x;\n\t\t\tint len = 0;\n\t\t\twhile(tmp > 0) { tmp /= n; len ++; }\n\t\t\treturn baseConvert(x, n, len);\n\t\t}\n\n\t\tint numDigits(long a) { return Long.toString(a).length(); }\n\t\tlong bitFlag(int a) { return 1L << (long)a; }\n\t\tboolean isFlagged(long x, int a) { return (x & bitFlag(a)) != 0; }\n\n\t\tlong countString(String str, String a) { return (str.length() - str.replace(a, \"\").length()) / a.length(); }\n\t\tlong countStringAll(String str, String a) { return str.length() - str.replaceAll(a, \"\").length(); }\n\n\n\t\tString reverse(String str) { return (new StringBuilder(str)).reverse().toString(); }\n\t\tvoid reverse(String[] array) { for(int i = 0; i < array.length / 2; i ++) swap(array, i, array.length - i - 1); }\n\t\tvoid reverse(int[] array) { for(int i = 0; i < array.length / 2; i ++) swap(array, i, array.length - i - 1); }\n\t\tvoid reverse(long[] array) { for(int i = 0; i < array.length / 2; i ++) swap(array, i, array.length - i - 1); }\n\t\tvoid reverse(double[] array) { for(int i = 0; i < array.length / 2; i ++) swap(array, i, array.length - i - 1); }\n\t\tvoid reverse(char[] array) { for(int i = 0; i < array.length / 2; i ++) swap(array, i, array.length - i - 1); }\n\t\tvoid reverse(boolean[] array) { for(int i = 0; i < array.length / 2; i ++) swap(array, i, array.length - i - 1); }\n\t\t void reverse(T[] array) { for(int i = 0; i < array.length / 2; i ++) swap(array, i, array.length - i - 1); }\n\t\tvoid fill(int[] array, int x) { Arrays.fill(array, x); }\n\t\tvoid fill(long[] array, long x) { Arrays.fill(array, x); }\n\t\tvoid fill(double[] array, double x) { Arrays.fill(array, x); }\n\t\tvoid fill(char[] array, char x) { Arrays.fill(array, x); }\n\t\tvoid fill(boolean[] array, boolean x) { Arrays.fill(array, x); }\n\t\tvoid fill(int[][] array, int x) { for(int[] a : array) fill(a, x); }\n\t\tvoid fill(long[][] array, long x) { for(long[] a : array) fill(a, x); }\n\t\tvoid fill(double[][] array, double x) { for(double[] a : array) fill(a, x); }\n\t\tvoid fill(char[][] array, char x) { for(char[] a : array) fill(a, x); }\n\t\tvoid fill(boolean[][] array, boolean x) { for(boolean[] a : array) fill(a, x); }\n\t\tvoid fill(int[][][] array, int x) { for(int[][] a : array) fill(a, x); }\n\t\tvoid fill(long[][][] array, long x) { for(long[][] a : array) fill(a, x); }\n\t\tvoid fill(double[][][] array, double x) { for(double[][] a : array) fill(a, x); }\n\t\tvoid fill(char[][][] array, char x) { for(char[][] a : array) fill(a, x); }\n\t\tvoid fill(boolean[][][] array, boolean x) { for(boolean[][] a : array) fill(a, x); }\n\n\t\tint[] resize(int[] array, int m, int x) {\n\t\t\tint resized[] = new int[m];\n\t\t\tfor(int i = max(0, - x); i < array.length && i + x < m; i ++) resized[i + x] = array[i];\n\t\t\treturn resized;\n\t\t}\n\t\tlong[] resize(long[] array, int m, int x) {\n\t\t\tlong resized[] = new long[m];\n\t\t\tfor(int i = max(0, - x); i < array.length && i + x < m; i ++) resized[i + x] = array[i];\n\t\t\treturn resized;\n\t\t}\n\t\tdouble[] resize(double[] array, int m, int x) {\n\t\t\tdouble resized[] = new double[m];\n\t\t\tfor(int i = max(0, - x); i < array.length && i + x < m; i ++) resized[i + x] = array[i];\n\t\t\treturn resized;\n\t\t}\n\t\tchar[] resize(char[] array, int m, int x) {\n\t\t\tchar resized[] = new char[m];\n\t\t\tfor(int i = max(0, - x); i < array.length && i + x < m; i ++) resized[i + x] = array[i];\n\t\t\treturn resized;\n\t\t}\n\t\tboolean[] resize(boolean[] array, int m, int x) {\n\t\t\tboolean resized[] = new boolean[m];\n\t\t\tfor(int i = max(0, - x); i < array.length && i + x < m; i ++) resized[i + x] = array[i];\n\t\t\treturn resized;\n\t\t}\n\t\tObject[] resize(Object[] array, int m, int x) {\n\t\t\tObject resized[] = new Object[m];\n\t\t\tfor(int i = max(0, - x); i < array.length && i + x < m; i ++) resized[i + x] = array[i];\n\t\t\treturn resized;\n\t\t}\n\n\t\tvoid shuffleArray(int[] array){\n\t\t\tfor(int i = 0; i < array.length; i ++){\n\t\t\t\tint tmp = array[i];\n\t\t\t\tint randomPos = random(i, array.length);\n\t\t\t\tarray[i] = array[randomPos];\n\t\t\t\tarray[randomPos] = tmp;\n\t\t\t}\n\t\t}\n\t\tvoid shuffleArray(long[] array){\n\t\t\tfor(int i = 0; i < array.length; i ++){\n\t\t\t\tlong tmp = array[i];\n\t\t\t\tint randomPos = random(i, array.length);\n\t\t\t\tarray[i] = array[randomPos];\n\t\t\t\tarray[randomPos] = tmp;\n\t\t\t}\n\t\t}\n\t\tvoid shuffleArray(double[] array){\n\t\t\tfor(int i = 0; i < array.length; i ++){\n\t\t\t\tdouble tmp = array[i];\n\t\t\t\tint randomPos = random(i, array.length);\n\t\t\t\tarray[i] = array[randomPos];\n\t\t\t\tarray[randomPos] = tmp;\n\t\t\t}\n\t\t}\n\t\tint[] randomi(int num, int max){\n\t\t\tint array[] = new int[num];\n\t\t\tfor(int i = 0; i < num; i ++) array[i] = random(max);\n\t\t\treturn array;\n\t\t}\n\t\tlong[] randoml(int num, long max){\n\t\t\tlong array[] = new long[num];\n\t\t\tfor(int i = 0; i < num; i ++) array[i] = random(max);\n\t\t\treturn array;\n\t\t}\n\t\tdouble[] randomd(int num, double max){\n\t\t\tdouble array[] = new double[num];\n\t\t\tfor(int i = 0; i < num; i ++) array[i] = random(max);\n\t\t\treturn array;\n\t\t}\n\t\tint[] randomi(int num, int min, int max){\n\t\t\tint array[] = new int[num];\n\t\t\tfor(int i = 0; i < num; i ++) array[i] = random(min, max);\n\t\t\treturn array;\n\t\t}\n\t\tlong[] randoml(int num, long min, long max){\n\t\t\tlong array[] = new long[num];\n\t\t\tfor(int i = 0; i < num; i ++) array[i] = random(min, max);\n\t\t\treturn array;\n\t\t}\n\t\tdouble[] randomd(int num, double min, double max){\n\t\t\tdouble array[] = new double[num];\n\t\t\tfor(int i = 0; i < num; i ++) array[i] = random(min, max);\n\t\t\treturn array;\n\t\t}\n\n\t\tvoid swap(String[] array, int i, int j) {\n\t\t\tString tmp = array[i];\n\t\t\tarray[i] = array[j];\n\t\t\tarray[j] = tmp;\n\t\t}\n\t\tvoid swap(int[] array, int i, int j) {\n\t\t\tint tmp = array[i];\n\t\t\tarray[i] = array[j];\n\t\t\tarray[j] = tmp;\n\t\t}\n\t\tvoid swap(long[] array, int i, int j) {\n\t\t\tlong tmp = array[i];\n\t\t\tarray[i] = array[j];\n\t\t\tarray[j] = tmp;\n\t\t}\n\t\tvoid swap(double[] array, int i, int j) {\n\t\t\tdouble tmp = array[i];\n\t\t\tarray[i] = array[j];\n\t\t\tarray[j] = tmp;\n\t\t}\n\t\tvoid swap(char[] array, int i, int j) {\n\t\t\tchar tmp = array[i];\n\t\t\tarray[i] = array[j];\n\t\t\tarray[j] = tmp;\n\t\t}\n\t\tvoid swap(boolean[] array, int i, int j) {\n\t\t\tboolean tmp = array[i];\n\t\t\tarray[i] = array[j];\n\t\t\tarray[j] = tmp;\n\t\t}\n\t\t void swap(T[] array, int i, int j) {\n\t\t\tT tmp = array[i];\n\t\t\tarray[i] = array[j];\n\t\t\tarray[j] = tmp;\n\t\t}\n\n\t\tint[] compress(int[] a) {\n\t\t\tint num = a.length;\n\t\t\tSet ss = new TreeSet<>();\n\t\t\tfor(int i = 0; i < num; i ++) ss.add(a[i]);\n\t\t\tint compressed[] = new int[ss.size()];\n\t\t\tint j = 0;\n\t\t\tfor(Integer x : ss) compressed[j ++] = x;\n\t\t\tfor(int i = 0; i < num; i ++) a[i] = lowerBound(compressed, a[i]);\n\t\t\treturn compressed;\n\t\t}\n\t\tlong[] compress(long[] a) {\n\t\t\tint num = a.length;\n\t\t\tSet ss = new TreeSet<>();\n\t\t\tfor(int i = 0; i < num; i ++) ss.add(a[i]);\n\t\t\tlong compressed[] = new long[ss.size()];\n\t\t\tint j = 0;\n\t\t\tfor(Long x : ss) compressed[j ++] = x;\n\t\t\tfor(int i = 0; i < num; i ++) a[i] = lowerBound(compressed, a[i]);\n\t\t\treturn compressed;\n\t\t}\n\t\tdouble[] compress(double[] a) {\n\t\t\tint num = a.length;\n\t\t\tSet ss = new TreeSet<>();\n\t\t\tfor(int i = 0; i < num; i ++) ss.add(a[i]);\n\t\t\tdouble compressed[] = new double[ss.size()];\n\t\t\tint j = 0;\n\t\t\tfor(Double x : ss) compressed[j ++] = x;\n\t\t\tfor(int i = 0; i < num; i ++) a[i] = lowerBound(compressed, a[i]);\n\t\t\treturn compressed;\n\t\t}\n\n\n\t\tint lowerBound(int[] array, int key) {\n\t\t\treturn BS(array, key, true, true, true);\n\t\t}\n\t\tint lowerBound(int[] array, int key, int ng, int ok) {\n\t\t\treturn BS(array, key, true, true, true, ng, ok);\n\t\t}\n\t\tint upperBound(int[] array, int key) {\n\t\t\treturn BS(array, key, true, true, false);\n\t\t}\n\t\tint upperBound(int[] array, int key, int ng, int ok) {\n\t\t\treturn BS(array, key, true, true, false, ng, ok);\n\t\t}\n\t\tint cntBS(int[] array, int key, boolean ascending, boolean greater, boolean equals) {\n\t\t\treturn BS(array, key, ascending, greater, equals, true);\n\t\t}\n\t\tint cntBS(int[] array, int key, boolean ascending, boolean greater, boolean equals, int ng, int ok) {\n\t\t\treturn BS(array, key, ascending, greater, equals, true, ng, ok);\n\t\t}\n\t\tint BS(int[] array, int key, boolean ascending, boolean greater, boolean equals) {\n\t\t\treturn BS(array, key, ascending, greater, equals, false);\n\t\t}\n\t\tint BS(int[] array, int key, boolean ascending, boolean greater, boolean equals, int ng, int ok) {\n\t\t\treturn BS(array, key, ascending, greater, equals, false, ng, ok);\n\t\t}\n\t\tint BS(int[] array, int key, boolean ascending, boolean greater, boolean equals, boolean count) {\n\t\t\tint ng = ascending ^ greater ? array.length : -1;\n\t\t\tint ok = ascending ^ greater ? -1 : array.length;\n\t\t\treturn BS(array, key, ascending, greater, equals, count, ng, ok);\n\t\t}\n\t\tint BS(int[] array, int key, boolean ascending, boolean greater, boolean equals, boolean count, int ng, int ok) {\n\t\t\tint index = binarySearch(array, key, greater, equals, ng, ok);\n\t\t\treturn count ? (int)abs(ok - index) : index;\n\t\t}\n\t\tint binarySearch(int[] array, int key, boolean greater, boolean equals, int ng, int ok) {\n\t\t\twhile (abs(ok - ng) > 1) {\n\t\t\t\tint mid = (ok + ng) / 2;\n\t\t\t\tif(isOKforBinarySearch(array, mid, key, greater, equals)) ok = mid; else ng = mid;\n\t\t\t}\n\t\t\treturn ok;\n\t\t}\n\t\tboolean isOKforBinarySearch(int[] array, int index, int key, boolean greater, boolean equals) {\n\t\t\treturn (array[index] > key && greater) || (array[index] < key && !greater) || (array[index] == key && equals);\n\t\t}\n\t\tint lowerBound(long[] array, long key) {\n\t\t\treturn BS(array, key, true, true, true);\n\t\t}\n\t\tint lowerBound(long[] array, long key, int ng, int ok) {\n\t\t\treturn BS(array, key, true, true, true, ng, ok);\n\t\t}\n\t\tint upperBound(long[] array, long key) {\n\t\t\treturn BS(array, key, true, true, false);\n\t\t}\n\t\tint upperBound(long[] array, long key, int ng, int ok) {\n\t\t\treturn BS(array, key, true, true, false, ng, ok);\n\t\t}\n\t\tint cntBS(long[] array, long key, boolean ascending, boolean greater, boolean equals) {\n\t\t\treturn BS(array, key, ascending, greater, equals, true);\n\t\t}\n\t\tint cntBS(long[] array, long key, boolean ascending, boolean greater, boolean equals, int ng, int ok) {\n\t\t\treturn BS(array, key, ascending, greater, equals, true, ng, ok);\n\t\t}\n\t\tint BS(long[] array, long key, boolean ascending, boolean greater, boolean equals) {\n\t\t\treturn BS(array, key, ascending, greater, equals, false);\n\t\t}\n\t\tint BS(long[] array, long key, boolean ascending, boolean greater, boolean equals, int ng, int ok) {\n\t\t\treturn BS(array, key, ascending, greater, equals, false, ng, ok);\n\t\t}\n\t\tint BS(long[] array, long key, boolean ascending, boolean greater, boolean equals, boolean count) {\n\t\t\tint ng = ascending ^ greater ? array.length : -1;\n\t\t\tint ok = ascending ^ greater ? -1 : array.length;\n\t\t\treturn BS(array, key, ascending, greater, equals, count, ng, ok);\n\t\t}\n\t\tint BS(long[] array, long key, boolean ascending, boolean greater, boolean equals, boolean count, int ng, int ok) {\n\t\t\tint index = binarySearch(array, key, greater, equals, ng, ok);\n\t\t\treturn count ? (int)abs(ok - index) : index;\n\t\t}\n\t\tint binarySearch(long[] array, long key, boolean greater, boolean equals, int ng, int ok) {\n\t\t\twhile (abs(ok - ng) > 1) {\n\t\t\t\tint mid = (ok + ng) / 2;\n\t\t\t\tif(isOKforBinarySearch(array, mid, key, greater, equals)) ok = mid; else ng = mid;\n\t\t\t}\n\t\t\treturn ok;\n\t\t}\n\t\tboolean isOKforBinarySearch(long[] array, int index, long key, boolean greater, boolean equals) {\n\t\t\treturn (array[index] > key && greater) || (array[index] < key && !greater) || (array[index] == key && equals);\n\t\t}\n\t\tint lowerBound(double[] array, double key) {\n\t\t\treturn BS(array, key, true, true, true);\n\t\t}\n\t\tint lowerBound(double[] array, double key, int ng, int ok) {\n\t\t\treturn BS(array, key, true, true, true, ng, ok);\n\t\t}\n\t\tint upperBound(double[] array, double key) {\n\t\t\treturn BS(array, key, true, true, false);\n\t\t}\n\t\tint upperBound(double[] array, double key, int ng, int ok) {\n\t\t\treturn BS(array, key, true, true, false, ng, ok);\n\t\t}\n\t\tint cntBS(double[] array, double key, boolean ascending, boolean greater, boolean equals) {\n\t\t\treturn BS(array, key, ascending, greater, equals, true);\n\t\t}\n\t\tint cntBS(double[] array, double key, boolean ascending, boolean greater, boolean equals, int ng, int ok) {\n\t\t\treturn BS(array, key, ascending, greater, equals, true, ng, ok);\n\t\t}\n\t\tint BS(double[] array, double key, boolean ascending, boolean greater, boolean equals) {\n\t\t\treturn BS(array, key, ascending, greater, equals, false);\n\t\t}\n\t\tint BS(double[] array, double key, boolean ascending, boolean greater, boolean equals, int ng, int ok) {\n\t\t\treturn BS(array, key, ascending, greater, equals, false, ng, ok);\n\t\t}\n\t\tint BS(double[] array, double key, boolean ascending, boolean greater, boolean equals, boolean count) {\n\t\t\tint ng = ascending ^ greater ? array.length : -1;\n\t\t\tint ok = ascending ^ greater ? -1 : array.length;\n\t\t\treturn BS(array, key, ascending, greater, equals, count, ng, ok);\n\t\t}\n\t\tint BS(double[] array, double key, boolean ascending, boolean greater, boolean equals, boolean count, int ng, int ok) {\n\t\t\tint index = binarySearch(array, key, greater, equals, ng, ok);\n\t\t\treturn count ? (int)abs(ok - index) : index;\n\t\t}\n\t\tint binarySearch(double[] array, double key, boolean greater, boolean equals, int ng, int ok) {\n\t\t\twhile (abs(ok - ng) > 1) {\n\t\t\t\tint mid = (ok + ng) / 2;\n\t\t\t\tif(isOKforBinarySearch(array, mid, key, greater, equals)) ok = mid; else ng = mid;\n\t\t\t}\n\t\t\treturn ok;\n\t\t}\n\t\tboolean isOKforBinarySearch(double[] array, int index, double key, boolean greater, boolean equals) {\n\t\t\treturn (array[index] > key && greater) || (array[index] < key && !greater) || (array[index] == key && equals);\n\t\t}\n\t\t> int lowerBound(T[] array, T key) {\n\t\t\treturn BS(array, key, true, true, true);\n\t\t}\n\t\t> int lowerBound(T[] array, T key, int ng, int ok) {\n\t\t\treturn BS(array, key, true, true, true, ng, ok);\n\t\t}\n\t\t> int upperBound(T[] array, T key) {\n\t\t\treturn BS(array, key, true, true, false);\n\t\t}\n\t\t> int upperBound(T[] array, T key, int ng, int ok) {\n\t\t\treturn BS(array, key, true, true, false, ng, ok);\n\t\t}\n\t\t> int cntBS(T[] array, T key, boolean ascending, boolean greater, boolean equals) {\n\t\t\treturn BS(array, key, ascending, greater, equals, true);\n\t\t}\n\t\t> int cntBS(T[] array, T key, boolean ascending, boolean greater, boolean equals, int ng, int ok) {\n\t\t\treturn BS(array, key, ascending, greater, equals, true, ng, ok);\n\t\t}\n\t\t> int BS(T[] array, T key, boolean ascending, boolean greater, boolean equals) {\n\t\t\treturn BS(array, key, ascending, greater, equals, false);\n\t\t}\n\t\t> int BS(T[] array, T key, boolean ascending, boolean greater, boolean equals, int ng, int ok) {\n\t\t\treturn BS(array, key, ascending, greater, equals, false, ng, ok);\n\t\t}\n\t\t> int BS(T[] array, T key, boolean ascending, boolean greater, boolean equals, boolean count) {\n\t\t\tint ng = ascending ^ greater ? array.length : -1;\n\t\t\tint ok = ascending ^ greater ? -1 : array.length;\n\t\t\treturn BS(array, key, ascending, greater, equals, count, ng, ok);\n\t\t}\n\t\t> int BS(T[] array, T key, boolean ascending, boolean greater, boolean equals, boolean count, int ng, int ok) {\n\t\t\tint index = binarySearch(array, key, greater, equals, ng, ok);\n\t\t\treturn count ? (int)abs(ok - index) : index;\n\t\t}\n\t\t> int binarySearch(T[] array, T key, boolean greater, boolean equals, int ng, int ok) {\n\t\t\twhile (abs(ok - ng) > 1) {\n\t\t\t\tint mid = (ok + ng) / 2;\n\t\t\t\tif(isOKforBinarySearch(array, mid, key, greater, equals)) ok = mid; else ng = mid;\n\t\t\t}\n\t\t\treturn ok;\n\t\t}\n\t\t> boolean isOKforBinarySearch(T[] array, int index, T key, boolean greater, boolean equals) {\n\t\t\tint compare = array[index].compareTo(key);\n\t\t\treturn (compare > 0 && greater) || (compare < 0 && !greater) || (compare == 0 && equals);\n\t\t}\n\t\t int lowerBound(T[] array, T key, Comparator c) {\n\t\t\treturn BS(array, key, true, true, true, c);\n\t\t}\n\t\t int lowerBound(T[] array, T key, int ng, int ok, Comparator c) {\n\t\t\treturn BS(array, key, true, true, true, ng, ok, c);\n\t\t}\n\t\t int upperBound(T[] array, T key, Comparator c) {\n\t\t\treturn BS(array, key, true, true, false, c);\n\t\t}\n\t\t int upperBound(T[] array, T key, int ng, int ok, Comparator c) {\n\t\t\treturn BS(array, key, true, true, false, ng, ok, c);\n\t\t}\n\t\t int cntBS(T[] array, T key, boolean ascending, boolean greater, boolean equals, Comparator c) {\n\t\t\treturn BS(array, key, ascending, greater, equals, true, c);\n\t\t}\n\t\t int cntBS(T[] array, T key, boolean ascending, boolean greater, boolean equals, int ng, int ok, Comparator c) {\n\t\t\treturn BS(array, key, ascending, greater, equals, true, ng, ok, c);\n\t\t}\n\t\t int BS(T[] array, T key, boolean ascending, boolean greater, boolean equals, Comparator c) {\n\t\t\treturn BS(array, key, ascending, greater, equals, false, c);\n\t\t}\n\t\t int BS(T[] array, T key, boolean ascending, boolean greater, boolean equals, int ng, int ok, Comparator c) {\n\t\t\treturn BS(array, key, ascending, greater, equals, false, ng, ok, c);\n\t\t}\n\t\t int BS(T[] array, T key, boolean ascending, boolean greater, boolean equals, boolean count, Comparator c) {\n\t\t\tint ng = ascending ^ greater ? array.length : -1;\n\t\t\tint ok = ascending ^ greater ? -1 : array.length;\n\t\t\treturn BS(array, key, ascending, greater, equals, count, ng, ok, c);\n\t\t}\n\t\t int BS(T[] array, T key, boolean ascending, boolean greater, boolean equals, boolean count, int ng, int ok, Comparator c) {\n\t\t\tint index = binarySearch(array, key, greater, equals, ng, ok, c);\n\t\t\treturn count ? (int)abs(ok - index) : index;\n\t\t}\n\t\t int binarySearch(T[] array, T key, boolean greater, boolean equals, int ng, int ok, Comparator c) {\n\t\t\twhile (abs(ok - ng) > 1) {\n\t\t\t\tint mid = (ok + ng) / 2;\n\t\t\t\tif(isOKforBinarySearch(array, mid, key, greater, equals, c)) ok = mid; else ng = mid;\n\t\t\t}\n\t\t\treturn ok;\n\t\t}\n\t\t boolean isOKforBinarySearch(T[] array, int index, T key, boolean greater, boolean equals, Comparator c) {\n\t\t\tint compare = c.compare(array[index], key);\n\t\t\treturn (compare > 0 && greater) || (compare < 0 && !greater) || (compare == 0 && equals);\n\t\t}\n\t\t> int lowerBound(List array, T key) {\n\t\t\treturn BS(array, key, true, true, true);\n\t\t}\n\t\t> int lowerBound(List array, T key, int ng, int ok) {\n\t\t\treturn BS(array, key, true, true, true, ng, ok);\n\t\t}\n\t\t> int upperBound(List array, T key) {\n\t\t\treturn BS(array, key, true, true, false);\n\t\t}\n\t\t> int upperBound(List array, T key, int ng, int ok) {\n\t\t\treturn BS(array, key, true, true, false, ng, ok);\n\t\t}\n\t\t> int cntBS(List array, T key, boolean ascending, boolean greater, boolean equals) {\n\t\t\treturn BS(array, key, ascending, greater, equals, true);\n\t\t}\n\t\t> int cntBS(List array, T key, boolean ascending, boolean greater, boolean equals, int ng, int ok) {\n\t\t\treturn BS(array, key, ascending, greater, equals, true, ng, ok);\n\t\t}\n\t\t> int BS(List array, T key, boolean ascending, boolean greater, boolean equals) {\n\t\t\treturn BS(array, key, ascending, greater, equals, false);\n\t\t}\n\t\t> int BS(List array, T key, boolean ascending, boolean greater, boolean equals, int ng, int ok) {\n\t\t\treturn BS(array, key, ascending, greater, equals, false, ng, ok);\n\t\t}\n\t\t> int BS(List array, T key, boolean ascending, boolean greater, boolean equals, boolean count) {\n\t\t\tint ng = ascending ^ greater ? array.size() : -1;\n\t\t\tint ok = ascending ^ greater ? -1 : array.size();\n\t\t\treturn BS(array, key, ascending, greater, equals, count, ng, ok);\n\t\t}\n\t\t> int BS(List array, T key, boolean ascending, boolean greater, boolean equals, boolean count, int ng, int ok) {\n\t\t\tint index = binarySearch(array, key, greater, equals, ng, ok);\n\t\t\treturn count ? (int)abs(ok - index) : index;\n\t\t}\n\t\t> int binarySearch(List array, T key, boolean greater, boolean equals, int ng, int ok) {\n\t\t\twhile (abs(ok - ng) > 1) {\n\t\t\t\tint mid = (ok + ng) / 2;\n\t\t\t\tif(isOKforBinarySearch(array, mid, key, greater, equals)) ok = mid; else ng = mid;\n\t\t\t}\n\t\t\treturn ok;\n\t\t}\n\t\t> boolean isOKforBinarySearch(List array, int index, T key, boolean greater, boolean equals) {\n\t\t\tint compare = array.get(index).compareTo(key);\n\t\t\treturn (compare > 0 && greater) || (compare < 0 && !greater) || (compare == 0 && equals);\n\t\t}\n\t\t int lowerBound(List array, T key, Comparator c) {\n\t\t\treturn BS(array, key, true, true, true, c);\n\t\t}\n\t\t int lowerBound(List array, T key, int ng, int ok, Comparator c) {\n\t\t\treturn BS(array, key, true, true, true, ng, ok, c);\n\t\t}\n\t\t int upperBound(List array, T key, Comparator c) {\n\t\t\treturn BS(array, key, true, true, false, c);\n\t\t}\n\t\t int upperBound(List array, T key, int ng, int ok, Comparator c) {\n\t\t\treturn BS(array, key, true, true, false, ng, ok, c);\n\t\t}\n\t\t int cntBS(List array, T key, boolean ascending, boolean greater, boolean equals, Comparator c) {\n\t\t\treturn BS(array, key, ascending, greater, equals, true, c);\n\t\t}\n\t\t int cntBS(List array, T key, boolean ascending, boolean greater, boolean equals, int ng, int ok, Comparator c) {\n\t\t\treturn BS(array, key, ascending, greater, equals, true, ng, ok, c);\n\t\t}\n\t\t int BS(List array, T key, boolean ascending, boolean greater, boolean equals, Comparator c) {\n\t\t\treturn BS(array, key, ascending, greater, equals, false, c);\n\t\t}\n\t\t int BS(List array, T key, boolean ascending, boolean greater, boolean equals, int ng, int ok, Comparator c) {\n\t\t\treturn BS(array, key, ascending, greater, equals, false, ng, ok, c);\n\t\t}\n\t\t int BS(List array, T key, boolean ascending, boolean greater, boolean equals, boolean count, Comparator c) {\n\t\t\tint ng = ascending ^ greater ? array.size() : -1;\n\t\t\tint ok = ascending ^ greater ? -1 : array.size();\n\t\t\treturn BS(array, key, ascending, greater, equals, count, ng, ok, c);\n\t\t}\n\t\t int BS(List array, T key, boolean ascending, boolean greater, boolean equals, boolean count, int ng, int ok, Comparator c) {\n\t\t\tint index = binarySearch(array, key, greater, equals, ng, ok, c);\n\t\t\treturn count ? (int)abs(ok - index) : index;\n\t\t}\n\t\t int binarySearch(List array, T key, boolean greater, boolean equals, int ng, int ok, Comparator c) {\n\t\t\twhile (abs(ok - ng) > 1) {\n\t\t\t\tint mid = (ok + ng) / 2;\n\t\t\t\tif(isOKforBinarySearch(array, mid, key, greater, equals, c)) ok = mid; else ng = mid;\n\t\t\t}\n\t\t\treturn ok;\n\t\t}\n\t\t boolean isOKforBinarySearch(List array, int index, T key, boolean greater, boolean equals, Comparator c) {\n\t\t\tint compare = c.compare(array.get(index), key);\n\t\t\treturn (compare > 0 && greater) || (compare < 0 && !greater) || (compare == 0 && equals);\n\t\t}\n\n\t\tPairLL binaryRangeSearch(long left, long right, UnaryOperator op, boolean minimize) {\n\t\t\tlong ok1 = right, ng1 = left;\n\t\t\twhile(abs(ok1 - ng1) > 1) {\n\t\t\t\tlong mid = (ok1 + ng1) / 2;\n\t\t\t\tboolean isOK = (op.apply(mid + 1) - op.apply(mid)) * (minimize ? 1 : -1) >= 0;\n\t\t\t\tif(isOK) ok1 = mid; else ng1 = mid;\n\t\t\t}\n\t\t\tlong ok2 = left, ng2 = right;\n\t\t\twhile(abs(ok2 - ng2) > 1) {\n\t\t\t\tlong mid = (ok2 + ng2) / 2;\n\t\t\t\tboolean isOK = (op.apply(mid - 1) - op.apply(mid)) * (minimize ? 1 : -1) >= 0;\n\t\t\t\tif(isOK) ok2 = mid; else ng2 = mid;\n\t\t\t}\n\t\t\treturn new PairLL(ok1, ok2); //[l, r]\n\t\t}\n\n\t\tdouble ternarySearch(double left, double right, UnaryOperator op, boolean minimize, int loop) {\n\t\t\tfor(int cnt = 0; cnt < loop; cnt ++) {\n\t\t\t\tdouble m1 = (left * 2 + right) / 3.0;\n\t\t\t\tdouble m2 = (left + right * 2) / 3.0;\n\t\t\t\tif(op.apply(m1) > op.apply(m2) ^ minimize) right = m2; else left = m1;\n\t\t\t}\n\t\t\treturn (left + right) / 2.0;\n\t\t}\n\n\n\t\t// mods\n\t\tfinal long MOD = (long)1e9 + 7; // 998244353;\n\t\tlong mod(long i) { i %= MOD; return i + (i < 0 ? MOD : 0); }\n\t\tvoid mod(long[] a) { for(int i = 0; i < a.length; i ++) a[i] = mod(a[i]); }\n\t\tvoid mod(long[][] a) { for(int i = 0; i < a.length; i ++) mod(a[i]); }\n\t\tvoid mod(long[][][] a) { for(int i = 0; i < a.length; i ++) mod(a[i]); }\n\n\t\tlong pow_m(long x, long y) {\n\t\t\tlong ans = 1;\n\t\t\tfor(; y > 0; y /= 2) {\n\t\t\t\tif(y % 2 != 0) ans = mod(ans * x);\n\t\t\t\tx = mod(x * x);\n\t\t\t}\n\t\t\treturn ans;\n\t\t}\n\t\tlong[] pows_m(long x, int max) {\n\t\t\tlong pow[] = new long[max + 1];\n\t\t\tpow[0] = 1;\n\t\t\tfor(int i = 0; i < max; i ++) pow[i + 1] = mod(pow[i] * x);\n\t\t\treturn pow;\n\t\t}\n\t\tlong fact_m(int n) {\n\t\t\tlong ans = 1;\n\t\t\tfor(int i = 1; i <= n; i ++) ans = mod(ans * i);\n\t\t\treturn ans;\n\t\t}\n\n\t\tfinal int MAX_INV_SIZE = 100_100;\n\t\tMap invMap = new HashMap<>();\n\t\tlong inv(long x) {\n\t\t\tx = mod(x);\n\t\t\tif(invMap.containsKey(x)) return invMap.get(x);\n\t\t\tif(invMap.size() >= MAX_INV_SIZE) return calInv(x);\n\t\t\tinvMap.put(x, calInv(x));\n\t\t\treturn invMap.get(x);\n\t\t}\n\t\tlong calInv(long x) { return pow_m(x, MOD - 2); }\n\n\t\tfinal int MAX_FACT = 5_000_100;\n\t\tlong fact[];\n\t\tlong invFact[];\n\t\tboolean isFactPrepared = false;\n\t\tMap factMap;\n\t\tvoid prepareFact() {\n\t\t\tfact = new long[MAX_FACT];\n\t\t\tfill(fact, 0);\n\t\t\tinvFact = new long[MAX_FACT];\n\t\t\tfill(invFact, 0);\n\t\t\tfact[0] = 1;\n\t\t\tint maxIndex = min(MAX_FACT, (int)MOD);\n\t\t\tfor(int i = 1; i < maxIndex; i ++) fact[i] = mod(fact[i - 1] * i);\n\t\t\tinvFact[maxIndex - 1] = inv(fact[maxIndex - 1]);\n\t\t\tfor(int i = maxIndex - 1; i > 0; i --) invFact[i - 1] = mod(invFact[i] * i);\n\n\t\t\tfactMap = new HashMap<>();\n\t\t\tisFactPrepared = true;\n\t\t}\n\n\t\tlong P(int n, int r) {\n\t\t\tif(!isFactPrepared) { prepareFact(); }\n\t\t\tif(n < 0 || r < 0 || n < r) { return 0; }\n\t\t\tif(n >= MAX_FACT) {\n\t\t\t\tif(!factMap.containsKey(n)) {\n\t\t\t\t\tlong largeFact[] = new long[MAX_FACT];\n\t\t\t\t\tfactMap.put(n, largeFact);\n\t\t\t\t\tfill(largeFact, -INF);\n\t\t\t\t\tlargeFact[0] = 1;\n\t\t\t\t}\n\t\t\t\tlong largeFact[] = factMap.get(n);\n\t\t\t\tint i = r;\n\t\t\t\twhile(isINF(largeFact[i])) i --;\n\t\t\t\tfor(; i < r; i ++) largeFact[i + 1] = mod(largeFact[i] * (n - i));\n\t\t\t\treturn largeFact[r];\n\t\t\t}\n\t\t\treturn mod(fact[n] * invFact[n - r]);\n\t\t}\n\t\tlong C(int n, int r) {\n\t\t\tif(!isFactPrepared) prepareFact();\n\t\t\tif(n < 0 || r < 0 || n < r) return 0;\n\t\t\treturn mod(P(n, r) * invFact[r]);\n\t\t}\n\t\tlong H(int n, int r) { return C((n - 1) + r, r); }\n\n\n\t\t// grid\n\t\tclass Grids {\n\t\t\tint h;\n\t\t\tint w;\n\t\t\tGrid[][] gs;\n\t\t\tGrid[] gi;\n\t\t\tGrids(int h, int w) {\n\t\t\t\tthis.h = h;\n\t\t\t\tthis.w = w;\n\t\t\t\tgs = new Grid[h][w];\n\t\t\t\tgi = new Grid[h * w];\n\t\t\t\tfor(int i = 0; i < h; i ++) {\n\t\t\t\t\tfor(int j = 0; j < w; j ++) {\n\t\t\t\t\t\tgs[i][j] = new Grid(i, j, h, w);\n\t\t\t\t\t\tgi[gs[i][j].i] = gs[i][j];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvoid init(boolean[][] b) {\n\t\t\t\tfor(int i = 0; i < h; i ++) for(int j = 0; j < w; j ++) gs[i][j].b = b[i][j];\n\t\t\t}\n\t\t\tvoid init(long[][] val) {\n\t\t\t\tfor(int i = 0; i < h; i ++) for(int j = 0; j < w; j ++) gs[i][j].val = val[i][j];\n\t\t\t}\n\n\t\t\tGrid get(int x, int y) { return isValid(x, y, h, w) ? gs[x][y] : null; }\n\t\t\tGrid get(int i) { return get(i / w, i % w); }\n\n\t\t\tint dx[] = {0, -1, 1, 0, 0, -1, 1, -1, 1};\n\t\t\tint dy[] = {0, 0, 0, -1, 1, -1, -1, 1, 1};\n\t\t\tGrid next(int x, int y, int i) { return next(gs[x][y], i); }\n\t\t\tGrid next(Grid g, int i) {\n\t\t\t\treturn isValid(g.x + dx[i], g.y + dy[i], g.h, g.w)\n\t\t\t\t\t? gs[g.x + dx[i]][g.y + dy[i]]\n\t\t\t\t\t: null;\n\t\t\t}\n\t\t}\n\t\tclass Grid implements Comparable {\n\t\t\tint x;\n\t\t\tint y;\n\t\t\tint h;\n\t\t\tint w;\n\t\t\tint i;\n\t\t\tboolean b;\n\t\t\tlong val;\n\n\t\t\tGrid() { }\n\t\t\tGrid(int x, int y, int h, int w) { init(x, y, h, w, false, 0); }\n\t\t\tGrid(int x, int y, int h, int w, boolean b) { init(x, y, h, w, b, 0); }\n\t\t\tGrid(int x, int y, int h, int w, long val) { init(x, y, h, w, false, val); }\n\t\t\tGrid(int x, int y, int h, int w, boolean b, long val) { init(x, y, h, w, b, val); }\n\n\t\t\tvoid init(int x, int y, int h, int w, boolean b, long val) {\n\t\t\t\tthis.x = x;\n\t\t\t\tthis.y = y;\n\t\t\t\tthis.h = h;\n\t\t\t\tthis.w = w;\n\t\t\t\tthis.b = b;\n\t\t\t\tthis.val = val;\n\t\t\t\tthis.i = x * w + y;\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic String toString() { return \"(\"+x+\", \"+y+\")\"+\" \"+booleanToString(b)+\" \"+val; }\n\t\t\t@Override\n\t\t\tpublic int hashCode() { return Objects.hash(x, y, h, w, b, val); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null) return false;\n\t\t\t\tif(this.getClass() != obj.getClass()) return false;\n\t\t\t\tGrid that = (Grid) obj;\n\t\t\t\tif(this.x != that.x) return false;\n\t\t\t\tif(this.y != that.y) return false;\n\t\t\t\tif(this.h != that.h) return false;\n\t\t\t\tif(this.w != that.w) return false;\n\t\t\t\tif(this.b != that.b) return false;\n\t\t\t\tif(this.val != that.val) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(Grid that) {\n\t\t\t\tint c = Long.compare(this.val, that.val);\n\t\t\t\tif(c == 0) c = Integer.compare(this.x, that.x);\n\t\t\t\tif(c == 0) c = Integer.compare(this.y, that.y);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\n\t\tboolean isValid(int x, int y, int h, int w) { return x >= 0 && x < h && y >= 0 && y < w; }\n\t\tboolean isValid(Grid g) { return isValid(g.x, g.y, g.h, g.w); }\n\n\t\t// graph\n\t\tclass Graph {\n\t\t\tint numNode;\n\t\t\tint numEdge;\n\t\t\tboolean directed;\n\t\t\tSet edges = new HashSet<>();\n\t\t\tNode nodes[];\n\t\t\tNode reversedNodes[];\n\n\t\t\tGraph(int numNode, int numEdge, boolean directed) {\n\t\t\t\tthis.numNode = numNode;\n\t\t\t\tthis.numEdge = numEdge;\n\t\t\t\tthis.directed = directed;\n\t\t\t\tnodes = new Node[numNode];\n\t\t\t\treversedNodes = new Node[numNode];\n\t\t\t\tfor(int i = 0; i < numNode; i ++) {\n\t\t\t\t\tnodes[i] = new Node(i);\n\t\t\t\t\treversedNodes[i] = new Node(i);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvoid init(Set edges) {\n\t\t\t\tthis.edges = edges;\n\t\t\t\tfor(Edge e : edges) add(e);\n\t\t\t}\n\n\t\t\tvoid add(Edge e) {\n\t\t\t\tedges.add(e);\n\t\t\t\tnodes[e.source].add(e.target, e.cost);\n\t\t\t\tif(directed) reversedNodes[e.target].add(e.source, e.cost);\n\t\t\t\telse nodes[e.target].add(e.source, e.cost);\n\t\t\t}\n\n\t\t\tvoid remove(Edge e) {\n\t\t\t\tedges.remove(e);\n\t\t\t\tnodes[e.source].remove(e.target, e.cost);\n\t\t\t\tif(directed) reversedNodes[e.target].remove(e.source, e.cost);\n\t\t\t\telse nodes[e.target].remove(e.source, e.cost);\n\t\t\t}\n\n\t\t\tvoid update(Edge e, long cost) {\n\t\t\t\tnodes[e.source].update(e.target, cost);\n\t\t\t\tif(directed) reversedNodes[e.target].update(e.source, cost);\n\t\t\t\telse nodes[e.target].update(e.source, cost);\n\t\t\t\te.cost = cost;\n\t\t\t}\n\t\t\tvoid update(int source, int target, long cost) { update(new Edge(source, target, cost), cost); }\n\n\t\t\tvoid clearNodes() {\n\t\t\t\tfor(Node n : nodes) n.clear();\n\t\t\t\tfor(Node n : reversedNodes) n.clear();\n\t\t\t}\n\t\t}\n\n\t\tclass Node extends HashSet {\n\t\t\tint id;\n\n\t\t\tNode(int id) { this.id = id; }\n\t\t\tvoid add(int target, long cost) { add(new Edge(id, target, cost)); }\n\t\t\tvoid remove(int target, long cost) { remove(new Edge(id, target, cost)); }\n\t\t\tvoid update(int target, long cost) { remove(target, cost); add(target, cost); }\n\t\t}\n\n\t\tclass Edge implements Comparable {\n\t\t\tint source;\n\t\t\tint target;\n\t\t\tlong cost;\n\t\t\tEdge(int source, int target, long cost) {\n\t\t\t\tthis.source = source;\n\t\t\t\tthis.target = target;\n\t\t\t\tthis.cost = cost;\n\t\t\t}\n\n\n\t\t\t@Override\n\t\t\tpublic String toString() { return source+\" - \"+cost+\" -> \"+target; }\n\t\t\t@Override\n\t\t\tpublic int hashCode() { return Objects.hash(source, target); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null) return false;\n\t\t\t\tif(this.getClass() != obj.getClass()) return false;\n\t\t\t\tEdge that = (Edge) obj;\n\t\t\t\tif(this.source != that.source) return false;\n\t\t\t\tif(this.target != that.target) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(Edge that) {\n\t\t\t\tint c = Long.compare(this.cost, that.cost);\n\t\t\t\tif(c == 0) c = Integer.compare(this.source, that.source);\n\t\t\t\tif(c == 0) c = Integer.compare(this.target, that.target);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\n\t\t// Pair, Tuple\n\t\tclass Pair, U extends Comparable> implements Comparable> {\n\t\t\tT a;\n\t\t\tU b;\n\t\t\tPair() { }\n\t\t\tPair(T a, U b) {\n\t\t\t\tthis.a = a;\n\t\t\t\tthis.b = b;\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic String toString() { return \"(\"+a.toString()+\", \"+b.toString()+\")\"; }\n\t\t\t@Override\n\t\t\tpublic int hashCode() { return Objects.hash(a, b); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null) return false;\n\t\t\t\tif(this.getClass() != obj.getClass()) return false;\n\t\t\t\tPair that = (Pair) obj;\n\t\t\t\tif(this.a.getClass() != that.a.getClass()) return false;\n\t\t\t\tif(this.b.getClass() != that.b.getClass()) return false;\n\t\t\t\tif(!this.a.equals(that.a)) return false;\n\t\t\t\tif(!this.b.equals(that.b)) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(Pair that) {\n\t\t\t\tint c = (this.a).compareTo(that.a);\n\t\t\t\tif(c == 0) c = (this.b).compareTo(that.b);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass PairII implements Comparable {\n\t\t\tint a; int b;\n\t\t\tPairII() { }\n\t\t\tPairII(int a, int b) { this.a = a; this.b = b; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null) return false;\n\t\t\t\tif(this.getClass() != obj.getClass()) return false;\n\t\t\t\tPairII that = (PairII) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(PairII that) {\n\t\t\t\tint c = Integer.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Integer.compare(this.b, that.b);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass PairIL implements Comparable {\n\t\t\tint a; long b;\n\t\t\tPairIL() { }\n\t\t\tPairIL(int a, long b) { this.a = a; this.b = b; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null) return false;\n\t\t\t\tif(this.getClass() != obj.getClass()) return false;\n\t\t\t\tPairIL that = (PairIL) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(PairIL that) {\n\t\t\t\tint c = Integer.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Long.compare(this.b, that.b);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass PairID implements Comparable {\n\t\t\tint a; double b;\n\t\t\tPairID() { }\n\t\t\tPairID(int a, double b) { this.a = a; this.b = b; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null) return false;\n\t\t\t\tif(this.getClass() != obj.getClass()) return false;\n\t\t\t\tPairID that = (PairID) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(PairID that) {\n\t\t\t\tint c = Integer.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Double.compare(this.b, that.b);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass PairLI implements Comparable {\n\t\t\tlong a; int b;\n\t\t\tPairLI() { }\n\t\t\tPairLI(long a, int b) { this.a = a; this.b = b; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null) return false;\n\t\t\t\tif(this.getClass() != obj.getClass()) return false;\n\t\t\t\tPairLI that = (PairLI) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(PairLI that) {\n\t\t\t\tint c = Long.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Integer.compare(this.b, that.b);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass PairLL implements Comparable {\n\t\t\tlong a; long b;\n\t\t\tPairLL() { }\n\t\t\tPairLL(long a, long b) { this.a = a; this.b = b; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null) return false;\n\t\t\t\tif(this.getClass() != obj.getClass()) return false;\n\t\t\t\tPairLL that = (PairLL) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(PairLL that) {\n\t\t\t\tint c = Long.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Long.compare(this.b, that.b);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass PairLD implements Comparable {\n\t\t\tlong a; double b;\n\t\t\tPairLD() { }\n\t\t\tPairLD(long a, double b) { this.a = a; this.b = b; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null) return false;\n\t\t\t\tif(this.getClass() != obj.getClass()) return false;\n\t\t\t\tPairLD that = (PairLD) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(PairLD that) {\n\t\t\t\tint c = Long.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Double.compare(this.b, that.b);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass PairDI implements Comparable {\n\t\t\tdouble a; int b;\n\t\t\tPairDI() { }\n\t\t\tPairDI(double a, int b) { this.a = a; this.b = b; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null) return false;\n\t\t\t\tif(this.getClass() != obj.getClass()) return false;\n\t\t\t\tPairDI that = (PairDI) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(PairDI that) {\n\t\t\t\tint c = Double.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Integer.compare(this.b, that.b);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass PairDL implements Comparable {\n\t\t\tdouble a; long b;\n\t\t\tPairDL() { }\n\t\t\tPairDL(double a, long b) { this.a = a; this.b = b; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null) return false;\n\t\t\t\tif(this.getClass() != obj.getClass()) return false;\n\t\t\t\tPairDL that = (PairDL) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(PairDL that) {\n\t\t\t\tint c = Double.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Long.compare(this.b, that.b);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass PairDD implements Comparable {\n\t\t\tdouble a; double b;\n\t\t\tPairDD() { }\n\t\t\tPairDD(double a, double b) { this.a = a; this.b = b; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null) return false;\n\t\t\t\tif(this.getClass() != obj.getClass()) return false;\n\t\t\t\tPairDD that = (PairDD) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(PairDD that) {\n\t\t\t\tint c = Double.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Double.compare(this.b, that.b);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\n\t\tinterface ITuple {\n\t\t\tpublic StringBuilder toStringBuilder();\n\t\t\t@Override\n\t\t\tpublic String toString();\n\t\t\t@Override\n\t\t\tpublic int hashCode();\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj);\n\t\t}\n\t\tclass BasicTuple, V extends Comparable> implements Comparable {\n\t\t\tT t;\n\t\t\tV a;\n\t\t\tBasicTuple() { }\n\n\t\t\tStringBuilder sbTuple = new StringBuilder();\n\t\t\tpublic StringBuilder toStringBuilder() {\n\t\t\t\tsbTuple.setLength(0);\n\t\t\t\treturn sbTuple.append(t.toStringBuilder()).append(\", \").append(a);\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic String toString() { return \"(\"+toStringBuilder().toString()+\")\"; }\n\t\t\t@Override\n\t\t\tpublic int hashCode() { return Objects.hash(t, a); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null) return false;\n\t\t\t\tif(this.getClass() != obj.getClass()) return false;\n\t\t\t\tBasicTuple that = (BasicTuple) obj;\n\t\t\t\tif(this.t.getClass() != that.t.getClass()) return false;\n\t\t\t\tif(this.a.getClass() != that.a.getClass()) return false;\n\t\t\t\tif(!this.t.equals(that.t)) return false;\n\t\t\t\tif(!this.a.equals(that.a)) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\t@SuppressWarnings(\"unchecked\")\n\t\t\tpublic int compareTo(BasicTuple that) {\n\t\t\t\tint c = (this.t).compareTo((T) (Object) that.t);\n\t\t\t\tif(c == 0) c = (this.a).compareTo((V) (Object) that.a);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass UniqueTuple> implements ITuple, Comparable {\n\t\t\tV a;\n\t\t\tUniqueTuple() { }\n\n\t\t\tStringBuilder sbTuple = new StringBuilder();\n\t\t\tpublic StringBuilder toStringBuilder() {\n\t\t\t\tsbTuple.setLength(0);\n\t\t\t\treturn sbTuple.append(a);\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic String toString() { return \"(\"+toStringBuilder().toString()+\")\"; }\n\t\t\t@Override\n\t\t\tpublic int hashCode() { return Objects.hash(a); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null) return false;\n\t\t\t\tif(this.getClass() != obj.getClass()) return false;\n\t\t\t\tUniqueTuple that = (UniqueTuple) obj;\n\t\t\t\tif(this.a.getClass() != that.a.getClass()) return false;\n\t\t\t\tif(!this.a.equals(that.a)) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\t@SuppressWarnings(\"unchecked\")\n\t\t\tpublic int compareTo(UniqueTuple that) {\n\t\t\t\treturn (this.a).compareTo((V) (Object) that.a);\n\t\t\t}\n\t\t}\n\n\t\tclass Tuple1> extends UniqueTuple implements ITuple {\n\t\t\tTuple1() { super(); }\n\t\t\tTuple1(T0 a0) {\n\t\t\t\tsuper();\n\t\t\t\tthis.a = a0;\n\t\t\t}\n\t\t\tT0 get0() { return a; }\n\t\t\tvoid set0(T0 x) { a = x; }\n\t\t}\n\t\tclass Tuple2<\n\t\t\t\tT0 extends Comparable,\n\t\t\t\tT1 extends Comparable>\n\t\t\t\textends BasicTuple, T1> implements ITuple {\n\t\t\tTuple2() { super(); }\n\t\t\t@SuppressWarnings(\"unchecked\")\n\t\t\tTuple2(T0 a0, T1 a1) {\n\t\t\t\tsuper();\n\t\t\t\tthis.t = new Tuple1(a0);\n\t\t\t\tthis.a = a1;\n\t\t\t}\n\t\t\tT0 get0() { return t.get0(); }\n\t\t\tT1 get1() { return a; }\n\t\t\tvoid set0(T0 x) { t.set0(x); }\n\t\t\tvoid set1(T1 x) { a = x; }\n\t\t}\n\t\tclass Tuple3<\n\t\t\t\tT0 extends Comparable,\n\t\t\t\tT1 extends Comparable,\n\t\t\t\tT2 extends Comparable>\n\t\t\t\textends BasicTuple, T2> implements ITuple {\n\t\t\tTuple3() { super(); }\n\t\t\t@SuppressWarnings(\"unchecked\")\n\t\t\tTuple3(T0 a0, T1 a1, T2 a2) {\n\t\t\t\tsuper();\n\t\t\t\tthis.t = new Tuple2(a0, a1);\n\t\t\t\tthis.a = a2;\n\t\t\t}\n\t\t\tT0 get0() { return t.get0(); }\n\t\t\tT1 get1() { return t.get1(); }\n\t\t\tT2 get2() { return a; }\n\t\t\tvoid set0(T0 x) { t.set0(x); }\n\t\t\tvoid set1(T1 x) { t.set1(x); }\n\t\t\tvoid set2(T2 x) { a = x; }\n\t\t}\n\t\tclass Tuple4<\n\t\t\t\tT0 extends Comparable,\n\t\t\t\tT1 extends Comparable,\n\t\t\t\tT2 extends Comparable,\n\t\t\t\tT3 extends Comparable>\n\t\t\t\textends BasicTuple, T3> implements ITuple {\n\t\t\tTuple4() { super(); }\n\t\t\t@SuppressWarnings(\"unchecked\")\n\t\t\tTuple4(T0 a0, T1 a1, T2 a2, T3 a3) {\n\t\t\t\tsuper();\n\t\t\t\tthis.t = new Tuple3(a0, a1, a2);\n\t\t\t\tthis.a = a3;\n\t\t\t}\n\t\t\tT0 get0() { return t.get0(); }\n\t\t\tT1 get1() { return t.get1(); }\n\t\t\tT2 get2() { return t.get2(); }\n\t\t\tT3 get3() { return a; }\n\t\t\tvoid set0(T0 x) { t.set0(x); }\n\t\t\tvoid set1(T1 x) { t.set1(x); }\n\t\t\tvoid set2(T2 x) { t.set2(x); }\n\t\t\tvoid set3(T3 x) { a = x; }\n\t\t}\n\t\tclass Tuple5<\n\t\t\t\tT0 extends Comparable,\n\t\t\t\tT1 extends Comparable,\n\t\t\t\tT2 extends Comparable,\n\t\t\t\tT3 extends Comparable,\n\t\t\t\tT4 extends Comparable>\n\t\t\t\textends BasicTuple, T4> implements ITuple {\n\t\t\tTuple5() { super(); }\n\t\t\t@SuppressWarnings(\"unchecked\")\n\t\t\tTuple5(T0 a0, T1 a1, T2 a2, T3 a3, T4 a4) {\n\t\t\t\tsuper();\n\t\t\t\tthis.t = new Tuple4(a0, a1, a2, a3);\n\t\t\t\tthis.a = a4;\n\t\t\t}\n\t\t\tT0 get0() { return t.get0(); }\n\t\t\tT1 get1() { return t.get1(); }\n\t\t\tT2 get2() { return t.get2(); }\n\t\t\tT3 get3() { return t.get3(); }\n\t\t\tT4 get4() { return a; }\n\t\t\tvoid set0(T0 x) { t.set0(x); }\n\t\t\tvoid set1(T1 x) { t.set1(x); }\n\t\t\tvoid set2(T2 x) { t.set2(x); }\n\t\t\tvoid set3(T3 x) { t.set3(x); }\n\t\t\tvoid set4(T4 x) { a = x; }\n\t\t}\n\t\tclass Tuple6<\n\t\t\t\tT0 extends Comparable,\n\t\t\t\tT1 extends Comparable,\n\t\t\t\tT2 extends Comparable,\n\t\t\t\tT3 extends Comparable,\n\t\t\t\tT4 extends Comparable,\n\t\t\t\tT5 extends Comparable>\n\t\t\t\textends BasicTuple, T5> implements ITuple {\n\t\t\tTuple6() { super(); }\n\t\t\t@SuppressWarnings(\"unchecked\")\n\t\t\tTuple6(T0 a0, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) {\n\t\t\t\tsuper();\n\t\t\t\tthis.t = new Tuple5(a0, a1, a2, a3, a4);\n\t\t\t\tthis.a = a5;\n\t\t\t}\n\t\t\tT0 get0() { return t.get0(); }\n\t\t\tT1 get1() { return t.get1(); }\n\t\t\tT2 get2() { return t.get2(); }\n\t\t\tT3 get3() { return t.get3(); }\n\t\t\tT4 get4() { return t.get4(); }\n\t\t\tT5 get5() { return a; }\n\t\t\tvoid set0(T0 x) { t.set0(x); }\n\t\t\tvoid set1(T1 x) { t.set1(x); }\n\t\t\tvoid set2(T2 x) { t.set2(x); }\n\t\t\tvoid set3(T3 x) { t.set3(x); }\n\t\t\tvoid set4(T4 x) { t.set4(x); }\n\t\t\tvoid set5(T5 x) { a = x; }\n\t\t}\n\t\tclass Tuple7<\n\t\t\t\tT0 extends Comparable,\n\t\t\t\tT1 extends Comparable,\n\t\t\t\tT2 extends Comparable,\n\t\t\t\tT3 extends Comparable,\n\t\t\t\tT4 extends Comparable,\n\t\t\t\tT5 extends Comparable,\n\t\t\t\tT6 extends Comparable>\n\t\t\t\textends BasicTuple, T6> implements ITuple {\n\t\t\tTuple7() { super(); }\n\t\t\t@SuppressWarnings(\"unchecked\")\n\t\t\tTuple7(T0 a0, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) {\n\t\t\t\tsuper();\n\t\t\t\tthis.t = new Tuple6(a0, a1, a2, a3, a4, a5);\n\t\t\t\tthis.a = a6;\n\t\t\t}\n\t\t\tT0 get0() { return t.get0(); }\n\t\t\tT1 get1() { return t.get1(); }\n\t\t\tT2 get2() { return t.get2(); }\n\t\t\tT3 get3() { return t.get3(); }\n\t\t\tT4 get4() { return t.get4(); }\n\t\t\tT5 get5() { return t.get5(); }\n\t\t\tT6 get6() { return a; }\n\t\t\tvoid set0(T0 x) { t.set0(x); }\n\t\t\tvoid set1(T1 x) { t.set1(x); }\n\t\t\tvoid set2(T2 x) { t.set2(x); }\n\t\t\tvoid set3(T3 x) { t.set3(x); }\n\t\t\tvoid set4(T4 x) { t.set4(x); }\n\t\t\tvoid set5(T5 x) { t.set5(x); }\n\t\t\tvoid set6(T6 x) { a = x; }\n\t\t}\n\t\tclass Tuple8<\n\t\t\t\tT0 extends Comparable,\n\t\t\t\tT1 extends Comparable,\n\t\t\t\tT2 extends Comparable,\n\t\t\t\tT3 extends Comparable,\n\t\t\t\tT4 extends Comparable,\n\t\t\t\tT5 extends Comparable,\n\t\t\t\tT6 extends Comparable,\n\t\t\t\tT7 extends Comparable>\n\t\t\t\textends BasicTuple, T7> implements ITuple {\n\t\t\tTuple8() { super(); }\n\t\t\t@SuppressWarnings(\"unchecked\")\n\t\t\tTuple8(T0 a0, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) {\n\t\t\t\tsuper();\n\t\t\t\tthis.t = new Tuple7(a0, a1, a2, a3, a4, a5, a6);\n\t\t\t\tthis.a = a7;\n\t\t\t}\n\t\t\tT0 get0() { return t.get0(); }\n\t\t\tT1 get1() { return t.get1(); }\n\t\t\tT2 get2() { return t.get2(); }\n\t\t\tT3 get3() { return t.get3(); }\n\t\t\tT4 get4() { return t.get4(); }\n\t\t\tT5 get5() { return t.get5(); }\n\t\t\tT6 get6() { return t.get6(); }\n\t\t\tT7 get7() { return a; }\n\t\t\tvoid set0(T0 x) { t.set0(x); }\n\t\t\tvoid set1(T1 x) { t.set1(x); }\n\t\t\tvoid set2(T2 x) { t.set2(x); }\n\t\t\tvoid set3(T3 x) { t.set3(x); }\n\t\t\tvoid set4(T4 x) { t.set4(x); }\n\t\t\tvoid set5(T5 x) { t.set5(x); }\n\t\t\tvoid set6(T6 x) { t.set6(x); }\n\t\t\tvoid set7(T7 x) { a = x; }\n\t\t}\n\n\t\tclass TupleIII implements Comparable {\n\t\t\tint a; int b; int c;\n\t\t\tTupleIII() { }\n\t\t\tTupleIII(int a, int b, int c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleIII that = (TupleIII) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleIII that) {\n\t\t\t\tint c = Integer.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Integer.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Integer.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleIIL implements Comparable {\n\t\t\tint a; int b; long c;\n\t\t\tTupleIIL() { }\n\t\t\tTupleIIL(int a, int b, long c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleIIL that = (TupleIIL) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleIIL that) {\n\t\t\t\tint c = Integer.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Integer.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Long.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleIID implements Comparable {\n\t\t\tint a; int b; double c;\n\t\t\tTupleIID() { }\n\t\t\tTupleIID(int a, int b, double c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleIID that = (TupleIID) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleIID that) {\n\t\t\t\tint c = Integer.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Integer.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Double.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleILI implements Comparable {\n\t\t\tint a; long b; int c;\n\t\t\tTupleILI() { }\n\t\t\tTupleILI(int a, long b, int c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleILI that = (TupleILI) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleILI that) {\n\t\t\t\tint c = Integer.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Long.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Integer.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleILL implements Comparable {\n\t\t\tint a; long b; long c;\n\t\t\tTupleILL() { }\n\t\t\tTupleILL(int a, long b, long c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleILL that = (TupleILL) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleILL that) {\n\t\t\t\tint c = Integer.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Long.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Long.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleILD implements Comparable {\n\t\t\tint a; long b; double c;\n\t\t\tTupleILD() { }\n\t\t\tTupleILD(int a, long b, double c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleILD that = (TupleILD) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleILD that) {\n\t\t\t\tint c = Integer.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Long.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Double.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleIDI implements Comparable {\n\t\t\tint a; double b; int c;\n\t\t\tTupleIDI() { }\n\t\t\tTupleIDI(int a, double b, int c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleIDI that = (TupleIDI) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleIDI that) {\n\t\t\t\tint c = Integer.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Double.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Integer.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleIDL implements Comparable {\n\t\t\tint a; double b; long c;\n\t\t\tTupleIDL() { }\n\t\t\tTupleIDL(int a, double b, long c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleIDL that = (TupleIDL) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleIDL that) {\n\t\t\t\tint c = Integer.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Double.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Long.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleIDD implements Comparable {\n\t\t\tint a; double b; double c;\n\t\t\tTupleIDD() { }\n\t\t\tTupleIDD(int a, double b, double c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleIDD that = (TupleIDD) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleIDD that) {\n\t\t\t\tint c = Integer.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Double.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Double.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleLII implements Comparable {\n\t\t\tlong a; int b; int c;\n\t\t\tTupleLII() { }\n\t\t\tTupleLII(long a, int b, int c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleLII that = (TupleLII) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleLII that) {\n\t\t\t\tint c = Long.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Integer.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Integer.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleLIL implements Comparable {\n\t\t\tlong a; int b; long c;\n\t\t\tTupleLIL() { }\n\t\t\tTupleLIL(long a, int b, long c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleLIL that = (TupleLIL) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleLIL that) {\n\t\t\t\tint c = Long.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Integer.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Long.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleLID implements Comparable {\n\t\t\tlong a; int b; double c;\n\t\t\tTupleLID() { }\n\t\t\tTupleLID(long a, int b, double c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleLID that = (TupleLID) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleLID that) {\n\t\t\t\tint c = Long.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Integer.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Double.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleLLI implements Comparable {\n\t\t\tlong a; long b; int c;\n\t\t\tTupleLLI() { }\n\t\t\tTupleLLI(long a, long b, int c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleLLI that = (TupleLLI) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleLLI that) {\n\t\t\t\tint c = Long.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Long.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Integer.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleLLL implements Comparable {\n\t\t\tlong a; long b; long c;\n\t\t\tTupleLLL() { }\n\t\t\tTupleLLL(long a, long b, long c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleLLL that = (TupleLLL) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleLLL that) {\n\t\t\t\tint c = Long.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Long.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Long.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleLLD implements Comparable {\n\t\t\tlong a; long b; double c;\n\t\t\tTupleLLD() { }\n\t\t\tTupleLLD(long a, long b, double c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleLLD that = (TupleLLD) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleLLD that) {\n\t\t\t\tint c = Long.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Long.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Double.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleLDI implements Comparable {\n\t\t\tlong a; double b; int c;\n\t\t\tTupleLDI() { }\n\t\t\tTupleLDI(long a, double b, int c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleLDI that = (TupleLDI) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleLDI that) {\n\t\t\t\tint c = Long.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Double.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Integer.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleLDL implements Comparable {\n\t\t\tlong a; double b; long c;\n\t\t\tTupleLDL() { }\n\t\t\tTupleLDL(long a, double b, long c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleLDL that = (TupleLDL) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleLDL that) {\n\t\t\t\tint c = Long.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Double.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Long.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleLDD implements Comparable {\n\t\t\tlong a; double b; double c;\n\t\t\tTupleLDD() { }\n\t\t\tTupleLDD(long a, double b, double c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleLDD that = (TupleLDD) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleLDD that) {\n\t\t\t\tint c = Long.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Double.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Double.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleDII implements Comparable {\n\t\t\tdouble a; int b; int c;\n\t\t\tTupleDII() { }\n\t\t\tTupleDII(double a, int b, int c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleDII that = (TupleDII) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleDII that) {\n\t\t\t\tint c = Double.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Integer.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Integer.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleDIL implements Comparable {\n\t\t\tdouble a; int b; long c;\n\t\t\tTupleDIL() { }\n\t\t\tTupleDIL(double a, int b, long c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleDIL that = (TupleDIL) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleDIL that) {\n\t\t\t\tint c = Double.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Integer.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Long.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleDID implements Comparable {\n\t\t\tdouble a; int b; double c;\n\t\t\tTupleDID() { }\n\t\t\tTupleDID(double a, int b, double c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleDID that = (TupleDID) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleDID that) {\n\t\t\t\tint c = Double.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Integer.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Double.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleDLI implements Comparable {\n\t\t\tdouble a; long b; int c;\n\t\t\tTupleDLI() { }\n\t\t\tTupleDLI(double a, long b, int c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleDLI that = (TupleDLI) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleDLI that) {\n\t\t\t\tint c = Double.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Long.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Integer.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleDLL implements Comparable {\n\t\t\tdouble a; long b; long c;\n\t\t\tTupleDLL() { }\n\t\t\tTupleDLL(double a, long b, long c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleDLL that = (TupleDLL) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleDLL that) {\n\t\t\t\tint c = Double.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Long.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Long.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleDLD implements Comparable {\n\t\t\tdouble a; long b; double c;\n\t\t\tTupleDLD() { }\n\t\t\tTupleDLD(double a, long b, double c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleDLD that = (TupleDLD) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleDLD that) {\n\t\t\t\tint c = Double.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Long.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Double.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleDDI implements Comparable {\n\t\t\tdouble a; double b; int c;\n\t\t\tTupleDDI() { }\n\t\t\tTupleDDI(double a, double b, int c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleDDI that = (TupleDDI) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleDDI that) {\n\t\t\t\tint c = Double.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Double.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Integer.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleDDL implements Comparable {\n\t\t\tdouble a; double b; long c;\n\t\t\tTupleDDL() { }\n\t\t\tTupleDDL(double a, double b, long c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleDDL that = (TupleDDL) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleDDL that) {\n\t\t\t\tint c = Double.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Double.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Long.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\t\tclass TupleDDD implements Comparable {\n\t\t\tdouble a; double b; double c;\n\t\t\tTupleDDD() { }\n\t\t\tTupleDDD(double a, double b, double c) { this.a = a; this.b = b; this.c = c; }\n\t\t\t@Override public String toString() { return \"(\"+a+\", \"+b+\", \"+c+\")\"; }\n\t\t\t@Override public int hashCode() { return Objects.hash(a, b, c); }\n\t\t\t@Override\n\t\t\tpublic boolean equals(Object obj) {\n\t\t\t\tif(this == obj) return true;\n\t\t\t\tif(obj == null || this.getClass() != obj.getClass()) return false;\n\t\t\t\tTupleDDD that = (TupleDDD) obj;\n\t\t\t\tif(this.a != that.a || this.b != that.b || this.c != that.c) return false;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic int compareTo(TupleDDD that) {\n\t\t\t\tint c = Double.compare(this.a, that.a);\n\t\t\t\tif(c == 0) c = Double.compare(this.b, that.b);\n\t\t\t\tif(c == 0) c = Double.compare(this.c, that.c);\n\t\t\t\treturn c;\n\t\t\t}\n\t\t}\n\npublic void solve() {\n\tint h = ni();\n\tint w = ni();\n\tint num = ni();\n\tPairII p[] = new PairII[num];\n\tfor(int i = 0; i < num; i ++) {\n\t\tp[i] = new PairII(ni() - 1, ni() - 1);\n\t}\n\tSet hs = new HashSet<>();\n\tfor(int i = 0; i < num; i ++) {\n\t\ths.add(p[i]);\n\t}\n\tint cntH[] = new int[h];\n\tint cntW[] = new int[w];\n\tfor(int i = 0; i < num; i ++) {\n\t\tcntH[p[i].a] ++;\n\t\tcntW[p[i].b] ++;\n\t}\n\tlong maxH = max(cntH);\n\tList indexH = new ArrayList<>();\n\tfor(int i = 0; i < h; i ++) {\n\t\tif(maxH == cntH[i]) indexH.add(i);\n\t}\n\tlong maxW = max(cntW);\n\tList indexW = new ArrayList<>();\n\tfor(int i = 0; i < w; i ++) {\n\t\tif(maxW == cntW[i]) indexW.add(i);\n\t}\n\tfor(int crtH : indexH) {\n\t\tfor(int crtW : indexW) {\n\t\t\tif(!hs.contains(new PairII(crtH, crtW))) exit(maxH + maxW);\n\t\t}\n\t}\n\t\n\tlong max = 0;\n\tfor(int i = 0; i < num; i ++) {\n\t\tmax = max(max, cntH[p[i].a] + cntW[p[i].b] - 1);\n\t}\n\tprtln(max);\n}\n\n\n\t}\n}\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have a two-dimensional grid with H \\times W squares. There are M targets to destroy in this grid - the position of the i-th target is \\left(h_i, w_i \\right).\n\nTakahashi will choose one square in this grid, place a bomb there, and ignite it. The bomb will destroy all targets that are in the row or the column where the bomb is placed. It is possible to place the bomb at a square with a target.\n\nTakahashi is trying to maximize the number of targets to destroy. Find the maximum number of targets that can be destroyed.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 3 \\times 10^5\n\n1 \\leq M \\leq \\min\\left(H\\times W, 3 \\times 10^5\\right)\n\n1 \\leq h_i \\leq H\n\n1 \\leq w_i \\leq W\n\n\\left(h_i, w_i\\right) \\neq \\left(h_j, w_j\\right) \\left(i \\neq j\\right)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W M\nh_1 w_1\n\\vdots\nh_M w_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2 3 3\n2 2\n1 1\n1 3\n\nSample Output 1\n\n3\n\nWe can destroy all the targets by placing the bomb at \\left(1, 2\\right).\n\nSample Input 2\n\n3 3 4\n3 3\n3 1\n1 1\n1 2\n\nSample Output 2\n\n3\n\nSample Input 3\n\n5 5 10\n2 5\n4 3\n2 3\n5 5\n2 2\n5 4\n5 3\n5 1\n3 5\n1 4\n\nSample Output 3\n\n6", "sample_input": "2 3 3\n2 2\n1 1\n1 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02580", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have a two-dimensional grid with H \\times W squares. There are M targets to destroy in this grid - the position of the i-th target is \\left(h_i, w_i \\right).\n\nTakahashi will choose one square in this grid, place a bomb there, and ignite it. The bomb will destroy all targets that are in the row or the column where the bomb is placed. It is possible to place the bomb at a square with a target.\n\nTakahashi is trying to maximize the number of targets to destroy. Find the maximum number of targets that can be destroyed.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 3 \\times 10^5\n\n1 \\leq M \\leq \\min\\left(H\\times W, 3 \\times 10^5\\right)\n\n1 \\leq h_i \\leq H\n\n1 \\leq w_i \\leq W\n\n\\left(h_i, w_i\\right) \\neq \\left(h_j, w_j\\right) \\left(i \\neq j\\right)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W M\nh_1 w_1\n\\vdots\nh_M w_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2 3 3\n2 2\n1 1\n1 3\n\nSample Output 1\n\n3\n\nWe can destroy all the targets by placing the bomb at \\left(1, 2\\right).\n\nSample Input 2\n\n3 3 4\n3 3\n3 1\n1 1\n1 2\n\nSample Output 2\n\n3\n\nSample Input 3\n\n5 5 10\n2 5\n4 3\n2 3\n5 5\n2 2\n5 4\n5 3\n5 1\n3 5\n1 4\n\nSample Output 3\n\n6", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 91610, "cpu_time_ms": 746, "memory_kb": 95844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s749824346", "group_id": "codeNet:p02612", "input_text": "import java.util.*;\npublic class Main{\n\tpublic static void main(String[] args){\n \tScanner s=new Scanner(System.in);\n int n=s.nextInt();\n int res=(1000-n%1000)%1000;\n System.out.println(res);\n }\n}", "language": "Java", "metadata": {"date": 1596412794, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02612/input.txt", "sample_output_relpath": "derived/input_output/data/p02612/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02612/Java/s749824346.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s749824346", "user_id": "u814232738"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "import java.util.*;\npublic class Main{\n\tpublic static void main(String[] args){\n \tScanner s=new Scanner(System.in);\n int n=s.nextInt();\n int res=(1000-n%1000)%1000;\n System.out.println(res);\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "sample_input": "1900\n"}, "reference_outputs": ["100\n"], "source_document_id": "p02612", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 122, "memory_kb": 35672}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s939747750", "group_id": "codeNet:p02612", "input_text": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.InputMismatchException;\nimport java.io.IOException;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author Pranay2516\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastReader in = new FastReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n A solver = new A();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class A {\n public void solve(int testNumber, FastReader in, PrintWriter out) {\n int n = in.nextInt();\n out.println((1000 - n % 1000) % 1000);\n }\n\n }\n\n static class FastReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private FastReader.SpaceCharFilter filter;\n\n public FastReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) return -1;\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n }\n while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }\n}\n\n", "language": "Java", "metadata": {"date": 1596395646, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02612/input.txt", "sample_output_relpath": "derived/input_output/data/p02612/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02612/Java/s939747750.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s939747750", "user_id": "u222548870"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.InputMismatchException;\nimport java.io.IOException;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author Pranay2516\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastReader in = new FastReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n A solver = new A();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class A {\n public void solve(int testNumber, FastReader in, PrintWriter out) {\n int n = in.nextInt();\n out.println((1000 - n % 1000) % 1000);\n }\n\n }\n\n static class FastReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private FastReader.SpaceCharFilter filter;\n\n public FastReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) return -1;\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n }\n while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }\n}\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "sample_input": "1900\n"}, "reference_outputs": ["100\n"], "source_document_id": "p02612", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2470, "cpu_time_ms": 85, "memory_kb": 32488}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s561723122", "group_id": "codeNet:p02612", "input_text": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int price = sc.nextInt();\n int result = 1000 - (price % 1000);\n result = result == 1000 ? 0 : result;\n System.out.println(result);\n sc.close();\n }\n}", "language": "Java", "metadata": {"date": 1596382046, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02612/input.txt", "sample_output_relpath": "derived/input_output/data/p02612/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02612/Java/s561723122.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s561723122", "user_id": "u571582644"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int price = sc.nextInt();\n int result = 1000 - (price % 1000);\n result = result == 1000 ? 0 : result;\n System.out.println(result);\n sc.close();\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "sample_input": "1900\n"}, "reference_outputs": ["100\n"], "source_document_id": "p02612", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 116, "memory_kb": 35788}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s821159469", "group_id": "codeNet:p02612", "input_text": "import java.util.*;\n\nclass Main{\n\tpublic static void main(String args[]){\n \tScanner sc = new Scanner(System.in);\n \tint n = sc.nextInt();\n System.out.println((1000-(n%1000))+\"円\");\n }\n}", "language": "Java", "metadata": {"date": 1595878582, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02612/input.txt", "sample_output_relpath": "derived/input_output/data/p02612/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02612/Java/s821159469.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s821159469", "user_id": "u737117214"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "import java.util.*;\n\nclass Main{\n\tpublic static void main(String args[]){\n \tScanner sc = new Scanner(System.in);\n \tint n = sc.nextInt();\n System.out.println((1000-(n%1000))+\"円\");\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "sample_input": "1900\n"}, "reference_outputs": ["100\n"], "source_document_id": "p02612", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 144, "memory_kb": 38504}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s602477834", "group_id": "codeNet:p02612", "input_text": "import java.util.*;\nimport java.io.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n\n Scanner in = new Scanner(System.in);\n int N = in.nextInt();\n int bill = 1000;\n int currAmount = 0;\n while (currAmount < N) {\n\n currAmount += bill;\n\n\n }\n System.out.println(currAmount-N);\n }\n\n}\n", "language": "Java", "metadata": {"date": 1595399591, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02612/input.txt", "sample_output_relpath": "derived/input_output/data/p02612/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02612/Java/s602477834.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s602477834", "user_id": "u416439192"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n\n Scanner in = new Scanner(System.in);\n int N = in.nextInt();\n int bill = 1000;\n int currAmount = 0;\n while (currAmount < N) {\n\n currAmount += bill;\n\n\n }\n System.out.println(currAmount-N);\n }\n\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "sample_input": "1900\n"}, "reference_outputs": ["100\n"], "source_document_id": "p02612", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 120, "memory_kb": 35652}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s350690107", "group_id": "codeNet:p02612", "input_text": "import java.util.Scanner;\n\npublic class Main {\n public static void abc173_a() {\n try (Scanner sc = new Scanner(System.in)) {\n int a = Integer.parseInt(sc.next());\n int change = a % 1000;\n if (change == 0)\n System.out.println(0);\n else\n System.out.println(1000 - change);\n }\n }\n}", "language": "Java", "metadata": {"date": 1595113237, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02612/input.txt", "sample_output_relpath": "derived/input_output/data/p02612/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02612/Java/s350690107.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s350690107", "user_id": "u249123713"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n public static void abc173_a() {\n try (Scanner sc = new Scanner(System.in)) {\n int a = Integer.parseInt(sc.next());\n int change = a % 1000;\n if (change == 0)\n System.out.println(0);\n else\n System.out.println(1000 - change);\n }\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "sample_input": "1900\n"}, "reference_outputs": ["100\n"], "source_document_id": "p02612", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 372, "cpu_time_ms": 100, "memory_kb": 35104}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s940208927", "group_id": "codeNet:p02612", "input_text": "import java.util.Scanner;\npublic class Main{\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint C1=0,C2=0,C3=0,C4=0;\n\t\tfor(int i=0;i= 0) {\n n -= 1000;\n }\n System.out.println(Math.abs(n));\n }\n}", "language": "Java", "metadata": {"date": 1594088838, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02612/input.txt", "sample_output_relpath": "derived/input_output/data/p02612/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02612/Java/s088970490.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s088970490", "user_id": "u397330502"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n while (n >= 0) {\n n -= 1000;\n }\n System.out.println(Math.abs(n));\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "sample_input": "1900\n"}, "reference_outputs": ["100\n"], "source_document_id": "p02612", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 116, "memory_kb": 35800}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s310412862", "group_id": "codeNet:p02612", "input_text": "\nimport java.util.*;\nimport java.io.*;\n\npublic class Main {\n\n\n public static void main(String[] args) {\n FastReader sc = new FastReader();\n int n = sc.nextInt();\n System.out.println(1000-n%1000);\n }\n\n private static boolean ok(int k) {\n while (k>0) {\n int c = k%10;\n if (c!=4&&c!=7) return false;\n k/=10;\n }\n return true;\n }\n\n // 1 2 3 4 5 6\n // x * 2 == 10\n\n\n\n private static boolean preSum(int[] nums, int target) {\n int cur = 0;\n Set set = new HashSet<>();\n set.add(0);\n for (int i = 0; i < nums.length; i++) {\n cur += nums[i];\n if (set.contains(cur-target)) {\n System.out.println(cur-target);\n return true;\n }\n set.add(cur);\n }\n return false;\n }\n\n static class FastReader {\n BufferedReader br;\n StringTokenizer st;\n\n public FastReader() {\n br = new BufferedReader(new\n InputStreamReader(System.in));\n }\n\n String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n String nextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n\n\n }\n\n}\n\n", "language": "Java", "metadata": {"date": 1594071479, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02612/input.txt", "sample_output_relpath": "derived/input_output/data/p02612/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02612/Java/s310412862.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s310412862", "user_id": "u198680972"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "\nimport java.util.*;\nimport java.io.*;\n\npublic class Main {\n\n\n public static void main(String[] args) {\n FastReader sc = new FastReader();\n int n = sc.nextInt();\n System.out.println(1000-n%1000);\n }\n\n private static boolean ok(int k) {\n while (k>0) {\n int c = k%10;\n if (c!=4&&c!=7) return false;\n k/=10;\n }\n return true;\n }\n\n // 1 2 3 4 5 6\n // x * 2 == 10\n\n\n\n private static boolean preSum(int[] nums, int target) {\n int cur = 0;\n Set set = new HashSet<>();\n set.add(0);\n for (int i = 0; i < nums.length; i++) {\n cur += nums[i];\n if (set.contains(cur-target)) {\n System.out.println(cur-target);\n return true;\n }\n set.add(cur);\n }\n return false;\n }\n\n static class FastReader {\n BufferedReader br;\n StringTokenizer st;\n\n public FastReader() {\n br = new BufferedReader(new\n InputStreamReader(System.in));\n }\n\n String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n String nextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n\n\n }\n\n}\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "sample_input": "1900\n"}, "reference_outputs": ["100\n"], "source_document_id": "p02612", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1914, "cpu_time_ms": 87, "memory_kb": 32376}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s815246999", "group_id": "codeNet:p02612", "input_text": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String[] price = sc.next().split(\"\");\n \n if (Integer.parseInt(price[1]) == 0) System.out.println(0);\n else System.out.println(10 - Integer.parseInt(price[1]));\n }\n}", "language": "Java", "metadata": {"date": 1594041190, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02612/input.txt", "sample_output_relpath": "derived/input_output/data/p02612/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02612/Java/s815246999.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s815246999", "user_id": "u326014872"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String[] price = sc.next().split(\"\");\n \n if (Integer.parseInt(price[1]) == 0) System.out.println(0);\n else System.out.println(10 - Integer.parseInt(price[1]));\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "sample_input": "1900\n"}, "reference_outputs": ["100\n"], "source_document_id": "p02612", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 333, "cpu_time_ms": 106, "memory_kb": 26932}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s134431644", "group_id": "codeNet:p02612", "input_text": "// \"static void main\" must be defined in a public class.\nimport java.util.* ;\npublic class Main {\n public static void main(String[] args) {\n Scanner S = new Scanner( System.in ) ;\n Main obj = new Main() ;\n int t = S.nextInt() ;\n int min = Integer.MAX_VALUE ;\n if( t<1000 ) {\n \n min = t ;\n }\n int change = t%1000 ;\n System.out.println( Math.min( min , (1000-change) ) ) ;\n }\n}\n// \"static void main\" must be defined in a public class.\n// import java.util.* ;\n// public class Main {\n// public static void main(String[] args) {\n// Scanner S = new Scanner( System.in ) ;\n// Main obj = new Main() ;\n// int t = S.nextInt() ;\n \n// }\n// }", "language": "Java", "metadata": {"date": 1594000273, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02612/input.txt", "sample_output_relpath": "derived/input_output/data/p02612/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02612/Java/s134431644.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s134431644", "user_id": "u090695248"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "// \"static void main\" must be defined in a public class.\nimport java.util.* ;\npublic class Main {\n public static void main(String[] args) {\n Scanner S = new Scanner( System.in ) ;\n Main obj = new Main() ;\n int t = S.nextInt() ;\n int min = Integer.MAX_VALUE ;\n if( t<1000 ) {\n \n min = t ;\n }\n int change = t%1000 ;\n System.out.println( Math.min( min , (1000-change) ) ) ;\n }\n}\n// \"static void main\" must be defined in a public class.\n// import java.util.* ;\n// public class Main {\n// public static void main(String[] args) {\n// Scanner S = new Scanner( System.in ) ;\n// Main obj = new Main() ;\n// int t = S.nextInt() ;\n \n// }\n// }", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "sample_input": "1900\n"}, "reference_outputs": ["100\n"], "source_document_id": "p02612", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 124, "memory_kb": 35640}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s309726603", "group_id": "codeNet:p02612", "input_text": "import java.util.*;\nimport java.lang.*;\nimport java.io.*;\npublic class Main {\n\n\tpublic static void main(String[] args)throws java.lang.Exception\n {\t\t\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n =Integer.parseInt(br.readLine());\n\t\tSystem.out.println(n%1000==0?0:1000-n%1000);\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1593999247, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02612/input.txt", "sample_output_relpath": "derived/input_output/data/p02612/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02612/Java/s309726603.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s309726603", "user_id": "u948358897"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "import java.util.*;\nimport java.lang.*;\nimport java.io.*;\npublic class Main {\n\n\tpublic static void main(String[] args)throws java.lang.Exception\n {\t\t\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n =Integer.parseInt(br.readLine());\n\t\tSystem.out.println(n%1000==0?0:1000-n%1000);\n\t}\n\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "sample_input": "1900\n"}, "reference_outputs": ["100\n"], "source_document_id": "p02612", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 84, "memory_kb": 32648}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s657925004", "group_id": "codeNet:p02612", "input_text": "import java.util.*;\nclass Main {\n\n static Scanner scan = new Scanner(System.in);\n public static void main(String[] args) {\n int N = scan.nextInt();\n int change = Integer.MIN_VALUE;\n if(N % 1000 == 0) {\n change = 0;\n } else {\n int rem = N / 1000;\n change = (rem + 1) * 1000 - N;\n }\n System.out.println(change);\n }\n}\n", "language": "Java", "metadata": {"date": 1593998568, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02612/input.txt", "sample_output_relpath": "derived/input_output/data/p02612/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02612/Java/s657925004.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s657925004", "user_id": "u369841816"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "import java.util.*;\nclass Main {\n\n static Scanner scan = new Scanner(System.in);\n public static void main(String[] args) {\n int N = scan.nextInt();\n int change = Integer.MIN_VALUE;\n if(N % 1000 == 0) {\n change = 0;\n } else {\n int rem = N / 1000;\n change = (rem + 1) * 1000 - N;\n }\n System.out.println(change);\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "sample_input": "1900\n"}, "reference_outputs": ["100\n"], "source_document_id": "p02612", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 433, "cpu_time_ms": 129, "memory_kb": 35920}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s250926751", "group_id": "codeNet:p02612", "input_text": "import java.util.*;\npublic class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n \n int change = 1000-(n%1000);\n if(change == 1000) change = 0;\n System.out.println(change);\n \n }\n}\n", "language": "Java", "metadata": {"date": 1593997927, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02612/input.txt", "sample_output_relpath": "derived/input_output/data/p02612/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02612/Java/s250926751.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s250926751", "user_id": "u591003861"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n \n int change = 1000-(n%1000);\n if(change == 1000) change = 0;\n System.out.println(change);\n \n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "sample_input": "1900\n"}, "reference_outputs": ["100\n"], "source_document_id": "p02612", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 124, "memory_kb": 35764}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s836035511", "group_id": "codeNet:p02612", "input_text": "import java.util.*;\n public class Main{\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int a = n%1000;\n System.out.println(a);\n }\n } ", "language": "Java", "metadata": {"date": 1593997811, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02612/input.txt", "sample_output_relpath": "derived/input_output/data/p02612/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02612/Java/s836035511.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s836035511", "user_id": "u023425456"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "import java.util.*;\n public class Main{\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int a = n%1000;\n System.out.println(a);\n }\n } ", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "sample_input": "1900\n"}, "reference_outputs": ["100\n"], "source_document_id": "p02612", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 158, "memory_kb": 35740}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s827490315", "group_id": "codeNet:p02612", "input_text": "import java.util.*;\n \npublic class Main { //クラス名はMain\n public static void main(String[] args) {\n //整数の入力\n Scanner sc = new Scanner(System.in);\n int A = Integer.parseInt(sc.next());\n\n int oturi = A%1000 == 0 ? A/1000 : A/1000 + 1;\n\n System.out.println(oturi);\n } \n}\n", "language": "Java", "metadata": {"date": 1593997700, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02612/input.txt", "sample_output_relpath": "derived/input_output/data/p02612/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02612/Java/s827490315.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s827490315", "user_id": "u881848290"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "import java.util.*;\n \npublic class Main { //クラス名はMain\n public static void main(String[] args) {\n //整数の入力\n Scanner sc = new Scanner(System.in);\n int A = Integer.parseInt(sc.next());\n\n int oturi = A%1000 == 0 ? A/1000 : A/1000 + 1;\n\n System.out.println(oturi);\n } \n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "sample_input": "1900\n"}, "reference_outputs": ["100\n"], "source_document_id": "p02612", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 144, "memory_kb": 35660}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s715529528", "group_id": "codeNet:p02612", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint t = sc.nextInt();\n\t\tStringBuilder ans = new StringBuilder();\n\t\twhile (--t >= 0) {\n\t\t\tint n = sc.nextInt();\n\t\t\tint numOfNotes = n / 1000;\n\t\t\tif (n % 1000 != 0)\n\t\t\t\tnumOfNotes++;\n\t\t\tSystem.out.println(1000 * numOfNotes - n);\n\t\t}\n\t}\n}\n", "language": "Java", "metadata": {"date": 1593997667, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02612/input.txt", "sample_output_relpath": "derived/input_output/data/p02612/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02612/Java/s715529528.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s715529528", "user_id": "u773565827"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint t = sc.nextInt();\n\t\tStringBuilder ans = new StringBuilder();\n\t\twhile (--t >= 0) {\n\t\t\tint n = sc.nextInt();\n\t\t\tint numOfNotes = n / 1000;\n\t\t\tif (n % 1000 != 0)\n\t\t\t\tnumOfNotes++;\n\t\t\tSystem.out.println(1000 * numOfNotes - n);\n\t\t}\n\t}\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "sample_input": "1900\n"}, "reference_outputs": ["100\n"], "source_document_id": "p02612", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 128, "memory_kb": 35944}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s243286180", "group_id": "codeNet:p02612", "input_text": "\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n System.out.println(1000 - sc.nextInt() % 1000);\n }\n}\n", "language": "Java", "metadata": {"date": 1593997399, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02612/input.txt", "sample_output_relpath": "derived/input_output/data/p02612/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02612/Java/s243286180.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s243286180", "user_id": "u793380652"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n System.out.println(1000 - sc.nextInt() % 1000);\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "sample_input": "1900\n"}, "reference_outputs": ["100\n"], "source_document_id": "p02612", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 103, "memory_kb": 27088}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s668089625", "group_id": "codeNet:p02612", "input_text": "import java.util.*;\n\npublic class Main {\n public static void main(String args[]) {\n Scanner scn = new Scanner(System.in);\n int n = scn.nextInt();\n int pay = 1000;\n\n while(n>pay){\n pay += 1000;\n }\n\n System.out.println(pay-n);\n\n\n scn.close();\n\n }\n\n\n}", "language": "Java", "metadata": {"date": 1593997354, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02612/input.txt", "sample_output_relpath": "derived/input_output/data/p02612/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02612/Java/s668089625.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s668089625", "user_id": "u425261844"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n public static void main(String args[]) {\n Scanner scn = new Scanner(System.in);\n int n = scn.nextInt();\n int pay = 1000;\n\n while(n>pay){\n pay += 1000;\n }\n\n System.out.println(pay-n);\n\n\n scn.close();\n\n }\n\n\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "sample_input": "1900\n"}, "reference_outputs": ["100\n"], "source_document_id": "p02612", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 98, "memory_kb": 27020}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s298723968", "group_id": "codeNet:p02612", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n\t// write your code here\n\n Scanner src = new Scanner(System.in);\n\n \n int n = src.nextInt();\n \n System.out.println(n%1000);\n \n \n\n\n\n }\n}\n", "language": "Java", "metadata": {"date": 1593997341, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02612/input.txt", "sample_output_relpath": "derived/input_output/data/p02612/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02612/Java/s298723968.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s298723968", "user_id": "u214872673"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n\t// write your code here\n\n Scanner src = new Scanner(System.in);\n\n \n int n = src.nextInt();\n \n System.out.println(n%1000);\n \n \n\n\n\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "sample_input": "1900\n"}, "reference_outputs": ["100\n"], "source_document_id": "p02612", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 105, "memory_kb": 27080}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s307815836", "group_id": "codeNet:p02612", "input_text": "//Created by Aminul on 7/5/2020.\n\nimport java.io.*;\nimport java.util.*;\n\nimport static java.lang.Math.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n Scanner in = new Scanner(System.in);\n PrintWriter pw = new PrintWriter(System.out);\n int n = in.nextInt();\n int res = n / 1000;\n if (n % 1000 != 0) res++;\n res = (res * 1000) - n;\n pw.println(res);\n\n pw.close();\n }\n\n static void debug(Object... obj) {\n System.err.println(Arrays.deepToString(obj));\n }\n}", "language": "Java", "metadata": {"date": 1593997314, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02612/input.txt", "sample_output_relpath": "derived/input_output/data/p02612/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02612/Java/s307815836.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s307815836", "user_id": "u895864703"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "//Created by Aminul on 7/5/2020.\n\nimport java.io.*;\nimport java.util.*;\n\nimport static java.lang.Math.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n Scanner in = new Scanner(System.in);\n PrintWriter pw = new PrintWriter(System.out);\n int n = in.nextInt();\n int res = n / 1000;\n if (n % 1000 != 0) res++;\n res = (res * 1000) - n;\n pw.println(res);\n\n pw.close();\n }\n\n static void debug(Object... obj) {\n System.err.println(Arrays.deepToString(obj));\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "sample_input": "1900\n"}, "reference_outputs": ["100\n"], "source_document_id": "p02612", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 108, "memory_kb": 27064}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s820743910", "group_id": "codeNet:p02612", "input_text": "import java.io.*;\nimport java.util.*;\n\n/**\n * Created by Ayushi on 05 Jul 2020.\n * Problem:\n * Round:\n */\n\npublic class Main {\n public static void main(String[] args) throws IOException {\n StringTokenizer st;\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n st = new StringTokenizer(br.readLine(), \" \");\n int n = Integer.parseInt(st.nextToken());\n br.close();\n int ans = 1000 - (n % 1000);\n System.out.println(ans);\n }\n}\n", "language": "Java", "metadata": {"date": 1593997308, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02612/input.txt", "sample_output_relpath": "derived/input_output/data/p02612/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02612/Java/s820743910.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s820743910", "user_id": "u121485613"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "import java.io.*;\nimport java.util.*;\n\n/**\n * Created by Ayushi on 05 Jul 2020.\n * Problem:\n * Round:\n */\n\npublic class Main {\n public static void main(String[] args) throws IOException {\n StringTokenizer st;\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n st = new StringTokenizer(br.readLine(), \" \");\n int n = Integer.parseInt(st.nextToken());\n br.close();\n int ans = 1000 - (n % 1000);\n System.out.println(ans);\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "sample_input": "1900\n"}, "reference_outputs": ["100\n"], "source_document_id": "p02612", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 503, "cpu_time_ms": 87, "memory_kb": 32644}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s659016990", "group_id": "codeNet:p02612", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n\n System.out.println(n % 1000);\n }\n}\n", "language": "Java", "metadata": {"date": 1593997272, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02612/input.txt", "sample_output_relpath": "derived/input_output/data/p02612/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02612/Java/s659016990.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s659016990", "user_id": "u685019390"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n\n System.out.println(n % 1000);\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "sample_input": "1900\n"}, "reference_outputs": ["100\n"], "source_document_id": "p02612", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\n\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\n\nAssume we use the minimum number of bills required.\n\nConstraints\n\n1 \\leq N \\leq 10000\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 amount of change as an integer.\n\nSample Input 1\n\n1900\n\nSample Output 1\n\n100\n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\nSample Input 2\n\n3000\n\nSample Output 2\n\n0\n\nWe can pay the exact price.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 123, "memory_kb": 35600}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s208773646", "group_id": "codeNet:p02618", "input_text": "\nimport java.awt.Point;\nimport java.io.File;\nimport java.io.FileInputStream;\nimport java.io.FileNotFoundException;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Iterator;\nimport java.util.Locale;\nimport java.util.NoSuchElementException;\nimport java.util.Random;\nimport java.util.concurrent.Executors;\nimport java.util.concurrent.ScheduledExecutorService;\nimport java.util.concurrent.ScheduledFuture;\nimport java.util.concurrent.TimeUnit;\n\npublic class Main implements Runnable{\n\n\tprivate static final int LIMIT = 1800; // ループで回せる時間\n\tprivate static void solve(FastIO io) {\n\t\t/*\n\t\t * author: 31536000\n\t\t * Introduction to Heuristics Contest A問題\n\t\t * 考察メモ\n\t\t * まず、各日に決められるコンテストは高々1つなので、それを焼きなましすることを考える\n\t\t * ここで、ある日に開くコンテストを変えた場合に変わる情報は次に開催するlastだけ\n\t\t * 従って、更新はO(1)で行えるはず\n\t\t *\n\t\t * 実際に更新をO(1)で行う方法を考える\n\t\t * データ構造として、双方向連結リストを考える\n\t\t * 各日のコンテストは、直前と直後に開催されたコンテストを記録する\n\t\t * この時、ある日のコンテストの種類を変更することは次のように表される\n\t\t * 1. そのコンテストのスコアを減らす\n\t\t * 2. そのコンテストの次に開かれた同じコンテストの直前コンテストを更新し、スコアを更新する(減らす)\n\t\t * 3. コンテストを変更し、スコアを増やす\n\t\t * 4. 直前と直後を繋ぐ…えー、O(D)やん、もっと速くならない?\n\t\t *\n\t\t * 次の情報: d日目以前に開かれたi番目のコンテストのうち、一番最後の物を求める\n\t\t * これは、計算量O(logN) (TreeSet)以外にできるか?\n\t\t * 区間max/一点更新で解けそうじゃない?\n\t\t * つまり、一点更新で開かれたコンテストのポインタを入れれば、区間maxが最後のもの\n\t\t * nullは最小、両方が非nullなら右側優先でおっけー\n\t\t */\n\t\tio.setAutoFlush(true);\n\t\tMarathon marathon = new Marathon(io);\n\t\tMarathonTimer timer = new MarathonTimer(marathon);\n\t\ttimer.start(LIMIT);\n\t}\n\n\tprivate static class Marathon implements MarathonInterface {\n\t\tprivate FastIO io;\n\t\tprivate Random rnd;\n\t\tprivate int loop;\n\n\t\tprivate static final int CONTEST = 26;\n\t\tprivate final int D;\n\t\tprivate final int HALF_OF_D;\n\t\tprivate final int[] c;\n\t\tprivate final int[][] s;\n\t\tprivate final int[] s2; // sを展開したもの、少し速くなると嬉しい……\n\n\t\tprivate final Contest[] contest; // D日目に開かれたコンテスト\n\t\t// private final SegmentTree[] segment; // 各コンテストを高速検索するためのRMQ\n\n\t\tprivate final Contest[] begin, end; // 各コンテストの連結リストの端\n\n\t\tint score;\n\n\t\tclass Contest {\n\t\t\tContest last, next;\n\t\t\tint day, type;\n\t\t\tContest(int day, int type) {\n\t\t\t\tthis.type = type;\n\t\t\t\tthis.day = day;\n\t\t\t\tlast = next = this;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic String toString() {\n\t\t\t\treturn \"Contest \" + type + \" is held \" + day;\n\t\t\t}\n\t\t}\n\n\t\t/*private class SegmentTree {\n\t\t\tprivate Contest[] tree;\n\t\t\tprivate final int size;\n\t\t\tprivate final Contest MIN, MAX;\n\t\t\tpublic SegmentTree(int type) {\n\t\t\t\tsize = Integer.highestOneBit(D + 1) << 1;\n\t\t\t\ttree = new Contest[size * 2];\n\t\t\t\ttree[size] = MIN = new Contest(-1, type);\n\t\t\t\ttree[tree.length - 1] = MAX = new Contest(D, type);\n\t\t\t}\n\t\t\tpublic final void set(int index, final Contest contest) {\n\t\t\t\tindex += size + 1;\n\t\t\t\ttree[index] = contest;\n\t\t\t\twhile(index != 0) {\n\t\t\t\t\tindex >>= 1;\n\t\t\t\t\tContest right = tree[index << 1 | 1];\n\t\t\t\t\ttree[index] = right == null ? tree[index << 1] : right;\n\t\t\t\t}\n\t\t\t}\n\t\t\tpublic final Contest get() {\n\t\t\t\treturn MAX;\n\t\t\t}\n\t\t\tpublic final Contest get(int toIndex) {\n\t\t\t\tint fromIndex = size;\n\t\t\t\ttoIndex += size;\n\t\t\t\twhile(fromIndex <= toIndex) {\n\t\t\t\t\tif ((toIndex & 1) == 0) {\n\t\t\t\t\t\tContest right = tree[toIndex];\n\t\t\t\t\t\tif (right != null) return right;\n\t\t\t\t\t\t-- toIndex;\n\t\t\t\t\t}\n\t\t\t\t\tfromIndex >>= 1;\n\t\t\t\t\ttoIndex >>= 1;\n\t\t\t\t}\n\t\t\t\treturn MIN;\n\t\t\t}\n\t\t}*/\n\n\t\tpublic Marathon(FastIO io) {\n\t\t\tthis.io = io;\n\t\t\trnd = new Random();\n\t\t\tD = io.nextInt();\n\t\t\tHALF_OF_D = D >> 1;\n\t\t\tc = io.nextInt(CONTEST);\n\t\t\ts = io.nextInt(CONTEST, D);\n\t\t\ts2 = new int[CONTEST * D];\n\t\t\tfor (int i = 0;i < D;++ i) {\n\t\t\t\tfor (int j = 0;j < CONTEST;++ j) s2[i * CONTEST + j] = s[i][j];\n\t\t\t}\n\t\t\tcontest = new Contest[D];\n\t\t\t//segment = new SegmentTree[CONTEST];\n\t\t\t//for (int i = 0;i < CONTEST;++ i) segment[i] = new SegmentTree(i);\n\t\t\tbegin = new Contest[CONTEST];\n\t\t\tend = new Contest[CONTEST];\n\t\t\tfor (int i = 0;i < CONTEST;++ i) {\n\t\t\t\tbegin[i] = new Contest(-1, i);\n\t\t\t\tend[i] = new Contest(D, i);\n\t\t\t}\n\t\t}\n\n\t\tprivate int want(final int contest, final int wait) {\n\t\t\treturn c[contest] * wait * (wait - 1) >> 1;\n\t\t}\n\n\t\t@Override\n\t\tpublic void read() {\n\t\t}\n\n\t\t@Override\n\t\tpublic void init() {\n\t\t\tloop = 0;\n\n\t\t\t// 貪欲法で構築しておく\n\t\t\tContest[] last = Arrays.copyOf(begin, CONTEST); // 最後に開かれたタイミング\n\t\t\tfor (int i = 0;i < D;++ i) {\n\t\t\t\tint max = 0, maxScore = -1;\n\t\t\t\tfor (int j = 0;j < CONTEST;++ j) {\n\t\t\t\t\tint score = s2[i * CONTEST + j] + c[j] * (i - last[j].day);\n\t\t\t\t\tif (maxScore < score) {\n\t\t\t\t\t\tmaxScore = score;\n\t\t\t\t\t\tmax = j;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcontest[i] = new Contest(i, max);\n\t\t\t\tcontest[i].last = last[max];\n\t\t\t\tcontest[i].last.next = contest[i];\n\t\t\t\tlast[max] = contest[i];\n\t\t\t\tscore += s2[i * CONTEST + max];\n\t\t\t\tscore -= want(max, i - contest[i].last.day);\n\t\t\t}\n\t\t\tfor (int i = 0;i < CONTEST;++ i) {\n\t\t\t\tContest tmp = end[i];\n\t\t\t\ttmp.last = last[i];\n\t\t\t\ttmp.last.next = tmp;\n\t\t\t\tscore -= want(i, D - tmp.last.day);\n\t\t\t}\n\t\t\tseed = rnd.nextInt();\n\t\t\tfor (int i = 0;i < log.length;++ i) log[i] = Math.log(nextDouble());\n\t\t}\n\n\t\tprivate int seed;\n\t\tprivate static final int XOR_MASK = 0x7FFFFFFF;\n\t\tprivate static final int LOG_SIZE = 1 << 10;\n\t\tprivate static final int LOG_MASK = LOG_SIZE - 1;\n\t\tfinal double[] log = new double[LOG_SIZE];\n\t\tint xorshift() {\n\t\t\tseed = seed ^ (seed << 13);\n\t\t\tseed = seed ^ (seed >>> 17);\n\t\t\treturn seed = seed ^ (seed << 5);\n\t\t}\n\n\t\tpublic int nextInt(int bound) {\n\t\t\treturn (xorshift() & XOR_MASK) % bound;\n\t\t}\n\n\t\t/*public final int nextInt(int bound) {\n\t\t\tint bits, val;\n\t\t\tdo {\n\t\t\t\tbits = xorshift() & XOR_MASK;\n\t\t\t\tval = bits % bound;\n\t\t\t} while (bits - val + (bound - 1) < 0);\n\t\t\treturn val;\n\t\t}*/\n\n\t\tprivate static final double RND_DOUBLE_INV = 1.0 / (1L << 53);\n\t\tpublic final double nextDouble() {\n\t\t\treturn (((xorshift() & 0x03FFFFFFL) << 27) + (xorshift() & 0x07FFFFFF)) * RND_DOUBLE_INV;\n\t\t}\n\n\t\tprivate static final int NEARLY_INV_LIMIT = 32 - Integer.numberOfLeadingZeros(LIMIT - 1);\n\t\t@Override\n\t\tpublic final void update(int delay) { // TODO UPDATE\n\t\t\t++ loop;\n\n\t\t\tint patturn = nextInt(101 - (delay * 90 >> NEARLY_INV_LIMIT));\n\t\t\tif (patturn < 9) { // パターン1: 特定の日付のコンテストの種類を変える\n\t\t\t\tint day = nextInt(D);\n\t\t\t\tint swap = nextInt(CONTEST - 1);\n\t\t\t\tContest now = contest[day];\n\t\t\t\tint type = now.type;\n\t\t\t\tif (swap >= now.type) ++ swap;\n\n\t\t\t\tint change = 0; // 更新されるスコアの増え幅\n\t\t\t\tchange += want(type, day - now.last.day); // 元々の値\n\t\t\t\tchange += want(type, now.next.day - day); // 元々の値\n\t\t\t\tchange -= want(type, now.next.day - now.last.day);\n\t\t\t\tchange -= s2[day * CONTEST + type];\n\t\t\t\tContest swapNext;\n\t\t\t\tif (day <= HALF_OF_D) {\n\t\t\t\t\tswapNext = begin[swap];\n\t\t\t\t\twhile(swapNext.day < day) swapNext = swapNext.next;\n\t\t\t\t} else {\n\t\t\t\t\tswapNext = end[swap];\n\t\t\t\t\twhile(swapNext.last.day > day) swapNext = swapNext.last;\n\t\t\t\t}\n\t\t\t\tchange += want(swap, swapNext.day - swapNext.last.day); // 元々の値\n\t\t\t\tchange -= want(swap, swapNext.day - day);\n\t\t\t\tchange -= want(swap, day - swapNext.last.day);\n\t\t\t\tchange += s2[day * CONTEST + swap];\n\t\t\t\tif (isChange(change, delay)) {\n\t\t\t\t\tscore += change;\n\t\t\t\t\tnow.type = swap;\n\t\t\t\t\tnow.next.last = now.last;\n\t\t\t\t\tnow.last.next = now.next;\n\t\t\t\t\tswapNext.last.next = now;\n\t\t\t\t\tnow.last = swapNext.last;\n\t\t\t\t\tswapNext.last = now;\n\t\t\t\t\tnow.next = swapNext;\n\t\t\t\t}\n\t\t\t /* } else if (patturn < 20){ // パターン2: 二つのコンテストの日付を入れ替える\n\t\t\t\tint day1 = nextInt(D);\n\t\t\t\tint day2 = nextInt(D - 1);\n\t\t\t\tif (day2 >= day1) ++ day2;\n\t\t\t\tContest d1 = contest[day1];\n\t\t\t\tContest d2 = contest[day2];\n\t\t\t\tint type1 = d1.type, type2 = d2.type;\n\t\t\t\tSegmentTree segment1 = segment[type1], segment2 = segment[type2];\n\t\t\t\tif (d1.type == d2.type) {\n\t\t\t\t\t-- loop;\n\t\t\t\t\treturn; // swapするだけ無駄\n\t\t\t\t}\n\t\t\t\tContest day1Last = d1.last.day < day2 && day2 < d1.next.day ? null : segment1.get(day2);\n\t\t\t\tContest day2Last = d2.last.day < day1 && day1 < d2.next.day ? null : segment2.get(day1);\n\t\t\t\tint change = 0; // 更新されるスコアの増え幅\n\t\t\t\tchange -= s2[day1 * CONTEST + type1];\n\t\t\t\tchange += s2[day2 * CONTEST + type1];\n\t\t\t\tchange += want(type1, d1.next.day - day1);\n\t\t\t\tchange += want(type1, day1 - d1.last.day);\n\t\t\t\tif (day1Last == null) {\n\t\t\t\t\tchange -= want(type1, d1.next.day - day2);\n\t\t\t\t\tchange -= want(type1, day2 - d1.last.day);\n\t\t\t\t} else {\n\t\t\t\t\tchange -= want(type1, d1.next.day - d1.last.day);\n\t\t\t\t\tchange += want(type1, day1Last.next.day - day1Last.day);\n\t\t\t\t\tchange -= want(type1, day1Last.next.day - day2);\n\t\t\t\t\tchange -= want(type1, day2 - day1Last.day);\n\t\t\t\t}\n\t\t\t\tchange -= s2[day2 * CONTEST + type2];\n\t\t\t\tchange += s2[day1 * CONTEST + type2];\n\t\t\t\tchange += want(type2, d2.next.day - day2);\n\t\t\t\tchange += want(type2, day2 - d2.last.day);\n\t\t\t\tif (day2Last == null) {\n\t\t\t\t\tchange -= want(type2, d2.next.day - day1);\n\t\t\t\t\tchange -= want(type2, day1 - d2.last.day);\n\t\t\t\t} else {\n\t\t\t\t\tchange -= want(type2, d2.next.day - d2.last.day);\n\t\t\t\t\tchange += want(type2, day2Last.next.day - day2Last.day);\n\t\t\t\t\tchange -= want(type2, day2Last.next.day - day1);\n\t\t\t\t\tchange -= want(type2, day1 - day2Last.day);\n\t\t\t\t}\n\t\t\t\tif (isChange(change, delay)) {\n\t\t\t\t\tscore += change;\n\t\t\t\t\tsegment1.set(day1, null);\n\t\t\t\t\tsegment1.set(day2, d1);\n\t\t\t\t\tsegment2.set(day2, null);\n\t\t\t\t\tsegment2.set(day1, d2);\n\t\t\t\t\tcontest[day2] = d1;\n\t\t\t\t\tcontest[day1] = d2;\n\t\t\t\t\td1.day = day2;\n\t\t\t\t\td2.day = day1;\n\t\t\t\t\tif (day1Last != null) {\n\t\t\t\t\t\td1.last.next = d1.next;\n\t\t\t\t\t\td1.next.last = d1.last;\n\t\t\t\t\t\td1.next = day1Last.next;\n\t\t\t\t\t\td1.last = day1Last;\n\t\t\t\t\t\tday1Last.next.last = d1;\n\t\t\t\t\t\tday1Last.next = d1;\n\t\t\t\t\t}\n\t\t\t\t\tif (day2Last != null) {\n\t\t\t\t\t\td2.last.next = d2.next;\n\t\t\t\t\t\td2.next.last = d2.last;\n\t\t\t\t\t\td2.next = day2Last.next;\n\t\t\t\t\t\td2.last = day2Last;\n\t\t\t\t\t\tday2Last.next.last = d2;\n\t\t\t\t\t\tday2Last.next = d2;\n\t\t\t\t\t}\n\t\t\t\t} // */\n\t\t\t} else { // パターン3: 近いコンテストを入れ替える\n\t\t\t\tint day1 = nextInt(D - 13);\n\t\t\t\tint day2 = nextInt(13) + 1 + day1;\n\t\t\t\tContest d1 = contest[day1];\n\t\t\t\tContest d2 = contest[day2];\n\t\t\t\tint type1 = d1.type, type2 = d2.type;\n\t\t\t\tif (type1 == type2) {\n\t\t\t\t\t-- loop;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tContest day1Last, day2Last;\n\t\t\t\tif (d1.last.day < day2 && day2 < d1.next.day) {\n\t\t\t\t\tday1Last = null;\n\t\t\t\t} else {\n\t\t\t\t\tday1Last = d1;\n\t\t\t\t\twhile(day1Last.next.day < day2) day1Last = day1Last.next;\n\t\t\t\t}\n\t\t\t\tif (d2.last.day < day1 && day1 < d2.next.day ) {\n\t\t\t\t\tday2Last = null;\n\t\t\t\t} else {\n\t\t\t\t\tday2Last = d2;\n\t\t\t\t\twhile(day2Last.last.day >= day1) day2Last = day2Last.last;\n\t\t\t\t\tday2Last = day2Last.last;\n\t\t\t\t}\n\t\t\t\tint change = 0; // 更新されるスコアの増え幅\n\t\t\t\tchange -= s2[day1 * CONTEST + type1];\n\t\t\t\tchange += s2[day2 * CONTEST + type1];\n\t\t\t\tchange += want(type1, d1.next.day - day1);\n\t\t\t\tchange += want(type1, day1 - d1.last.day);\n\t\t\t\tif (day1Last == null) {\n\t\t\t\t\tchange -= want(type1, d1.next.day - day2);\n\t\t\t\t\tchange -= want(type1, day2 - d1.last.day);\n\t\t\t\t} else {\n\t\t\t\t\tchange -= want(type1, d1.next.day - d1.last.day);\n\t\t\t\t\tchange += want(type1, day1Last.next.day - day1Last.day);\n\t\t\t\t\tchange -= want(type1, day1Last.next.day - day2);\n\t\t\t\t\tchange -= want(type1, day2 - day1Last.day);\n\t\t\t\t}\n\t\t\t\tchange -= s2[day2 * CONTEST + type2];\n\t\t\t\tchange += s2[day1 * CONTEST + type2];\n\t\t\t\tchange += want(type2, d2.next.day - day2);\n\t\t\t\tchange += want(type2, day2 - d2.last.day);\n\t\t\t\tif (day2Last == null) {\n\t\t\t\t\tchange -= want(type2, d2.next.day - day1);\n\t\t\t\t\tchange -= want(type2, day1 - d2.last.day);\n\t\t\t\t} else {\n\t\t\t\t\tchange -= want(type2, d2.next.day - d2.last.day);\n\t\t\t\t\tchange += want(type2, day2Last.next.day - day2Last.day);\n\t\t\t\t\tchange -= want(type2, day2Last.next.day - day1);\n\t\t\t\t\tchange -= want(type2, day1 - day2Last.day);\n\t\t\t\t}\n\t\t\t\tif (isChange(change, delay)) {\n\t\t\t\t\tscore += change;\n\t\t\t\t\t//SegmentTree segment1 = segment[type1], segment2 = segment[type2];\n\t\t\t\t\t//segment1.set(day1, null);\n\t\t\t\t\t//segment1.set(day2, d1);\n\t\t\t\t\t//segment2.set(day2, null);\n\t\t\t\t\t//segment2.set(day1, d2);\n\t\t\t\t\tcontest[day2] = d1;\n\t\t\t\t\tcontest[day1] = d2;\n\t\t\t\t\td1.day = day2;\n\t\t\t\t\td2.day = day1;\n\t\t\t\t\tif (day1Last != null) {\n\t\t\t\t\t\td1.last.next = d1.next;\n\t\t\t\t\t\td1.next.last = d1.last;\n\t\t\t\t\t\td1.next = day1Last.next;\n\t\t\t\t\t\td1.last = day1Last;\n\t\t\t\t\t\tday1Last.next.last = d1;\n\t\t\t\t\t\tday1Last.next = d1;\n\t\t\t\t\t}\n\t\t\t\t\tif (day2Last != null) {\n\t\t\t\t\t\td2.last.next = d2.next;\n\t\t\t\t\t\td2.next.last = d2.last;\n\t\t\t\t\t\td2.next = day2Last.next;\n\t\t\t\t\t\td2.last = day2Last;\n\t\t\t\t\t\tday2Last.next.last = d2;\n\t\t\t\t\t\tday2Last.next = d2;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tprivate static final int START_TEMP = 1500; // TODO 焼きなまし関数\n\t\tprivate static final int END_TEMP = 150;\n\t\tprivate static final int DIFF = START_TEMP - END_TEMP;\n\t\tprivate static final double INV_LIMIT = 1.0 / LIMIT;\n\n\t\tprivate boolean isChange(int change, int delay) {\n//\t\t\treturn change >= 0; // 山登り法\n\t\t\tdouble tmp = temperature(delay);\n\t\t\t// return nextDouble() <= Math.exp(change / tmp);\n\t\t\treturn change >= tmp * log[xorshift() & LOG_MASK];\n\t\t}\n\n\t\tprivate static double temperature(int delay) {\n\t\t\treturn DIFF * delay * INV_LIMIT + END_TEMP;\n\t\t}\n\n\t\t@Override\n\t\tpublic void finish() {\n\t\t\tio.debugln(\"loop:\" + loop + \", score:\" + Math.max(1000000 + score, 0));\n\t\t\tfor (int i = 0;i < D;++ i) {\n\t\t\t\tio.println(contest[i].type + 1);\n\t\t\t}\n\t\t}\n\n\t}\n\n\t/** デバッグ用コードのお供に */\n\tprivate static boolean DEBUG = false;\n\t/** 確保するメモリの大きさ(単位: MB)*/\n\tprivate static final long MEMORY = 64;\n\tprivate final FastIO io;\n\n\tpublic static void main(String[] args) {\n\t Thread.setDefaultUncaughtExceptionHandler((t, e) -> e.printStackTrace());\n\t new Thread(null, new Main(), \"\", MEMORY * 1048576).start();\n\t}\n\n\tpublic Main() {\n\t\tthis(new FastIO());\n\t}\n\n\tpublic Main(FastIO io) {\n\t\tthis.io = io;\n\t\tif (DEBUG) {\n\t\t\tio.setAutoFlush(true);\n\t\t\tio.debugln(\"debug mode\");\n\t\t}\n\t}\n\n\t@Override\n\tpublic void run() {\n\t\tsolve(io);\n\t\tio.flush();\n\t}\n\n\t// 以下、ライブラリ\n\n\tprivate static interface MarathonInterface {\n\t\t/**\n\t\t * 標準入力を受け取る関数です。\n\t\t */\n\t\tpublic void read();\n\t\t/**\n\t\t * 受け取った標準入力から、処理しやすいように加工する関数です。\n\t\t */\n\t\tpublic void init();\n\t\t/**\n\t\t * 近傍を探したりなど、毎回更新の処理を行う関数です。\n\t\t * @param delay 残り時間\n\t\t */\n\t\tpublic void update(int delay);\n\t\t/**\n\t\t * 求まった結果を出力する関数です。\n\t\t */\n\t\tpublic void finish();\n\t}\n\n\tprivate static class MarathonTimer implements Runnable {\n\n\t\tprivate MarathonInterface marathon;\n\t\tprivate volatile boolean roopFlag;\n\t\tprivate ScheduledExecutorService threadPool;\n\t\tprivate ScheduledFuture future;\n\n\t\tpublic MarathonTimer(Marathon marathon) {\n\t\t\tthis.marathon = marathon;\n\t\t\tthreadPool = Executors.newScheduledThreadPool(2);\n\t\t\tmarathon.read();\n\t\t}\n\n\t\tpublic void start(int millis) {\n\t\t\tmarathon.init();\n\t\t\troopFlag = true;\n\t\t\tfuture = threadPool.schedule(() -> roopFlag = false, millis, TimeUnit.MILLISECONDS);\n\t\t\tthreadPool.execute(this);\n\t\t\ttry {\n\t\t\t\tthreadPool.awaitTermination(7, TimeUnit.DAYS);\n\t\t\t} catch (InterruptedException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\n\t\t@Override\n\t\tpublic void run() {\n\t\t\twhile(roopFlag) {\n\t\t\t\tint delay = (int)future.getDelay(TimeUnit.MILLISECONDS);\n\t\t\t\tfor (int i = 0;i < 16384;++ i) marathon.update(delay); // TODO 定数ループ増やしすぎるとTLEするので、上手くループ数見て調整して\n\t\t\t}\n\t\t\tmarathon.finish();\n\t\t\tthreadPool.shutdown();\n\t\t}\n\t}\n\n\t/**\n\t * 高速な入出力を提供します。\n\t * @author 31536000\n\t *\n\t */\n\tpublic static class FastIO {\n\t\tprivate InputStream in;\n\t\tprivate final byte[] buffer = new byte[1024];\n\t\tprivate int read = 0;\n\t\tprivate int length = 0;\n\t\tprivate PrintWriter out;\n\t\tprivate PrintWriter err;\n\t\tprivate boolean autoFlush = false;\n\n\t\tpublic FastIO() {\n\t\t\tthis(System.in, System.out, System.err);\n\t\t}\n\n\t\tpublic FastIO(InputStream in, PrintStream out, PrintStream err) {\n\t\t\tthis.in = in;\n\t\t\tthis.out = new PrintWriter(out, false);\n\t\t\tthis.err = new PrintWriter(err, false);\n\t\t}\n\n\t\tpublic final void setInputStream(InputStream in) {\n\t\t\tthis.in = in;\n\t\t}\n\n\t\tpublic final void setInputStream(File in) {\n\t\t\ttry {\n\t\t\t\tthis.in = new FileInputStream(in);\n\t\t\t} catch (FileNotFoundException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\n\t\tpublic final void setOutputStream(PrintStream out) {\n\t\t\tthis.out = new PrintWriter(out, false);\n\t\t}\n\n\t\tpublic final void setOutputStream(File out) {\n\t\t\ttry {\n\t\t\t\tthis.out = new PrintWriter(new FileOutputStream(out), false);\n\t\t\t} catch (FileNotFoundException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\n\t\tpublic final void setErrorStream(PrintStream err) {\n\t\t\tthis.err = new PrintWriter(err, false);\n\t\t}\n\n\t\tpublic final void setErrorStream(File err) {\n\t\t\ttry {\n\t\t\t\tthis.err = new PrintWriter(new FileOutputStream(err), false);\n\t\t\t} catch (FileNotFoundException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\n\t\tpublic final void setAutoFlush(boolean flush) {\n\t\t\tautoFlush = flush;\n\t\t}\n\n\t\tprivate boolean hasNextByte() {\n\t\t\tif (read < length) return true;\n\t\t\tread = 0;\n\t\t\ttry {\n\t\t\t\tlength = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\treturn length > 0;\n\t\t}\n\n\t\tprivate int readByte() {\n\t\t\treturn hasNextByte() ? buffer[read++] : -1;\n\t\t}\n\n\t\tprivate static boolean isPrintableChar(int c) {\n\t\t\treturn 33 <= c && c <= 126;\n\t\t}\n\n\t\tprivate static boolean isNumber(int c) {\n\t\t\treturn '0' <= c && c <= '9';\n\t\t}\n\n\t\tpublic final boolean hasNext() {\n\t\t\twhile (hasNextByte() && !isPrintableChar(buffer[read])) read++;\n\t\t\treturn hasNextByte();\n\t\t}\n\n\t\tpublic final char nextChar() {\n\t\t\tif (!hasNextByte()) throw new NoSuchElementException();\n\t\t\treturn (char)readByte();\n\t\t}\n\n\t\tpublic final char[][] nextChar(int height) {\n\t\t\tchar[][] ret = new char[height][];\n\t\t\tfor (int i = 0;i < ret.length;++ i) ret[i] = next().toCharArray();\n\t\t\treturn ret;\n\t\t}\n\n\t\tpublic final String next() {\n\t\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tint b;\n\t\t\twhile (isPrintableChar(b = readByte())) sb.appendCodePoint(b);\n\t\t\treturn sb.toString();\n\t\t}\n\n\t\tpublic final String nextLine() {\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tint b;\n\t\t\twhile(!isPrintableChar(b = readByte()));\n\t\t\tdo sb.appendCodePoint(b); while(isPrintableChar(b = readByte()) || b == ' ');\n\t\t\treturn sb.toString();\n\t\t}\n\n\t\tpublic final long nextLong() {\n\t\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\t\tlong n = 0;\n\t\t\tboolean minus = false;\n\t\t\tint b = readByte();\n\t\t\tif (b == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\tif (!isNumber(b)) throw new NumberFormatException();\n\t\t\twhile (true) {\n\t\t\t\tif (isNumber(b)) {\n\t\t\t\t\tn *= 10;\n\t\t\t\t\tn += b - '0';\n\t\t\t\t} else if (b == -1 || !isPrintableChar(b)) return minus ? -n : n;\n\t\t\t\telse throw new NumberFormatException();\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t}\n\n\t\tpublic final int nextInt() {\n\t\t\tlong nl = nextLong();\n\t\t\tif (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n\t\t\treturn (int) nl;\n\t\t}\n\n\t\tpublic final double nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tpublic final int[] nextInt(int width) {\n\t\t\tint[] ret = new int[width];\n\t\t\tfor (int i = 0;i < width;++ i) ret[i] = nextInt();\n\t\t\treturn ret;\n\t\t}\n\n\t\tpublic final int[] nextInts() {\n\t\t\treturn nextInts(\" \");\n\t\t}\n\n\t\tpublic final int[] nextInts(String parse) {\n\t\t\tString[] get = nextLine().split(parse);\n\t\t\tint[] ret = new int[get.length];\n\t\t\tfor (int i = 0;i < ret.length;++ i) ret[i] = Integer.valueOf(get[i]);\n\t\t\treturn ret;\n\t\t}\n\n\t\tpublic final long[] nextLong(int width) {\n\t\t\tlong[] ret = new long[width];\n\t\t\tfor (int i = 0;i < width;++ i) ret[i] = nextLong();\n\t\t\treturn ret;\n\t\t}\n\n\t\tpublic final long[] nextLongs() {\n\t\t\treturn nextLongs(\" \");\n\t\t}\n\n\t\tpublic final long[] nextLongs(String parse) {\n\t\t\tString[] get = nextLine().split(parse);\n\t\t\tlong[] ret = new long[get.length];\n\t\t\tfor (int i = 0;i < ret.length;++ i) ret[i] = Long.valueOf(get[i]);\n\t\t\treturn ret;\n\t\t}\n\n\t\tpublic final int[][] nextInt(int width, int height) {\n\t\t\tint[][] ret = new int[height][width];\n\t\t\tfor (int i = 0, j;i < height;++ i) for (j = 0;j < width;++ j) ret[i][j] = nextInt();\n\t\t\treturn ret;\n\t\t}\n\n\t\tpublic final long[][] nextLong(int width, int height) {\n\t\t\tlong[][] ret = new long[height][width];\n\t\t\tfor (int i = 0, j;i < height;++ i) for (j = 0;j < width;++ j) ret[j][i] = nextLong();\n\t\t\treturn ret;\n\t\t}\n\n\t\tpublic final boolean[] nextBoolean(char T) {\n\t\t\tchar[] s = next().toCharArray();\n\t\t\tboolean[] ret = new boolean[s.length];\n\t\t\tfor (int i = 0;i < ret.length;++ i) ret[i] = s[i] == T;\n\t\t\treturn ret;\n\t\t}\n\n\t\tpublic final boolean[][] nextBoolean(char T, int height) {\n\t\t\tboolean[][] ret = new boolean[height][];\n\t\t\tfor (int i = 0;i < ret.length;++ i) {\n\t\t\t\tchar[] s = next().toCharArray();\n\t\t\t\tret[i] = new boolean[s.length];\n\t\t\t\tfor (int j = 0;j < ret[i].length;++ j) ret[i][j] = s[j] == T;\n\t\t\t}\n\t\t\treturn ret;\n\t\t}\n\n\t\tpublic final Point nextPoint() {\n\t\t\treturn new Point(nextInt(), nextInt());\n\t\t}\n\n\t\tpublic final Point[] nextPoint(int width) {\n\t\t\tPoint[] ret = new Point[width];\n\t\t\tfor (int i = 0;i < width;++ i) ret[i] = nextPoint();\n\t\t\treturn ret;\n\t\t}\n\n\t\t@Override\n\t\tprotected void finalize() throws Throwable {\n\t\t\ttry {\n\t\t\t\tsuper.finalize();\n\t\t\t} finally {\n\t\t\t\tin.close();\n\t\t\t\tout.close();\n\t\t\t\terr.close();\n\t\t\t}\n\t\t}\n\n\t\tpublic final boolean print(boolean b) {\n\t\t\tout.print(b);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn b;\n\t\t}\n\n\t\tpublic final Object print(boolean b, Object t, Object f) {\n\t\t\treturn b ? print(t) : print(f);\n\t\t}\n\n\t\tpublic final char print(char c) {\n\t\t\tout.print(c);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn c;\n\t\t}\n\n\t\tpublic final char[] print(char[] s) {\n\t\t\tout.print(s);\n\t\t\treturn s;\n\t\t}\n\n\t\tpublic final double print(double d) {\n\t\t\tout.print(d);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn d;\n\t\t}\n\n\t\tpublic final double print(double d, int length) {\n\t\t\tif (d < 0) {\n\t\t\t\tout.print('-');\n\t\t\t\td = -d;\n\t\t\t}\n\t\t\td += Math.pow(10, -length) / 2;\n\t\t\tout.print((long)d);\n\t\t\tout.print('.');\n\t\t\td -= (long)d;\n\t\t\tfor (int i = 0;i < length;++ i) {\n\t\t\t\td *= 10;\n\t\t\t\tout.print((int)d);\n\t\t\t\td -= (int)d;\n\t\t\t}\n\t\t\tif (autoFlush) flush();\n\t\t\treturn d;\n\t\t}\n\n\t\tpublic final float print(float f) {\n\t\t\tout.print(f);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn f;\n\t\t}\n\n\t\tpublic final int print(int i) {\n\t\t\tout.print(i);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn i;\n\t\t}\n\n\t\tpublic final long print(long l) {\n\t\t\tout.print(l);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn l;\n\t\t}\n\n\t\tpublic final Object print(Object obj) {\n\t\t\tif (obj.getClass().isArray()) {\n\t\t\t\tif (obj instanceof boolean[][]) print(obj, \"\\n\", \" \");\n\t\t\t\telse if (obj instanceof byte[][]) print(obj, \"\\n\", \" \");\n\t\t\t\telse if (obj instanceof short[][]) print(obj, \"\\n\", \" \");\n\t\t\t\telse if (obj instanceof int[][]) print(obj, \"\\n\", \" \");\n\t\t\t\telse if (obj instanceof long[][]) print(obj, \"\\n\", \" \");\n\t\t\t\telse if (obj instanceof float[][]) print(obj, \"\\n\", \" \");\n\t\t\t\telse if (obj instanceof double[][]) print(obj, \"\\n\", \" \");\n\t\t\t\telse if (obj instanceof char[][]) print(obj, \"\\n\", \" \");\n\t\t\t\telse if (obj instanceof Object[][]) print(obj, \"\\n\", \" \");\n\t\t\t\telse print(obj, \" \");\n\t\t\t} else {\n\t\t\t\tout.print(obj);\n\t\t\t\tif (autoFlush) flush();\n\t\t\t}\n\t\t\treturn obj;\n\t\t}\n\n\t\tpublic final String print(String s) {\n\t\t\tout.print(s);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn s;\n\t\t}\n\n\t\tpublic final Object print(Object array, String... parse) {\n\t\t\tprint(array, 0, parse);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn array;\n\t\t}\n\n\t\tprivate final Object print(Object array, int check, String... parse) {\n\t\t\tif (check >= parse.length) {\n\t\t\t\tif (array.getClass().isArray()) throw new IllegalArgumentException(\"not equal dimension\");\n\t\t\t\tprint(array);\n\t\t\t\treturn array;\n\t\t\t}\n\t\t\tString str = parse[check];\n\t\t\tif (array instanceof Object[]) {\n\t\t\t\tObject[] obj = (Object[]) array;\n\t\t\t\tif (obj.length == 0) return array;\n\t\t\t\tprint(obj[0], check + 1, parse);\n\t\t\t\tfor (int i = 1;i < obj.length;++ i) {\n\t\t\t\t\tprint(str);\n\t\t\t\t\tprint(obj[i], check + 1, parse);\n\t\t\t\t}\n\t\t\t\treturn array;\n\t\t\t}\n\t\t\tif (array instanceof Collection) {\n\t\t\t\tIterator iter = ((Collection)array).iterator();\n\t\t\t\tif (!iter.hasNext()) return array;\n\t\t\t\tprint(iter.next(), check + 1, parse);\n\t\t\t\twhile(iter.hasNext()) {\n\t\t\t\t\tprint(str);\n\t\t\t\t\tprint(iter.next(), check + 1, parse);\n\t\t\t\t}\n\t\t\t\treturn array;\n\t\t\t}\n\t\t\tif (!array.getClass().isArray()) throw new IllegalArgumentException(\"not equal dimension\");\n\t\t\tif (check != parse.length - 1) throw new IllegalArgumentException(\"not equal dimension\");\n\t\t\tif (array instanceof boolean[]) {\n\t\t\t\tboolean[] obj = (boolean[]) array;\n\t\t\t\tif (obj.length == 0) return array;\n\t\t\t\tprint(obj[0]);\n\t\t\t\tfor (int i = 1;i < obj.length;++ i) {\n\t\t\t\t\tprint(str);\n\t\t\t\t\tprint(obj[i]);\n\t\t\t\t}\n\t\t\t} else if (array instanceof byte[]) {\n\t\t\t\tbyte[] obj = (byte[]) array;\n\t\t\t\tif (obj.length == 0) return array;\n\t\t\t\tprint(obj[0]);\n\t\t\t\tfor (int i = 1;i < obj.length;++ i) {\n\t\t\t\t\tprint(str);\n\t\t\t\t\tprint(obj[i]);\n\t\t\t\t}\n\t\t\t\treturn array;\n\t\t\t} else if (array instanceof short[]) {\n\t\t\t\tshort[] obj = (short[]) array;\n\t\t\t\tif (obj.length == 0) return array;\n\t\t\t\tprint(obj[0]);\n\t\t\t\tfor (int i = 1;i < obj.length;++ i) {\n\t\t\t\t\tprint(str);\n\t\t\t\t\tprint(obj[i]);\n\t\t\t\t}\n\t\t\t} else if (array instanceof int[]) {\n\t\t\t\tint[] obj = (int[]) array;\n\t\t\t\tif (obj.length == 0) return array;\n\t\t\t\tprint(obj[0]);\n\t\t\t\tfor (int i = 1;i < obj.length;++ i) {\n\t\t\t\t\tprint(str);\n\t\t\t\t\tprint(obj[i]);\n\t\t\t\t}\n\t\t\t} else if (array instanceof long[]) {\n\t\t\t\tlong[] obj = (long[]) array;\n\t\t\t\tif (obj.length == 0) return array;\n\t\t\t\tprint(obj[0]);\n\t\t\t\tfor (int i = 1;i < obj.length;++ i) {\n\t\t\t\t\tprint(str);\n\t\t\t\t\tprint(obj[i]);\n\t\t\t\t}\n\t\t\t} else if (array instanceof float[]) {\n\t\t\t\tfloat[] obj = (float[]) array;\n\t\t\t\tif (obj.length == 0) return array;\n\t\t\t\tprint(obj[0]);\n\t\t\t\tfor (int i = 1;i < obj.length;++ i) {\n\t\t\t\t\tprint(str);\n\t\t\t\t\tprint(obj[i]);\n\t\t\t\t}\n\t\t\t} else if (array instanceof double[]) {\n\t\t\t\tdouble[] obj = (double[]) array;\n\t\t\t\tif (obj.length == 0) return array;\n\t\t\t\tprint(obj[0]);\n\t\t\t\tfor (int i = 1;i < obj.length;++ i) {\n\t\t\t\t\tprint(str);\n\t\t\t\t\tprint(obj[i]);\n\t\t\t\t}\n\t\t\t} else if (array instanceof char[]) {\n\t\t\t\tchar[] obj = (char[]) array;\n\t\t\t\tif (obj.length == 0) return array;\n\t\t\t\tprint(obj[0]);\n\t\t\t\tfor (int i = 1;i < obj.length;++ i) {\n\t\t\t\t\tprint(str);\n\t\t\t\t\tprint(obj[i]);\n\t\t\t\t}\n\t\t\t} else throw new AssertionError();\n\t\t\treturn array;\n\t\t}\n\n\t\tpublic final Object[] print(String parse, Object... args) {\n\t\t\tprint(args[0]);\n\t\t\tfor (int i = 1;i < args.length;++ i) {\n\t\t\t\tprint(parse);\n\t\t\t\tprint(args[i]);\n\t\t\t}\n\t\t\treturn args;\n\t\t}\n\n\t\tpublic final Object[] printf(String format, Object... args) {\n\t\t\tout.printf(format, args);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn args;\n\t\t}\n\n\t\tpublic final Object printf(Locale l, String format, Object... args) {\n\t\t\tout.printf(l, format, args);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn args;\n\t\t}\n\n\t\tpublic final void println() {\n\t\t\tout.println();\n\t\t\tif (autoFlush) flush();\n\t\t}\n\n\t\tpublic final boolean println(boolean b) {\n\t\t\tout.println(b);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn b;\n\t\t}\n\n\t\tpublic final Object println(boolean b, Object t, Object f) {\n\t\t\treturn b ? println(t) : println(f);\n\t\t}\n\n\t\tpublic final char println(char c) {\n\t\t\tout.println(c);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn c;\n\t\t}\n\n\t\tpublic final char[] println(char[] s) {\n\t\t\tout.println(s);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn s;\n\t\t}\n\n\t\tpublic final double println(double d) {\n\t\t\tout.println(d);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn d;\n\t\t}\n\n\t\tpublic final double println(double d, int length) {\n\t\t\tprint(d, length);\n\t\t\tprintln();\n\t\t\treturn d;\n\t\t}\n\n\t\tpublic final float println(float f) {\n\t\t\tout.println(f);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn f;\n\t\t}\n\n\t\tpublic final int println(int i) {\n\t\t\tout.println(i);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn i;\n\t\t}\n\n\t\tpublic final long println(long l) {\n\t\t\tout.println(l);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn l;\n\t\t}\n\n\t\tpublic final Object println(Object obj) {\n\t\t\tprint(obj);\n\t\t\tprintln();\n\t\t\treturn obj;\n\t\t}\n\n\t\tpublic final String println(String s) {\n\t\t\tout.println(s);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn s;\n\t\t}\n\n\t\tpublic final Object println(Object array, String... parse) {\n\t\t\tprint(array, parse);\n\t\t\tprintln();\n\t\t\treturn array;\n\t\t}\n\n\t\tpublic final boolean debug(boolean b) {\n\t\t\terr.print(b);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn b;\n\t\t}\n\n\t\tpublic final Object debug(boolean b, Object t, Object f) {\n\t\t\treturn b ? debug(t) : debug(f);\n\t\t}\n\n\t\tpublic final char debug(char c) {\n\t\t\terr.print(c);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn c;\n\t\t}\n\n\t\tpublic final char[] debug(char[] s) {\n\t\t\terr.print(s);\n\t\t\treturn s;\n\t\t}\n\n\t\tpublic final double debug(double d) {\n\t\t\terr.print(d);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn d;\n\t\t}\n\n\t\tpublic final double debug(double d, int length) {\n\t\t\tif (d < 0) {\n\t\t\t\terr.print('-');\n\t\t\t\td = -d;\n\t\t\t}\n\t\t\td += Math.pow(10, -length) / 2;\n\t\t\terr.print((long)d);\n\t\t\terr.print('.');\n\t\t\td -= (long)d;\n\t\t\tfor (int i = 0;i < length;++ i) {\n\t\t\t\td *= 10;\n\t\t\t\terr.print((int)d);\n\t\t\t\td -= (int)d;\n\t\t\t}\n\t\t\tif (autoFlush) flush();\n\t\t\treturn d;\n\t\t}\n\n\t\tpublic final float debug(float f) {\n\t\t\terr.print(f);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn f;\n\t\t}\n\n\t\tpublic final int debug(int i) {\n\t\t\terr.print(i);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn i;\n\t\t}\n\n\t\tpublic final long debug(long l) {\n\t\t\terr.print(l);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn l;\n\t\t}\n\n\t\tpublic final Object debug(Object obj) {\n\t\t\tif (obj.getClass().isArray()) {\n\t\t\t\tif (obj instanceof boolean[][]) debug(obj, \"\\n\", \" \");\n\t\t\t\telse if (obj instanceof byte[][]) debug(obj, \"\\n\", \" \");\n\t\t\t\telse if (obj instanceof short[][]) debug(obj, \"\\n\", \" \");\n\t\t\t\telse if (obj instanceof int[][]) debug(obj, \"\\n\", \" \");\n\t\t\t\telse if (obj instanceof long[][]) debug(obj, \"\\n\", \" \");\n\t\t\t\telse if (obj instanceof float[][]) debug(obj, \"\\n\", \" \");\n\t\t\t\telse if (obj instanceof double[][]) debug(obj, \"\\n\", \" \");\n\t\t\t\telse if (obj instanceof char[][]) debug(obj, \"\\n\", \" \");\n\t\t\t\telse if (obj instanceof Object[][]) debug(obj, \"\\n\", \" \");\n\t\t\t\telse debug(obj, \" \");\n\t\t\t} else {\n\t\t\t\terr.print(obj);\n\t\t\t\tif (autoFlush) flush();\n\t\t\t}\n\t\t\treturn obj;\n\t\t}\n\n\t\tpublic final String debug(String s) {\n\t\t\terr.print(s);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn s;\n\t\t}\n\n\t\tpublic final Object debug(Object array, String... parse) {\n\t\t\tdebug(array, 0, parse);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn array;\n\t\t}\n\n\t\tprivate final Object debug(Object array, int check, String... parse) {\n\t\t\tif (check >= parse.length) {\n\t\t\t\tif (array.getClass().isArray()) throw new IllegalArgumentException(\"not equal dimension\");\n\t\t\t\tdebug(array);\n\t\t\t\treturn array;\n\t\t\t}\n\t\t\tString str = parse[check];\n\t\t\tif (array instanceof Object[]) {\n\t\t\t\tObject[] obj = (Object[]) array;\n\t\t\t\tif (obj.length == 0) return array;\n\t\t\t\tdebug(obj[0], check + 1, parse);\n\t\t\t\tfor (int i = 1;i < obj.length;++ i) {\n\t\t\t\t\tdebug(str);\n\t\t\t\t\tdebug(obj[i], check + 1, parse);\n\t\t\t\t}\n\t\t\t\treturn array;\n\t\t\t}\n\t\t\tif (array instanceof Collection) {\n\t\t\t\tIterator iter = ((Collection)array).iterator();\n\t\t\t\tif (!iter.hasNext()) return array;\n\t\t\t\tdebug(iter.next(), check + 1, parse);\n\t\t\t\twhile(iter.hasNext()) {\n\t\t\t\t\tdebug(str);\n\t\t\t\t\tdebug(iter.next(), check + 1, parse);\n\t\t\t\t}\n\t\t\t\treturn array;\n\t\t\t}\n\t\t\tif (!array.getClass().isArray()) throw new IllegalArgumentException(\"not equal dimension\");\n\t\t\tif (check != parse.length - 1) throw new IllegalArgumentException(\"not equal dimension\");\n\t\t\tif (array instanceof boolean[]) {\n\t\t\t\tboolean[] obj = (boolean[]) array;\n\t\t\t\tif (obj.length == 0) return array;\n\t\t\t\tdebug(obj[0]);\n\t\t\t\tfor (int i = 1;i < obj.length;++ i) {\n\t\t\t\t\tdebug(str);\n\t\t\t\t\tdebug(obj[i]);\n\t\t\t\t}\n\t\t\t} else if (array instanceof byte[]) {\n\t\t\t\tbyte[] obj = (byte[]) array;\n\t\t\t\tif (obj.length == 0) return array;\n\t\t\t\tdebug(obj[0]);\n\t\t\t\tfor (int i = 1;i < obj.length;++ i) {\n\t\t\t\t\tdebug(str);\n\t\t\t\t\tdebug(obj[i]);\n\t\t\t\t}\n\t\t\t\treturn array;\n\t\t\t} else if (array instanceof short[]) {\n\t\t\t\tshort[] obj = (short[]) array;\n\t\t\t\tif (obj.length == 0) return array;\n\t\t\t\tdebug(obj[0]);\n\t\t\t\tfor (int i = 1;i < obj.length;++ i) {\n\t\t\t\t\tdebug(str);\n\t\t\t\t\tdebug(obj[i]);\n\t\t\t\t}\n\t\t\t} else if (array instanceof int[]) {\n\t\t\t\tint[] obj = (int[]) array;\n\t\t\t\tif (obj.length == 0) return array;\n\t\t\t\tdebug(obj[0]);\n\t\t\t\tfor (int i = 1;i < obj.length;++ i) {\n\t\t\t\t\tdebug(str);\n\t\t\t\t\tdebug(obj[i]);\n\t\t\t\t}\n\t\t\t} else if (array instanceof long[]) {\n\t\t\t\tlong[] obj = (long[]) array;\n\t\t\t\tif (obj.length == 0) return array;\n\t\t\t\tdebug(obj[0]);\n\t\t\t\tfor (int i = 1;i < obj.length;++ i) {\n\t\t\t\t\tdebug(str);\n\t\t\t\t\tdebug(obj[i]);\n\t\t\t\t}\n\t\t\t} else if (array instanceof float[]) {\n\t\t\t\tfloat[] obj = (float[]) array;\n\t\t\t\tif (obj.length == 0) return array;\n\t\t\t\tdebug(obj[0]);\n\t\t\t\tfor (int i = 1;i < obj.length;++ i) {\n\t\t\t\t\tdebug(str);\n\t\t\t\t\tdebug(obj[i]);\n\t\t\t\t}\n\t\t\t} else if (array instanceof double[]) {\n\t\t\t\tdouble[] obj = (double[]) array;\n\t\t\t\tif (obj.length == 0) return array;\n\t\t\t\tdebug(obj[0]);\n\t\t\t\tfor (int i = 1;i < obj.length;++ i) {\n\t\t\t\t\tdebug(str);\n\t\t\t\t\tdebug(obj[i]);\n\t\t\t\t}\n\t\t\t} else if (array instanceof char[]) {\n\t\t\t\tchar[] obj = (char[]) array;\n\t\t\t\tif (obj.length == 0) return array;\n\t\t\t\tdebug(obj[0]);\n\t\t\t\tfor (int i = 1;i < obj.length;++ i) {\n\t\t\t\t\tdebug(str);\n\t\t\t\t\tdebug(obj[i]);\n\t\t\t\t}\n\t\t\t} else throw new AssertionError();\n\t\t\treturn array;\n\t\t}\n\n\t\tpublic final Object[] debug(String parse, Object... args) {\n\t\t\tdebug(args[0]);\n\t\t\tfor (int i = 1;i < args.length;++ i) {\n\t\t\t\tdebug(parse);\n\t\t\t\tdebug(args[i]);\n\t\t\t}\n\t\t\treturn args;\n\t\t}\n\n\t\tpublic final Object[] debugf(String format, Object... args) {\n\t\t\terr.printf(format, args);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn args;\n\t\t}\n\n\t\tpublic final Object debugf(Locale l, String format, Object... args) {\n\t\t\terr.printf(l, format, args);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn args;\n\t\t}\n\n\t\tpublic final void debugln() {\n\t\t\terr.println();\n\t\t\tif (autoFlush) flush();\n\t\t}\n\n\t\tpublic final boolean debugln(boolean b) {\n\t\t\terr.println(b);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn b;\n\t\t}\n\n\t\tpublic final Object debugln(boolean b, Object t, Object f) {\n\t\t\treturn b ? debugln(t) : debugln(f);\n\t\t}\n\n\t\tpublic final char debugln(char c) {\n\t\t\terr.println(c);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn c;\n\t\t}\n\n\t\tpublic final char[] debugln(char[] s) {\n\t\t\terr.println(s);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn s;\n\t\t}\n\n\t\tpublic final double debugln(double d) {\n\t\t\terr.println(d);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn d;\n\t\t}\n\n\t\tpublic final double debugln(double d, int length) {\n\t\t\tdebug(d, length);\n\t\t\tdebugln();\n\t\t\treturn d;\n\t\t}\n\n\t\tpublic final float debugln(float f) {\n\t\t\terr.println(f);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn f;\n\t\t}\n\n\t\tpublic final int debugln(int i) {\n\t\t\terr.println(i);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn i;\n\t\t}\n\n\t\tpublic final long debugln(long l) {\n\t\t\terr.println(l);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn l;\n\t\t}\n\n\t\tpublic final Object debugln(Object obj) {\n\t\t\tdebug(obj);\n\t\t\tdebugln();\n\t\t\treturn obj;\n\t\t}\n\n\t\tpublic final String debugln(String s) {\n\t\t\terr.println(s);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn s;\n\t\t}\n\n\t\tpublic final Object debugln(Object array, String... parse) {\n\t\t\tdebug(array, parse);\n\t\t\tdebugln();\n\t\t\treturn array;\n\t\t}\n\n\t\tpublic final void flush() {\n\t\t\tout.flush();\n\t\t\terr.flush();\n\t\t}\n\t}\n}\n", "language": "Java", "metadata": {"date": 1593474035, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02618.html", "problem_id": "p02618", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02618/input.txt", "sample_output_relpath": "derived/input_output/data/p02618/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02618/Java/s208773646.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s208773646", "user_id": "u550314572"}, "prompt_components": {"gold_output": "1\n17\n13\n14\n13\n", "input_to_evaluate": "\nimport java.awt.Point;\nimport java.io.File;\nimport java.io.FileInputStream;\nimport java.io.FileNotFoundException;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Iterator;\nimport java.util.Locale;\nimport java.util.NoSuchElementException;\nimport java.util.Random;\nimport java.util.concurrent.Executors;\nimport java.util.concurrent.ScheduledExecutorService;\nimport java.util.concurrent.ScheduledFuture;\nimport java.util.concurrent.TimeUnit;\n\npublic class Main implements Runnable{\n\n\tprivate static final int LIMIT = 1800; // ループで回せる時間\n\tprivate static void solve(FastIO io) {\n\t\t/*\n\t\t * author: 31536000\n\t\t * Introduction to Heuristics Contest A問題\n\t\t * 考察メモ\n\t\t * まず、各日に決められるコンテストは高々1つなので、それを焼きなましすることを考える\n\t\t * ここで、ある日に開くコンテストを変えた場合に変わる情報は次に開催するlastだけ\n\t\t * 従って、更新はO(1)で行えるはず\n\t\t *\n\t\t * 実際に更新をO(1)で行う方法を考える\n\t\t * データ構造として、双方向連結リストを考える\n\t\t * 各日のコンテストは、直前と直後に開催されたコンテストを記録する\n\t\t * この時、ある日のコンテストの種類を変更することは次のように表される\n\t\t * 1. そのコンテストのスコアを減らす\n\t\t * 2. そのコンテストの次に開かれた同じコンテストの直前コンテストを更新し、スコアを更新する(減らす)\n\t\t * 3. コンテストを変更し、スコアを増やす\n\t\t * 4. 直前と直後を繋ぐ…えー、O(D)やん、もっと速くならない?\n\t\t *\n\t\t * 次の情報: d日目以前に開かれたi番目のコンテストのうち、一番最後の物を求める\n\t\t * これは、計算量O(logN) (TreeSet)以外にできるか?\n\t\t * 区間max/一点更新で解けそうじゃない?\n\t\t * つまり、一点更新で開かれたコンテストのポインタを入れれば、区間maxが最後のもの\n\t\t * nullは最小、両方が非nullなら右側優先でおっけー\n\t\t */\n\t\tio.setAutoFlush(true);\n\t\tMarathon marathon = new Marathon(io);\n\t\tMarathonTimer timer = new MarathonTimer(marathon);\n\t\ttimer.start(LIMIT);\n\t}\n\n\tprivate static class Marathon implements MarathonInterface {\n\t\tprivate FastIO io;\n\t\tprivate Random rnd;\n\t\tprivate int loop;\n\n\t\tprivate static final int CONTEST = 26;\n\t\tprivate final int D;\n\t\tprivate final int HALF_OF_D;\n\t\tprivate final int[] c;\n\t\tprivate final int[][] s;\n\t\tprivate final int[] s2; // sを展開したもの、少し速くなると嬉しい……\n\n\t\tprivate final Contest[] contest; // D日目に開かれたコンテスト\n\t\t// private final SegmentTree[] segment; // 各コンテストを高速検索するためのRMQ\n\n\t\tprivate final Contest[] begin, end; // 各コンテストの連結リストの端\n\n\t\tint score;\n\n\t\tclass Contest {\n\t\t\tContest last, next;\n\t\t\tint day, type;\n\t\t\tContest(int day, int type) {\n\t\t\t\tthis.type = type;\n\t\t\t\tthis.day = day;\n\t\t\t\tlast = next = this;\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic String toString() {\n\t\t\t\treturn \"Contest \" + type + \" is held \" + day;\n\t\t\t}\n\t\t}\n\n\t\t/*private class SegmentTree {\n\t\t\tprivate Contest[] tree;\n\t\t\tprivate final int size;\n\t\t\tprivate final Contest MIN, MAX;\n\t\t\tpublic SegmentTree(int type) {\n\t\t\t\tsize = Integer.highestOneBit(D + 1) << 1;\n\t\t\t\ttree = new Contest[size * 2];\n\t\t\t\ttree[size] = MIN = new Contest(-1, type);\n\t\t\t\ttree[tree.length - 1] = MAX = new Contest(D, type);\n\t\t\t}\n\t\t\tpublic final void set(int index, final Contest contest) {\n\t\t\t\tindex += size + 1;\n\t\t\t\ttree[index] = contest;\n\t\t\t\twhile(index != 0) {\n\t\t\t\t\tindex >>= 1;\n\t\t\t\t\tContest right = tree[index << 1 | 1];\n\t\t\t\t\ttree[index] = right == null ? tree[index << 1] : right;\n\t\t\t\t}\n\t\t\t}\n\t\t\tpublic final Contest get() {\n\t\t\t\treturn MAX;\n\t\t\t}\n\t\t\tpublic final Contest get(int toIndex) {\n\t\t\t\tint fromIndex = size;\n\t\t\t\ttoIndex += size;\n\t\t\t\twhile(fromIndex <= toIndex) {\n\t\t\t\t\tif ((toIndex & 1) == 0) {\n\t\t\t\t\t\tContest right = tree[toIndex];\n\t\t\t\t\t\tif (right != null) return right;\n\t\t\t\t\t\t-- toIndex;\n\t\t\t\t\t}\n\t\t\t\t\tfromIndex >>= 1;\n\t\t\t\t\ttoIndex >>= 1;\n\t\t\t\t}\n\t\t\t\treturn MIN;\n\t\t\t}\n\t\t}*/\n\n\t\tpublic Marathon(FastIO io) {\n\t\t\tthis.io = io;\n\t\t\trnd = new Random();\n\t\t\tD = io.nextInt();\n\t\t\tHALF_OF_D = D >> 1;\n\t\t\tc = io.nextInt(CONTEST);\n\t\t\ts = io.nextInt(CONTEST, D);\n\t\t\ts2 = new int[CONTEST * D];\n\t\t\tfor (int i = 0;i < D;++ i) {\n\t\t\t\tfor (int j = 0;j < CONTEST;++ j) s2[i * CONTEST + j] = s[i][j];\n\t\t\t}\n\t\t\tcontest = new Contest[D];\n\t\t\t//segment = new SegmentTree[CONTEST];\n\t\t\t//for (int i = 0;i < CONTEST;++ i) segment[i] = new SegmentTree(i);\n\t\t\tbegin = new Contest[CONTEST];\n\t\t\tend = new Contest[CONTEST];\n\t\t\tfor (int i = 0;i < CONTEST;++ i) {\n\t\t\t\tbegin[i] = new Contest(-1, i);\n\t\t\t\tend[i] = new Contest(D, i);\n\t\t\t}\n\t\t}\n\n\t\tprivate int want(final int contest, final int wait) {\n\t\t\treturn c[contest] * wait * (wait - 1) >> 1;\n\t\t}\n\n\t\t@Override\n\t\tpublic void read() {\n\t\t}\n\n\t\t@Override\n\t\tpublic void init() {\n\t\t\tloop = 0;\n\n\t\t\t// 貪欲法で構築しておく\n\t\t\tContest[] last = Arrays.copyOf(begin, CONTEST); // 最後に開かれたタイミング\n\t\t\tfor (int i = 0;i < D;++ i) {\n\t\t\t\tint max = 0, maxScore = -1;\n\t\t\t\tfor (int j = 0;j < CONTEST;++ j) {\n\t\t\t\t\tint score = s2[i * CONTEST + j] + c[j] * (i - last[j].day);\n\t\t\t\t\tif (maxScore < score) {\n\t\t\t\t\t\tmaxScore = score;\n\t\t\t\t\t\tmax = j;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcontest[i] = new Contest(i, max);\n\t\t\t\tcontest[i].last = last[max];\n\t\t\t\tcontest[i].last.next = contest[i];\n\t\t\t\tlast[max] = contest[i];\n\t\t\t\tscore += s2[i * CONTEST + max];\n\t\t\t\tscore -= want(max, i - contest[i].last.day);\n\t\t\t}\n\t\t\tfor (int i = 0;i < CONTEST;++ i) {\n\t\t\t\tContest tmp = end[i];\n\t\t\t\ttmp.last = last[i];\n\t\t\t\ttmp.last.next = tmp;\n\t\t\t\tscore -= want(i, D - tmp.last.day);\n\t\t\t}\n\t\t\tseed = rnd.nextInt();\n\t\t\tfor (int i = 0;i < log.length;++ i) log[i] = Math.log(nextDouble());\n\t\t}\n\n\t\tprivate int seed;\n\t\tprivate static final int XOR_MASK = 0x7FFFFFFF;\n\t\tprivate static final int LOG_SIZE = 1 << 10;\n\t\tprivate static final int LOG_MASK = LOG_SIZE - 1;\n\t\tfinal double[] log = new double[LOG_SIZE];\n\t\tint xorshift() {\n\t\t\tseed = seed ^ (seed << 13);\n\t\t\tseed = seed ^ (seed >>> 17);\n\t\t\treturn seed = seed ^ (seed << 5);\n\t\t}\n\n\t\tpublic int nextInt(int bound) {\n\t\t\treturn (xorshift() & XOR_MASK) % bound;\n\t\t}\n\n\t\t/*public final int nextInt(int bound) {\n\t\t\tint bits, val;\n\t\t\tdo {\n\t\t\t\tbits = xorshift() & XOR_MASK;\n\t\t\t\tval = bits % bound;\n\t\t\t} while (bits - val + (bound - 1) < 0);\n\t\t\treturn val;\n\t\t}*/\n\n\t\tprivate static final double RND_DOUBLE_INV = 1.0 / (1L << 53);\n\t\tpublic final double nextDouble() {\n\t\t\treturn (((xorshift() & 0x03FFFFFFL) << 27) + (xorshift() & 0x07FFFFFF)) * RND_DOUBLE_INV;\n\t\t}\n\n\t\tprivate static final int NEARLY_INV_LIMIT = 32 - Integer.numberOfLeadingZeros(LIMIT - 1);\n\t\t@Override\n\t\tpublic final void update(int delay) { // TODO UPDATE\n\t\t\t++ loop;\n\n\t\t\tint patturn = nextInt(101 - (delay * 90 >> NEARLY_INV_LIMIT));\n\t\t\tif (patturn < 9) { // パターン1: 特定の日付のコンテストの種類を変える\n\t\t\t\tint day = nextInt(D);\n\t\t\t\tint swap = nextInt(CONTEST - 1);\n\t\t\t\tContest now = contest[day];\n\t\t\t\tint type = now.type;\n\t\t\t\tif (swap >= now.type) ++ swap;\n\n\t\t\t\tint change = 0; // 更新されるスコアの増え幅\n\t\t\t\tchange += want(type, day - now.last.day); // 元々の値\n\t\t\t\tchange += want(type, now.next.day - day); // 元々の値\n\t\t\t\tchange -= want(type, now.next.day - now.last.day);\n\t\t\t\tchange -= s2[day * CONTEST + type];\n\t\t\t\tContest swapNext;\n\t\t\t\tif (day <= HALF_OF_D) {\n\t\t\t\t\tswapNext = begin[swap];\n\t\t\t\t\twhile(swapNext.day < day) swapNext = swapNext.next;\n\t\t\t\t} else {\n\t\t\t\t\tswapNext = end[swap];\n\t\t\t\t\twhile(swapNext.last.day > day) swapNext = swapNext.last;\n\t\t\t\t}\n\t\t\t\tchange += want(swap, swapNext.day - swapNext.last.day); // 元々の値\n\t\t\t\tchange -= want(swap, swapNext.day - day);\n\t\t\t\tchange -= want(swap, day - swapNext.last.day);\n\t\t\t\tchange += s2[day * CONTEST + swap];\n\t\t\t\tif (isChange(change, delay)) {\n\t\t\t\t\tscore += change;\n\t\t\t\t\tnow.type = swap;\n\t\t\t\t\tnow.next.last = now.last;\n\t\t\t\t\tnow.last.next = now.next;\n\t\t\t\t\tswapNext.last.next = now;\n\t\t\t\t\tnow.last = swapNext.last;\n\t\t\t\t\tswapNext.last = now;\n\t\t\t\t\tnow.next = swapNext;\n\t\t\t\t}\n\t\t\t /* } else if (patturn < 20){ // パターン2: 二つのコンテストの日付を入れ替える\n\t\t\t\tint day1 = nextInt(D);\n\t\t\t\tint day2 = nextInt(D - 1);\n\t\t\t\tif (day2 >= day1) ++ day2;\n\t\t\t\tContest d1 = contest[day1];\n\t\t\t\tContest d2 = contest[day2];\n\t\t\t\tint type1 = d1.type, type2 = d2.type;\n\t\t\t\tSegmentTree segment1 = segment[type1], segment2 = segment[type2];\n\t\t\t\tif (d1.type == d2.type) {\n\t\t\t\t\t-- loop;\n\t\t\t\t\treturn; // swapするだけ無駄\n\t\t\t\t}\n\t\t\t\tContest day1Last = d1.last.day < day2 && day2 < d1.next.day ? null : segment1.get(day2);\n\t\t\t\tContest day2Last = d2.last.day < day1 && day1 < d2.next.day ? null : segment2.get(day1);\n\t\t\t\tint change = 0; // 更新されるスコアの増え幅\n\t\t\t\tchange -= s2[day1 * CONTEST + type1];\n\t\t\t\tchange += s2[day2 * CONTEST + type1];\n\t\t\t\tchange += want(type1, d1.next.day - day1);\n\t\t\t\tchange += want(type1, day1 - d1.last.day);\n\t\t\t\tif (day1Last == null) {\n\t\t\t\t\tchange -= want(type1, d1.next.day - day2);\n\t\t\t\t\tchange -= want(type1, day2 - d1.last.day);\n\t\t\t\t} else {\n\t\t\t\t\tchange -= want(type1, d1.next.day - d1.last.day);\n\t\t\t\t\tchange += want(type1, day1Last.next.day - day1Last.day);\n\t\t\t\t\tchange -= want(type1, day1Last.next.day - day2);\n\t\t\t\t\tchange -= want(type1, day2 - day1Last.day);\n\t\t\t\t}\n\t\t\t\tchange -= s2[day2 * CONTEST + type2];\n\t\t\t\tchange += s2[day1 * CONTEST + type2];\n\t\t\t\tchange += want(type2, d2.next.day - day2);\n\t\t\t\tchange += want(type2, day2 - d2.last.day);\n\t\t\t\tif (day2Last == null) {\n\t\t\t\t\tchange -= want(type2, d2.next.day - day1);\n\t\t\t\t\tchange -= want(type2, day1 - d2.last.day);\n\t\t\t\t} else {\n\t\t\t\t\tchange -= want(type2, d2.next.day - d2.last.day);\n\t\t\t\t\tchange += want(type2, day2Last.next.day - day2Last.day);\n\t\t\t\t\tchange -= want(type2, day2Last.next.day - day1);\n\t\t\t\t\tchange -= want(type2, day1 - day2Last.day);\n\t\t\t\t}\n\t\t\t\tif (isChange(change, delay)) {\n\t\t\t\t\tscore += change;\n\t\t\t\t\tsegment1.set(day1, null);\n\t\t\t\t\tsegment1.set(day2, d1);\n\t\t\t\t\tsegment2.set(day2, null);\n\t\t\t\t\tsegment2.set(day1, d2);\n\t\t\t\t\tcontest[day2] = d1;\n\t\t\t\t\tcontest[day1] = d2;\n\t\t\t\t\td1.day = day2;\n\t\t\t\t\td2.day = day1;\n\t\t\t\t\tif (day1Last != null) {\n\t\t\t\t\t\td1.last.next = d1.next;\n\t\t\t\t\t\td1.next.last = d1.last;\n\t\t\t\t\t\td1.next = day1Last.next;\n\t\t\t\t\t\td1.last = day1Last;\n\t\t\t\t\t\tday1Last.next.last = d1;\n\t\t\t\t\t\tday1Last.next = d1;\n\t\t\t\t\t}\n\t\t\t\t\tif (day2Last != null) {\n\t\t\t\t\t\td2.last.next = d2.next;\n\t\t\t\t\t\td2.next.last = d2.last;\n\t\t\t\t\t\td2.next = day2Last.next;\n\t\t\t\t\t\td2.last = day2Last;\n\t\t\t\t\t\tday2Last.next.last = d2;\n\t\t\t\t\t\tday2Last.next = d2;\n\t\t\t\t\t}\n\t\t\t\t} // */\n\t\t\t} else { // パターン3: 近いコンテストを入れ替える\n\t\t\t\tint day1 = nextInt(D - 13);\n\t\t\t\tint day2 = nextInt(13) + 1 + day1;\n\t\t\t\tContest d1 = contest[day1];\n\t\t\t\tContest d2 = contest[day2];\n\t\t\t\tint type1 = d1.type, type2 = d2.type;\n\t\t\t\tif (type1 == type2) {\n\t\t\t\t\t-- loop;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tContest day1Last, day2Last;\n\t\t\t\tif (d1.last.day < day2 && day2 < d1.next.day) {\n\t\t\t\t\tday1Last = null;\n\t\t\t\t} else {\n\t\t\t\t\tday1Last = d1;\n\t\t\t\t\twhile(day1Last.next.day < day2) day1Last = day1Last.next;\n\t\t\t\t}\n\t\t\t\tif (d2.last.day < day1 && day1 < d2.next.day ) {\n\t\t\t\t\tday2Last = null;\n\t\t\t\t} else {\n\t\t\t\t\tday2Last = d2;\n\t\t\t\t\twhile(day2Last.last.day >= day1) day2Last = day2Last.last;\n\t\t\t\t\tday2Last = day2Last.last;\n\t\t\t\t}\n\t\t\t\tint change = 0; // 更新されるスコアの増え幅\n\t\t\t\tchange -= s2[day1 * CONTEST + type1];\n\t\t\t\tchange += s2[day2 * CONTEST + type1];\n\t\t\t\tchange += want(type1, d1.next.day - day1);\n\t\t\t\tchange += want(type1, day1 - d1.last.day);\n\t\t\t\tif (day1Last == null) {\n\t\t\t\t\tchange -= want(type1, d1.next.day - day2);\n\t\t\t\t\tchange -= want(type1, day2 - d1.last.day);\n\t\t\t\t} else {\n\t\t\t\t\tchange -= want(type1, d1.next.day - d1.last.day);\n\t\t\t\t\tchange += want(type1, day1Last.next.day - day1Last.day);\n\t\t\t\t\tchange -= want(type1, day1Last.next.day - day2);\n\t\t\t\t\tchange -= want(type1, day2 - day1Last.day);\n\t\t\t\t}\n\t\t\t\tchange -= s2[day2 * CONTEST + type2];\n\t\t\t\tchange += s2[day1 * CONTEST + type2];\n\t\t\t\tchange += want(type2, d2.next.day - day2);\n\t\t\t\tchange += want(type2, day2 - d2.last.day);\n\t\t\t\tif (day2Last == null) {\n\t\t\t\t\tchange -= want(type2, d2.next.day - day1);\n\t\t\t\t\tchange -= want(type2, day1 - d2.last.day);\n\t\t\t\t} else {\n\t\t\t\t\tchange -= want(type2, d2.next.day - d2.last.day);\n\t\t\t\t\tchange += want(type2, day2Last.next.day - day2Last.day);\n\t\t\t\t\tchange -= want(type2, day2Last.next.day - day1);\n\t\t\t\t\tchange -= want(type2, day1 - day2Last.day);\n\t\t\t\t}\n\t\t\t\tif (isChange(change, delay)) {\n\t\t\t\t\tscore += change;\n\t\t\t\t\t//SegmentTree segment1 = segment[type1], segment2 = segment[type2];\n\t\t\t\t\t//segment1.set(day1, null);\n\t\t\t\t\t//segment1.set(day2, d1);\n\t\t\t\t\t//segment2.set(day2, null);\n\t\t\t\t\t//segment2.set(day1, d2);\n\t\t\t\t\tcontest[day2] = d1;\n\t\t\t\t\tcontest[day1] = d2;\n\t\t\t\t\td1.day = day2;\n\t\t\t\t\td2.day = day1;\n\t\t\t\t\tif (day1Last != null) {\n\t\t\t\t\t\td1.last.next = d1.next;\n\t\t\t\t\t\td1.next.last = d1.last;\n\t\t\t\t\t\td1.next = day1Last.next;\n\t\t\t\t\t\td1.last = day1Last;\n\t\t\t\t\t\tday1Last.next.last = d1;\n\t\t\t\t\t\tday1Last.next = d1;\n\t\t\t\t\t}\n\t\t\t\t\tif (day2Last != null) {\n\t\t\t\t\t\td2.last.next = d2.next;\n\t\t\t\t\t\td2.next.last = d2.last;\n\t\t\t\t\t\td2.next = day2Last.next;\n\t\t\t\t\t\td2.last = day2Last;\n\t\t\t\t\t\tday2Last.next.last = d2;\n\t\t\t\t\t\tday2Last.next = d2;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tprivate static final int START_TEMP = 1500; // TODO 焼きなまし関数\n\t\tprivate static final int END_TEMP = 150;\n\t\tprivate static final int DIFF = START_TEMP - END_TEMP;\n\t\tprivate static final double INV_LIMIT = 1.0 / LIMIT;\n\n\t\tprivate boolean isChange(int change, int delay) {\n//\t\t\treturn change >= 0; // 山登り法\n\t\t\tdouble tmp = temperature(delay);\n\t\t\t// return nextDouble() <= Math.exp(change / tmp);\n\t\t\treturn change >= tmp * log[xorshift() & LOG_MASK];\n\t\t}\n\n\t\tprivate static double temperature(int delay) {\n\t\t\treturn DIFF * delay * INV_LIMIT + END_TEMP;\n\t\t}\n\n\t\t@Override\n\t\tpublic void finish() {\n\t\t\tio.debugln(\"loop:\" + loop + \", score:\" + Math.max(1000000 + score, 0));\n\t\t\tfor (int i = 0;i < D;++ i) {\n\t\t\t\tio.println(contest[i].type + 1);\n\t\t\t}\n\t\t}\n\n\t}\n\n\t/** デバッグ用コードのお供に */\n\tprivate static boolean DEBUG = false;\n\t/** 確保するメモリの大きさ(単位: MB)*/\n\tprivate static final long MEMORY = 64;\n\tprivate final FastIO io;\n\n\tpublic static void main(String[] args) {\n\t Thread.setDefaultUncaughtExceptionHandler((t, e) -> e.printStackTrace());\n\t new Thread(null, new Main(), \"\", MEMORY * 1048576).start();\n\t}\n\n\tpublic Main() {\n\t\tthis(new FastIO());\n\t}\n\n\tpublic Main(FastIO io) {\n\t\tthis.io = io;\n\t\tif (DEBUG) {\n\t\t\tio.setAutoFlush(true);\n\t\t\tio.debugln(\"debug mode\");\n\t\t}\n\t}\n\n\t@Override\n\tpublic void run() {\n\t\tsolve(io);\n\t\tio.flush();\n\t}\n\n\t// 以下、ライブラリ\n\n\tprivate static interface MarathonInterface {\n\t\t/**\n\t\t * 標準入力を受け取る関数です。\n\t\t */\n\t\tpublic void read();\n\t\t/**\n\t\t * 受け取った標準入力から、処理しやすいように加工する関数です。\n\t\t */\n\t\tpublic void init();\n\t\t/**\n\t\t * 近傍を探したりなど、毎回更新の処理を行う関数です。\n\t\t * @param delay 残り時間\n\t\t */\n\t\tpublic void update(int delay);\n\t\t/**\n\t\t * 求まった結果を出力する関数です。\n\t\t */\n\t\tpublic void finish();\n\t}\n\n\tprivate static class MarathonTimer implements Runnable {\n\n\t\tprivate MarathonInterface marathon;\n\t\tprivate volatile boolean roopFlag;\n\t\tprivate ScheduledExecutorService threadPool;\n\t\tprivate ScheduledFuture future;\n\n\t\tpublic MarathonTimer(Marathon marathon) {\n\t\t\tthis.marathon = marathon;\n\t\t\tthreadPool = Executors.newScheduledThreadPool(2);\n\t\t\tmarathon.read();\n\t\t}\n\n\t\tpublic void start(int millis) {\n\t\t\tmarathon.init();\n\t\t\troopFlag = true;\n\t\t\tfuture = threadPool.schedule(() -> roopFlag = false, millis, TimeUnit.MILLISECONDS);\n\t\t\tthreadPool.execute(this);\n\t\t\ttry {\n\t\t\t\tthreadPool.awaitTermination(7, TimeUnit.DAYS);\n\t\t\t} catch (InterruptedException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\n\t\t@Override\n\t\tpublic void run() {\n\t\t\twhile(roopFlag) {\n\t\t\t\tint delay = (int)future.getDelay(TimeUnit.MILLISECONDS);\n\t\t\t\tfor (int i = 0;i < 16384;++ i) marathon.update(delay); // TODO 定数ループ増やしすぎるとTLEするので、上手くループ数見て調整して\n\t\t\t}\n\t\t\tmarathon.finish();\n\t\t\tthreadPool.shutdown();\n\t\t}\n\t}\n\n\t/**\n\t * 高速な入出力を提供します。\n\t * @author 31536000\n\t *\n\t */\n\tpublic static class FastIO {\n\t\tprivate InputStream in;\n\t\tprivate final byte[] buffer = new byte[1024];\n\t\tprivate int read = 0;\n\t\tprivate int length = 0;\n\t\tprivate PrintWriter out;\n\t\tprivate PrintWriter err;\n\t\tprivate boolean autoFlush = false;\n\n\t\tpublic FastIO() {\n\t\t\tthis(System.in, System.out, System.err);\n\t\t}\n\n\t\tpublic FastIO(InputStream in, PrintStream out, PrintStream err) {\n\t\t\tthis.in = in;\n\t\t\tthis.out = new PrintWriter(out, false);\n\t\t\tthis.err = new PrintWriter(err, false);\n\t\t}\n\n\t\tpublic final void setInputStream(InputStream in) {\n\t\t\tthis.in = in;\n\t\t}\n\n\t\tpublic final void setInputStream(File in) {\n\t\t\ttry {\n\t\t\t\tthis.in = new FileInputStream(in);\n\t\t\t} catch (FileNotFoundException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\n\t\tpublic final void setOutputStream(PrintStream out) {\n\t\t\tthis.out = new PrintWriter(out, false);\n\t\t}\n\n\t\tpublic final void setOutputStream(File out) {\n\t\t\ttry {\n\t\t\t\tthis.out = new PrintWriter(new FileOutputStream(out), false);\n\t\t\t} catch (FileNotFoundException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\n\t\tpublic final void setErrorStream(PrintStream err) {\n\t\t\tthis.err = new PrintWriter(err, false);\n\t\t}\n\n\t\tpublic final void setErrorStream(File err) {\n\t\t\ttry {\n\t\t\t\tthis.err = new PrintWriter(new FileOutputStream(err), false);\n\t\t\t} catch (FileNotFoundException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\n\t\tpublic final void setAutoFlush(boolean flush) {\n\t\t\tautoFlush = flush;\n\t\t}\n\n\t\tprivate boolean hasNextByte() {\n\t\t\tif (read < length) return true;\n\t\t\tread = 0;\n\t\t\ttry {\n\t\t\t\tlength = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\treturn length > 0;\n\t\t}\n\n\t\tprivate int readByte() {\n\t\t\treturn hasNextByte() ? buffer[read++] : -1;\n\t\t}\n\n\t\tprivate static boolean isPrintableChar(int c) {\n\t\t\treturn 33 <= c && c <= 126;\n\t\t}\n\n\t\tprivate static boolean isNumber(int c) {\n\t\t\treturn '0' <= c && c <= '9';\n\t\t}\n\n\t\tpublic final boolean hasNext() {\n\t\t\twhile (hasNextByte() && !isPrintableChar(buffer[read])) read++;\n\t\t\treturn hasNextByte();\n\t\t}\n\n\t\tpublic final char nextChar() {\n\t\t\tif (!hasNextByte()) throw new NoSuchElementException();\n\t\t\treturn (char)readByte();\n\t\t}\n\n\t\tpublic final char[][] nextChar(int height) {\n\t\t\tchar[][] ret = new char[height][];\n\t\t\tfor (int i = 0;i < ret.length;++ i) ret[i] = next().toCharArray();\n\t\t\treturn ret;\n\t\t}\n\n\t\tpublic final String next() {\n\t\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tint b;\n\t\t\twhile (isPrintableChar(b = readByte())) sb.appendCodePoint(b);\n\t\t\treturn sb.toString();\n\t\t}\n\n\t\tpublic final String nextLine() {\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tint b;\n\t\t\twhile(!isPrintableChar(b = readByte()));\n\t\t\tdo sb.appendCodePoint(b); while(isPrintableChar(b = readByte()) || b == ' ');\n\t\t\treturn sb.toString();\n\t\t}\n\n\t\tpublic final long nextLong() {\n\t\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\t\tlong n = 0;\n\t\t\tboolean minus = false;\n\t\t\tint b = readByte();\n\t\t\tif (b == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\tif (!isNumber(b)) throw new NumberFormatException();\n\t\t\twhile (true) {\n\t\t\t\tif (isNumber(b)) {\n\t\t\t\t\tn *= 10;\n\t\t\t\t\tn += b - '0';\n\t\t\t\t} else if (b == -1 || !isPrintableChar(b)) return minus ? -n : n;\n\t\t\t\telse throw new NumberFormatException();\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t}\n\n\t\tpublic final int nextInt() {\n\t\t\tlong nl = nextLong();\n\t\t\tif (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n\t\t\treturn (int) nl;\n\t\t}\n\n\t\tpublic final double nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tpublic final int[] nextInt(int width) {\n\t\t\tint[] ret = new int[width];\n\t\t\tfor (int i = 0;i < width;++ i) ret[i] = nextInt();\n\t\t\treturn ret;\n\t\t}\n\n\t\tpublic final int[] nextInts() {\n\t\t\treturn nextInts(\" \");\n\t\t}\n\n\t\tpublic final int[] nextInts(String parse) {\n\t\t\tString[] get = nextLine().split(parse);\n\t\t\tint[] ret = new int[get.length];\n\t\t\tfor (int i = 0;i < ret.length;++ i) ret[i] = Integer.valueOf(get[i]);\n\t\t\treturn ret;\n\t\t}\n\n\t\tpublic final long[] nextLong(int width) {\n\t\t\tlong[] ret = new long[width];\n\t\t\tfor (int i = 0;i < width;++ i) ret[i] = nextLong();\n\t\t\treturn ret;\n\t\t}\n\n\t\tpublic final long[] nextLongs() {\n\t\t\treturn nextLongs(\" \");\n\t\t}\n\n\t\tpublic final long[] nextLongs(String parse) {\n\t\t\tString[] get = nextLine().split(parse);\n\t\t\tlong[] ret = new long[get.length];\n\t\t\tfor (int i = 0;i < ret.length;++ i) ret[i] = Long.valueOf(get[i]);\n\t\t\treturn ret;\n\t\t}\n\n\t\tpublic final int[][] nextInt(int width, int height) {\n\t\t\tint[][] ret = new int[height][width];\n\t\t\tfor (int i = 0, j;i < height;++ i) for (j = 0;j < width;++ j) ret[i][j] = nextInt();\n\t\t\treturn ret;\n\t\t}\n\n\t\tpublic final long[][] nextLong(int width, int height) {\n\t\t\tlong[][] ret = new long[height][width];\n\t\t\tfor (int i = 0, j;i < height;++ i) for (j = 0;j < width;++ j) ret[j][i] = nextLong();\n\t\t\treturn ret;\n\t\t}\n\n\t\tpublic final boolean[] nextBoolean(char T) {\n\t\t\tchar[] s = next().toCharArray();\n\t\t\tboolean[] ret = new boolean[s.length];\n\t\t\tfor (int i = 0;i < ret.length;++ i) ret[i] = s[i] == T;\n\t\t\treturn ret;\n\t\t}\n\n\t\tpublic final boolean[][] nextBoolean(char T, int height) {\n\t\t\tboolean[][] ret = new boolean[height][];\n\t\t\tfor (int i = 0;i < ret.length;++ i) {\n\t\t\t\tchar[] s = next().toCharArray();\n\t\t\t\tret[i] = new boolean[s.length];\n\t\t\t\tfor (int j = 0;j < ret[i].length;++ j) ret[i][j] = s[j] == T;\n\t\t\t}\n\t\t\treturn ret;\n\t\t}\n\n\t\tpublic final Point nextPoint() {\n\t\t\treturn new Point(nextInt(), nextInt());\n\t\t}\n\n\t\tpublic final Point[] nextPoint(int width) {\n\t\t\tPoint[] ret = new Point[width];\n\t\t\tfor (int i = 0;i < width;++ i) ret[i] = nextPoint();\n\t\t\treturn ret;\n\t\t}\n\n\t\t@Override\n\t\tprotected void finalize() throws Throwable {\n\t\t\ttry {\n\t\t\t\tsuper.finalize();\n\t\t\t} finally {\n\t\t\t\tin.close();\n\t\t\t\tout.close();\n\t\t\t\terr.close();\n\t\t\t}\n\t\t}\n\n\t\tpublic final boolean print(boolean b) {\n\t\t\tout.print(b);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn b;\n\t\t}\n\n\t\tpublic final Object print(boolean b, Object t, Object f) {\n\t\t\treturn b ? print(t) : print(f);\n\t\t}\n\n\t\tpublic final char print(char c) {\n\t\t\tout.print(c);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn c;\n\t\t}\n\n\t\tpublic final char[] print(char[] s) {\n\t\t\tout.print(s);\n\t\t\treturn s;\n\t\t}\n\n\t\tpublic final double print(double d) {\n\t\t\tout.print(d);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn d;\n\t\t}\n\n\t\tpublic final double print(double d, int length) {\n\t\t\tif (d < 0) {\n\t\t\t\tout.print('-');\n\t\t\t\td = -d;\n\t\t\t}\n\t\t\td += Math.pow(10, -length) / 2;\n\t\t\tout.print((long)d);\n\t\t\tout.print('.');\n\t\t\td -= (long)d;\n\t\t\tfor (int i = 0;i < length;++ i) {\n\t\t\t\td *= 10;\n\t\t\t\tout.print((int)d);\n\t\t\t\td -= (int)d;\n\t\t\t}\n\t\t\tif (autoFlush) flush();\n\t\t\treturn d;\n\t\t}\n\n\t\tpublic final float print(float f) {\n\t\t\tout.print(f);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn f;\n\t\t}\n\n\t\tpublic final int print(int i) {\n\t\t\tout.print(i);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn i;\n\t\t}\n\n\t\tpublic final long print(long l) {\n\t\t\tout.print(l);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn l;\n\t\t}\n\n\t\tpublic final Object print(Object obj) {\n\t\t\tif (obj.getClass().isArray()) {\n\t\t\t\tif (obj instanceof boolean[][]) print(obj, \"\\n\", \" \");\n\t\t\t\telse if (obj instanceof byte[][]) print(obj, \"\\n\", \" \");\n\t\t\t\telse if (obj instanceof short[][]) print(obj, \"\\n\", \" \");\n\t\t\t\telse if (obj instanceof int[][]) print(obj, \"\\n\", \" \");\n\t\t\t\telse if (obj instanceof long[][]) print(obj, \"\\n\", \" \");\n\t\t\t\telse if (obj instanceof float[][]) print(obj, \"\\n\", \" \");\n\t\t\t\telse if (obj instanceof double[][]) print(obj, \"\\n\", \" \");\n\t\t\t\telse if (obj instanceof char[][]) print(obj, \"\\n\", \" \");\n\t\t\t\telse if (obj instanceof Object[][]) print(obj, \"\\n\", \" \");\n\t\t\t\telse print(obj, \" \");\n\t\t\t} else {\n\t\t\t\tout.print(obj);\n\t\t\t\tif (autoFlush) flush();\n\t\t\t}\n\t\t\treturn obj;\n\t\t}\n\n\t\tpublic final String print(String s) {\n\t\t\tout.print(s);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn s;\n\t\t}\n\n\t\tpublic final Object print(Object array, String... parse) {\n\t\t\tprint(array, 0, parse);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn array;\n\t\t}\n\n\t\tprivate final Object print(Object array, int check, String... parse) {\n\t\t\tif (check >= parse.length) {\n\t\t\t\tif (array.getClass().isArray()) throw new IllegalArgumentException(\"not equal dimension\");\n\t\t\t\tprint(array);\n\t\t\t\treturn array;\n\t\t\t}\n\t\t\tString str = parse[check];\n\t\t\tif (array instanceof Object[]) {\n\t\t\t\tObject[] obj = (Object[]) array;\n\t\t\t\tif (obj.length == 0) return array;\n\t\t\t\tprint(obj[0], check + 1, parse);\n\t\t\t\tfor (int i = 1;i < obj.length;++ i) {\n\t\t\t\t\tprint(str);\n\t\t\t\t\tprint(obj[i], check + 1, parse);\n\t\t\t\t}\n\t\t\t\treturn array;\n\t\t\t}\n\t\t\tif (array instanceof Collection) {\n\t\t\t\tIterator iter = ((Collection)array).iterator();\n\t\t\t\tif (!iter.hasNext()) return array;\n\t\t\t\tprint(iter.next(), check + 1, parse);\n\t\t\t\twhile(iter.hasNext()) {\n\t\t\t\t\tprint(str);\n\t\t\t\t\tprint(iter.next(), check + 1, parse);\n\t\t\t\t}\n\t\t\t\treturn array;\n\t\t\t}\n\t\t\tif (!array.getClass().isArray()) throw new IllegalArgumentException(\"not equal dimension\");\n\t\t\tif (check != parse.length - 1) throw new IllegalArgumentException(\"not equal dimension\");\n\t\t\tif (array instanceof boolean[]) {\n\t\t\t\tboolean[] obj = (boolean[]) array;\n\t\t\t\tif (obj.length == 0) return array;\n\t\t\t\tprint(obj[0]);\n\t\t\t\tfor (int i = 1;i < obj.length;++ i) {\n\t\t\t\t\tprint(str);\n\t\t\t\t\tprint(obj[i]);\n\t\t\t\t}\n\t\t\t} else if (array instanceof byte[]) {\n\t\t\t\tbyte[] obj = (byte[]) array;\n\t\t\t\tif (obj.length == 0) return array;\n\t\t\t\tprint(obj[0]);\n\t\t\t\tfor (int i = 1;i < obj.length;++ i) {\n\t\t\t\t\tprint(str);\n\t\t\t\t\tprint(obj[i]);\n\t\t\t\t}\n\t\t\t\treturn array;\n\t\t\t} else if (array instanceof short[]) {\n\t\t\t\tshort[] obj = (short[]) array;\n\t\t\t\tif (obj.length == 0) return array;\n\t\t\t\tprint(obj[0]);\n\t\t\t\tfor (int i = 1;i < obj.length;++ i) {\n\t\t\t\t\tprint(str);\n\t\t\t\t\tprint(obj[i]);\n\t\t\t\t}\n\t\t\t} else if (array instanceof int[]) {\n\t\t\t\tint[] obj = (int[]) array;\n\t\t\t\tif (obj.length == 0) return array;\n\t\t\t\tprint(obj[0]);\n\t\t\t\tfor (int i = 1;i < obj.length;++ i) {\n\t\t\t\t\tprint(str);\n\t\t\t\t\tprint(obj[i]);\n\t\t\t\t}\n\t\t\t} else if (array instanceof long[]) {\n\t\t\t\tlong[] obj = (long[]) array;\n\t\t\t\tif (obj.length == 0) return array;\n\t\t\t\tprint(obj[0]);\n\t\t\t\tfor (int i = 1;i < obj.length;++ i) {\n\t\t\t\t\tprint(str);\n\t\t\t\t\tprint(obj[i]);\n\t\t\t\t}\n\t\t\t} else if (array instanceof float[]) {\n\t\t\t\tfloat[] obj = (float[]) array;\n\t\t\t\tif (obj.length == 0) return array;\n\t\t\t\tprint(obj[0]);\n\t\t\t\tfor (int i = 1;i < obj.length;++ i) {\n\t\t\t\t\tprint(str);\n\t\t\t\t\tprint(obj[i]);\n\t\t\t\t}\n\t\t\t} else if (array instanceof double[]) {\n\t\t\t\tdouble[] obj = (double[]) array;\n\t\t\t\tif (obj.length == 0) return array;\n\t\t\t\tprint(obj[0]);\n\t\t\t\tfor (int i = 1;i < obj.length;++ i) {\n\t\t\t\t\tprint(str);\n\t\t\t\t\tprint(obj[i]);\n\t\t\t\t}\n\t\t\t} else if (array instanceof char[]) {\n\t\t\t\tchar[] obj = (char[]) array;\n\t\t\t\tif (obj.length == 0) return array;\n\t\t\t\tprint(obj[0]);\n\t\t\t\tfor (int i = 1;i < obj.length;++ i) {\n\t\t\t\t\tprint(str);\n\t\t\t\t\tprint(obj[i]);\n\t\t\t\t}\n\t\t\t} else throw new AssertionError();\n\t\t\treturn array;\n\t\t}\n\n\t\tpublic final Object[] print(String parse, Object... args) {\n\t\t\tprint(args[0]);\n\t\t\tfor (int i = 1;i < args.length;++ i) {\n\t\t\t\tprint(parse);\n\t\t\t\tprint(args[i]);\n\t\t\t}\n\t\t\treturn args;\n\t\t}\n\n\t\tpublic final Object[] printf(String format, Object... args) {\n\t\t\tout.printf(format, args);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn args;\n\t\t}\n\n\t\tpublic final Object printf(Locale l, String format, Object... args) {\n\t\t\tout.printf(l, format, args);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn args;\n\t\t}\n\n\t\tpublic final void println() {\n\t\t\tout.println();\n\t\t\tif (autoFlush) flush();\n\t\t}\n\n\t\tpublic final boolean println(boolean b) {\n\t\t\tout.println(b);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn b;\n\t\t}\n\n\t\tpublic final Object println(boolean b, Object t, Object f) {\n\t\t\treturn b ? println(t) : println(f);\n\t\t}\n\n\t\tpublic final char println(char c) {\n\t\t\tout.println(c);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn c;\n\t\t}\n\n\t\tpublic final char[] println(char[] s) {\n\t\t\tout.println(s);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn s;\n\t\t}\n\n\t\tpublic final double println(double d) {\n\t\t\tout.println(d);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn d;\n\t\t}\n\n\t\tpublic final double println(double d, int length) {\n\t\t\tprint(d, length);\n\t\t\tprintln();\n\t\t\treturn d;\n\t\t}\n\n\t\tpublic final float println(float f) {\n\t\t\tout.println(f);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn f;\n\t\t}\n\n\t\tpublic final int println(int i) {\n\t\t\tout.println(i);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn i;\n\t\t}\n\n\t\tpublic final long println(long l) {\n\t\t\tout.println(l);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn l;\n\t\t}\n\n\t\tpublic final Object println(Object obj) {\n\t\t\tprint(obj);\n\t\t\tprintln();\n\t\t\treturn obj;\n\t\t}\n\n\t\tpublic final String println(String s) {\n\t\t\tout.println(s);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn s;\n\t\t}\n\n\t\tpublic final Object println(Object array, String... parse) {\n\t\t\tprint(array, parse);\n\t\t\tprintln();\n\t\t\treturn array;\n\t\t}\n\n\t\tpublic final boolean debug(boolean b) {\n\t\t\terr.print(b);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn b;\n\t\t}\n\n\t\tpublic final Object debug(boolean b, Object t, Object f) {\n\t\t\treturn b ? debug(t) : debug(f);\n\t\t}\n\n\t\tpublic final char debug(char c) {\n\t\t\terr.print(c);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn c;\n\t\t}\n\n\t\tpublic final char[] debug(char[] s) {\n\t\t\terr.print(s);\n\t\t\treturn s;\n\t\t}\n\n\t\tpublic final double debug(double d) {\n\t\t\terr.print(d);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn d;\n\t\t}\n\n\t\tpublic final double debug(double d, int length) {\n\t\t\tif (d < 0) {\n\t\t\t\terr.print('-');\n\t\t\t\td = -d;\n\t\t\t}\n\t\t\td += Math.pow(10, -length) / 2;\n\t\t\terr.print((long)d);\n\t\t\terr.print('.');\n\t\t\td -= (long)d;\n\t\t\tfor (int i = 0;i < length;++ i) {\n\t\t\t\td *= 10;\n\t\t\t\terr.print((int)d);\n\t\t\t\td -= (int)d;\n\t\t\t}\n\t\t\tif (autoFlush) flush();\n\t\t\treturn d;\n\t\t}\n\n\t\tpublic final float debug(float f) {\n\t\t\terr.print(f);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn f;\n\t\t}\n\n\t\tpublic final int debug(int i) {\n\t\t\terr.print(i);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn i;\n\t\t}\n\n\t\tpublic final long debug(long l) {\n\t\t\terr.print(l);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn l;\n\t\t}\n\n\t\tpublic final Object debug(Object obj) {\n\t\t\tif (obj.getClass().isArray()) {\n\t\t\t\tif (obj instanceof boolean[][]) debug(obj, \"\\n\", \" \");\n\t\t\t\telse if (obj instanceof byte[][]) debug(obj, \"\\n\", \" \");\n\t\t\t\telse if (obj instanceof short[][]) debug(obj, \"\\n\", \" \");\n\t\t\t\telse if (obj instanceof int[][]) debug(obj, \"\\n\", \" \");\n\t\t\t\telse if (obj instanceof long[][]) debug(obj, \"\\n\", \" \");\n\t\t\t\telse if (obj instanceof float[][]) debug(obj, \"\\n\", \" \");\n\t\t\t\telse if (obj instanceof double[][]) debug(obj, \"\\n\", \" \");\n\t\t\t\telse if (obj instanceof char[][]) debug(obj, \"\\n\", \" \");\n\t\t\t\telse if (obj instanceof Object[][]) debug(obj, \"\\n\", \" \");\n\t\t\t\telse debug(obj, \" \");\n\t\t\t} else {\n\t\t\t\terr.print(obj);\n\t\t\t\tif (autoFlush) flush();\n\t\t\t}\n\t\t\treturn obj;\n\t\t}\n\n\t\tpublic final String debug(String s) {\n\t\t\terr.print(s);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn s;\n\t\t}\n\n\t\tpublic final Object debug(Object array, String... parse) {\n\t\t\tdebug(array, 0, parse);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn array;\n\t\t}\n\n\t\tprivate final Object debug(Object array, int check, String... parse) {\n\t\t\tif (check >= parse.length) {\n\t\t\t\tif (array.getClass().isArray()) throw new IllegalArgumentException(\"not equal dimension\");\n\t\t\t\tdebug(array);\n\t\t\t\treturn array;\n\t\t\t}\n\t\t\tString str = parse[check];\n\t\t\tif (array instanceof Object[]) {\n\t\t\t\tObject[] obj = (Object[]) array;\n\t\t\t\tif (obj.length == 0) return array;\n\t\t\t\tdebug(obj[0], check + 1, parse);\n\t\t\t\tfor (int i = 1;i < obj.length;++ i) {\n\t\t\t\t\tdebug(str);\n\t\t\t\t\tdebug(obj[i], check + 1, parse);\n\t\t\t\t}\n\t\t\t\treturn array;\n\t\t\t}\n\t\t\tif (array instanceof Collection) {\n\t\t\t\tIterator iter = ((Collection)array).iterator();\n\t\t\t\tif (!iter.hasNext()) return array;\n\t\t\t\tdebug(iter.next(), check + 1, parse);\n\t\t\t\twhile(iter.hasNext()) {\n\t\t\t\t\tdebug(str);\n\t\t\t\t\tdebug(iter.next(), check + 1, parse);\n\t\t\t\t}\n\t\t\t\treturn array;\n\t\t\t}\n\t\t\tif (!array.getClass().isArray()) throw new IllegalArgumentException(\"not equal dimension\");\n\t\t\tif (check != parse.length - 1) throw new IllegalArgumentException(\"not equal dimension\");\n\t\t\tif (array instanceof boolean[]) {\n\t\t\t\tboolean[] obj = (boolean[]) array;\n\t\t\t\tif (obj.length == 0) return array;\n\t\t\t\tdebug(obj[0]);\n\t\t\t\tfor (int i = 1;i < obj.length;++ i) {\n\t\t\t\t\tdebug(str);\n\t\t\t\t\tdebug(obj[i]);\n\t\t\t\t}\n\t\t\t} else if (array instanceof byte[]) {\n\t\t\t\tbyte[] obj = (byte[]) array;\n\t\t\t\tif (obj.length == 0) return array;\n\t\t\t\tdebug(obj[0]);\n\t\t\t\tfor (int i = 1;i < obj.length;++ i) {\n\t\t\t\t\tdebug(str);\n\t\t\t\t\tdebug(obj[i]);\n\t\t\t\t}\n\t\t\t\treturn array;\n\t\t\t} else if (array instanceof short[]) {\n\t\t\t\tshort[] obj = (short[]) array;\n\t\t\t\tif (obj.length == 0) return array;\n\t\t\t\tdebug(obj[0]);\n\t\t\t\tfor (int i = 1;i < obj.length;++ i) {\n\t\t\t\t\tdebug(str);\n\t\t\t\t\tdebug(obj[i]);\n\t\t\t\t}\n\t\t\t} else if (array instanceof int[]) {\n\t\t\t\tint[] obj = (int[]) array;\n\t\t\t\tif (obj.length == 0) return array;\n\t\t\t\tdebug(obj[0]);\n\t\t\t\tfor (int i = 1;i < obj.length;++ i) {\n\t\t\t\t\tdebug(str);\n\t\t\t\t\tdebug(obj[i]);\n\t\t\t\t}\n\t\t\t} else if (array instanceof long[]) {\n\t\t\t\tlong[] obj = (long[]) array;\n\t\t\t\tif (obj.length == 0) return array;\n\t\t\t\tdebug(obj[0]);\n\t\t\t\tfor (int i = 1;i < obj.length;++ i) {\n\t\t\t\t\tdebug(str);\n\t\t\t\t\tdebug(obj[i]);\n\t\t\t\t}\n\t\t\t} else if (array instanceof float[]) {\n\t\t\t\tfloat[] obj = (float[]) array;\n\t\t\t\tif (obj.length == 0) return array;\n\t\t\t\tdebug(obj[0]);\n\t\t\t\tfor (int i = 1;i < obj.length;++ i) {\n\t\t\t\t\tdebug(str);\n\t\t\t\t\tdebug(obj[i]);\n\t\t\t\t}\n\t\t\t} else if (array instanceof double[]) {\n\t\t\t\tdouble[] obj = (double[]) array;\n\t\t\t\tif (obj.length == 0) return array;\n\t\t\t\tdebug(obj[0]);\n\t\t\t\tfor (int i = 1;i < obj.length;++ i) {\n\t\t\t\t\tdebug(str);\n\t\t\t\t\tdebug(obj[i]);\n\t\t\t\t}\n\t\t\t} else if (array instanceof char[]) {\n\t\t\t\tchar[] obj = (char[]) array;\n\t\t\t\tif (obj.length == 0) return array;\n\t\t\t\tdebug(obj[0]);\n\t\t\t\tfor (int i = 1;i < obj.length;++ i) {\n\t\t\t\t\tdebug(str);\n\t\t\t\t\tdebug(obj[i]);\n\t\t\t\t}\n\t\t\t} else throw new AssertionError();\n\t\t\treturn array;\n\t\t}\n\n\t\tpublic final Object[] debug(String parse, Object... args) {\n\t\t\tdebug(args[0]);\n\t\t\tfor (int i = 1;i < args.length;++ i) {\n\t\t\t\tdebug(parse);\n\t\t\t\tdebug(args[i]);\n\t\t\t}\n\t\t\treturn args;\n\t\t}\n\n\t\tpublic final Object[] debugf(String format, Object... args) {\n\t\t\terr.printf(format, args);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn args;\n\t\t}\n\n\t\tpublic final Object debugf(Locale l, String format, Object... args) {\n\t\t\terr.printf(l, format, args);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn args;\n\t\t}\n\n\t\tpublic final void debugln() {\n\t\t\terr.println();\n\t\t\tif (autoFlush) flush();\n\t\t}\n\n\t\tpublic final boolean debugln(boolean b) {\n\t\t\terr.println(b);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn b;\n\t\t}\n\n\t\tpublic final Object debugln(boolean b, Object t, Object f) {\n\t\t\treturn b ? debugln(t) : debugln(f);\n\t\t}\n\n\t\tpublic final char debugln(char c) {\n\t\t\terr.println(c);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn c;\n\t\t}\n\n\t\tpublic final char[] debugln(char[] s) {\n\t\t\terr.println(s);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn s;\n\t\t}\n\n\t\tpublic final double debugln(double d) {\n\t\t\terr.println(d);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn d;\n\t\t}\n\n\t\tpublic final double debugln(double d, int length) {\n\t\t\tdebug(d, length);\n\t\t\tdebugln();\n\t\t\treturn d;\n\t\t}\n\n\t\tpublic final float debugln(float f) {\n\t\t\terr.println(f);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn f;\n\t\t}\n\n\t\tpublic final int debugln(int i) {\n\t\t\terr.println(i);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn i;\n\t\t}\n\n\t\tpublic final long debugln(long l) {\n\t\t\terr.println(l);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn l;\n\t\t}\n\n\t\tpublic final Object debugln(Object obj) {\n\t\t\tdebug(obj);\n\t\t\tdebugln();\n\t\t\treturn obj;\n\t\t}\n\n\t\tpublic final String debugln(String s) {\n\t\t\terr.println(s);\n\t\t\tif (autoFlush) flush();\n\t\t\treturn s;\n\t\t}\n\n\t\tpublic final Object debugln(Object array, String... parse) {\n\t\t\tdebug(array, parse);\n\t\t\tdebugln();\n\t\t\treturn array;\n\t\t}\n\n\t\tpublic final void flush() {\n\t\t\tout.flush();\n\t\t\terr.flush();\n\t\t}\n\t}\n}\n", "problem_context": "Problem Statement\n\nAtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the number of users has grown, in order to meet the needs of more users, AtCoder has decided to increase the number of contests to 26 types, from AAC to AZC. For convenience, we number these 26 types as type 1 through type 26. AtCoder wants to schedule contests for D days so that user satisfaction is as high as possible. For every day, AtCoder will hold exactly one contest, and each contest will end on that day. The satisfaction is calculated as follows.\n\nThe satisfaction at the beginning of day 1 is 0. Satisfaction can be negative.\n\nHolding contests increases satisfaction. The amount of increase will vary depending on a variety of factors. Specifically, we know in advance that holding a contest of type i on day d will increase the satisfaction by s_{d,i}.\n\nIf a particular type of contest is not held for a while, the satisfaction decreases. Each contest type i has an integer c_i, and at the end of each day d=1,2,...,D, the satisfaction decreases as follows. Let \\mathrm{last}(d,i) be the last day before day d (including d) on which a contest of type i was held. If contests of type i have never been held yet, we define \\mathrm{last}(d,i)=0. At the end of day d, the satisfaction decreases by \\sum _{i=1}^{26}c_i \\times (d-\\mathrm{last}(d,i)).\n\nPlease schedule contests on behalf of AtCoder.\nIf the satisfaction at the end of day D is S, you will get a score of \\max(10^6 + S, 0).\nThere are 50 test cases, and the score of a submission is the total scores for each test case.\nYou can make submissions multiple times, and the highest score among your submissions will be your score.\n\nConstraints\n\nD = 365\n\nEach c_i is an integer satisfying 0\\leq c_i \\leq 100.\n\nEach s_{d,i} is an integer satisfying 0\\leq s_{d,i} \\leq 20000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD\nc_1 c_2 \\cdots c_{26}\ns_{1,1} s_{1,2} \\cdots s_{1,26}\n\\vdots\ns_{D,1} s_{D,2} \\cdots s_{D,26}\n\nOutput\n\nLet t_d (1\\leq t_d \\leq 26) be the type of the contest that will be held at day d.\nPrint D integers t_d to Standard Output in the following format:\n\nt_1\nt_2\n\\vdots\nt_D\n\nAny output that does not follow the above format may result in 0 pointsWA for that test case.\n\nInput Generation\n\nEach integer c_i and s_{d,i} is generated independently and uniformly at random from the integers in the range described in the problem statement.\n\nSample Input 1\n\n5\n86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192\n\nSample Output 1\n\n1\n17\n13\n14\n13\n\nNote that this example is a small one for checking the problem specification. It does not satisfy the constraint D=365 and is never actually given as a test case. The final satisfaction with this output is 79325, so the score is 1079325.\n\nInput generator, score calculator, and visualizer\n\nBeginner's Guide\n\nIf you don't know what to do, proceed to problem B or C.", "sample_input": "5\n86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192\n"}, "reference_outputs": ["1\n17\n13\n14\n13\n"], "source_document_id": "p02618", "source_text": "Problem Statement\n\nAtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the number of users has grown, in order to meet the needs of more users, AtCoder has decided to increase the number of contests to 26 types, from AAC to AZC. For convenience, we number these 26 types as type 1 through type 26. AtCoder wants to schedule contests for D days so that user satisfaction is as high as possible. For every day, AtCoder will hold exactly one contest, and each contest will end on that day. The satisfaction is calculated as follows.\n\nThe satisfaction at the beginning of day 1 is 0. Satisfaction can be negative.\n\nHolding contests increases satisfaction. The amount of increase will vary depending on a variety of factors. Specifically, we know in advance that holding a contest of type i on day d will increase the satisfaction by s_{d,i}.\n\nIf a particular type of contest is not held for a while, the satisfaction decreases. Each contest type i has an integer c_i, and at the end of each day d=1,2,...,D, the satisfaction decreases as follows. Let \\mathrm{last}(d,i) be the last day before day d (including d) on which a contest of type i was held. If contests of type i have never been held yet, we define \\mathrm{last}(d,i)=0. At the end of day d, the satisfaction decreases by \\sum _{i=1}^{26}c_i \\times (d-\\mathrm{last}(d,i)).\n\nPlease schedule contests on behalf of AtCoder.\nIf the satisfaction at the end of day D is S, you will get a score of \\max(10^6 + S, 0).\nThere are 50 test cases, and the score of a submission is the total scores for each test case.\nYou can make submissions multiple times, and the highest score among your submissions will be your score.\n\nConstraints\n\nD = 365\n\nEach c_i is an integer satisfying 0\\leq c_i \\leq 100.\n\nEach s_{d,i} is an integer satisfying 0\\leq s_{d,i} \\leq 20000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD\nc_1 c_2 \\cdots c_{26}\ns_{1,1} s_{1,2} \\cdots s_{1,26}\n\\vdots\ns_{D,1} s_{D,2} \\cdots s_{D,26}\n\nOutput\n\nLet t_d (1\\leq t_d \\leq 26) be the type of the contest that will be held at day d.\nPrint D integers t_d to Standard Output in the following format:\n\nt_1\nt_2\n\\vdots\nt_D\n\nAny output that does not follow the above format may result in 0 pointsWA for that test case.\n\nInput Generation\n\nEach integer c_i and s_{d,i} is generated independently and uniformly at random from the integers in the range described in the problem statement.\n\nSample Input 1\n\n5\n86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192\n\nSample Output 1\n\n1\n17\n13\n14\n13\n\nNote that this example is a small one for checking the problem specification. It does not satisfy the constraint D=365 and is never actually given as a test case. The final satisfaction with this output is 79325, so the score is 1079325.\n\nInput generator, score calculator, and visualizer\n\nBeginner's Guide\n\nIf you don't know what to do, proceed to problem B or C.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 35810, "cpu_time_ms": 1974, "memory_kb": 40036}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s745358607", "group_id": "codeNet:p02618", "input_text": "import java.util.*;\nimport java.io.*;\n \npublic class Main {\n //static long ans = 0;\n static long[] c;\n static long[][] dc;\n static int[] last;\n public static void main(String[] args) throws Exception {\n FastScanner sc = new FastScanner(System.in);\n int d = sc.nextInt();\n c = sc.nextLongArray(26);\n dc = new long[d][26];\n last = new int[26];\n int[] schedule = new int[d];\n for(int i = 0; i < d; i++){\n long maxV = -Integer.MAX_VALUE;\n int max = 0;\n for(int j = 0; j < 26; j++){\n dc[i][j] = sc.nextInt();\n if(maxV < dc[i][j]){\n maxV = dc[i][j] + (c[j] * (i-last[j]));\n max = j;\n }\n }\n schedule[i] = max;\n last[max] = i;\n }\n int[] top = new int[d];\n Arrays.fill(top,0);\n long topscore = -Integer.MAX_VALUE;\n schedule[0] = 0;\n last = new int[26];\n last[0] = 1;\n for(int k = 1; k < d; k++){\n long maxV = -Integer.MAX_VALUE;\n int max = 0;\n for(int j = 0; j < 26; j++){\n if(maxV < dc[k][j]){\n maxV = dc[k][j] + (c[j] * (k-last[j]));\n max = j;\n }\n }\n schedule[k] = max;\n last[max] = k;\n }\n long score = checkAns(schedule);\n if(score > topscore){\n topscore = score;\n top = schedule.clone();\n }\n for(int i = 0; i <= 270000; i++){\n int[] tmp = top.clone();\n int di = (int)(Math.random()*d);\n int ci = (int)(Math.random()*26);\n tmp[di] = ci;\n score = checkAns(tmp);\n if(score > topscore){\n topscore = score;\n top[di] = ci;\n }\n }\n printSchedule(top);\n }\n \n public static long checkAns(int[] s){\n int d = s.length;\n last = new int[26];\n long ans = 0;\n for(int i = 0; i < d; i++){\n int hold = s[i];\n last[hold] = i+1;\n ans += dc[i][hold];\n ans = calc(i+1,ans);\n }\n return ans;\n }\n \n public static long calc(int d, long ans){\n for(int i = 0; i < 26; i++){\n ans -= c[i] * (d-last[i]);\n }\n return ans;\n }\n \n public static void printSchedule(int[] schedule){\n for(int d : schedule){\n System.out.println(d+1);\n }\n return;\n }\n}\n\nclass FastScanner {\n private BufferedReader reader = null;\n private StringTokenizer tokenizer = null;\n public FastScanner(InputStream in) {\n reader = new BufferedReader(new InputStreamReader(in));\n tokenizer = null;\n }\n\n public String next() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public String nextLine() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n return reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken(\"\\n\");\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n \n public String[] nextArray(int n) {\n String[] a = new String[n];\n for (int i = 0; i < n; i++)\n a[i] = next();\n return a;\n }\n\n public int[] nextIntArray(int n) {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n return a;\n }\n\n public long[] nextLongArray(int n) {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = nextLong();\n return a;\n } \n}\n", "language": "Java", "metadata": {"date": 1593399397, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02618.html", "problem_id": "p02618", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02618/input.txt", "sample_output_relpath": "derived/input_output/data/p02618/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02618/Java/s745358607.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s745358607", "user_id": "u578775554"}, "prompt_components": {"gold_output": "1\n17\n13\n14\n13\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\n \npublic class Main {\n //static long ans = 0;\n static long[] c;\n static long[][] dc;\n static int[] last;\n public static void main(String[] args) throws Exception {\n FastScanner sc = new FastScanner(System.in);\n int d = sc.nextInt();\n c = sc.nextLongArray(26);\n dc = new long[d][26];\n last = new int[26];\n int[] schedule = new int[d];\n for(int i = 0; i < d; i++){\n long maxV = -Integer.MAX_VALUE;\n int max = 0;\n for(int j = 0; j < 26; j++){\n dc[i][j] = sc.nextInt();\n if(maxV < dc[i][j]){\n maxV = dc[i][j] + (c[j] * (i-last[j]));\n max = j;\n }\n }\n schedule[i] = max;\n last[max] = i;\n }\n int[] top = new int[d];\n Arrays.fill(top,0);\n long topscore = -Integer.MAX_VALUE;\n schedule[0] = 0;\n last = new int[26];\n last[0] = 1;\n for(int k = 1; k < d; k++){\n long maxV = -Integer.MAX_VALUE;\n int max = 0;\n for(int j = 0; j < 26; j++){\n if(maxV < dc[k][j]){\n maxV = dc[k][j] + (c[j] * (k-last[j]));\n max = j;\n }\n }\n schedule[k] = max;\n last[max] = k;\n }\n long score = checkAns(schedule);\n if(score > topscore){\n topscore = score;\n top = schedule.clone();\n }\n for(int i = 0; i <= 270000; i++){\n int[] tmp = top.clone();\n int di = (int)(Math.random()*d);\n int ci = (int)(Math.random()*26);\n tmp[di] = ci;\n score = checkAns(tmp);\n if(score > topscore){\n topscore = score;\n top[di] = ci;\n }\n }\n printSchedule(top);\n }\n \n public static long checkAns(int[] s){\n int d = s.length;\n last = new int[26];\n long ans = 0;\n for(int i = 0; i < d; i++){\n int hold = s[i];\n last[hold] = i+1;\n ans += dc[i][hold];\n ans = calc(i+1,ans);\n }\n return ans;\n }\n \n public static long calc(int d, long ans){\n for(int i = 0; i < 26; i++){\n ans -= c[i] * (d-last[i]);\n }\n return ans;\n }\n \n public static void printSchedule(int[] schedule){\n for(int d : schedule){\n System.out.println(d+1);\n }\n return;\n }\n}\n\nclass FastScanner {\n private BufferedReader reader = null;\n private StringTokenizer tokenizer = null;\n public FastScanner(InputStream in) {\n reader = new BufferedReader(new InputStreamReader(in));\n tokenizer = null;\n }\n\n public String next() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public String nextLine() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n return reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken(\"\\n\");\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n \n public String[] nextArray(int n) {\n String[] a = new String[n];\n for (int i = 0; i < n; i++)\n a[i] = next();\n return a;\n }\n\n public int[] nextIntArray(int n) {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n return a;\n }\n\n public long[] nextLongArray(int n) {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = nextLong();\n return a;\n } \n}\n", "problem_context": "Problem Statement\n\nAtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the number of users has grown, in order to meet the needs of more users, AtCoder has decided to increase the number of contests to 26 types, from AAC to AZC. For convenience, we number these 26 types as type 1 through type 26. AtCoder wants to schedule contests for D days so that user satisfaction is as high as possible. For every day, AtCoder will hold exactly one contest, and each contest will end on that day. The satisfaction is calculated as follows.\n\nThe satisfaction at the beginning of day 1 is 0. Satisfaction can be negative.\n\nHolding contests increases satisfaction. The amount of increase will vary depending on a variety of factors. Specifically, we know in advance that holding a contest of type i on day d will increase the satisfaction by s_{d,i}.\n\nIf a particular type of contest is not held for a while, the satisfaction decreases. Each contest type i has an integer c_i, and at the end of each day d=1,2,...,D, the satisfaction decreases as follows. Let \\mathrm{last}(d,i) be the last day before day d (including d) on which a contest of type i was held. If contests of type i have never been held yet, we define \\mathrm{last}(d,i)=0. At the end of day d, the satisfaction decreases by \\sum _{i=1}^{26}c_i \\times (d-\\mathrm{last}(d,i)).\n\nPlease schedule contests on behalf of AtCoder.\nIf the satisfaction at the end of day D is S, you will get a score of \\max(10^6 + S, 0).\nThere are 50 test cases, and the score of a submission is the total scores for each test case.\nYou can make submissions multiple times, and the highest score among your submissions will be your score.\n\nConstraints\n\nD = 365\n\nEach c_i is an integer satisfying 0\\leq c_i \\leq 100.\n\nEach s_{d,i} is an integer satisfying 0\\leq s_{d,i} \\leq 20000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD\nc_1 c_2 \\cdots c_{26}\ns_{1,1} s_{1,2} \\cdots s_{1,26}\n\\vdots\ns_{D,1} s_{D,2} \\cdots s_{D,26}\n\nOutput\n\nLet t_d (1\\leq t_d \\leq 26) be the type of the contest that will be held at day d.\nPrint D integers t_d to Standard Output in the following format:\n\nt_1\nt_2\n\\vdots\nt_D\n\nAny output that does not follow the above format may result in 0 pointsWA for that test case.\n\nInput Generation\n\nEach integer c_i and s_{d,i} is generated independently and uniformly at random from the integers in the range described in the problem statement.\n\nSample Input 1\n\n5\n86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192\n\nSample Output 1\n\n1\n17\n13\n14\n13\n\nNote that this example is a small one for checking the problem specification. It does not satisfy the constraint D=365 and is never actually given as a test case. The final satisfaction with this output is 79325, so the score is 1079325.\n\nInput generator, score calculator, and visualizer\n\nBeginner's Guide\n\nIf you don't know what to do, proceed to problem B or C.", "sample_input": "5\n86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192\n"}, "reference_outputs": ["1\n17\n13\n14\n13\n"], "source_document_id": "p02618", "source_text": "Problem Statement\n\nAtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the number of users has grown, in order to meet the needs of more users, AtCoder has decided to increase the number of contests to 26 types, from AAC to AZC. For convenience, we number these 26 types as type 1 through type 26. AtCoder wants to schedule contests for D days so that user satisfaction is as high as possible. For every day, AtCoder will hold exactly one contest, and each contest will end on that day. The satisfaction is calculated as follows.\n\nThe satisfaction at the beginning of day 1 is 0. Satisfaction can be negative.\n\nHolding contests increases satisfaction. The amount of increase will vary depending on a variety of factors. Specifically, we know in advance that holding a contest of type i on day d will increase the satisfaction by s_{d,i}.\n\nIf a particular type of contest is not held for a while, the satisfaction decreases. Each contest type i has an integer c_i, and at the end of each day d=1,2,...,D, the satisfaction decreases as follows. Let \\mathrm{last}(d,i) be the last day before day d (including d) on which a contest of type i was held. If contests of type i have never been held yet, we define \\mathrm{last}(d,i)=0. At the end of day d, the satisfaction decreases by \\sum _{i=1}^{26}c_i \\times (d-\\mathrm{last}(d,i)).\n\nPlease schedule contests on behalf of AtCoder.\nIf the satisfaction at the end of day D is S, you will get a score of \\max(10^6 + S, 0).\nThere are 50 test cases, and the score of a submission is the total scores for each test case.\nYou can make submissions multiple times, and the highest score among your submissions will be your score.\n\nConstraints\n\nD = 365\n\nEach c_i is an integer satisfying 0\\leq c_i \\leq 100.\n\nEach s_{d,i} is an integer satisfying 0\\leq s_{d,i} \\leq 20000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD\nc_1 c_2 \\cdots c_{26}\ns_{1,1} s_{1,2} \\cdots s_{1,26}\n\\vdots\ns_{D,1} s_{D,2} \\cdots s_{D,26}\n\nOutput\n\nLet t_d (1\\leq t_d \\leq 26) be the type of the contest that will be held at day d.\nPrint D integers t_d to Standard Output in the following format:\n\nt_1\nt_2\n\\vdots\nt_D\n\nAny output that does not follow the above format may result in 0 pointsWA for that test case.\n\nInput Generation\n\nEach integer c_i and s_{d,i} is generated independently and uniformly at random from the integers in the range described in the problem statement.\n\nSample Input 1\n\n5\n86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192\n\nSample Output 1\n\n1\n17\n13\n14\n13\n\nNote that this example is a small one for checking the problem specification. It does not satisfy the constraint D=365 and is never actually given as a test case. The final satisfaction with this output is 79325, so the score is 1079325.\n\nInput generator, score calculator, and visualizer\n\nBeginner's Guide\n\nIf you don't know what to do, proceed to problem B or C.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 4186, "cpu_time_ms": 1784, "memory_kb": 44508}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s812944661", "group_id": "codeNet:p02618", "input_text": "import java.util.*;\n\npublic class Main {\n\n\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n\n int D = sc.nextInt();\n int[] c = new int[27];\n int[] t = new int[D + 1];\n int[] last_day = new int[27];\n Arrays.fill(last_day, 0);\n int[][] s = new int[D + 1][27];\n for (int i = 1; i <= 26; i++) {\n c[i] = sc.nextInt();\n }\n for (int i = 1; i <= D; i++) {\n for (int j = 1; j <= 26; j++) {\n s[i][j] = sc.nextInt();\n }\n }\n Random random =new Random();\n for (int i = 1; i <= D; i++) {\n t[i] = 1+random.nextInt(26);\n }\n int[] tmp_array = t;\n long tmp_sum = 0;\n long last_sum =0;\n for (int j = 0; j < 9; j++) {\n int d = 1+random.nextInt(D);\n int q = 1+random.nextInt(D);\n t[d] = t[q];\n for (int i = 1; i <= D; i++) {\n last_day[t[i]] = i;\n tmp_sum += calcS(c, s, t[i], i, last_day);\n }\n if(tmp_sum>last_sum){\n continue;\n }else {\n t = tmp_array;\n }\n }\n\n\n for (int i = 1; i <= D; i++) {\n System.out.println(t[i]);\n }\n\n }\n\n private static long calcS(int[] c, int[][] s, int kaisai, int day, int[] last_day) {\n\n long loss = 0;\n for (int i = 1; i <= 26; i++) {\n if (i == kaisai) {\n last_day[i] = day;\n continue;\n }\n loss -= c[i] * (day - last_day[i]);\n }\n\n long plus = s[day][kaisai];\n return plus + loss;\n }\n\n}\n", "language": "Java", "metadata": {"date": 1593397673, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02618.html", "problem_id": "p02618", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02618/input.txt", "sample_output_relpath": "derived/input_output/data/p02618/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02618/Java/s812944661.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s812944661", "user_id": "u661594854"}, "prompt_components": {"gold_output": "1\n17\n13\n14\n13\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n\n\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n\n int D = sc.nextInt();\n int[] c = new int[27];\n int[] t = new int[D + 1];\n int[] last_day = new int[27];\n Arrays.fill(last_day, 0);\n int[][] s = new int[D + 1][27];\n for (int i = 1; i <= 26; i++) {\n c[i] = sc.nextInt();\n }\n for (int i = 1; i <= D; i++) {\n for (int j = 1; j <= 26; j++) {\n s[i][j] = sc.nextInt();\n }\n }\n Random random =new Random();\n for (int i = 1; i <= D; i++) {\n t[i] = 1+random.nextInt(26);\n }\n int[] tmp_array = t;\n long tmp_sum = 0;\n long last_sum =0;\n for (int j = 0; j < 9; j++) {\n int d = 1+random.nextInt(D);\n int q = 1+random.nextInt(D);\n t[d] = t[q];\n for (int i = 1; i <= D; i++) {\n last_day[t[i]] = i;\n tmp_sum += calcS(c, s, t[i], i, last_day);\n }\n if(tmp_sum>last_sum){\n continue;\n }else {\n t = tmp_array;\n }\n }\n\n\n for (int i = 1; i <= D; i++) {\n System.out.println(t[i]);\n }\n\n }\n\n private static long calcS(int[] c, int[][] s, int kaisai, int day, int[] last_day) {\n\n long loss = 0;\n for (int i = 1; i <= 26; i++) {\n if (i == kaisai) {\n last_day[i] = day;\n continue;\n }\n loss -= c[i] * (day - last_day[i]);\n }\n\n long plus = s[day][kaisai];\n return plus + loss;\n }\n\n}\n", "problem_context": "Problem Statement\n\nAtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the number of users has grown, in order to meet the needs of more users, AtCoder has decided to increase the number of contests to 26 types, from AAC to AZC. For convenience, we number these 26 types as type 1 through type 26. AtCoder wants to schedule contests for D days so that user satisfaction is as high as possible. For every day, AtCoder will hold exactly one contest, and each contest will end on that day. The satisfaction is calculated as follows.\n\nThe satisfaction at the beginning of day 1 is 0. Satisfaction can be negative.\n\nHolding contests increases satisfaction. The amount of increase will vary depending on a variety of factors. Specifically, we know in advance that holding a contest of type i on day d will increase the satisfaction by s_{d,i}.\n\nIf a particular type of contest is not held for a while, the satisfaction decreases. Each contest type i has an integer c_i, and at the end of each day d=1,2,...,D, the satisfaction decreases as follows. Let \\mathrm{last}(d,i) be the last day before day d (including d) on which a contest of type i was held. If contests of type i have never been held yet, we define \\mathrm{last}(d,i)=0. At the end of day d, the satisfaction decreases by \\sum _{i=1}^{26}c_i \\times (d-\\mathrm{last}(d,i)).\n\nPlease schedule contests on behalf of AtCoder.\nIf the satisfaction at the end of day D is S, you will get a score of \\max(10^6 + S, 0).\nThere are 50 test cases, and the score of a submission is the total scores for each test case.\nYou can make submissions multiple times, and the highest score among your submissions will be your score.\n\nConstraints\n\nD = 365\n\nEach c_i is an integer satisfying 0\\leq c_i \\leq 100.\n\nEach s_{d,i} is an integer satisfying 0\\leq s_{d,i} \\leq 20000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD\nc_1 c_2 \\cdots c_{26}\ns_{1,1} s_{1,2} \\cdots s_{1,26}\n\\vdots\ns_{D,1} s_{D,2} \\cdots s_{D,26}\n\nOutput\n\nLet t_d (1\\leq t_d \\leq 26) be the type of the contest that will be held at day d.\nPrint D integers t_d to Standard Output in the following format:\n\nt_1\nt_2\n\\vdots\nt_D\n\nAny output that does not follow the above format may result in 0 pointsWA for that test case.\n\nInput Generation\n\nEach integer c_i and s_{d,i} is generated independently and uniformly at random from the integers in the range described in the problem statement.\n\nSample Input 1\n\n5\n86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192\n\nSample Output 1\n\n1\n17\n13\n14\n13\n\nNote that this example is a small one for checking the problem specification. It does not satisfy the constraint D=365 and is never actually given as a test case. The final satisfaction with this output is 79325, so the score is 1079325.\n\nInput generator, score calculator, and visualizer\n\nBeginner's Guide\n\nIf you don't know what to do, proceed to problem B or C.", "sample_input": "5\n86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192\n"}, "reference_outputs": ["1\n17\n13\n14\n13\n"], "source_document_id": "p02618", "source_text": "Problem Statement\n\nAtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the number of users has grown, in order to meet the needs of more users, AtCoder has decided to increase the number of contests to 26 types, from AAC to AZC. For convenience, we number these 26 types as type 1 through type 26. AtCoder wants to schedule contests for D days so that user satisfaction is as high as possible. For every day, AtCoder will hold exactly one contest, and each contest will end on that day. The satisfaction is calculated as follows.\n\nThe satisfaction at the beginning of day 1 is 0. Satisfaction can be negative.\n\nHolding contests increases satisfaction. The amount of increase will vary depending on a variety of factors. Specifically, we know in advance that holding a contest of type i on day d will increase the satisfaction by s_{d,i}.\n\nIf a particular type of contest is not held for a while, the satisfaction decreases. Each contest type i has an integer c_i, and at the end of each day d=1,2,...,D, the satisfaction decreases as follows. Let \\mathrm{last}(d,i) be the last day before day d (including d) on which a contest of type i was held. If contests of type i have never been held yet, we define \\mathrm{last}(d,i)=0. At the end of day d, the satisfaction decreases by \\sum _{i=1}^{26}c_i \\times (d-\\mathrm{last}(d,i)).\n\nPlease schedule contests on behalf of AtCoder.\nIf the satisfaction at the end of day D is S, you will get a score of \\max(10^6 + S, 0).\nThere are 50 test cases, and the score of a submission is the total scores for each test case.\nYou can make submissions multiple times, and the highest score among your submissions will be your score.\n\nConstraints\n\nD = 365\n\nEach c_i is an integer satisfying 0\\leq c_i \\leq 100.\n\nEach s_{d,i} is an integer satisfying 0\\leq s_{d,i} \\leq 20000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD\nc_1 c_2 \\cdots c_{26}\ns_{1,1} s_{1,2} \\cdots s_{1,26}\n\\vdots\ns_{D,1} s_{D,2} \\cdots s_{D,26}\n\nOutput\n\nLet t_d (1\\leq t_d \\leq 26) be the type of the contest that will be held at day d.\nPrint D integers t_d to Standard Output in the following format:\n\nt_1\nt_2\n\\vdots\nt_D\n\nAny output that does not follow the above format may result in 0 pointsWA for that test case.\n\nInput Generation\n\nEach integer c_i and s_{d,i} is generated independently and uniformly at random from the integers in the range described in the problem statement.\n\nSample Input 1\n\n5\n86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192\n\nSample Output 1\n\n1\n17\n13\n14\n13\n\nNote that this example is a small one for checking the problem specification. It does not satisfy the constraint D=365 and is never actually given as a test case. The final satisfaction with this output is 79325, so the score is 1079325.\n\nInput generator, score calculator, and visualizer\n\nBeginner's Guide\n\nIf you don't know what to do, proceed to problem B or C.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1700, "cpu_time_ms": 205, "memory_kb": 38208}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s743404790", "group_id": "codeNet:p02618", "input_text": "import java.util.*;\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tlong start = System.currentTimeMillis();\n\t\tint INF = Integer.MAX_VALUE/2;\n\t\tStringBuilder ans = new StringBuilder();\n\t\tScanner sc = new Scanner(System.in);\n\t\tint D = Integer.parseInt(sc.next());\n\t\tint[] c = new int[26];\n\t\tArrays.setAll(c, i -> Integer.parseInt(sc.next()));\n\t\tint[][] s = new int[D][26];\n\t\tfor(int i = 0; i < D; i++)\n\t\t\tArrays.setAll(s[i], x -> Integer.parseInt(sc.next()));\n\t\tint[] con = new int[D];\n\t\tTreeSet[] used = new TreeSet[26];\n\t\tfor(int i = 0; i < 26; i++) {\n\t\t\tused[i] = new TreeSet();\n\t\t\tused[i].add(-1);\n\t\t}\n\t\tint sat = 0;\n\t\tfor(int d = 0; d < D; d++) {\n\t\t\tint max = -INF, now = 0;\n\t\t\tfor(int i = 0; i < 26; i++) {\n\t\t\t\tint temp = 0;\n\t\t\t\ttemp += s[d][i];\n\t\t\t\tfor(int j = 0; j < 26; j++)\n\t\t\t\t\tif(i != j)\n\t\t\t\t\t\ttemp -= c[j] * (d - used[j].last());\n\t\t\t\tif(max < temp) {\n\t\t\t\t\tmax = temp;\n\t\t\t\t\tnow = i;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcon[d] = now;\n\t\t\tused[now].add(d);\n\t\t\tsat += max;\n\t\t}\n\t\tfor(int i = 0; i < 26; i++)\n\t\t\tused[i].add(D);\n\t\tRandom r = new Random();\n\t\twhile(true) {\n\t\t\tint d = r.nextInt(D);\n\t\t\tfor(int q = 0; q < 26; q++) {\n\t\t\t\tint temp = 0;\n\t\t\t\ttemp -= s[d][con[d]];\n\t\t\t\ttemp += s[d][q];\n\t\t\t\ttemp -= c[con[d]] * (used[con[d]].ceiling(d) - d) * (d - used[con[d]].lower(d));\n\t\t\t\ttemp += c[q] * (d - used[q].lower(d)) * (used[q].ceiling(d) - d);\n\t\t\t\tif(temp > 0) {\n\t\t\t\t\tsat += temp;\n\t\t\t\t\tcon[d] = q;\n\t\t\t\t\tused[con[d]].remove(d);\n\t\t\t\t\tused[q].add(d);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(System.currentTimeMillis() - start > 1850)\n\t\t\t\tbreak;\n\t\t}\n\t\tfor(int i : con)\n\t\t\tans.append((i+1) + \"\\n\");\n\t\tSystem.out.println(ans);\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1593396921, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02618.html", "problem_id": "p02618", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02618/input.txt", "sample_output_relpath": "derived/input_output/data/p02618/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02618/Java/s743404790.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s743404790", "user_id": "u912599273"}, "prompt_components": {"gold_output": "1\n17\n13\n14\n13\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tlong start = System.currentTimeMillis();\n\t\tint INF = Integer.MAX_VALUE/2;\n\t\tStringBuilder ans = new StringBuilder();\n\t\tScanner sc = new Scanner(System.in);\n\t\tint D = Integer.parseInt(sc.next());\n\t\tint[] c = new int[26];\n\t\tArrays.setAll(c, i -> Integer.parseInt(sc.next()));\n\t\tint[][] s = new int[D][26];\n\t\tfor(int i = 0; i < D; i++)\n\t\t\tArrays.setAll(s[i], x -> Integer.parseInt(sc.next()));\n\t\tint[] con = new int[D];\n\t\tTreeSet[] used = new TreeSet[26];\n\t\tfor(int i = 0; i < 26; i++) {\n\t\t\tused[i] = new TreeSet();\n\t\t\tused[i].add(-1);\n\t\t}\n\t\tint sat = 0;\n\t\tfor(int d = 0; d < D; d++) {\n\t\t\tint max = -INF, now = 0;\n\t\t\tfor(int i = 0; i < 26; i++) {\n\t\t\t\tint temp = 0;\n\t\t\t\ttemp += s[d][i];\n\t\t\t\tfor(int j = 0; j < 26; j++)\n\t\t\t\t\tif(i != j)\n\t\t\t\t\t\ttemp -= c[j] * (d - used[j].last());\n\t\t\t\tif(max < temp) {\n\t\t\t\t\tmax = temp;\n\t\t\t\t\tnow = i;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcon[d] = now;\n\t\t\tused[now].add(d);\n\t\t\tsat += max;\n\t\t}\n\t\tfor(int i = 0; i < 26; i++)\n\t\t\tused[i].add(D);\n\t\tRandom r = new Random();\n\t\twhile(true) {\n\t\t\tint d = r.nextInt(D);\n\t\t\tfor(int q = 0; q < 26; q++) {\n\t\t\t\tint temp = 0;\n\t\t\t\ttemp -= s[d][con[d]];\n\t\t\t\ttemp += s[d][q];\n\t\t\t\ttemp -= c[con[d]] * (used[con[d]].ceiling(d) - d) * (d - used[con[d]].lower(d));\n\t\t\t\ttemp += c[q] * (d - used[q].lower(d)) * (used[q].ceiling(d) - d);\n\t\t\t\tif(temp > 0) {\n\t\t\t\t\tsat += temp;\n\t\t\t\t\tcon[d] = q;\n\t\t\t\t\tused[con[d]].remove(d);\n\t\t\t\t\tused[q].add(d);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(System.currentTimeMillis() - start > 1850)\n\t\t\t\tbreak;\n\t\t}\n\t\tfor(int i : con)\n\t\t\tans.append((i+1) + \"\\n\");\n\t\tSystem.out.println(ans);\n\t}\n\n}\n", "problem_context": "Problem Statement\n\nAtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the number of users has grown, in order to meet the needs of more users, AtCoder has decided to increase the number of contests to 26 types, from AAC to AZC. For convenience, we number these 26 types as type 1 through type 26. AtCoder wants to schedule contests for D days so that user satisfaction is as high as possible. For every day, AtCoder will hold exactly one contest, and each contest will end on that day. The satisfaction is calculated as follows.\n\nThe satisfaction at the beginning of day 1 is 0. Satisfaction can be negative.\n\nHolding contests increases satisfaction. The amount of increase will vary depending on a variety of factors. Specifically, we know in advance that holding a contest of type i on day d will increase the satisfaction by s_{d,i}.\n\nIf a particular type of contest is not held for a while, the satisfaction decreases. Each contest type i has an integer c_i, and at the end of each day d=1,2,...,D, the satisfaction decreases as follows. Let \\mathrm{last}(d,i) be the last day before day d (including d) on which a contest of type i was held. If contests of type i have never been held yet, we define \\mathrm{last}(d,i)=0. At the end of day d, the satisfaction decreases by \\sum _{i=1}^{26}c_i \\times (d-\\mathrm{last}(d,i)).\n\nPlease schedule contests on behalf of AtCoder.\nIf the satisfaction at the end of day D is S, you will get a score of \\max(10^6 + S, 0).\nThere are 50 test cases, and the score of a submission is the total scores for each test case.\nYou can make submissions multiple times, and the highest score among your submissions will be your score.\n\nConstraints\n\nD = 365\n\nEach c_i is an integer satisfying 0\\leq c_i \\leq 100.\n\nEach s_{d,i} is an integer satisfying 0\\leq s_{d,i} \\leq 20000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD\nc_1 c_2 \\cdots c_{26}\ns_{1,1} s_{1,2} \\cdots s_{1,26}\n\\vdots\ns_{D,1} s_{D,2} \\cdots s_{D,26}\n\nOutput\n\nLet t_d (1\\leq t_d \\leq 26) be the type of the contest that will be held at day d.\nPrint D integers t_d to Standard Output in the following format:\n\nt_1\nt_2\n\\vdots\nt_D\n\nAny output that does not follow the above format may result in 0 pointsWA for that test case.\n\nInput Generation\n\nEach integer c_i and s_{d,i} is generated independently and uniformly at random from the integers in the range described in the problem statement.\n\nSample Input 1\n\n5\n86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192\n\nSample Output 1\n\n1\n17\n13\n14\n13\n\nNote that this example is a small one for checking the problem specification. It does not satisfy the constraint D=365 and is never actually given as a test case. The final satisfaction with this output is 79325, so the score is 1079325.\n\nInput generator, score calculator, and visualizer\n\nBeginner's Guide\n\nIf you don't know what to do, proceed to problem B or C.", "sample_input": "5\n86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192\n"}, "reference_outputs": ["1\n17\n13\n14\n13\n"], "source_document_id": "p02618", "source_text": "Problem Statement\n\nAtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the number of users has grown, in order to meet the needs of more users, AtCoder has decided to increase the number of contests to 26 types, from AAC to AZC. For convenience, we number these 26 types as type 1 through type 26. AtCoder wants to schedule contests for D days so that user satisfaction is as high as possible. For every day, AtCoder will hold exactly one contest, and each contest will end on that day. The satisfaction is calculated as follows.\n\nThe satisfaction at the beginning of day 1 is 0. Satisfaction can be negative.\n\nHolding contests increases satisfaction. The amount of increase will vary depending on a variety of factors. Specifically, we know in advance that holding a contest of type i on day d will increase the satisfaction by s_{d,i}.\n\nIf a particular type of contest is not held for a while, the satisfaction decreases. Each contest type i has an integer c_i, and at the end of each day d=1,2,...,D, the satisfaction decreases as follows. Let \\mathrm{last}(d,i) be the last day before day d (including d) on which a contest of type i was held. If contests of type i have never been held yet, we define \\mathrm{last}(d,i)=0. At the end of day d, the satisfaction decreases by \\sum _{i=1}^{26}c_i \\times (d-\\mathrm{last}(d,i)).\n\nPlease schedule contests on behalf of AtCoder.\nIf the satisfaction at the end of day D is S, you will get a score of \\max(10^6 + S, 0).\nThere are 50 test cases, and the score of a submission is the total scores for each test case.\nYou can make submissions multiple times, and the highest score among your submissions will be your score.\n\nConstraints\n\nD = 365\n\nEach c_i is an integer satisfying 0\\leq c_i \\leq 100.\n\nEach s_{d,i} is an integer satisfying 0\\leq s_{d,i} \\leq 20000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD\nc_1 c_2 \\cdots c_{26}\ns_{1,1} s_{1,2} \\cdots s_{1,26}\n\\vdots\ns_{D,1} s_{D,2} \\cdots s_{D,26}\n\nOutput\n\nLet t_d (1\\leq t_d \\leq 26) be the type of the contest that will be held at day d.\nPrint D integers t_d to Standard Output in the following format:\n\nt_1\nt_2\n\\vdots\nt_D\n\nAny output that does not follow the above format may result in 0 pointsWA for that test case.\n\nInput Generation\n\nEach integer c_i and s_{d,i} is generated independently and uniformly at random from the integers in the range described in the problem statement.\n\nSample Input 1\n\n5\n86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192\n\nSample Output 1\n\n1\n17\n13\n14\n13\n\nNote that this example is a small one for checking the problem specification. It does not satisfy the constraint D=365 and is never actually given as a test case. The final satisfaction with this output is 79325, so the score is 1079325.\n\nInput generator, score calculator, and visualizer\n\nBeginner's Guide\n\nIf you don't know what to do, proceed to problem B or C.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1627, "cpu_time_ms": 1970, "memory_kb": 59140}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s065344397", "group_id": "codeNet:p02618", "input_text": "\nimport java.io.BufferedWriter;\nimport java.io.File;\nimport java.io.FileWriter;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.ArrayDeque;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.NoSuchElementException;\nimport java.util.PriorityQueue;\nimport java.util.Set;\n\n/**\n * Introduction to Heuristics Contest\n * @author tsukammo\n */\npublic class Main {\n\n\t// only call\n\tpublic static void main(String[] args) throws IOException {\n\t\tif (submit) {\n\t\t\tout = new PrintWriter(System.out);\n\t\t} else {\n\t\t\tout = new PrintWriter(new BufferedWriter(new FileWriter(file)));\n\t\t}\n\t\tnew Main().run();\n\t\tout.flush();\n\t}\n\n\t// variables\n\tint D, T;\n\tint[] c;\n\tint[][] s;\n\tint[] preOpen;\n\tNode ans;\n\tSet loopCheck = new HashSet<>();\n\n\tint[] dx = new int[] { 0, 0, -1, 1 };\n\tint[] dy = new int[] { -1, 1, 0, 0 };\n\tint[] dxR = new int[] { 0, 0, 1, -1 };\n\tint[] dyR = new int[] { 1, -1, 0, 0 };\n\tint[] dR = new int[] { 1, 0, 3, 2 };\n\n\tvoid run() {\n\t\tinput();\n\t\tinit();\n\t\tsolve();\n\t\toutput();\n\t}\n\n\tlong timeLimit = 1_900;\n\n\tvoid solve() {\n\t\tNode now = new Node(D);\n\t\tnow.eval();\n\t\tint trueScore = now.score;\n\t\tans = now;\n\t\tSystem.err.println(\"first=\" + now.score);\n\t\tnow.evalTmp(null);\n\t\tint tmpScore = now.score;\n\t\tint checkSum = 0;\n\t\tfor (int i = 0; i < T; i++) {\n\t\t\tcheckSum += now.scoreC[i];\n\t\t}\n\t\tSystem.err.println(\"tmpScore=\" + now.score + \" \" + checkSum);\n\t\tlong currentTime = System.currentTimeMillis();\n\t\tint loopCount = 0;\n\t\tdouble forceLine;\n\t\twhile (currentTime < et) {\n\t\t\tloopCount++;\n\t\t\tint r = rnd.nextInt(2);\n\t\t\t//int r = 0;\n\t\t\tint cd = -1;\n\t\t\tint ct = -1;\n\t\t\tswitch (r) {\n\t\t\tcase 0:\n\t\t\t\tcd = rnd.nextInt(D);\n\t\t\t\tct = rnd.nextInt(T);\n\t\t\t\twhile (now.contests[cd] == ct) {\n\t\t\t\t\tcd = rnd.nextInt(D);\n\t\t\t\t\tct = rnd.nextInt(T);\n\t\t\t\t}\n\t\t\t\ttmpScore = now.evalChange(cd, ct);\n\t\t\t\tbreak;\n\t\t\tcase 1:\n\t\t\t\tcd = rnd.nextInt(D - 1);\n\t\t\t\ttmpScore = now.evalSwap(cd);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcurrentTime = System.currentTimeMillis();\n\t\t\tforceLine = (et - currentTime) / C;\n\t\t\tif (now.score <= tmpScore || forceLine > rnd.nextDouble()) {\n\t\t\t\tnow.score = tmpScore;\n\n\t\t\t\tswitch (r) {\n\t\t\t\tcase 0:\n\t\t\t\t\tnow.stateChange(cd, ct);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 1:\n\t\t\t\t\tnow.stateSwap(cd);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// rollback\n\t\t\t}\n\t\t}\n\t\tcheckSum = 0;\n\t\tfor (int i = 0; i < T; i++) {\n\t\t\tcheckSum += now.scoreC[i];\n\t\t}\n\t\tnow.eval();\n\t\tSystem.err.println(\"final=\" + now.score + \" \" + checkSum);\n\t\tSystem.err.println(\"loop=\" + loopCount);\n\t\tSystem.err.println(\"solve END.\");\n\t}\n\n\tvoid output() {\n\t\tfor (int i = 0; i < D; i++) {\n\t\t\tout.println(ans.contests[i] + 1);\n\t\t}\n\t}\n\n\tchar getCharD(byte d) {\n\t\tswitch (d) {\n\t\tcase 0:\n\t\t\treturn 'U';\n\t\tcase 1:\n\t\t\treturn 'D';\n\t\tcase 2:\n\t\t\treturn 'L';\n\t\tcase 3:\n\t\t\treturn 'R';\n\n\t\tdefault:\n\t\t\tbreak;\n\t\t}\n\t\treturn '_';\n\t}\n\n\t/**\n\t * 計算用に編集\n\t */\n\tvoid init() {\n\t\tpreOpen = new int[T];\n\t}\n\n\t/**\n\t * 素直に持つ\n\t */\n\tvoid input() {\n\t\tD = in.nextInt();\n\t\tst = System.currentTimeMillis();\n\t\tet = st + timeLimit;\n\t\tT = 26;\n\t\tc = new int[T];\n\t\tfor (int i = 0; i < T; i++) {\n\t\t\tc[i] = in.nextInt();\n\t\t}\n\t\ts = new int[D][T];\n\t\tfor (int i = 0; i < D; i++) {\n\t\t\tfor (int j = 0; j < T; j++) {\n\t\t\t\ts[i][j] = in.nextInt();\n\t\t\t}\n\t\t}\n\t\tSystem.err.println(\"input END.\");\n\t}\n\n\t// param\n\tfinal byte GOAL = -9;\n\tfinal byte NONE = -1;\n\tfinal byte INF = 100;\n\tfinal byte BLOCK = 111;\n\tfinal long C = TL * 10_000;\n\tfinal int X = 1000; // 厳密な精度は不要と考え、小数点以下を簡略化するための桁増し。\n\tfinal int SCORE_D = -10;\n\tfinal int SCORE_D2 = -9;\n\tfinal int SCORE_C = 1;\n\tfinal int SCORE_R = 1000;\n\tfinal int SPEED_CAR = 250;\n\tfinal int SPEED_DOLLY = 100;\n\tfinal int PRIME_TIME_LIMIT = 240;\n\tfinal int ROLLY_LIMIT = 10;\n\tfinal int POINT_DELIVERY = 10000;\n\tfinal int M2S = 60;\n\tint TIME_LIMIT;\n\tint TIME_LIMIT_2;\n\n\t// predefined\n\tFastScanner in = new FastScanner(System.in);\n\tstatic PrintWriter out = new PrintWriter(System.out);\n\tstatic final String FILE_PATH = \".\\\\\";\n\tstatic File file = new File(FILE_PATH + \"result.out\");\n\tlong st = 0, et = 0;\n\tpublic Random rnd = new Random(19881221L);\n\n\tArrayList list = new ArrayList<>();\n\tArrayDeque

q = new ArrayDeque<>();\n\tArrayDeque

q2 = new ArrayDeque<>();\n\n\t// 2D-map\n\tfinal int[] dw = new int[] { 0, 1, 0, -1, 1, 1, -1, -1 };\n\tfinal int[] dh = new int[] { 1, 0, -1, 0, 1, -1, 1, -1 };\n\n\t// search\n\tPriorityQueue pq = new PriorityQueue<>();\n\n\tint[] preDay = new int[] { -1, -1 };\n\n\tclass Node implements Comparable {\n\n\t\tint score;\n\t\tint[] scoreC;\n\t\tint[] contests;\n\n\t\tpublic Node(int N) {\n\t\t\tthis.score = 0;\n\t\t\tscoreC = new int[T];\n\t\t\tcontests = new int[N];\n\t\t\tfor (int i = 0; i < contests.length; i++) {\n\t\t\t\t// 初期解\n\t\t\t\tcontests[i] = rnd.nextInt(T);\n\t\t\t}\n\t\t\t// TODO\n\t\t\t/*\n\t\t\tcontests[0] = 0;\n\t\t\tcontests[1] = 16;\n\t\t\tcontests[2] = 12;\n\t\t\tcontests[3] = 13;\n\t\t\tcontests[4] = 12;\n\t\t\t*/\n\t\t}\n\n\t\tint evalSwap(int d) {\n\t\t\tint ret = this.score;\n\t\t\tint before = this.contests[d];\n\t\t\tint after = this.contests[d + 1];\n\t\t\tret -= this.scoreC[before];\n\t\t\tret -= this.scoreC[after];\n\t\t\tArrays.fill(preDay, -1);\n\t\t\tfor (int i = 0; i < D; i++) {\n\t\t\t\tint t = this.contests[i];\n\t\t\t\tif (i == d) {\n\t\t\t\t\tret += s[i][after];\n\t\t\t\t\tpreDay[1] = i;\n\t\t\t\t} else if (i == d + 1) {\n\t\t\t\t\tret += s[i][before];\n\t\t\t\t\tpreDay[0] = i;\n\t\t\t\t} else {\n\t\t\t\t\tif (t == before) {\n\t\t\t\t\t\tret += s[i][t];\n\t\t\t\t\t\tpreDay[0] = i;\n\t\t\t\t\t} else if (t == after) {\n\t\t\t\t\t\tret += s[i][t];\n\t\t\t\t\t\tpreDay[1] = i;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tret -= c[before] * (i - preDay[0]);\n\t\t\t\tret -= c[after] * (i - preDay[1]);\n\t\t\t}\n\t\t\treturn ret;\n\t\t}\n\n\t\tvoid stateSwap(int d) {\n\t\t\tint before = this.contests[d];\n\t\t\tint after = this.contests[d + 1];\n\t\t\tthis.contests[d] = after;\n\t\t\tthis.contests[d + 1] = before;\n\t\t\tthis.scoreC[before] = 0;\n\t\t\tthis.scoreC[after] = 0;\n\n\t\t\tArrays.fill(preDay, -1);\n\t\t\tfor (int i = 0; i < D; i++) {\n\t\t\t\tint t = this.contests[i];\n\t\t\t\tif (t == before) {\n\t\t\t\t\tthis.scoreC[before] += s[i][t];\n\t\t\t\t\tpreDay[0] = i;\n\t\t\t\t} else if (t == after) {\n\t\t\t\t\tthis.scoreC[after] += s[i][t];\n\t\t\t\t\tpreDay[1] = i;\n\t\t\t\t}\n\t\t\t\tthis.scoreC[before] -= c[before] * (i - preDay[0]);\n\t\t\t\tthis.scoreC[after] -= c[after] * (i - preDay[1]);\n\t\t\t}\n\t\t}\n\n\t\tint evalChange(int cd, int ct) {\n\t\t\tint ret = this.score;\n\t\t\tint before = this.contests[cd];\n\t\t\tret -= this.scoreC[before];\n\t\t\tret -= this.scoreC[ct];\n\t\t\tArrays.fill(preDay, -1);\n\t\t\tfor (int i = 0; i < D; i++) {\n\t\t\t\tint t = this.contests[i];\n\t\t\t\tif (i == cd) {\n\t\t\t\t\tret += s[i][ct];\n\t\t\t\t\tpreDay[1] = i;\n\t\t\t\t} else {\n\t\t\t\t\tif (t == before) {\n\t\t\t\t\t\tret += s[i][t];\n\t\t\t\t\t\tpreDay[0] = i;\n\t\t\t\t\t} else if (t == ct) {\n\t\t\t\t\t\tret += s[i][t];\n\t\t\t\t\t\tpreDay[1] = i;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tret -= c[before] * (i - preDay[0]);\n\t\t\t\tret -= c[ct] * (i - preDay[1]);\n\t\t\t}\n\t\t\treturn ret;\n\t\t}\n\n\t\tvoid stateChange(int cd, int ct) {\n\t\t\tint before = this.contests[cd];\n\t\t\tthis.contests[cd] = ct;\n\t\t\tthis.scoreC[before] = 0;\n\t\t\tthis.scoreC[ct] = 0;\n\n\t\t\tArrays.fill(preDay, -1);\n\t\t\tfor (int i = 0; i < D; i++) {\n\t\t\t\tint t = this.contests[i];\n\t\t\t\tif (t == before) {\n\t\t\t\t\tthis.scoreC[before] += s[i][t];\n\t\t\t\t\tpreDay[0] = i;\n\t\t\t\t} else if (t == ct) {\n\t\t\t\t\tthis.scoreC[ct] += s[i][t];\n\t\t\t\t\tpreDay[1] = i;\n\t\t\t\t}\n\t\t\t\tthis.scoreC[before] -= c[before] * (i - preDay[0]);\n\t\t\t\tthis.scoreC[ct] -= c[ct] * (i - preDay[1]);\n\t\t\t}\n\t\t\t//this.score += this.scoreC[before];\n\t\t\t//this.score += this.scoreC[ct];\n\t\t}\n\n\t\tpublic Node(Node n) {\n\t\t\tthis.score = n.score;\n\t\t\tthis.contests = Arrays.copyOf(n.contests, D);\n\t\t}\n\n\t\tpublic int eval() {\n\t\t\tthis.score = 0;\n\t\t\tArrays.fill(scoreC, 0);\n\t\t\tArrays.fill(preOpen, -1);\n\t\t\tfor (int i = 0; i < D; i++) {\n\t\t\t\tint t = this.contests[i];\n\t\t\t\tscore += s[i][t];\n\t\t\t\tscoreC[t] += s[i][t];\n\t\t\t\tpreOpen[t] = i;\n\t\t\t\tfor (int j = 0; j < T; j++) {\n\t\t\t\t\tint tmp = c[j] * (i - preOpen[j]);\n\t\t\t\t\tscore -= tmp;\n\t\t\t\t\tscoreC[j] -= tmp;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn this.score;\n\t\t}\n\n\n\n\t\tpublic void evalTmp(byte[][][] nowStep) {\n\t\t\t// TODO\n\t\t}\n\n\t\t@Override\n\t\tpublic int compareTo(Node o) {\n\t\t\treturn Integer.compare(this.score, o.score);\n\t\t}\n\n\t}\n\n\tint valid(int p) {\n\t\tif (p == -1) {\n\t\t\treturn D - 1;\n\t\t}\n\t\tif (p == D) {\n\t\t\treturn 0;\n\t\t}\n\t\treturn p;\n\t}\n\n\tint changeD(int d, byte b) {\n\t\tswitch (b) {\n\t\tcase 0:\n\t\t\treturn 0;\n\t\tcase 1:\n\t\t\treturn 1;\n\t\tcase 2:\n\t\t\treturn 2;\n\t\tcase 3:\n\t\t\treturn 3;\n\t\tdefault:\n\t\t\tbreak;\n\t\t}\n\t\treturn d;\n\t}\n\n\t// object\n\tclass P {\n\t\tint y, x;\n\n\t\tpublic P(int y, int x) {\n\t\t\tthis.y = y;\n\t\t\tthis.x = x;\n\t\t}\n\n\t\tpublic P(P p) {\n\t\t\tthis.y = p.y;\n\t\t\tthis.x = p.x;\n\t\t}\n\n\t\tP nextP(int d) {\n\t\t\tint ny = valid(y + dy[d]);\n\t\t\tint nx = valid(x + dx[d]);\n\t\t\treturn new P(ny, nx);\n\t\t}\n\n\t\tpublic String toString() {\n\t\t\treturn y + \" \" + x;\n\t\t}\n\t}\n\n\tclass D {\n\t\tP p;\n\t\tbyte d;\n\n\t\tpublic D(P p, int d) {\n\t\t\tthis.p = p;\n\t\t\tthis.d = (byte) d;\n\t\t}\n\n\t\tpublic D(D d) {\n\t\t\tthis.p = new P(d.p);\n\t\t\tthis.d = d.d;\n\t\t}\n\n\t\tpublic String toString() {\n\t\t\treturn p.y + \" \" + p.x + \" \" + d;\n\t\t}\n\t}\n\n\t// library\n\tclass FastScanner {\n\t\tprivate final InputStream in;\n\t\tprivate final byte[] buffer = new byte[1024];\n\t\tprivate int ptr = 0;\n\t\tprivate int buflen = 0;\n\n\t\tFastScanner(InputStream in) {\n\t\t\tthis.in = in;\n\t\t}\n\n\t\tprivate boolean hasNextByte() {\n\t\t\tif (ptr < buflen) {\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\tptr = 0;\n\t\t\t\ttry {\n\t\t\t\t\tbuflen = in.read(buffer);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t\tif (buflen <= 0) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\tprivate int readByte() {\n\t\t\tif (hasNextByte())\n\t\t\t\treturn buffer[ptr++];\n\t\t\telse\n\t\t\t\treturn -1;\n\t\t}\n\n\t\tprivate boolean isPrintableChar(int c) {\n\t\t\treturn 33 <= c && c <= 126;\n\t\t}\n\n\t\tpublic boolean hasNext() {\n\t\t\twhile (hasNextByte() && !isPrintableChar(buffer[ptr]))\n\t\t\t\tptr++;\n\t\t\treturn hasNextByte();\n\t\t}\n\n\t\tpublic String next() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tint b = readByte();\n\t\t\twhile (isPrintableChar(b)) {\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\treturn sb.toString();\n\t\t}\n\n\t\tpublic long nextLong() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tlong n = 0;\n\t\t\tboolean minus = false;\n\t\t\tint b = readByte();\n\t\t\tif (b == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\tif (b < '0' || '9' < b) {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\twhile (true) {\n\t\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\t\tn *= 10;\n\t\t\t\t\tn += b - '0';\n\t\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\t\treturn minus ? -n : n;\n\t\t\t\t} else {\n\t\t\t\t\tthrow new NumberFormatException();\n\t\t\t\t}\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\tlong nl = nextLong();\n\t\t\tif (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)\n\t\t\t\tthrow new NumberFormatException();\n\t\t\treturn (int) nl;\n\t\t}\n\n\t\tpublic double nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\t}\n\n\tclass Random {\n\t\tprivate long seed;\n\t\tprivate final long multiplier = 0x5DEECE66DL, addend = 0xBL, mask = (1L << 48) - 1;\n\t\tint bits, val;\n\n\t\tRandom(long seed) {\n\t\t\tthis.seed = seed;\n\t\t}\n\n\t\tint nextInt(int n) {\n\t\t\tdo {\n\t\t\t\tbits = (int) ((seed = (seed * multiplier + addend) & mask) >>> 17);\n\t\t\t\tval = bits % n;\n\t\t\t} while (bits - val + (n - 1) < 0);\n\t\t\treturn val;\n\t\t}\n\n\t\tdouble nextDouble() {\n\t\t\treturn nextInt(10000000) / 10000000.0;\n\t\t}\n\t}\n\n\tstatic long TL = 1000;\n\tstatic boolean submit = true;\n}", "language": "Java", "metadata": {"date": 1593396730, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02618.html", "problem_id": "p02618", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02618/input.txt", "sample_output_relpath": "derived/input_output/data/p02618/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02618/Java/s065344397.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s065344397", "user_id": "u669373166"}, "prompt_components": {"gold_output": "1\n17\n13\n14\n13\n", "input_to_evaluate": "\nimport java.io.BufferedWriter;\nimport java.io.File;\nimport java.io.FileWriter;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.ArrayDeque;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.NoSuchElementException;\nimport java.util.PriorityQueue;\nimport java.util.Set;\n\n/**\n * Introduction to Heuristics Contest\n * @author tsukammo\n */\npublic class Main {\n\n\t// only call\n\tpublic static void main(String[] args) throws IOException {\n\t\tif (submit) {\n\t\t\tout = new PrintWriter(System.out);\n\t\t} else {\n\t\t\tout = new PrintWriter(new BufferedWriter(new FileWriter(file)));\n\t\t}\n\t\tnew Main().run();\n\t\tout.flush();\n\t}\n\n\t// variables\n\tint D, T;\n\tint[] c;\n\tint[][] s;\n\tint[] preOpen;\n\tNode ans;\n\tSet loopCheck = new HashSet<>();\n\n\tint[] dx = new int[] { 0, 0, -1, 1 };\n\tint[] dy = new int[] { -1, 1, 0, 0 };\n\tint[] dxR = new int[] { 0, 0, 1, -1 };\n\tint[] dyR = new int[] { 1, -1, 0, 0 };\n\tint[] dR = new int[] { 1, 0, 3, 2 };\n\n\tvoid run() {\n\t\tinput();\n\t\tinit();\n\t\tsolve();\n\t\toutput();\n\t}\n\n\tlong timeLimit = 1_900;\n\n\tvoid solve() {\n\t\tNode now = new Node(D);\n\t\tnow.eval();\n\t\tint trueScore = now.score;\n\t\tans = now;\n\t\tSystem.err.println(\"first=\" + now.score);\n\t\tnow.evalTmp(null);\n\t\tint tmpScore = now.score;\n\t\tint checkSum = 0;\n\t\tfor (int i = 0; i < T; i++) {\n\t\t\tcheckSum += now.scoreC[i];\n\t\t}\n\t\tSystem.err.println(\"tmpScore=\" + now.score + \" \" + checkSum);\n\t\tlong currentTime = System.currentTimeMillis();\n\t\tint loopCount = 0;\n\t\tdouble forceLine;\n\t\twhile (currentTime < et) {\n\t\t\tloopCount++;\n\t\t\tint r = rnd.nextInt(2);\n\t\t\t//int r = 0;\n\t\t\tint cd = -1;\n\t\t\tint ct = -1;\n\t\t\tswitch (r) {\n\t\t\tcase 0:\n\t\t\t\tcd = rnd.nextInt(D);\n\t\t\t\tct = rnd.nextInt(T);\n\t\t\t\twhile (now.contests[cd] == ct) {\n\t\t\t\t\tcd = rnd.nextInt(D);\n\t\t\t\t\tct = rnd.nextInt(T);\n\t\t\t\t}\n\t\t\t\ttmpScore = now.evalChange(cd, ct);\n\t\t\t\tbreak;\n\t\t\tcase 1:\n\t\t\t\tcd = rnd.nextInt(D - 1);\n\t\t\t\ttmpScore = now.evalSwap(cd);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcurrentTime = System.currentTimeMillis();\n\t\t\tforceLine = (et - currentTime) / C;\n\t\t\tif (now.score <= tmpScore || forceLine > rnd.nextDouble()) {\n\t\t\t\tnow.score = tmpScore;\n\n\t\t\t\tswitch (r) {\n\t\t\t\tcase 0:\n\t\t\t\t\tnow.stateChange(cd, ct);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 1:\n\t\t\t\t\tnow.stateSwap(cd);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// rollback\n\t\t\t}\n\t\t}\n\t\tcheckSum = 0;\n\t\tfor (int i = 0; i < T; i++) {\n\t\t\tcheckSum += now.scoreC[i];\n\t\t}\n\t\tnow.eval();\n\t\tSystem.err.println(\"final=\" + now.score + \" \" + checkSum);\n\t\tSystem.err.println(\"loop=\" + loopCount);\n\t\tSystem.err.println(\"solve END.\");\n\t}\n\n\tvoid output() {\n\t\tfor (int i = 0; i < D; i++) {\n\t\t\tout.println(ans.contests[i] + 1);\n\t\t}\n\t}\n\n\tchar getCharD(byte d) {\n\t\tswitch (d) {\n\t\tcase 0:\n\t\t\treturn 'U';\n\t\tcase 1:\n\t\t\treturn 'D';\n\t\tcase 2:\n\t\t\treturn 'L';\n\t\tcase 3:\n\t\t\treturn 'R';\n\n\t\tdefault:\n\t\t\tbreak;\n\t\t}\n\t\treturn '_';\n\t}\n\n\t/**\n\t * 計算用に編集\n\t */\n\tvoid init() {\n\t\tpreOpen = new int[T];\n\t}\n\n\t/**\n\t * 素直に持つ\n\t */\n\tvoid input() {\n\t\tD = in.nextInt();\n\t\tst = System.currentTimeMillis();\n\t\tet = st + timeLimit;\n\t\tT = 26;\n\t\tc = new int[T];\n\t\tfor (int i = 0; i < T; i++) {\n\t\t\tc[i] = in.nextInt();\n\t\t}\n\t\ts = new int[D][T];\n\t\tfor (int i = 0; i < D; i++) {\n\t\t\tfor (int j = 0; j < T; j++) {\n\t\t\t\ts[i][j] = in.nextInt();\n\t\t\t}\n\t\t}\n\t\tSystem.err.println(\"input END.\");\n\t}\n\n\t// param\n\tfinal byte GOAL = -9;\n\tfinal byte NONE = -1;\n\tfinal byte INF = 100;\n\tfinal byte BLOCK = 111;\n\tfinal long C = TL * 10_000;\n\tfinal int X = 1000; // 厳密な精度は不要と考え、小数点以下を簡略化するための桁増し。\n\tfinal int SCORE_D = -10;\n\tfinal int SCORE_D2 = -9;\n\tfinal int SCORE_C = 1;\n\tfinal int SCORE_R = 1000;\n\tfinal int SPEED_CAR = 250;\n\tfinal int SPEED_DOLLY = 100;\n\tfinal int PRIME_TIME_LIMIT = 240;\n\tfinal int ROLLY_LIMIT = 10;\n\tfinal int POINT_DELIVERY = 10000;\n\tfinal int M2S = 60;\n\tint TIME_LIMIT;\n\tint TIME_LIMIT_2;\n\n\t// predefined\n\tFastScanner in = new FastScanner(System.in);\n\tstatic PrintWriter out = new PrintWriter(System.out);\n\tstatic final String FILE_PATH = \".\\\\\";\n\tstatic File file = new File(FILE_PATH + \"result.out\");\n\tlong st = 0, et = 0;\n\tpublic Random rnd = new Random(19881221L);\n\n\tArrayList list = new ArrayList<>();\n\tArrayDeque

q = new ArrayDeque<>();\n\tArrayDeque

q2 = new ArrayDeque<>();\n\n\t// 2D-map\n\tfinal int[] dw = new int[] { 0, 1, 0, -1, 1, 1, -1, -1 };\n\tfinal int[] dh = new int[] { 1, 0, -1, 0, 1, -1, 1, -1 };\n\n\t// search\n\tPriorityQueue pq = new PriorityQueue<>();\n\n\tint[] preDay = new int[] { -1, -1 };\n\n\tclass Node implements Comparable {\n\n\t\tint score;\n\t\tint[] scoreC;\n\t\tint[] contests;\n\n\t\tpublic Node(int N) {\n\t\t\tthis.score = 0;\n\t\t\tscoreC = new int[T];\n\t\t\tcontests = new int[N];\n\t\t\tfor (int i = 0; i < contests.length; i++) {\n\t\t\t\t// 初期解\n\t\t\t\tcontests[i] = rnd.nextInt(T);\n\t\t\t}\n\t\t\t// TODO\n\t\t\t/*\n\t\t\tcontests[0] = 0;\n\t\t\tcontests[1] = 16;\n\t\t\tcontests[2] = 12;\n\t\t\tcontests[3] = 13;\n\t\t\tcontests[4] = 12;\n\t\t\t*/\n\t\t}\n\n\t\tint evalSwap(int d) {\n\t\t\tint ret = this.score;\n\t\t\tint before = this.contests[d];\n\t\t\tint after = this.contests[d + 1];\n\t\t\tret -= this.scoreC[before];\n\t\t\tret -= this.scoreC[after];\n\t\t\tArrays.fill(preDay, -1);\n\t\t\tfor (int i = 0; i < D; i++) {\n\t\t\t\tint t = this.contests[i];\n\t\t\t\tif (i == d) {\n\t\t\t\t\tret += s[i][after];\n\t\t\t\t\tpreDay[1] = i;\n\t\t\t\t} else if (i == d + 1) {\n\t\t\t\t\tret += s[i][before];\n\t\t\t\t\tpreDay[0] = i;\n\t\t\t\t} else {\n\t\t\t\t\tif (t == before) {\n\t\t\t\t\t\tret += s[i][t];\n\t\t\t\t\t\tpreDay[0] = i;\n\t\t\t\t\t} else if (t == after) {\n\t\t\t\t\t\tret += s[i][t];\n\t\t\t\t\t\tpreDay[1] = i;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tret -= c[before] * (i - preDay[0]);\n\t\t\t\tret -= c[after] * (i - preDay[1]);\n\t\t\t}\n\t\t\treturn ret;\n\t\t}\n\n\t\tvoid stateSwap(int d) {\n\t\t\tint before = this.contests[d];\n\t\t\tint after = this.contests[d + 1];\n\t\t\tthis.contests[d] = after;\n\t\t\tthis.contests[d + 1] = before;\n\t\t\tthis.scoreC[before] = 0;\n\t\t\tthis.scoreC[after] = 0;\n\n\t\t\tArrays.fill(preDay, -1);\n\t\t\tfor (int i = 0; i < D; i++) {\n\t\t\t\tint t = this.contests[i];\n\t\t\t\tif (t == before) {\n\t\t\t\t\tthis.scoreC[before] += s[i][t];\n\t\t\t\t\tpreDay[0] = i;\n\t\t\t\t} else if (t == after) {\n\t\t\t\t\tthis.scoreC[after] += s[i][t];\n\t\t\t\t\tpreDay[1] = i;\n\t\t\t\t}\n\t\t\t\tthis.scoreC[before] -= c[before] * (i - preDay[0]);\n\t\t\t\tthis.scoreC[after] -= c[after] * (i - preDay[1]);\n\t\t\t}\n\t\t}\n\n\t\tint evalChange(int cd, int ct) {\n\t\t\tint ret = this.score;\n\t\t\tint before = this.contests[cd];\n\t\t\tret -= this.scoreC[before];\n\t\t\tret -= this.scoreC[ct];\n\t\t\tArrays.fill(preDay, -1);\n\t\t\tfor (int i = 0; i < D; i++) {\n\t\t\t\tint t = this.contests[i];\n\t\t\t\tif (i == cd) {\n\t\t\t\t\tret += s[i][ct];\n\t\t\t\t\tpreDay[1] = i;\n\t\t\t\t} else {\n\t\t\t\t\tif (t == before) {\n\t\t\t\t\t\tret += s[i][t];\n\t\t\t\t\t\tpreDay[0] = i;\n\t\t\t\t\t} else if (t == ct) {\n\t\t\t\t\t\tret += s[i][t];\n\t\t\t\t\t\tpreDay[1] = i;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tret -= c[before] * (i - preDay[0]);\n\t\t\t\tret -= c[ct] * (i - preDay[1]);\n\t\t\t}\n\t\t\treturn ret;\n\t\t}\n\n\t\tvoid stateChange(int cd, int ct) {\n\t\t\tint before = this.contests[cd];\n\t\t\tthis.contests[cd] = ct;\n\t\t\tthis.scoreC[before] = 0;\n\t\t\tthis.scoreC[ct] = 0;\n\n\t\t\tArrays.fill(preDay, -1);\n\t\t\tfor (int i = 0; i < D; i++) {\n\t\t\t\tint t = this.contests[i];\n\t\t\t\tif (t == before) {\n\t\t\t\t\tthis.scoreC[before] += s[i][t];\n\t\t\t\t\tpreDay[0] = i;\n\t\t\t\t} else if (t == ct) {\n\t\t\t\t\tthis.scoreC[ct] += s[i][t];\n\t\t\t\t\tpreDay[1] = i;\n\t\t\t\t}\n\t\t\t\tthis.scoreC[before] -= c[before] * (i - preDay[0]);\n\t\t\t\tthis.scoreC[ct] -= c[ct] * (i - preDay[1]);\n\t\t\t}\n\t\t\t//this.score += this.scoreC[before];\n\t\t\t//this.score += this.scoreC[ct];\n\t\t}\n\n\t\tpublic Node(Node n) {\n\t\t\tthis.score = n.score;\n\t\t\tthis.contests = Arrays.copyOf(n.contests, D);\n\t\t}\n\n\t\tpublic int eval() {\n\t\t\tthis.score = 0;\n\t\t\tArrays.fill(scoreC, 0);\n\t\t\tArrays.fill(preOpen, -1);\n\t\t\tfor (int i = 0; i < D; i++) {\n\t\t\t\tint t = this.contests[i];\n\t\t\t\tscore += s[i][t];\n\t\t\t\tscoreC[t] += s[i][t];\n\t\t\t\tpreOpen[t] = i;\n\t\t\t\tfor (int j = 0; j < T; j++) {\n\t\t\t\t\tint tmp = c[j] * (i - preOpen[j]);\n\t\t\t\t\tscore -= tmp;\n\t\t\t\t\tscoreC[j] -= tmp;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn this.score;\n\t\t}\n\n\n\n\t\tpublic void evalTmp(byte[][][] nowStep) {\n\t\t\t// TODO\n\t\t}\n\n\t\t@Override\n\t\tpublic int compareTo(Node o) {\n\t\t\treturn Integer.compare(this.score, o.score);\n\t\t}\n\n\t}\n\n\tint valid(int p) {\n\t\tif (p == -1) {\n\t\t\treturn D - 1;\n\t\t}\n\t\tif (p == D) {\n\t\t\treturn 0;\n\t\t}\n\t\treturn p;\n\t}\n\n\tint changeD(int d, byte b) {\n\t\tswitch (b) {\n\t\tcase 0:\n\t\t\treturn 0;\n\t\tcase 1:\n\t\t\treturn 1;\n\t\tcase 2:\n\t\t\treturn 2;\n\t\tcase 3:\n\t\t\treturn 3;\n\t\tdefault:\n\t\t\tbreak;\n\t\t}\n\t\treturn d;\n\t}\n\n\t// object\n\tclass P {\n\t\tint y, x;\n\n\t\tpublic P(int y, int x) {\n\t\t\tthis.y = y;\n\t\t\tthis.x = x;\n\t\t}\n\n\t\tpublic P(P p) {\n\t\t\tthis.y = p.y;\n\t\t\tthis.x = p.x;\n\t\t}\n\n\t\tP nextP(int d) {\n\t\t\tint ny = valid(y + dy[d]);\n\t\t\tint nx = valid(x + dx[d]);\n\t\t\treturn new P(ny, nx);\n\t\t}\n\n\t\tpublic String toString() {\n\t\t\treturn y + \" \" + x;\n\t\t}\n\t}\n\n\tclass D {\n\t\tP p;\n\t\tbyte d;\n\n\t\tpublic D(P p, int d) {\n\t\t\tthis.p = p;\n\t\t\tthis.d = (byte) d;\n\t\t}\n\n\t\tpublic D(D d) {\n\t\t\tthis.p = new P(d.p);\n\t\t\tthis.d = d.d;\n\t\t}\n\n\t\tpublic String toString() {\n\t\t\treturn p.y + \" \" + p.x + \" \" + d;\n\t\t}\n\t}\n\n\t// library\n\tclass FastScanner {\n\t\tprivate final InputStream in;\n\t\tprivate final byte[] buffer = new byte[1024];\n\t\tprivate int ptr = 0;\n\t\tprivate int buflen = 0;\n\n\t\tFastScanner(InputStream in) {\n\t\t\tthis.in = in;\n\t\t}\n\n\t\tprivate boolean hasNextByte() {\n\t\t\tif (ptr < buflen) {\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\tptr = 0;\n\t\t\t\ttry {\n\t\t\t\t\tbuflen = in.read(buffer);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t\tif (buflen <= 0) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\tprivate int readByte() {\n\t\t\tif (hasNextByte())\n\t\t\t\treturn buffer[ptr++];\n\t\t\telse\n\t\t\t\treturn -1;\n\t\t}\n\n\t\tprivate boolean isPrintableChar(int c) {\n\t\t\treturn 33 <= c && c <= 126;\n\t\t}\n\n\t\tpublic boolean hasNext() {\n\t\t\twhile (hasNextByte() && !isPrintableChar(buffer[ptr]))\n\t\t\t\tptr++;\n\t\t\treturn hasNextByte();\n\t\t}\n\n\t\tpublic String next() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tint b = readByte();\n\t\t\twhile (isPrintableChar(b)) {\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\treturn sb.toString();\n\t\t}\n\n\t\tpublic long nextLong() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tlong n = 0;\n\t\t\tboolean minus = false;\n\t\t\tint b = readByte();\n\t\t\tif (b == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\tif (b < '0' || '9' < b) {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\twhile (true) {\n\t\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\t\tn *= 10;\n\t\t\t\t\tn += b - '0';\n\t\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\t\treturn minus ? -n : n;\n\t\t\t\t} else {\n\t\t\t\t\tthrow new NumberFormatException();\n\t\t\t\t}\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\tlong nl = nextLong();\n\t\t\tif (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)\n\t\t\t\tthrow new NumberFormatException();\n\t\t\treturn (int) nl;\n\t\t}\n\n\t\tpublic double nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\t}\n\n\tclass Random {\n\t\tprivate long seed;\n\t\tprivate final long multiplier = 0x5DEECE66DL, addend = 0xBL, mask = (1L << 48) - 1;\n\t\tint bits, val;\n\n\t\tRandom(long seed) {\n\t\t\tthis.seed = seed;\n\t\t}\n\n\t\tint nextInt(int n) {\n\t\t\tdo {\n\t\t\t\tbits = (int) ((seed = (seed * multiplier + addend) & mask) >>> 17);\n\t\t\t\tval = bits % n;\n\t\t\t} while (bits - val + (n - 1) < 0);\n\t\t\treturn val;\n\t\t}\n\n\t\tdouble nextDouble() {\n\t\t\treturn nextInt(10000000) / 10000000.0;\n\t\t}\n\t}\n\n\tstatic long TL = 1000;\n\tstatic boolean submit = true;\n}", "problem_context": "Problem Statement\n\nAtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the number of users has grown, in order to meet the needs of more users, AtCoder has decided to increase the number of contests to 26 types, from AAC to AZC. For convenience, we number these 26 types as type 1 through type 26. AtCoder wants to schedule contests for D days so that user satisfaction is as high as possible. For every day, AtCoder will hold exactly one contest, and each contest will end on that day. The satisfaction is calculated as follows.\n\nThe satisfaction at the beginning of day 1 is 0. Satisfaction can be negative.\n\nHolding contests increases satisfaction. The amount of increase will vary depending on a variety of factors. Specifically, we know in advance that holding a contest of type i on day d will increase the satisfaction by s_{d,i}.\n\nIf a particular type of contest is not held for a while, the satisfaction decreases. Each contest type i has an integer c_i, and at the end of each day d=1,2,...,D, the satisfaction decreases as follows. Let \\mathrm{last}(d,i) be the last day before day d (including d) on which a contest of type i was held. If contests of type i have never been held yet, we define \\mathrm{last}(d,i)=0. At the end of day d, the satisfaction decreases by \\sum _{i=1}^{26}c_i \\times (d-\\mathrm{last}(d,i)).\n\nPlease schedule contests on behalf of AtCoder.\nIf the satisfaction at the end of day D is S, you will get a score of \\max(10^6 + S, 0).\nThere are 50 test cases, and the score of a submission is the total scores for each test case.\nYou can make submissions multiple times, and the highest score among your submissions will be your score.\n\nConstraints\n\nD = 365\n\nEach c_i is an integer satisfying 0\\leq c_i \\leq 100.\n\nEach s_{d,i} is an integer satisfying 0\\leq s_{d,i} \\leq 20000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD\nc_1 c_2 \\cdots c_{26}\ns_{1,1} s_{1,2} \\cdots s_{1,26}\n\\vdots\ns_{D,1} s_{D,2} \\cdots s_{D,26}\n\nOutput\n\nLet t_d (1\\leq t_d \\leq 26) be the type of the contest that will be held at day d.\nPrint D integers t_d to Standard Output in the following format:\n\nt_1\nt_2\n\\vdots\nt_D\n\nAny output that does not follow the above format may result in 0 pointsWA for that test case.\n\nInput Generation\n\nEach integer c_i and s_{d,i} is generated independently and uniformly at random from the integers in the range described in the problem statement.\n\nSample Input 1\n\n5\n86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192\n\nSample Output 1\n\n1\n17\n13\n14\n13\n\nNote that this example is a small one for checking the problem specification. It does not satisfy the constraint D=365 and is never actually given as a test case. The final satisfaction with this output is 79325, so the score is 1079325.\n\nInput generator, score calculator, and visualizer\n\nBeginner's Guide\n\nIf you don't know what to do, proceed to problem B or C.", "sample_input": "5\n86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192\n"}, "reference_outputs": ["1\n17\n13\n14\n13\n"], "source_document_id": "p02618", "source_text": "Problem Statement\n\nAtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the number of users has grown, in order to meet the needs of more users, AtCoder has decided to increase the number of contests to 26 types, from AAC to AZC. For convenience, we number these 26 types as type 1 through type 26. AtCoder wants to schedule contests for D days so that user satisfaction is as high as possible. For every day, AtCoder will hold exactly one contest, and each contest will end on that day. The satisfaction is calculated as follows.\n\nThe satisfaction at the beginning of day 1 is 0. Satisfaction can be negative.\n\nHolding contests increases satisfaction. The amount of increase will vary depending on a variety of factors. Specifically, we know in advance that holding a contest of type i on day d will increase the satisfaction by s_{d,i}.\n\nIf a particular type of contest is not held for a while, the satisfaction decreases. Each contest type i has an integer c_i, and at the end of each day d=1,2,...,D, the satisfaction decreases as follows. Let \\mathrm{last}(d,i) be the last day before day d (including d) on which a contest of type i was held. If contests of type i have never been held yet, we define \\mathrm{last}(d,i)=0. At the end of day d, the satisfaction decreases by \\sum _{i=1}^{26}c_i \\times (d-\\mathrm{last}(d,i)).\n\nPlease schedule contests on behalf of AtCoder.\nIf the satisfaction at the end of day D is S, you will get a score of \\max(10^6 + S, 0).\nThere are 50 test cases, and the score of a submission is the total scores for each test case.\nYou can make submissions multiple times, and the highest score among your submissions will be your score.\n\nConstraints\n\nD = 365\n\nEach c_i is an integer satisfying 0\\leq c_i \\leq 100.\n\nEach s_{d,i} is an integer satisfying 0\\leq s_{d,i} \\leq 20000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD\nc_1 c_2 \\cdots c_{26}\ns_{1,1} s_{1,2} \\cdots s_{1,26}\n\\vdots\ns_{D,1} s_{D,2} \\cdots s_{D,26}\n\nOutput\n\nLet t_d (1\\leq t_d \\leq 26) be the type of the contest that will be held at day d.\nPrint D integers t_d to Standard Output in the following format:\n\nt_1\nt_2\n\\vdots\nt_D\n\nAny output that does not follow the above format may result in 0 pointsWA for that test case.\n\nInput Generation\n\nEach integer c_i and s_{d,i} is generated independently and uniformly at random from the integers in the range described in the problem statement.\n\nSample Input 1\n\n5\n86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192\n\nSample Output 1\n\n1\n17\n13\n14\n13\n\nNote that this example is a small one for checking the problem specification. It does not satisfy the constraint D=365 and is never actually given as a test case. The final satisfaction with this output is 79325, so the score is 1079325.\n\nInput generator, score calculator, and visualizer\n\nBeginner's Guide\n\nIf you don't know what to do, proceed to problem B or C.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 11183, "cpu_time_ms": 1992, "memory_kb": 40428}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s038782935", "group_id": "codeNet:p02618", "input_text": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint d = sc.nextInt();\n\n\t\tint[] c = new int[27];\n\t\tfor ( int i=1; i<27; i++ ) {\n\t\t\tc[i] = sc.nextInt();\n\t\t}\n\n\t\tint[][] s = new int[d][27];\n\t\tfor ( int i=0; iman ) {\n\t\t\t\t\tman = manj;\n\t\t\t\t\tt = j;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlast[t] = i+1;\n\t\t\tSystem.out.println(t);\n\t\t}\n\n\t}\n}", "language": "Java", "metadata": {"date": 1593395524, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02618.html", "problem_id": "p02618", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02618/input.txt", "sample_output_relpath": "derived/input_output/data/p02618/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02618/Java/s038782935.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s038782935", "user_id": "u526355529"}, "prompt_components": {"gold_output": "1\n17\n13\n14\n13\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint d = sc.nextInt();\n\n\t\tint[] c = new int[27];\n\t\tfor ( int i=1; i<27; i++ ) {\n\t\t\tc[i] = sc.nextInt();\n\t\t}\n\n\t\tint[][] s = new int[d][27];\n\t\tfor ( int i=0; iman ) {\n\t\t\t\t\tman = manj;\n\t\t\t\t\tt = j;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlast[t] = i+1;\n\t\t\tSystem.out.println(t);\n\t\t}\n\n\t}\n}", "problem_context": "Problem Statement\n\nAtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the number of users has grown, in order to meet the needs of more users, AtCoder has decided to increase the number of contests to 26 types, from AAC to AZC. For convenience, we number these 26 types as type 1 through type 26. AtCoder wants to schedule contests for D days so that user satisfaction is as high as possible. For every day, AtCoder will hold exactly one contest, and each contest will end on that day. The satisfaction is calculated as follows.\n\nThe satisfaction at the beginning of day 1 is 0. Satisfaction can be negative.\n\nHolding contests increases satisfaction. The amount of increase will vary depending on a variety of factors. Specifically, we know in advance that holding a contest of type i on day d will increase the satisfaction by s_{d,i}.\n\nIf a particular type of contest is not held for a while, the satisfaction decreases. Each contest type i has an integer c_i, and at the end of each day d=1,2,...,D, the satisfaction decreases as follows. Let \\mathrm{last}(d,i) be the last day before day d (including d) on which a contest of type i was held. If contests of type i have never been held yet, we define \\mathrm{last}(d,i)=0. At the end of day d, the satisfaction decreases by \\sum _{i=1}^{26}c_i \\times (d-\\mathrm{last}(d,i)).\n\nPlease schedule contests on behalf of AtCoder.\nIf the satisfaction at the end of day D is S, you will get a score of \\max(10^6 + S, 0).\nThere are 50 test cases, and the score of a submission is the total scores for each test case.\nYou can make submissions multiple times, and the highest score among your submissions will be your score.\n\nConstraints\n\nD = 365\n\nEach c_i is an integer satisfying 0\\leq c_i \\leq 100.\n\nEach s_{d,i} is an integer satisfying 0\\leq s_{d,i} \\leq 20000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD\nc_1 c_2 \\cdots c_{26}\ns_{1,1} s_{1,2} \\cdots s_{1,26}\n\\vdots\ns_{D,1} s_{D,2} \\cdots s_{D,26}\n\nOutput\n\nLet t_d (1\\leq t_d \\leq 26) be the type of the contest that will be held at day d.\nPrint D integers t_d to Standard Output in the following format:\n\nt_1\nt_2\n\\vdots\nt_D\n\nAny output that does not follow the above format may result in 0 pointsWA for that test case.\n\nInput Generation\n\nEach integer c_i and s_{d,i} is generated independently and uniformly at random from the integers in the range described in the problem statement.\n\nSample Input 1\n\n5\n86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192\n\nSample Output 1\n\n1\n17\n13\n14\n13\n\nNote that this example is a small one for checking the problem specification. It does not satisfy the constraint D=365 and is never actually given as a test case. The final satisfaction with this output is 79325, so the score is 1079325.\n\nInput generator, score calculator, and visualizer\n\nBeginner's Guide\n\nIf you don't know what to do, proceed to problem B or C.", "sample_input": "5\n86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192\n"}, "reference_outputs": ["1\n17\n13\n14\n13\n"], "source_document_id": "p02618", "source_text": "Problem Statement\n\nAtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the number of users has grown, in order to meet the needs of more users, AtCoder has decided to increase the number of contests to 26 types, from AAC to AZC. For convenience, we number these 26 types as type 1 through type 26. AtCoder wants to schedule contests for D days so that user satisfaction is as high as possible. For every day, AtCoder will hold exactly one contest, and each contest will end on that day. The satisfaction is calculated as follows.\n\nThe satisfaction at the beginning of day 1 is 0. Satisfaction can be negative.\n\nHolding contests increases satisfaction. The amount of increase will vary depending on a variety of factors. Specifically, we know in advance that holding a contest of type i on day d will increase the satisfaction by s_{d,i}.\n\nIf a particular type of contest is not held for a while, the satisfaction decreases. Each contest type i has an integer c_i, and at the end of each day d=1,2,...,D, the satisfaction decreases as follows. Let \\mathrm{last}(d,i) be the last day before day d (including d) on which a contest of type i was held. If contests of type i have never been held yet, we define \\mathrm{last}(d,i)=0. At the end of day d, the satisfaction decreases by \\sum _{i=1}^{26}c_i \\times (d-\\mathrm{last}(d,i)).\n\nPlease schedule contests on behalf of AtCoder.\nIf the satisfaction at the end of day D is S, you will get a score of \\max(10^6 + S, 0).\nThere are 50 test cases, and the score of a submission is the total scores for each test case.\nYou can make submissions multiple times, and the highest score among your submissions will be your score.\n\nConstraints\n\nD = 365\n\nEach c_i is an integer satisfying 0\\leq c_i \\leq 100.\n\nEach s_{d,i} is an integer satisfying 0\\leq s_{d,i} \\leq 20000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD\nc_1 c_2 \\cdots c_{26}\ns_{1,1} s_{1,2} \\cdots s_{1,26}\n\\vdots\ns_{D,1} s_{D,2} \\cdots s_{D,26}\n\nOutput\n\nLet t_d (1\\leq t_d \\leq 26) be the type of the contest that will be held at day d.\nPrint D integers t_d to Standard Output in the following format:\n\nt_1\nt_2\n\\vdots\nt_D\n\nAny output that does not follow the above format may result in 0 pointsWA for that test case.\n\nInput Generation\n\nEach integer c_i and s_{d,i} is generated independently and uniformly at random from the integers in the range described in the problem statement.\n\nSample Input 1\n\n5\n86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192\n\nSample Output 1\n\n1\n17\n13\n14\n13\n\nNote that this example is a small one for checking the problem specification. It does not satisfy the constraint D=365 and is never actually given as a test case. The final satisfaction with this output is 79325, so the score is 1079325.\n\nInput generator, score calculator, and visualizer\n\nBeginner's Guide\n\nIf you don't know what to do, proceed to problem B or C.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 763, "cpu_time_ms": 246, "memory_kb": 46632}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s572937265", "group_id": "codeNet:p02623", "input_text": "import java.util.*;\n\npublic class Main {\n\n public static void main(String args []) {\n\n Scanner scan = new Scanner(System.in);\n\n int n = scan.nextInt();\n int m = scan.nextInt();\n int k = scan.nextInt();\n\n long a[] = new long[n+1];\n long b[] = new long[m+1];\n long asum[] = new long[n+1];\n long bsum[] = new long[m+1];\n\n for (int i=1; i<=n; i++) {\n a[i] = scan.nextLong();\n\n asum[i] = asum[i-1] + a[i];\n }\n for (int i = 1; i<=m; i++) {\n b[i] = scan.nextLong();\n\n bsum[i] = bsum[i-1] + b[i];\n }\n\n int sum = 0;\n int j = m;\n\n for (int i=0; i<=n; i++) {\n\n if (a[i] > k) {\n continue;\n }\n\n while (b[j] > k - a[i]) {\n j--;\n }\n sum = Math.max(sum, i + j);\n }\n\n System.out.println(sum);\n\n }\n}\n", "language": "Java", "metadata": {"date": 1599255376, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02623/input.txt", "sample_output_relpath": "derived/input_output/data/p02623/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02623/Java/s572937265.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s572937265", "user_id": "u664527705"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n\n public static void main(String args []) {\n\n Scanner scan = new Scanner(System.in);\n\n int n = scan.nextInt();\n int m = scan.nextInt();\n int k = scan.nextInt();\n\n long a[] = new long[n+1];\n long b[] = new long[m+1];\n long asum[] = new long[n+1];\n long bsum[] = new long[m+1];\n\n for (int i=1; i<=n; i++) {\n a[i] = scan.nextLong();\n\n asum[i] = asum[i-1] + a[i];\n }\n for (int i = 1; i<=m; i++) {\n b[i] = scan.nextLong();\n\n bsum[i] = bsum[i-1] + b[i];\n }\n\n int sum = 0;\n int j = m;\n\n for (int i=0; i<=n; i++) {\n\n if (a[i] > k) {\n continue;\n }\n\n while (b[j] > k - a[i]) {\n j--;\n }\n sum = Math.max(sum, i + j);\n }\n\n System.out.println(sum);\n\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "sample_input": "3 4 240\n60 90 120\n80 150 80 150\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02623", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 936, "cpu_time_ms": 651, "memory_kb": 66876}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s525473504", "group_id": "codeNet:p02623", "input_text": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.Comparator;\nimport java.util.Objects;\nimport java.util.StringTokenizer;\nimport java.util.function.BiFunction;\nimport java.util.function.Function;\n\npublic class Main {\n\n static BiFunction ADD = (x, y) -> (x + y);\n static BiFunction, ArrayList, ArrayList> ADD_ARRAY_LIST = (x, y) -> {\n x.addAll(y);\n return x;\n };\n\n static Function, Integer> GET_FIRST = (x) -> (x.first);\n static Function, Integer> GET_SECOND = (x) -> (x.second);\n static Comparator> C = Comparator.comparing(GET_FIRST).thenComparing(GET_SECOND);\n\n public static void main(String[] args) throws Exception {\n long startTime = System.nanoTime();\n int t = 1;\n while (t-- > 0) {\n solve();\n }\n long endTime = System.nanoTime();\n err.println(\"Execution Time : +\" + (endTime - startTime) / 1000000 + \" ms\");\n exit(0);\n }\n\n static void solve() {\n int n = in.nextInt(), m = in.nextInt(), k = in.nextInt();\n long sum = 0;\n int[] A = in.readAllInts(n);\n int[] B = in.readAllInts(m);\n long[] AA = new long[n + 1];\n long[] AB = new long[m + 1];\n for (int i = 0; i < n; i++) {\n AA[i + 1] = AA[i] + A[i];\n }\n for (int i = 0; i < m; i++) {\n AB[i + 1] = AB[i] + B[i];\n }\n int ans = 0;\n for (int i = 1; i <= n; i++) {\n if (AA[i] <= k) {\n int j = upper_bound(AB, k - AA[i]);\n ans = Math.max(ans, i + j - 1);\n }\n }\n out.println(ans);\n }\n\n static int upper_bound(long[] ab, long i) {\n int l = 1;\n int r = ab.length-1;\n int mid;\n int ans = r;\n while (l <= r) {\n mid = (l + r) / 2;\n if (ab[mid] < i) {\n l = mid + 1;\n } else if (ab[mid] > i) {\n r = mid - 1;\n ans = mid;\n } else {\n r = mid - 1;\n }\n }\n return ans;\n }\n\n static void debug(Object... args) {\n for (Object a : args) {\n out.println(a);\n }\n }\n\n static void y() {\n out.println(\"YES\");\n }\n\n static void n() {\n out.println(\"NO\");\n }\n\n static T min(T a, T b, Comparator C) {\n if (C.compare(a, b) <= 0) {\n return a;\n }\n return b;\n }\n\n static T max(T a, T b, Comparator C) {\n if (C.compare(a, b) >= 0) {\n return a;\n }\n return b;\n }\n\n static void fail() {\n out.println(\"-1\");\n }\n\n static class Pair {\n public T first;\n public R second;\n\n public Pair(T first, R second) {\n this.first = first;\n this.second = second;\n }\n\n @Override\n public boolean equals(final Object o) {\n if (this == o) {\n return true;\n }\n if (o == null || getClass() != o.getClass()) {\n return false;\n }\n final Pair pair = (Pair) o;\n return Objects.equals(first, pair.first) && Objects.equals(second, pair.second);\n }\n\n @Override\n public int hashCode() {\n return Objects.hash(first, second);\n }\n\n @Override\n public String toString() {\n return \"Pair{\" + \"a=\" + first + \", b=\" + second + '}';\n }\n\n public T getFirst() {\n return first;\n }\n\n public R getSecond() {\n return second;\n }\n }\n\n static Pair make_pair(T a, R b) {\n return new Pair<>(a, b);\n }\n\n static class ArrayUtils {\n\n static void swap(int[] a, int i, int j) {\n int temp = a[i];\n a[i] = a[j];\n a[j] = temp;\n }\n\n static void swap(char[] a, int i, int j) {\n char temp = a[i];\n a[i] = a[j];\n a[j] = temp;\n }\n\n static void print(char[] a) {\n for (char c : a) {\n out.print(c);\n }\n out.println(\"\");\n }\n\n static int[] reverse(int[] data) {\n int[] p = new int[data.length];\n for (int i = 0, j = data.length - 1; i < data.length; i++, j--) {\n p[i] = data[j];\n }\n return p;\n }\n\n static void prefixSum(long[] data) {\n for (int i = 1; i < data.length; i++) {\n data[i] += data[i - 1];\n }\n }\n\n static void prefixSum(int[] data) {\n for (int i = 1; i < data.length; i++) {\n data[i] += data[i - 1];\n }\n }\n\n static long[] reverse(long[] data) {\n long[] p = new long[data.length];\n for (int i = 0, j = data.length - 1; i < data.length; i++, j--) {\n p[i] = data[j];\n }\n return p;\n }\n\n static char[] reverse(char[] data) {\n char[] p = new char[data.length];\n for (int i = 0, j = data.length - 1; i < data.length; i++, j--) {\n p[i] = data[j];\n }\n return p;\n }\n\n static int[] MergeSort(int[] A) {\n if (A.length > 1) {\n int q = A.length / 2;\n int[] left = new int[q];\n int[] right = new int[A.length - q];\n System.arraycopy(A, 0, left, 0, q);\n System.arraycopy(A, q, right, 0, A.length - q);\n int[] left_sorted = MergeSort(left);\n int[] right_sorted = MergeSort(right);\n return Merge(left_sorted, right_sorted);\n } else {\n return A;\n }\n }\n\n static int[] Merge(int[] left, int[] right) {\n int[] A = new int[left.length + right.length];\n int i = 0;\n int j = 0;\n for (int k = 0; k < A.length; k++) {\n // To handle left becoming empty\n if (i == left.length && j < right.length) {\n A[k] = right[j];\n j++;\n continue;\n }\n // To handle right becoming empty\n if (j == right.length && i < left.length) {\n A[k] = left[i];\n i++;\n continue;\n }\n if (left[i] <= right[j]) {\n A[k] = left[i];\n i++;\n } else {\n A[k] = right[j];\n j++;\n }\n }\n return A;\n }\n\n static long[] MergeSort(long[] A) {\n if (A.length > 1) {\n int q = A.length / 2;\n long[] left = new long[q];\n long[] right = new long[A.length - q];\n System.arraycopy(A, 0, left, 0, q);\n System.arraycopy(A, q, right, 0, A.length - q);\n long[] left_sorted = MergeSort(left);\n long[] right_sorted = MergeSort(right);\n return Merge(left_sorted, right_sorted);\n } else {\n return A;\n }\n }\n\n static long[] Merge(long[] left, long[] right) {\n long[] A = new long[left.length + right.length];\n int i = 0;\n int j = 0;\n for (int k = 0; k < A.length; k++) {\n // To handle left becoming empty\n if (i == left.length && j < right.length) {\n A[k] = right[j];\n j++;\n continue;\n }\n // To handle right becoming empty\n if (j == right.length && i < left.length) {\n A[k] = left[i];\n i++;\n continue;\n }\n if (left[i] <= right[j]) {\n A[k] = left[i];\n i++;\n } else {\n A[k] = right[j];\n j++;\n }\n }\n return A;\n }\n }\n\n static class InputReader {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 2048);\n tokenizer = null;\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public int[] readAllInts(int n) {\n int[] p = new int[n];\n for (int i = 0; i < n; i++) {\n p[i] = in.nextInt();\n }\n return p;\n }\n\n public int[] readAllInts(int n, int s) {\n int[] p = new int[n + s];\n for (int i = s; i < n + s; i++) {\n p[i] = in.nextInt();\n }\n return p;\n }\n\n public long[] readAllLongs(int n) {\n long[] p = new long[n];\n for (int i = 0; i < n; i++) {\n p[i] = in.nextLong();\n }\n return p;\n }\n\n public long[] readAllLongs(int n, int s) {\n long[] p = new long[n + s];\n for (int i = s; i < n + s; i++) {\n p[i] = in.nextLong();\n }\n return p;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n }\n\n static void exit(int a) {\n out.close();\n err.close();\n System.exit(a);\n }\n\n static InputStream inputStream = System.in;\n static OutputStream outputStream = System.out;\n static OutputStream errStream = System.err;\n static InputReader in = new InputReader(inputStream);\n static PrintWriter out = new PrintWriter(outputStream);\n static PrintWriter err = new PrintWriter(errStream);\n static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n}\n", "language": "Java", "metadata": {"date": 1599071808, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02623/input.txt", "sample_output_relpath": "derived/input_output/data/p02623/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02623/Java/s525473504.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s525473504", "user_id": "u669876141"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.Comparator;\nimport java.util.Objects;\nimport java.util.StringTokenizer;\nimport java.util.function.BiFunction;\nimport java.util.function.Function;\n\npublic class Main {\n\n static BiFunction ADD = (x, y) -> (x + y);\n static BiFunction, ArrayList, ArrayList> ADD_ARRAY_LIST = (x, y) -> {\n x.addAll(y);\n return x;\n };\n\n static Function, Integer> GET_FIRST = (x) -> (x.first);\n static Function, Integer> GET_SECOND = (x) -> (x.second);\n static Comparator> C = Comparator.comparing(GET_FIRST).thenComparing(GET_SECOND);\n\n public static void main(String[] args) throws Exception {\n long startTime = System.nanoTime();\n int t = 1;\n while (t-- > 0) {\n solve();\n }\n long endTime = System.nanoTime();\n err.println(\"Execution Time : +\" + (endTime - startTime) / 1000000 + \" ms\");\n exit(0);\n }\n\n static void solve() {\n int n = in.nextInt(), m = in.nextInt(), k = in.nextInt();\n long sum = 0;\n int[] A = in.readAllInts(n);\n int[] B = in.readAllInts(m);\n long[] AA = new long[n + 1];\n long[] AB = new long[m + 1];\n for (int i = 0; i < n; i++) {\n AA[i + 1] = AA[i] + A[i];\n }\n for (int i = 0; i < m; i++) {\n AB[i + 1] = AB[i] + B[i];\n }\n int ans = 0;\n for (int i = 1; i <= n; i++) {\n if (AA[i] <= k) {\n int j = upper_bound(AB, k - AA[i]);\n ans = Math.max(ans, i + j - 1);\n }\n }\n out.println(ans);\n }\n\n static int upper_bound(long[] ab, long i) {\n int l = 1;\n int r = ab.length-1;\n int mid;\n int ans = r;\n while (l <= r) {\n mid = (l + r) / 2;\n if (ab[mid] < i) {\n l = mid + 1;\n } else if (ab[mid] > i) {\n r = mid - 1;\n ans = mid;\n } else {\n r = mid - 1;\n }\n }\n return ans;\n }\n\n static void debug(Object... args) {\n for (Object a : args) {\n out.println(a);\n }\n }\n\n static void y() {\n out.println(\"YES\");\n }\n\n static void n() {\n out.println(\"NO\");\n }\n\n static T min(T a, T b, Comparator C) {\n if (C.compare(a, b) <= 0) {\n return a;\n }\n return b;\n }\n\n static T max(T a, T b, Comparator C) {\n if (C.compare(a, b) >= 0) {\n return a;\n }\n return b;\n }\n\n static void fail() {\n out.println(\"-1\");\n }\n\n static class Pair {\n public T first;\n public R second;\n\n public Pair(T first, R second) {\n this.first = first;\n this.second = second;\n }\n\n @Override\n public boolean equals(final Object o) {\n if (this == o) {\n return true;\n }\n if (o == null || getClass() != o.getClass()) {\n return false;\n }\n final Pair pair = (Pair) o;\n return Objects.equals(first, pair.first) && Objects.equals(second, pair.second);\n }\n\n @Override\n public int hashCode() {\n return Objects.hash(first, second);\n }\n\n @Override\n public String toString() {\n return \"Pair{\" + \"a=\" + first + \", b=\" + second + '}';\n }\n\n public T getFirst() {\n return first;\n }\n\n public R getSecond() {\n return second;\n }\n }\n\n static Pair make_pair(T a, R b) {\n return new Pair<>(a, b);\n }\n\n static class ArrayUtils {\n\n static void swap(int[] a, int i, int j) {\n int temp = a[i];\n a[i] = a[j];\n a[j] = temp;\n }\n\n static void swap(char[] a, int i, int j) {\n char temp = a[i];\n a[i] = a[j];\n a[j] = temp;\n }\n\n static void print(char[] a) {\n for (char c : a) {\n out.print(c);\n }\n out.println(\"\");\n }\n\n static int[] reverse(int[] data) {\n int[] p = new int[data.length];\n for (int i = 0, j = data.length - 1; i < data.length; i++, j--) {\n p[i] = data[j];\n }\n return p;\n }\n\n static void prefixSum(long[] data) {\n for (int i = 1; i < data.length; i++) {\n data[i] += data[i - 1];\n }\n }\n\n static void prefixSum(int[] data) {\n for (int i = 1; i < data.length; i++) {\n data[i] += data[i - 1];\n }\n }\n\n static long[] reverse(long[] data) {\n long[] p = new long[data.length];\n for (int i = 0, j = data.length - 1; i < data.length; i++, j--) {\n p[i] = data[j];\n }\n return p;\n }\n\n static char[] reverse(char[] data) {\n char[] p = new char[data.length];\n for (int i = 0, j = data.length - 1; i < data.length; i++, j--) {\n p[i] = data[j];\n }\n return p;\n }\n\n static int[] MergeSort(int[] A) {\n if (A.length > 1) {\n int q = A.length / 2;\n int[] left = new int[q];\n int[] right = new int[A.length - q];\n System.arraycopy(A, 0, left, 0, q);\n System.arraycopy(A, q, right, 0, A.length - q);\n int[] left_sorted = MergeSort(left);\n int[] right_sorted = MergeSort(right);\n return Merge(left_sorted, right_sorted);\n } else {\n return A;\n }\n }\n\n static int[] Merge(int[] left, int[] right) {\n int[] A = new int[left.length + right.length];\n int i = 0;\n int j = 0;\n for (int k = 0; k < A.length; k++) {\n // To handle left becoming empty\n if (i == left.length && j < right.length) {\n A[k] = right[j];\n j++;\n continue;\n }\n // To handle right becoming empty\n if (j == right.length && i < left.length) {\n A[k] = left[i];\n i++;\n continue;\n }\n if (left[i] <= right[j]) {\n A[k] = left[i];\n i++;\n } else {\n A[k] = right[j];\n j++;\n }\n }\n return A;\n }\n\n static long[] MergeSort(long[] A) {\n if (A.length > 1) {\n int q = A.length / 2;\n long[] left = new long[q];\n long[] right = new long[A.length - q];\n System.arraycopy(A, 0, left, 0, q);\n System.arraycopy(A, q, right, 0, A.length - q);\n long[] left_sorted = MergeSort(left);\n long[] right_sorted = MergeSort(right);\n return Merge(left_sorted, right_sorted);\n } else {\n return A;\n }\n }\n\n static long[] Merge(long[] left, long[] right) {\n long[] A = new long[left.length + right.length];\n int i = 0;\n int j = 0;\n for (int k = 0; k < A.length; k++) {\n // To handle left becoming empty\n if (i == left.length && j < right.length) {\n A[k] = right[j];\n j++;\n continue;\n }\n // To handle right becoming empty\n if (j == right.length && i < left.length) {\n A[k] = left[i];\n i++;\n continue;\n }\n if (left[i] <= right[j]) {\n A[k] = left[i];\n i++;\n } else {\n A[k] = right[j];\n j++;\n }\n }\n return A;\n }\n }\n\n static class InputReader {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 2048);\n tokenizer = null;\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public int[] readAllInts(int n) {\n int[] p = new int[n];\n for (int i = 0; i < n; i++) {\n p[i] = in.nextInt();\n }\n return p;\n }\n\n public int[] readAllInts(int n, int s) {\n int[] p = new int[n + s];\n for (int i = s; i < n + s; i++) {\n p[i] = in.nextInt();\n }\n return p;\n }\n\n public long[] readAllLongs(int n) {\n long[] p = new long[n];\n for (int i = 0; i < n; i++) {\n p[i] = in.nextLong();\n }\n return p;\n }\n\n public long[] readAllLongs(int n, int s) {\n long[] p = new long[n + s];\n for (int i = s; i < n + s; i++) {\n p[i] = in.nextLong();\n }\n return p;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n }\n\n static void exit(int a) {\n out.close();\n err.close();\n System.exit(a);\n }\n\n static InputStream inputStream = System.in;\n static OutputStream outputStream = System.out;\n static OutputStream errStream = System.err;\n static InputReader in = new InputReader(inputStream);\n static PrintWriter out = new PrintWriter(outputStream);\n static PrintWriter err = new PrintWriter(errStream);\n static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "sample_input": "3 4 240\n60 90 120\n80 150 80 150\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02623", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 10762, "cpu_time_ms": 403, "memory_kb": 63380}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s651695946", "group_id": "codeNet:p02623", "input_text": "import java.util.ArrayList;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int M = sc.nextInt();\n long K = sc.nextLong();\n List aSum = new ArrayList<>();\n aSum.add((long) 0);\n List bSum = new ArrayList<>();\n bSum.add((long) 0);\n long tmp = 0;\n for (int i = 0; i < N; i++) {\n tmp += sc.nextLong();\n aSum.add(tmp);\n }\n tmp = 0;\n for (int i = 0; i < M; i++) {\n tmp += sc.nextLong();\n bSum.add(tmp);\n }\n int aInd = 0;\n int bInd = 0;\n long ans = 0;\n while (bSum.get(bInd) <= K) {\n bInd += 1;\n if (bInd == M) {\n break;\n }\n }\n\n while (true) {\n while (aInd <= N && aSum.get(aInd) + bSum.get(bInd) <= K) {\n aInd += 1;\n }\n if (aInd != 0) aInd -= 1;\n if (aSum.get(aInd) + bSum.get(bInd) <= K) {\n ans = Math.max(ans, aInd + bInd);\n if (aInd == N)\n break;\n aInd += 1;\n }\n if (bInd == 0)\n break;\n while (aSum.get(aInd) + bSum.get(bInd) > K) {\n bInd -= 1;\n if (bInd == -1) {\n bInd += 1;\n break;\n }\n }\n }\n System.out.println(ans);\n }\n}\n", "language": "Java", "metadata": {"date": 1598037142, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02623/input.txt", "sample_output_relpath": "derived/input_output/data/p02623/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02623/Java/s651695946.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s651695946", "user_id": "u174394352"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.ArrayList;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int M = sc.nextInt();\n long K = sc.nextLong();\n List aSum = new ArrayList<>();\n aSum.add((long) 0);\n List bSum = new ArrayList<>();\n bSum.add((long) 0);\n long tmp = 0;\n for (int i = 0; i < N; i++) {\n tmp += sc.nextLong();\n aSum.add(tmp);\n }\n tmp = 0;\n for (int i = 0; i < M; i++) {\n tmp += sc.nextLong();\n bSum.add(tmp);\n }\n int aInd = 0;\n int bInd = 0;\n long ans = 0;\n while (bSum.get(bInd) <= K) {\n bInd += 1;\n if (bInd == M) {\n break;\n }\n }\n\n while (true) {\n while (aInd <= N && aSum.get(aInd) + bSum.get(bInd) <= K) {\n aInd += 1;\n }\n if (aInd != 0) aInd -= 1;\n if (aSum.get(aInd) + bSum.get(bInd) <= K) {\n ans = Math.max(ans, aInd + bInd);\n if (aInd == N)\n break;\n aInd += 1;\n }\n if (bInd == 0)\n break;\n while (aSum.get(aInd) + bSum.get(bInd) > K) {\n bInd -= 1;\n if (bInd == -1) {\n bInd += 1;\n break;\n }\n }\n }\n System.out.println(ans);\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "sample_input": "3 4 240\n60 90 120\n80 150 80 150\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02623", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1576, "cpu_time_ms": 681, "memory_kb": 73812}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s010335845", "group_id": "codeNet:p02623", "input_text": "import java.util.*;\npublic class Main {\n //変数定義\n static long [] SumB;\n static int M ;\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n M = sc.nextInt();\n long K = sc.nextLong();\n long A[] = new long[N+1];\n long B[] = new long[M+1];\n long SumA[] = new long[N+1];\n SumA[0]=0;\n SumB = new long[M+1];\n SumB[0]=0;\n long Remain = 0;\n int wk=0;\n int ans=0;\n\n for(int i=1;i<=N;i++){\n A[i]=sc.nextLong();\n\n SumA[i]=SumA[i-1]+A[i];\n }\n\n for(int j=1;j<=M;j++){\n B[j]=sc.nextLong();\n\n SumB[j]=SumB[j-1]+B[j];\n }\n\n\n outside:for(int i=1;i<=N;i++){\n Remain = K-SumA[i];\n if (Remain>0) {\n //にぶたん\n //二分探索\n\n wk=i+(binarysearch((int)Remain));\n\n ans=Math.max(wk,ans);\n\n }\n\n else{\n //終了\n if (Remain==0) {\n wk=i;\n }\n else{\n wk=i-1;\n }\n ans=Math.max(wk,ans);\n break outside;\n }\n }\n\n\n System.out.println(ans);\n\n\n }\n\n //関数定義二分探 \n public static int binarysearch(int key) {\n \n int left = 0;\n \n int right = SumB.length;\n \n while (right - left > 1) {\n \n int mid = left + (right - left) / 2;\n \n if (SumB[mid] > key){\n right = mid;\n \n }\n else{\n left = mid;\n } \n }\n \n /* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */\n return left;\n }\n\n\n}", "language": "Java", "metadata": {"date": 1597101819, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02623/input.txt", "sample_output_relpath": "derived/input_output/data/p02623/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02623/Java/s010335845.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s010335845", "user_id": "u832153770"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n //変数定義\n static long [] SumB;\n static int M ;\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n M = sc.nextInt();\n long K = sc.nextLong();\n long A[] = new long[N+1];\n long B[] = new long[M+1];\n long SumA[] = new long[N+1];\n SumA[0]=0;\n SumB = new long[M+1];\n SumB[0]=0;\n long Remain = 0;\n int wk=0;\n int ans=0;\n\n for(int i=1;i<=N;i++){\n A[i]=sc.nextLong();\n\n SumA[i]=SumA[i-1]+A[i];\n }\n\n for(int j=1;j<=M;j++){\n B[j]=sc.nextLong();\n\n SumB[j]=SumB[j-1]+B[j];\n }\n\n\n outside:for(int i=1;i<=N;i++){\n Remain = K-SumA[i];\n if (Remain>0) {\n //にぶたん\n //二分探索\n\n wk=i+(binarysearch((int)Remain));\n\n ans=Math.max(wk,ans);\n\n }\n\n else{\n //終了\n if (Remain==0) {\n wk=i;\n }\n else{\n wk=i-1;\n }\n ans=Math.max(wk,ans);\n break outside;\n }\n }\n\n\n System.out.println(ans);\n\n\n }\n\n //関数定義二分探 \n public static int binarysearch(int key) {\n \n int left = 0;\n \n int right = SumB.length;\n \n while (right - left > 1) {\n \n int mid = left + (right - left) / 2;\n \n if (SumB[mid] > key){\n right = mid;\n \n }\n else{\n left = mid;\n } \n }\n \n /* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */\n return left;\n }\n\n\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "sample_input": "3 4 240\n60 90 120\n80 150 80 150\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02623", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1910, "cpu_time_ms": 639, "memory_kb": 60208}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s172326991", "group_id": "codeNet:p02623", "input_text": "import java.util.*;\nimport java.io.*;\n\npublic class Main {\n\n public Main(FastScanner in, PrintWriter out, int test) {\n int N = in.nextInt();\n int M = in.nextInt();\n int K = in.nextInt();\n\n int[] A = new int[N];\n for (int i = 0; i < N; i++)\n A[i] = in.nextInt();\n\n int[] B = new int[M];\n for (int i = 0; i < M; i++)\n B[i] = in.nextInt();\n\n int res = 0, a = 0, b = 0;\n while (K > 0) {\n int t = 0;\n if (a < N && b < M) {\n t = A[a] <= B[b] ? A[a++] : B[b++];\n } else if (a < N) {\n t = A[a++];\n } else if (b < M) {\n t = B[b++];\n } else\n break;\n K -= t;\n if (K >= 0) res += 1;\n }\n out.println(res);\n }\n\n public static void main(String[] args) {\n PrintWriter out = new PrintWriter(System.out);\n // Scanner in = new Scanner(\n // new BufferedReader(new InputStreamReader(System.in)));\n FastScanner in = new FastScanner(System.in);\n\n // int T = in.nextInt();\n for (int t = 1; t <= 1; t++) {\n Main sol = new Main(in, out, t);\n }\n\n out.close();\n }\n}\n\n\nclass FastScanner{\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n\n public FastScanner(InputStream stream)\n {\n this.stream = stream;\n }\n\n int read()\n {\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars){\n curChar = 0;\n try{\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n boolean isSpaceChar(int c)\n {\n return c==' '||c=='\\n'||c=='\\r'||c=='\\t'||c==-1;\n }\n\n boolean isEndline(int c)\n {\n return c=='\\n'||c=='\\r'||c==-1;\n }\n\n int nextInt()\n {\n return Integer.parseInt(next());\n }\n\n long nextLong()\n {\n return Long.parseLong(next());\n }\n\n double nextDouble()\n {\n return Double.parseDouble(next());\n }\n\n String next(){\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do{\n res.appendCodePoint(c);\n c = read();\n }while(!isSpaceChar(c));\n return res.toString();\n }\n\n String nextLine(){\n int c = read();\n while (isEndline(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do{\n res.appendCodePoint(c);\n c = read();\n }while(!isEndline(c));\n return res.toString();\n }\n}\n", "language": "Java", "metadata": {"date": 1595588647, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02623/input.txt", "sample_output_relpath": "derived/input_output/data/p02623/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02623/Java/s172326991.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s172326991", "user_id": "u276152693"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\n\npublic class Main {\n\n public Main(FastScanner in, PrintWriter out, int test) {\n int N = in.nextInt();\n int M = in.nextInt();\n int K = in.nextInt();\n\n int[] A = new int[N];\n for (int i = 0; i < N; i++)\n A[i] = in.nextInt();\n\n int[] B = new int[M];\n for (int i = 0; i < M; i++)\n B[i] = in.nextInt();\n\n int res = 0, a = 0, b = 0;\n while (K > 0) {\n int t = 0;\n if (a < N && b < M) {\n t = A[a] <= B[b] ? A[a++] : B[b++];\n } else if (a < N) {\n t = A[a++];\n } else if (b < M) {\n t = B[b++];\n } else\n break;\n K -= t;\n if (K >= 0) res += 1;\n }\n out.println(res);\n }\n\n public static void main(String[] args) {\n PrintWriter out = new PrintWriter(System.out);\n // Scanner in = new Scanner(\n // new BufferedReader(new InputStreamReader(System.in)));\n FastScanner in = new FastScanner(System.in);\n\n // int T = in.nextInt();\n for (int t = 1; t <= 1; t++) {\n Main sol = new Main(in, out, t);\n }\n\n out.close();\n }\n}\n\n\nclass FastScanner{\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n\n public FastScanner(InputStream stream)\n {\n this.stream = stream;\n }\n\n int read()\n {\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars){\n curChar = 0;\n try{\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n boolean isSpaceChar(int c)\n {\n return c==' '||c=='\\n'||c=='\\r'||c=='\\t'||c==-1;\n }\n\n boolean isEndline(int c)\n {\n return c=='\\n'||c=='\\r'||c==-1;\n }\n\n int nextInt()\n {\n return Integer.parseInt(next());\n }\n\n long nextLong()\n {\n return Long.parseLong(next());\n }\n\n double nextDouble()\n {\n return Double.parseDouble(next());\n }\n\n String next(){\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do{\n res.appendCodePoint(c);\n c = read();\n }while(!isSpaceChar(c));\n return res.toString();\n }\n\n String nextLine(){\n int c = read();\n while (isEndline(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do{\n res.appendCodePoint(c);\n c = read();\n }while(!isEndline(c));\n return res.toString();\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "sample_input": "3 4 240\n60 90 120\n80 150 80 150\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02623", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2909, "cpu_time_ms": 263, "memory_kb": 57844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s966569349", "group_id": "codeNet:p02623", "input_text": "import java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n // abc173_a();\n // abc173_b();\n // abc173_c();\n // abc172_a();\n // abc172_b();\n abc172_c();\n }\n\n // int 2147483648 [ 2 * 10(9)]\n // long 9223372036854775808 [ 9 * 10(18)]\n\n public static void abc172_a() {\n try (Scanner sc = new Scanner(System.in)) {\n int a = parseI(sc.next());\n\n System.out.println(a + (int) Math.pow(a, 2) + (int) Math.pow(a, 3));\n } catch (Exception e) {\n System.out.println(\"エラー\" + e);\n }\n }\n\n public static void abc172_b() {\n try (Scanner sc = new Scanner(System.in)) {\n String s = sc.next();\n String t = sc.next();\n int ansCnt = 0;\n for (int i = 0; i < s.length(); i++) {\n if (!parseS(s.charAt(i)).equals(parseS(t.charAt(i)))) {\n ansCnt++;\n }\n }\n System.out.println(ansCnt);\n\n } catch (Exception e) {\n System.out.println(\"エラー\" + e);\n }\n }\n\n public static void abc172_c() {\n try (Scanner sc = new Scanner(System.in)) {\n int n = parseI(sc.next());\n int m = parseI(sc.next());\n long k = parseL(sc.next());\n\n List nList = new ArrayList();\n List mList = new ArrayList();\n\n for (int i = 0; i < n; i++) {\n nList.add(parseI(sc.next()));\n }\n for (int i = 0; i < m; i++) {\n mList.add(parseI(sc.next()));\n }\n\n long sum = 0L;\n int ansCnt = 0;\n\n while (!nList.isEmpty() || !mList.isEmpty()) {\n if (mList.isEmpty()\n || !nList.isEmpty() && nList.get(0) < mList.get(0)) {\n sum += nList.get(0);\n if (k < sum) {\n break;\n }\n nList.remove(0);\n ansCnt++;\n } else {\n sum += mList.get(0);\n if (k < sum) {\n break;\n }\n mList.remove(0);\n ansCnt++;\n }\n }\n System.out.println(ansCnt);\n\n } catch (Exception e) {\n System.out.println(\"エラー\" + e);\n }\n }\n\n public static void abc173_a() {\n try (Scanner sc = new Scanner(System.in)) {\n int payment = parseI(sc.next());\n int max = 10000;\n int thou = 1000;\n\n System.out.println((max - payment) % thou);\n } catch (Exception e) {\n System.out.println(\"エラー\" + e);\n }\n }\n\n public static void abc173_b() {\n try (Scanner sc = new Scanner(System.in)) {\n int num = parseI(sc.next());\n\n // AC\n // WA\n // TLE\n // RE x 0\n int[] ansCount = new int[4];\n final String[] err = { \"AC\", \"WA\", \"TLE\", \"RE\" };\n Arrays.fill(ansCount, 0);\n\n for (int i = 0; i < num; i++) {\n String ans = sc.next();\n switch (ans) {\n case \"AC\":\n ansCount[0]++;\n break;\n case \"WA\":\n ansCount[1]++;\n break;\n case \"TLE\":\n ansCount[2]++;\n break;\n case \"RE\":\n ansCount[3]++;\n break;\n }\n }\n int count = 0;\n for (int answer : ansCount) {\n System.out.println(err[count] + \" x \" + answer);\n count++;\n }\n } catch (Exception e) {\n System.out.println(\"エラー\" + e);\n }\n }\n\n public static void abc173_c() {\n try (Scanner sc = new Scanner(System.in)) {\n int row = parseI(sc.next());\n int column = parseI(sc.next());\n int checkBlackCount = parseI(sc.next());\n int existBlack = 0;\n int ansCount = 0;\n int[][] inputList = new int[row][column];\n String input = \"\";\n for (int i = 0; i < row; i++) {\n input = sc.next();\n for (int x = 0; x < column; x++) {\n inputList[i][x] =\n parseI(parseS(input.charAt(x)).replace(\".\", \"0\").replace(\"#\", \"1\"));\n }\n }\n\n for (int i = 0; i < (1 << row); i++) {\n for (int x = 0; x < (1 << column); x++) {\n\n for (int chRownum = 0; chRownum < row; chRownum++) {\n for (int chColNum = 0; chColNum < column; chColNum++) {\n if (inputList[chRownum][chColNum] == 1\n && ((i >> chRownum) & 1) == 0 && ((x >> chColNum) & 1) == 0) {\n existBlack++;\n }\n }\n }\n if (existBlack == checkBlackCount) ansCount++;\n existBlack = 0;\n\n }\n }\n System.out.println(ansCount);\n\n } catch (Exception e) {\n System.out.println(\"エラー\" + e);\n }\n }\n\n public static int parseI(String value) {\n return Integer.parseInt(value);\n }\n\n public static long parseL(String value) {\n return Long.parseLong(value);\n }\n\n public static double parseD(String value) {\n return Double.parseDouble(value);\n }\n\n public static String parseS(T value) {\n return String.valueOf(value);\n }\n\n}\n", "language": "Java", "metadata": {"date": 1595351961, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02623/input.txt", "sample_output_relpath": "derived/input_output/data/p02623/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02623/Java/s966569349.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s966569349", "user_id": "u247775641"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n // abc173_a();\n // abc173_b();\n // abc173_c();\n // abc172_a();\n // abc172_b();\n abc172_c();\n }\n\n // int 2147483648 [ 2 * 10(9)]\n // long 9223372036854775808 [ 9 * 10(18)]\n\n public static void abc172_a() {\n try (Scanner sc = new Scanner(System.in)) {\n int a = parseI(sc.next());\n\n System.out.println(a + (int) Math.pow(a, 2) + (int) Math.pow(a, 3));\n } catch (Exception e) {\n System.out.println(\"エラー\" + e);\n }\n }\n\n public static void abc172_b() {\n try (Scanner sc = new Scanner(System.in)) {\n String s = sc.next();\n String t = sc.next();\n int ansCnt = 0;\n for (int i = 0; i < s.length(); i++) {\n if (!parseS(s.charAt(i)).equals(parseS(t.charAt(i)))) {\n ansCnt++;\n }\n }\n System.out.println(ansCnt);\n\n } catch (Exception e) {\n System.out.println(\"エラー\" + e);\n }\n }\n\n public static void abc172_c() {\n try (Scanner sc = new Scanner(System.in)) {\n int n = parseI(sc.next());\n int m = parseI(sc.next());\n long k = parseL(sc.next());\n\n List nList = new ArrayList();\n List mList = new ArrayList();\n\n for (int i = 0; i < n; i++) {\n nList.add(parseI(sc.next()));\n }\n for (int i = 0; i < m; i++) {\n mList.add(parseI(sc.next()));\n }\n\n long sum = 0L;\n int ansCnt = 0;\n\n while (!nList.isEmpty() || !mList.isEmpty()) {\n if (mList.isEmpty()\n || !nList.isEmpty() && nList.get(0) < mList.get(0)) {\n sum += nList.get(0);\n if (k < sum) {\n break;\n }\n nList.remove(0);\n ansCnt++;\n } else {\n sum += mList.get(0);\n if (k < sum) {\n break;\n }\n mList.remove(0);\n ansCnt++;\n }\n }\n System.out.println(ansCnt);\n\n } catch (Exception e) {\n System.out.println(\"エラー\" + e);\n }\n }\n\n public static void abc173_a() {\n try (Scanner sc = new Scanner(System.in)) {\n int payment = parseI(sc.next());\n int max = 10000;\n int thou = 1000;\n\n System.out.println((max - payment) % thou);\n } catch (Exception e) {\n System.out.println(\"エラー\" + e);\n }\n }\n\n public static void abc173_b() {\n try (Scanner sc = new Scanner(System.in)) {\n int num = parseI(sc.next());\n\n // AC\n // WA\n // TLE\n // RE x 0\n int[] ansCount = new int[4];\n final String[] err = { \"AC\", \"WA\", \"TLE\", \"RE\" };\n Arrays.fill(ansCount, 0);\n\n for (int i = 0; i < num; i++) {\n String ans = sc.next();\n switch (ans) {\n case \"AC\":\n ansCount[0]++;\n break;\n case \"WA\":\n ansCount[1]++;\n break;\n case \"TLE\":\n ansCount[2]++;\n break;\n case \"RE\":\n ansCount[3]++;\n break;\n }\n }\n int count = 0;\n for (int answer : ansCount) {\n System.out.println(err[count] + \" x \" + answer);\n count++;\n }\n } catch (Exception e) {\n System.out.println(\"エラー\" + e);\n }\n }\n\n public static void abc173_c() {\n try (Scanner sc = new Scanner(System.in)) {\n int row = parseI(sc.next());\n int column = parseI(sc.next());\n int checkBlackCount = parseI(sc.next());\n int existBlack = 0;\n int ansCount = 0;\n int[][] inputList = new int[row][column];\n String input = \"\";\n for (int i = 0; i < row; i++) {\n input = sc.next();\n for (int x = 0; x < column; x++) {\n inputList[i][x] =\n parseI(parseS(input.charAt(x)).replace(\".\", \"0\").replace(\"#\", \"1\"));\n }\n }\n\n for (int i = 0; i < (1 << row); i++) {\n for (int x = 0; x < (1 << column); x++) {\n\n for (int chRownum = 0; chRownum < row; chRownum++) {\n for (int chColNum = 0; chColNum < column; chColNum++) {\n if (inputList[chRownum][chColNum] == 1\n && ((i >> chRownum) & 1) == 0 && ((x >> chColNum) & 1) == 0) {\n existBlack++;\n }\n }\n }\n if (existBlack == checkBlackCount) ansCount++;\n existBlack = 0;\n\n }\n }\n System.out.println(ansCount);\n\n } catch (Exception e) {\n System.out.println(\"エラー\" + e);\n }\n }\n\n public static int parseI(String value) {\n return Integer.parseInt(value);\n }\n\n public static long parseL(String value) {\n return Long.parseLong(value);\n }\n\n public static double parseD(String value) {\n return Double.parseDouble(value);\n }\n\n public static String parseS(T value) {\n return String.valueOf(value);\n }\n\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "sample_input": "3 4 240\n60 90 120\n80 150 80 150\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02623", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 4875, "cpu_time_ms": 2207, "memory_kb": 69320}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s774502603", "group_id": "codeNet:p02623", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint m = sc.nextInt();\n\t\tlong k = sc.nextLong();\n\t\tlong aSum[] = new long[n + 1];\n\t\tlong bSum[] = new long[m + 1];\n\t\tint ans = 0;\n\t\tint max = n;\n\t\tfor(int i = 1 ; i <= n ; i++) {\n\t\t\taSum[i] = aSum[i - 1] + sc.nextLong();\n\t\t}\n\n\t\tfor(int i = 0 ; i <= m ; i++) {\n if(i != m)\n\t\t\tbSum[i + 1] = bSum[i] + sc.nextLong();\n\n\t\t\tlong best = k - bSum[i];\n\t\t\tif(best < 0)\n\t\t\t\tbreak;\n\t\t\twhile(max > 0 && aSum[max] > best) max--;\n\n\t\t\tans = Math.max(ans , i + max);\n\t\t}\n\n\t\tSystem.out.println(ans);\n\n\t}\n}\n\n", "language": "Java", "metadata": {"date": 1594480635, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02623/input.txt", "sample_output_relpath": "derived/input_output/data/p02623/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02623/Java/s774502603.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s774502603", "user_id": "u465572759"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint m = sc.nextInt();\n\t\tlong k = sc.nextLong();\n\t\tlong aSum[] = new long[n + 1];\n\t\tlong bSum[] = new long[m + 1];\n\t\tint ans = 0;\n\t\tint max = n;\n\t\tfor(int i = 1 ; i <= n ; i++) {\n\t\t\taSum[i] = aSum[i - 1] + sc.nextLong();\n\t\t}\n\n\t\tfor(int i = 0 ; i <= m ; i++) {\n if(i != m)\n\t\t\tbSum[i + 1] = bSum[i] + sc.nextLong();\n\n\t\t\tlong best = k - bSum[i];\n\t\t\tif(best < 0)\n\t\t\t\tbreak;\n\t\t\twhile(max > 0 && aSum[max] > best) max--;\n\n\t\t\tans = Math.max(ans , i + max);\n\t\t}\n\n\t\tSystem.out.println(ans);\n\n\t}\n}\n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "sample_input": "3 4 240\n60 90 120\n80 150 80 150\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02623", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 603, "memory_kb": 64932}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s437739566", "group_id": "codeNet:p02623", "input_text": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\n private static class FastReader {\n BufferedReader br;\n StringTokenizer st;\n\n public FastReader() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n String nextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n }\n\n public static long[] buildPrefixArray(FastReader in, int n) {\n String[] tokens = in.nextLine().split(\" \");\n long[] a = new long[n + 1];\n for (int i = 1; i <= n; i++) {\n a[i] = a[i - 1] + Long.parseLong(tokens[i - 1]);\n }\n return a;\n }\n\n public static void main(final String[] args) throws IOException {\n FastReader in = new FastReader();\n PrintWriter out = new PrintWriter(System.out, true);\n\n int n = in.nextInt();\n int m = in.nextInt();\n long k = in.nextInt();\n\n long[] a = buildPrefixArray(in, n);\n long[] b = buildPrefixArray(in, m);\n\n int books = 0;\n for (int i = 1; i <= n; i++) {\n if (a[i] > k) {\n break;\n }\n for (int j = m; j >= 1; j--) {\n if (b[j] <= k - a[i]) {\n books = Math.max(books, i + j);\n break;\n }\n }\n }\n out.println(books);\n }\n}", "language": "Java", "metadata": {"date": 1593931108, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02623/input.txt", "sample_output_relpath": "derived/input_output/data/p02623/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02623/Java/s437739566.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s437739566", "user_id": "u973792557"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\n private static class FastReader {\n BufferedReader br;\n StringTokenizer st;\n\n public FastReader() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n String nextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n }\n\n public static long[] buildPrefixArray(FastReader in, int n) {\n String[] tokens = in.nextLine().split(\" \");\n long[] a = new long[n + 1];\n for (int i = 1; i <= n; i++) {\n a[i] = a[i - 1] + Long.parseLong(tokens[i - 1]);\n }\n return a;\n }\n\n public static void main(final String[] args) throws IOException {\n FastReader in = new FastReader();\n PrintWriter out = new PrintWriter(System.out, true);\n\n int n = in.nextInt();\n int m = in.nextInt();\n long k = in.nextInt();\n\n long[] a = buildPrefixArray(in, n);\n long[] b = buildPrefixArray(in, m);\n\n int books = 0;\n for (int i = 1; i <= n; i++) {\n if (a[i] > k) {\n break;\n }\n for (int j = m; j >= 1; j--) {\n if (b[j] <= k - a[i]) {\n books = Math.max(books, i + j);\n break;\n }\n }\n }\n out.println(books);\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "sample_input": "3 4 240\n60 90 120\n80 150 80 150\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02623", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2209, "cpu_time_ms": 2209, "memory_kb": 76548}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s763320547", "group_id": "codeNet:p02623", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\ttry (final Scanner sc = new Scanner(System.in);) {\n\n\t\t\tfinal int n = sc.nextInt();\n\t\t\tfinal int m = sc.nextInt();\n\t\t\tint k = sc.nextInt();\n\n\t\t\tfinal Integer[] n_b = new Integer[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tn_b[i] = sc.nextInt();\n\t\t\t}\n\n\t\t\tfinal Integer[] m_b = new Integer[m];\n\t\t\tfor (int i = 0; i < m; i++) {\n\t\t\t\tm_b[i] = sc.nextInt();\n\t\t\t}\n\n\t\t\tint count=0;\n\n\t\t\tint offset_n=0;\n\t\t\tint offset_m=0;\n\n\t\t\twhile(k!=0) {\n\n\t\t\t\tfinal Integer nBook = getBook(n_b, offset_n);\n\t\t\t\tfinal Integer mBook = getBook(m_b, offset_m);\n\n\t\t\t\tfinal int t;\n\t\t\t\tif(nBook==null&&mBook==null) {\n\t\t\t\t\tbreak;\n\n\t\t\t\t}else if(nBook==null) {\n\t\t\t\t\tt=mBook;\n\t\t\t\t\toffset_m++;\n\n\t\t\t\t}else if(mBook==null) {\n\t\t\t\t\tt=nBook;\n\t\t\t\t\toffset_n++;\n\n\t\t\t\t}else {\n\n\t\t\t\t\tif(nBook <= mBook) {\n\t\t\t\t\t\tt = nBook;\n\t\t\t\t\t\toffset_n++;\n\n\t\t\t\t\t}else {\n\t\t\t\t\t\tt=mBook;\n\t\t\t\t\t\toffset_m++;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif(k < t) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcount++;\n\t\t\t\tk-=t;\n\t\t\t}\n\n\t\t\tSystem.out.println(count);\n\t\t}\n\t}\n\n\t\tprivate static Integer getBook(final Integer[] books, final int offset) {\n\t\t\tif(books.length == offset) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn books[offset];\n\t\t}\n\n}", "language": "Java", "metadata": {"date": 1593919760, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02623/input.txt", "sample_output_relpath": "derived/input_output/data/p02623/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02623/Java/s763320547.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s763320547", "user_id": "u987268577"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\ttry (final Scanner sc = new Scanner(System.in);) {\n\n\t\t\tfinal int n = sc.nextInt();\n\t\t\tfinal int m = sc.nextInt();\n\t\t\tint k = sc.nextInt();\n\n\t\t\tfinal Integer[] n_b = new Integer[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tn_b[i] = sc.nextInt();\n\t\t\t}\n\n\t\t\tfinal Integer[] m_b = new Integer[m];\n\t\t\tfor (int i = 0; i < m; i++) {\n\t\t\t\tm_b[i] = sc.nextInt();\n\t\t\t}\n\n\t\t\tint count=0;\n\n\t\t\tint offset_n=0;\n\t\t\tint offset_m=0;\n\n\t\t\twhile(k!=0) {\n\n\t\t\t\tfinal Integer nBook = getBook(n_b, offset_n);\n\t\t\t\tfinal Integer mBook = getBook(m_b, offset_m);\n\n\t\t\t\tfinal int t;\n\t\t\t\tif(nBook==null&&mBook==null) {\n\t\t\t\t\tbreak;\n\n\t\t\t\t}else if(nBook==null) {\n\t\t\t\t\tt=mBook;\n\t\t\t\t\toffset_m++;\n\n\t\t\t\t}else if(mBook==null) {\n\t\t\t\t\tt=nBook;\n\t\t\t\t\toffset_n++;\n\n\t\t\t\t}else {\n\n\t\t\t\t\tif(nBook <= mBook) {\n\t\t\t\t\t\tt = nBook;\n\t\t\t\t\t\toffset_n++;\n\n\t\t\t\t\t}else {\n\t\t\t\t\t\tt=mBook;\n\t\t\t\t\t\toffset_m++;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif(k < t) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcount++;\n\t\t\t\tk-=t;\n\t\t\t}\n\n\t\t\tSystem.out.println(count);\n\t\t}\n\t}\n\n\t\tprivate static Integer getBook(final Integer[] books, final int offset) {\n\t\t\tif(books.length == offset) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn books[offset];\n\t\t}\n\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "sample_input": "3 4 240\n60 90 120\n80 150 80 150\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02623", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1204, "cpu_time_ms": 651, "memory_kb": 58588}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s308637205", "group_id": "codeNet:p02623", "input_text": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n // Your code here!\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int M = sc.nextInt();\n int K = sc.nextInt();\n \n double A[] = new double[N];\n double B[] = new double[M];\n \n int count = 0;\n double time = 0;\n int a = 0;\n int b = 0;\n \n for(int i=0;iK){\n count--;\n }\n \n System.out.println(count);\n }\n}\n", "language": "Java", "metadata": {"date": 1593528162, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02623/input.txt", "sample_output_relpath": "derived/input_output/data/p02623/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02623/Java/s308637205.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s308637205", "user_id": "u850830779"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n // Your code here!\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int M = sc.nextInt();\n int K = sc.nextInt();\n \n double A[] = new double[N];\n double B[] = new double[M];\n \n int count = 0;\n double time = 0;\n int a = 0;\n int b = 0;\n \n for(int i=0;iK){\n count--;\n }\n \n System.out.println(count);\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "sample_input": "3 4 240\n60 90 120\n80 150 80 150\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02623", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 980, "cpu_time_ms": 1273, "memory_kb": 69292}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s139338060", "group_id": "codeNet:p02623", "input_text": "import java.io.*;\nimport java.util.*;\npublic class Main {\n static long startTime;\n static long endTime;\n static Boolean [] prime ;\n static Scanner sc = new Scanner(System.in);\n static class FastReader{\n BufferedReader br;\n StringTokenizer st;\n\n public FastReader()\n {\n br = new BufferedReader(new\n InputStreamReader(System.in));\n }\n\n String next()\n {\n while (st == null || !st.hasMoreElements())\n {\n try\n {\n st = new StringTokenizer(br.readLine());\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n int nextInt()\n {\n return Integer.parseInt(next());\n }\n\n long nextLong()\n {\n return Long.parseLong(next());\n }\n\n double nextDouble()\n {\n return Double.parseDouble(next());\n }\n\n String nextLine()\n {\n String str = \"\";\n try\n {\n str = br.readLine();\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n return str;\n }\n }\n public static int lowerBound\n (Integer[] array, int length, int value) {\n int l = 0;\n int r = length;\n while (l < r) {\n int mid = (l + r) / 2;\n if (value < array[mid]) {\n r = mid;\n } else {\n l = mid + 1;\n }\n }\n return l;\n }\n public static long gcd(long a, long b){\n if (b == 0)\n return a;\n else return gcd(b, a % b);\n }\n public static long countDivs(long n ){\n int cn=0;\n long sqr = (long)Math.sqrt(n);\n for (long i = 1; i<=sqr ; ++i) {\n if(n%i==0){\n ++cn;\n }\n }\n cn*=2;\n if(sqr*sqr==n) cn--;\n return cn;\n\n }\n static void prime(int x) {\n //sieve algorithm. nlog(log(n)).\n prime=new Boolean[ (x+1)];\n Arrays.fill(prime,true);\n prime[0] = prime[1] = false;\n for (int i = 2; i * i <= x ; i++)\n if (prime[i])\n for (int j = i * i; j <= x; j += i)\n prime[j] = false;\n }\n static int[] sum;\n static void cumulitiveSum( int [] arr){\n sum = new int[arr.length];\n sum[0]=arr[0];\n for (int i = 1; i a = new LinkedList<>();\n Deque b = new LinkedList<>();\n\n // Integer [] a = new Integer [n];\n //Integer [] b = new Integer[m];\n for (int i = 0; i < n; i++) {\n a.add(sc.nextInt());\n }\n for (int i = 0; i < m; i++) {\n b.add(sc.nextInt());\n }\n\n long cn=0;\n long sum=0;\n int j=0;\n while(sum a = new LinkedList<>();\n Deque b = new LinkedList<>();\n\n // Integer [] a = new Integer [n];\n //Integer [] b = new Integer[m];\n for (int i = 0; i < n; i++) {\n a.add(sc.nextInt());\n }\n for (int i = 0; i < m; i++) {\n b.add(sc.nextInt());\n }\n\n long cn=0;\n long sum=0;\n int j=0;\n while(sum a = new ArrayList<>();\n ArrayList b = new ArrayList<>();\n\n int indexA = -1;\n int indexB = -1;\n BigInteger sum = BigInteger.ZERO;\n boolean boo = true;\n for (int i = 0; i < n; i++) {\n BigInteger aTmp = new BigInteger(sc.next());\n BigInteger tmp = sum.add(aTmp);\n if (boo && tmp.compareTo(k) <= 0) {\n indexA = i;\n sum = tmp;\n } else {\n boo = false;\n }\n a.add(aTmp);\n }\n boo = sum.compareTo(k) <= 0;\n for (int i = 0; i < m; i++) {\n BigInteger bTmp = new BigInteger(sc.next());\n BigInteger tmp = sum.add(bTmp);\n if (boo && tmp.compareTo(k) <= 0) {\n indexB = i;\n sum = tmp;\n } else {\n boo = false;\n }\n b.add(bTmp);\n }\n\n int max = (indexA + 1) + (indexB + 1);\n for (int i = indexA; i >= 0; i--) {\n if (indexB == m - 1) {\n break;\n }\n sum = sum.subtract(a.get(i));\n BigInteger tmp = sum;\n while (true) {\n if (indexB == m - 1) {\n break;\n }\n tmp = tmp.add(b.get(indexB + 1));\n if (tmp.compareTo(k) <= 0) {\n indexB++;\n sum = tmp;\n } else {\n break;\n }\n }\n int t = i + (indexB + 1);\n if (t > max) {\n max = t;\n }\n }\n System.out.println(max);\n }\n\n\n}\n", "language": "Java", "metadata": {"date": 1593484858, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02623/input.txt", "sample_output_relpath": "derived/input_output/data/p02623/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02623/Java/s874487622.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s874487622", "user_id": "u324739185"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.math.BigInteger;\nimport java.util.*;\nimport java.util.stream.Collectors;\n\npublic class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int m = sc.nextInt();\n BigInteger k = new BigInteger(sc.next());\n ArrayList a = new ArrayList<>();\n ArrayList b = new ArrayList<>();\n\n int indexA = -1;\n int indexB = -1;\n BigInteger sum = BigInteger.ZERO;\n boolean boo = true;\n for (int i = 0; i < n; i++) {\n BigInteger aTmp = new BigInteger(sc.next());\n BigInteger tmp = sum.add(aTmp);\n if (boo && tmp.compareTo(k) <= 0) {\n indexA = i;\n sum = tmp;\n } else {\n boo = false;\n }\n a.add(aTmp);\n }\n boo = sum.compareTo(k) <= 0;\n for (int i = 0; i < m; i++) {\n BigInteger bTmp = new BigInteger(sc.next());\n BigInteger tmp = sum.add(bTmp);\n if (boo && tmp.compareTo(k) <= 0) {\n indexB = i;\n sum = tmp;\n } else {\n boo = false;\n }\n b.add(bTmp);\n }\n\n int max = (indexA + 1) + (indexB + 1);\n for (int i = indexA; i >= 0; i--) {\n if (indexB == m - 1) {\n break;\n }\n sum = sum.subtract(a.get(i));\n BigInteger tmp = sum;\n while (true) {\n if (indexB == m - 1) {\n break;\n }\n tmp = tmp.add(b.get(indexB + 1));\n if (tmp.compareTo(k) <= 0) {\n indexB++;\n sum = tmp;\n } else {\n break;\n }\n }\n int t = i + (indexB + 1);\n if (t > max) {\n max = t;\n }\n }\n System.out.println(max);\n }\n\n\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "sample_input": "3 4 240\n60 90 120\n80 150 80 150\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02623", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1641, "cpu_time_ms": 761, "memory_kb": 80404}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s105249237", "group_id": "codeNet:p02623", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint[] a = new int[sc.nextInt()];\n\t\tint[] b = new int[sc.nextInt()];\n\t\tint k = sc.nextInt();\n\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\ta[i] = sc.nextInt();\n\t\t}\n\t\tfor (int i = 0; i < b.length; i++) {\n\t\t\tb[i] = sc.nextInt();\n\t\t}\n\t\tsc.close();\n\n\t\tlong sum = 0L;\n\t\tint markA = 0;\n\t\tint markB = 0;\n\t\twhile (sum < k) {\n\t\t\tif (markA < a.length && markB < b.length) {\n\t\t\t\tif (a[markA] < b[markB]) {\n\t\t\t\t\tif (sum + a[markA] > k)\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tsum += a[markA];\n\t\t\t\t\tmarkA++;\n\t\t\t\t} else {\n\t\t\t\t\tif (sum + b[markB] > k)\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tsum += b[markB];\n\t\t\t\t\tmarkB++;\n\t\t\t\t}\n\t\t\t} else if (markA < a.length) {\n\t\t\t\tif (sum + a[markA] > k)\n\t\t\t\t\tbreak;\n\t\t\t\tsum += a[markA];\n\t\t\t\tmarkA++;\n\t\t\t} else if (markB < b.length) {\n\t\t\t\tif (sum + b[markB] > k)\n\t\t\t\t\tbreak;\n\t\t\t\tsum += b[markB];\n\t\t\t\tmarkB++;\n\t\t\t}\n\n\t\t}\n\t\tSystem.out.println(markA + markB);\n\t}\n}", "language": "Java", "metadata": {"date": 1593453530, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02623/input.txt", "sample_output_relpath": "derived/input_output/data/p02623/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02623/Java/s105249237.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s105249237", "user_id": "u792069587"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint[] a = new int[sc.nextInt()];\n\t\tint[] b = new int[sc.nextInt()];\n\t\tint k = sc.nextInt();\n\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\ta[i] = sc.nextInt();\n\t\t}\n\t\tfor (int i = 0; i < b.length; i++) {\n\t\t\tb[i] = sc.nextInt();\n\t\t}\n\t\tsc.close();\n\n\t\tlong sum = 0L;\n\t\tint markA = 0;\n\t\tint markB = 0;\n\t\twhile (sum < k) {\n\t\t\tif (markA < a.length && markB < b.length) {\n\t\t\t\tif (a[markA] < b[markB]) {\n\t\t\t\t\tif (sum + a[markA] > k)\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tsum += a[markA];\n\t\t\t\t\tmarkA++;\n\t\t\t\t} else {\n\t\t\t\t\tif (sum + b[markB] > k)\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tsum += b[markB];\n\t\t\t\t\tmarkB++;\n\t\t\t\t}\n\t\t\t} else if (markA < a.length) {\n\t\t\t\tif (sum + a[markA] > k)\n\t\t\t\t\tbreak;\n\t\t\t\tsum += a[markA];\n\t\t\t\tmarkA++;\n\t\t\t} else if (markB < b.length) {\n\t\t\t\tif (sum + b[markB] > k)\n\t\t\t\t\tbreak;\n\t\t\t\tsum += b[markB];\n\t\t\t\tmarkB++;\n\t\t\t}\n\n\t\t}\n\t\tSystem.out.println(markA + markB);\n\t}\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "sample_input": "3 4 240\n60 90 120\n80 150 80 150\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02623", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 964, "cpu_time_ms": 653, "memory_kb": 61160}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s104405902", "group_id": "codeNet:p02623", "input_text": "import java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Scanner;\n\npublic class Main {\n\t\n\t\n\t\n\tpublic static void main(String[] args) {\n\t\tScanner s = new Scanner(System.in);\n\t\tint n = s.nextInt();\n\t\tint m = s.nextInt();\n\t\t\n\t\tlong k = s.nextInt();\n\t\t\n\t\tint a[] = new int[n];\n\t\tint b[] = new int[m];\n\t\tfor(int i=0;i= 0; i--) {\n max = Math.max(max, i + 1 + tmpj + 1);\n \n for (int j = tmpj+1; j < m; j++) {\n if (tmpl + tmpr + right[j] <= k) {\n tmpr += right[j];\n } else {\n break;\n }\n tmpj = j;\n max = Math.max(max, i + 1 + j + 1);\n }\n \n tmpl -= left[i];\n }\n \n System.out.println(max);\n }\n}\n", "language": "Java", "metadata": {"date": 1593375233, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02623/input.txt", "sample_output_relpath": "derived/input_output/data/p02623/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02623/Java/s814674497.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s814674497", "user_id": "u273816974"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n // Your code here!\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int m = sc.nextInt();\n int k = sc.nextInt();\n \n int[] left = new int[n];\n for (int i = 0; i < n; i++) {\n left[i] = sc.nextInt();\n }\n int[] right = new int[m];\n for (int i = 0; i < m; i++) {\n right[i] = sc.nextInt();\n }\n \n long[] suml = new long[n+1];\n for (int i = 1; i <= n; i++) {\n suml[i] = suml[i-1] + left[i-1];\n }\n long[] sumr = new long[m+1];\n for (int i = 1; i <= m; i++) {\n sumr[i] = sumr[i-1] + right[i-1];\n }\n \n long tmpl = 0;\n int tmpi = -1;\n for (int i = 0; i < n; i++) {\n if (tmpl + left[i] <= k) {\n tmpl += left[i];\n } else {\n break;\n }\n tmpi = i;\n }\n \n long tmpr = 0;\n int tmpj = -1;\n for (int j = 0; j < m; j++) {\n if (tmpl + tmpr + right[j] <= k) {\n tmpr += right[j];\n } else {\n break;\n }\n tmpj = j;\n }\n \n \n int max = tmpi + 1 + tmpj + 1;\n tmpl -= left[tmpi];\n tmpi--;\n for (int i = tmpi; i >= 0; i--) {\n max = Math.max(max, i + 1 + tmpj + 1);\n \n for (int j = tmpj+1; j < m; j++) {\n if (tmpl + tmpr + right[j] <= k) {\n tmpr += right[j];\n } else {\n break;\n }\n tmpj = j;\n max = Math.max(max, i + 1 + j + 1);\n }\n \n tmpl -= left[i];\n }\n \n System.out.println(max);\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "sample_input": "3 4 240\n60 90 120\n80 150 80 150\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02623", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1908, "cpu_time_ms": 665, "memory_kb": 60356}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s675672897", "group_id": "codeNet:p02623", "input_text": "import java.util.*;\npublic class Main {\n\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int M = sc.nextInt();\n int K = sc.nextInt();\n\n long[] A = new long[N];\n long[] B = new long[M];\n for (int i = 0; i < N; i++) {\n A[i] = sc.nextInt();\n }\n for (int i = 0; i < M; i++) {\n B[i] = sc.nextInt();\n }\n\n\n long sum=0;\n int bidx = -1;\n int count=0;\n for (int i = 0; i < M ; i++) {\n if(sum+B[i] <=K){\n sum += B[i];\n bidx =i;\n count++;\n }else{\n break;\n }\n }\n\n\n int ans = count;//A zero books\n\n for (int i = 0; i < N; i++) {\n long bookA = A[i];\n sum += bookA;\n count++;\n while(sum>K && bidx>=0){//remvoe books in B\n sum -= B[bidx];\n count--;\n bidx--;\n }\n if(sum>K){\n break;\n }\n ans = Math.max(ans,count);\n }\n\n System.out.println(ans);\n }\n}", "language": "Java", "metadata": {"date": 1593360921, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02623/input.txt", "sample_output_relpath": "derived/input_output/data/p02623/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02623/Java/s675672897.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s675672897", "user_id": "u584924463"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int M = sc.nextInt();\n int K = sc.nextInt();\n\n long[] A = new long[N];\n long[] B = new long[M];\n for (int i = 0; i < N; i++) {\n A[i] = sc.nextInt();\n }\n for (int i = 0; i < M; i++) {\n B[i] = sc.nextInt();\n }\n\n\n long sum=0;\n int bidx = -1;\n int count=0;\n for (int i = 0; i < M ; i++) {\n if(sum+B[i] <=K){\n sum += B[i];\n bidx =i;\n count++;\n }else{\n break;\n }\n }\n\n\n int ans = count;//A zero books\n\n for (int i = 0; i < N; i++) {\n long bookA = A[i];\n sum += bookA;\n count++;\n while(sum>K && bidx>=0){//remvoe books in B\n sum -= B[bidx];\n count--;\n bidx--;\n }\n if(sum>K){\n break;\n }\n ans = Math.max(ans,count);\n }\n\n System.out.println(ans);\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "sample_input": "3 4 240\n60 90 120\n80 150 80 150\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02623", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1189, "cpu_time_ms": 627, "memory_kb": 63416}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s450634660", "group_id": "codeNet:p02623", "input_text": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\n\nimport static java.lang.Integer.parseInt;\n\npublic class Main {\n public static void main(String[] args) throws IOException {\n BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));\n PrintWriter writer = new PrintWriter(System.out);\n foo(reader, writer);\n writer.flush();\n }\n\n public static void foo(BufferedReader reader, PrintWriter writer) throws IOException {\n int result = 0;\n String[] s = reader.readLine().split(\" \");\n int n = parseInt(s[0]), m = parseInt(s[1]), k = parseInt(s[2]);\n String[] a = reader.readLine().split(\" \");\n String[] b = reader.readLine().split(\" \");\n int l_a = a.length, l_b = b.length;\n int i = 0, j = 0;\n while (result <= k) {\n int x = Integer.MAX_VALUE, y = Integer.MAX_VALUE;\n if (i < l_a) x = Integer.parseInt(a[i]);\n if (j < l_b) y = Integer.parseInt(b[j]);\n if (x < y) {\n result += x;\n if (result > k) {\n result -= x;\n break;\n }\n i++;\n }\n else {\n result += y;\n if (result > k) {\n result -= y;\n break;\n }\n j++;\n }\n }\n writer.println(result);\n }\n}\n", "language": "Java", "metadata": {"date": 1593359460, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02623/input.txt", "sample_output_relpath": "derived/input_output/data/p02623/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02623/Java/s450634660.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s450634660", "user_id": "u799710027"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\n\nimport static java.lang.Integer.parseInt;\n\npublic class Main {\n public static void main(String[] args) throws IOException {\n BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));\n PrintWriter writer = new PrintWriter(System.out);\n foo(reader, writer);\n writer.flush();\n }\n\n public static void foo(BufferedReader reader, PrintWriter writer) throws IOException {\n int result = 0;\n String[] s = reader.readLine().split(\" \");\n int n = parseInt(s[0]), m = parseInt(s[1]), k = parseInt(s[2]);\n String[] a = reader.readLine().split(\" \");\n String[] b = reader.readLine().split(\" \");\n int l_a = a.length, l_b = b.length;\n int i = 0, j = 0;\n while (result <= k) {\n int x = Integer.MAX_VALUE, y = Integer.MAX_VALUE;\n if (i < l_a) x = Integer.parseInt(a[i]);\n if (j < l_b) y = Integer.parseInt(b[j]);\n if (x < y) {\n result += x;\n if (result > k) {\n result -= x;\n break;\n }\n i++;\n }\n else {\n result += y;\n if (result > k) {\n result -= y;\n break;\n }\n j++;\n }\n }\n writer.println(result);\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "sample_input": "3 4 240\n60 90 120\n80 150 80 150\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02623", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1507, "cpu_time_ms": 2208, "memory_kb": 85300}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s986061170", "group_id": "codeNet:p02623", "input_text": "import java.util.*;\nclass Main{\n public static void main(String[]args){\n Scanner scanner = new Scanner(System.in);\n int N = scanner.nextInt();\n int M = scanner.nextInt();\n int K = scanner.nextInt();\n int[] A = new int[N];\n int[] B = new int[M];\n for(int i=0;i K){\n break;\n }\n else{\n time += A[i];\n timecnt[j] +=1;\n }\n }\n for(int i=0; i K){\n break;\n }\n else{\n time += B[i];\n timecnt[j] +=1;\n }\n }\n }\n\n /*\n for(int i=0;i timecnt[i]){\n ans = timecnt[i];\n }\n temp = timecnt[i];\n }\n }\n\n return ans;\n }\n}", "language": "Java", "metadata": {"date": 1593324934, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02623/input.txt", "sample_output_relpath": "derived/input_output/data/p02623/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02623/Java/s986061170.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s986061170", "user_id": "u136717841"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.*;\nclass Main{\n public static void main(String[]args){\n Scanner scanner = new Scanner(System.in);\n int N = scanner.nextInt();\n int M = scanner.nextInt();\n int K = scanner.nextInt();\n int[] A = new int[N];\n int[] B = new int[M];\n for(int i=0;i K){\n break;\n }\n else{\n time += A[i];\n timecnt[j] +=1;\n }\n }\n for(int i=0; i K){\n break;\n }\n else{\n time += B[i];\n timecnt[j] +=1;\n }\n }\n }\n\n /*\n for(int i=0;i timecnt[i]){\n ans = timecnt[i];\n }\n temp = timecnt[i];\n }\n }\n\n return ans;\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "sample_input": "3 4 240\n60 90 120\n80 150 80 150\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02623", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2156, "cpu_time_ms": 657, "memory_kb": 61612}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s107016552", "group_id": "codeNet:p02623", "input_text": "import java.util.*;\nimport java.math.*;\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = in.nextInt();\n\t\tint m = in.nextInt();\n\t\tlong k = in.nextLong();\n\t\tlong[] a = new long[n];\n\t\tlong[] b = new long[m];\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ta[i] = in.nextLong();\n\t\t}\n\t\tfor(int i = 0; i < m; i++) {\n\t\t\tb[i] = in.nextLong();\n\t\t}\n\t\tlong add = 0L;\n\t\tint i;\n\t\tfor(i = 0; i < n; i++) {\n\t\t\tif(add + a[i] <= k) {\n\t\t\t\tadd += a[i];\n\t\t\t}else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tlong ans = i;\n\t\ti -= 1;\n\t\tmain:\n\t\tfor(int j = 0; j < m; j++) {\n\t\t\tif(add + b[j] <= k) {\n\t\t\t\tadd += b[j];\n\t\t\t\tans = Math.max(ans, (i + 1) + (j + 1));\n\t\t\t}else {\n\t\t\t\tboolean flag = false;\n\t\t\t\twhile(i >= 0) {\n\t\t\t\t\tadd -= a[i];\n\t\t\t\t\ti -= 1;\n\t\t\t\t\tif(add + b[j] <= k) {\n\t\t\t\t\t\tans = Math.max(ans, (i + 1) + (j + 1));\n\t\t\t\t\t\tadd += b[j];\n\t\t\t\t\t\tflag = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(flag == false) break;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}", "language": "Java", "metadata": {"date": 1593324460, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02623/input.txt", "sample_output_relpath": "derived/input_output/data/p02623/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02623/Java/s107016552.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s107016552", "user_id": "u549562937"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.*;\nimport java.math.*;\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = in.nextInt();\n\t\tint m = in.nextInt();\n\t\tlong k = in.nextLong();\n\t\tlong[] a = new long[n];\n\t\tlong[] b = new long[m];\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ta[i] = in.nextLong();\n\t\t}\n\t\tfor(int i = 0; i < m; i++) {\n\t\t\tb[i] = in.nextLong();\n\t\t}\n\t\tlong add = 0L;\n\t\tint i;\n\t\tfor(i = 0; i < n; i++) {\n\t\t\tif(add + a[i] <= k) {\n\t\t\t\tadd += a[i];\n\t\t\t}else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tlong ans = i;\n\t\ti -= 1;\n\t\tmain:\n\t\tfor(int j = 0; j < m; j++) {\n\t\t\tif(add + b[j] <= k) {\n\t\t\t\tadd += b[j];\n\t\t\t\tans = Math.max(ans, (i + 1) + (j + 1));\n\t\t\t}else {\n\t\t\t\tboolean flag = false;\n\t\t\t\twhile(i >= 0) {\n\t\t\t\t\tadd -= a[i];\n\t\t\t\t\ti -= 1;\n\t\t\t\t\tif(add + b[j] <= k) {\n\t\t\t\t\t\tans = Math.max(ans, (i + 1) + (j + 1));\n\t\t\t\t\t\tadd += b[j];\n\t\t\t\t\t\tflag = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(flag == false) break;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "sample_input": "3 4 240\n60 90 120\n80 150 80 150\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02623", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 958, "cpu_time_ms": 651, "memory_kb": 64336}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s787582457", "group_id": "codeNet:p02623", "input_text": "import java.util.*;\nimport java.lang.*;\n\npublic class Main{\n\tpublic static void main(String[] args) {\n\t Scanner sc=new Scanner(System.in);\n\t int n=sc.nextInt();\n\t int m=sc.nextInt();\n\t int k=sc.nextInt();\n\t int[] a=new int[n];\n\t int[] b=new int[m];\n\t \n\t int[] ac=new int[n];\n\t int[] bc=new int[m];\n\t \n\t for(int i=0;ik)break;\n\t\t\tint rest=k-ac[i];\n\t\t\t\n\t\t\twhile(bc[ind]>rest && ind>0) {\n\t\t\t\tind--;\n\t\t\t}\n\t\t\tif(ind!=0)ind++;\n\t\t\tans=Math.max(i+ind+1, ans);\n\t\t}\n\t\t \n\t\t\n\t\tSystem.out.println(ans);\n\t}\n\n}\n\t", "language": "Java", "metadata": {"date": 1593316347, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02623/input.txt", "sample_output_relpath": "derived/input_output/data/p02623/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02623/Java/s787582457.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s787582457", "user_id": "u847535452"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.*;\nimport java.lang.*;\n\npublic class Main{\n\tpublic static void main(String[] args) {\n\t Scanner sc=new Scanner(System.in);\n\t int n=sc.nextInt();\n\t int m=sc.nextInt();\n\t int k=sc.nextInt();\n\t int[] a=new int[n];\n\t int[] b=new int[m];\n\t \n\t int[] ac=new int[n];\n\t int[] bc=new int[m];\n\t \n\t for(int i=0;ik)break;\n\t\t\tint rest=k-ac[i];\n\t\t\t\n\t\t\twhile(bc[ind]>rest && ind>0) {\n\t\t\t\tind--;\n\t\t\t}\n\t\t\tif(ind!=0)ind++;\n\t\t\tans=Math.max(i+ind+1, ans);\n\t\t}\n\t\t \n\t\t\n\t\tSystem.out.println(ans);\n\t}\n\n}\n\t", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "sample_input": "3 4 240\n60 90 120\n80 150 80 150\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02623", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 646, "memory_kb": 63856}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s604044948", "group_id": "codeNet:p02623", "input_text": "import java.util.Scanner;\nimport java.util.ArrayList;\n \npublic class Main {\n\n public static void main(String[] args) {\n \n Scanner scanner = new Scanner(System.in);\n ArrayList a = new ArrayList<>();\n ArrayList b = new ArrayList<>();\n \n int n = Integer.valueOf(scanner.next());\n int m = Integer.valueOf(scanner.next());\n double k = Double.valueOf(scanner.next());\n \n System.out.println(\"\\n\");\n \n double aValue = 0;\n for(int i = 0; i < n; i++) {\n aValue = Double.valueOf(scanner.next());\n a.add(aValue);\n }\n \n System.out.println(\"\\n\");\n \n double bValue = 0;\n for(int j = 0; j < m; j++) {\n bValue = Double.valueOf(scanner.next());\n b.add(bValue);\n }\n \n double l = 0;\n int z = 0;\n while(true) {\n \n if(a.isEmpty() && b.isEmpty()) {\n break;\n }\n \n if(a.isEmpty() && !(b.isEmpty())) {\n l += b.get(0);\n b.remove(0);\n } \n \n if(b.isEmpty() && !(a.isEmpty())) {\n l += a.get(0);\n a.remove(0);\n } \n \n if(!(a.isEmpty() || b.isEmpty())) {\n if(a.get(0) < b.get(0)) {\n l += a.get(0);\n a.remove(0);\n }else {\n l += b.get(0);\n b.remove(0);\n }\n }\n \n if(l > k) {\n break;\n }\n \n z++;\n }\n \n System.out.println(z);\n }\n}", "language": "Java", "metadata": {"date": 1593311338, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02623/input.txt", "sample_output_relpath": "derived/input_output/data/p02623/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02623/Java/s604044948.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s604044948", "user_id": "u236782231"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.Scanner;\nimport java.util.ArrayList;\n \npublic class Main {\n\n public static void main(String[] args) {\n \n Scanner scanner = new Scanner(System.in);\n ArrayList a = new ArrayList<>();\n ArrayList b = new ArrayList<>();\n \n int n = Integer.valueOf(scanner.next());\n int m = Integer.valueOf(scanner.next());\n double k = Double.valueOf(scanner.next());\n \n System.out.println(\"\\n\");\n \n double aValue = 0;\n for(int i = 0; i < n; i++) {\n aValue = Double.valueOf(scanner.next());\n a.add(aValue);\n }\n \n System.out.println(\"\\n\");\n \n double bValue = 0;\n for(int j = 0; j < m; j++) {\n bValue = Double.valueOf(scanner.next());\n b.add(bValue);\n }\n \n double l = 0;\n int z = 0;\n while(true) {\n \n if(a.isEmpty() && b.isEmpty()) {\n break;\n }\n \n if(a.isEmpty() && !(b.isEmpty())) {\n l += b.get(0);\n b.remove(0);\n } \n \n if(b.isEmpty() && !(a.isEmpty())) {\n l += a.get(0);\n a.remove(0);\n } \n \n if(!(a.isEmpty() || b.isEmpty())) {\n if(a.get(0) < b.get(0)) {\n l += a.get(0);\n a.remove(0);\n }else {\n l += b.get(0);\n b.remove(0);\n }\n }\n \n if(l > k) {\n break;\n }\n \n z++;\n }\n \n System.out.println(z);\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "sample_input": "3 4 240\n60 90 120\n80 150 80 150\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02623", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1751, "cpu_time_ms": 2208, "memory_kb": 70916}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s374641948", "group_id": "codeNet:p02623", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\t//java11\n\n\tstatic int N, M, ans;\n\tstatic long K;\n\tstatic int[] A, B;\n\tstatic long time;\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tN = sc.nextInt();\n\t\tM = sc.nextInt();\n\t\tK = sc.nextLong();\n\n\t\tA = new int[N];\n\t\tfor(int i=0; i B[bi]) {\n\t\t\tif(time + B[bi] <= K) {\n\t\t\t\treturn -1;\n\t\t\t}else {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}else {\n\t\t\t//終了条件\n\t\t\tif(ai == N-1 || bi == M-1) {\n\t\t\t\tif(time + A[ai] <= K) {\n\t\t\t\t\treturn 1;\n\t\t\t\t}else {\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}else {\n\t\t\t\treturn judge(ai+1, bi+1);\n\t\t\t}\n\t\t}\n\t}\n}\n", "language": "Java", "metadata": {"date": 1593311331, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02623/input.txt", "sample_output_relpath": "derived/input_output/data/p02623/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02623/Java/s374641948.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s374641948", "user_id": "u374566600"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\t//java11\n\n\tstatic int N, M, ans;\n\tstatic long K;\n\tstatic int[] A, B;\n\tstatic long time;\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tN = sc.nextInt();\n\t\tM = sc.nextInt();\n\t\tK = sc.nextLong();\n\n\t\tA = new int[N];\n\t\tfor(int i=0; i B[bi]) {\n\t\t\tif(time + B[bi] <= K) {\n\t\t\t\treturn -1;\n\t\t\t}else {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}else {\n\t\t\t//終了条件\n\t\t\tif(ai == N-1 || bi == M-1) {\n\t\t\t\tif(time + A[ai] <= K) {\n\t\t\t\t\treturn 1;\n\t\t\t\t}else {\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}else {\n\t\t\t\treturn judge(ai+1, bi+1);\n\t\t\t}\n\t\t}\n\t}\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "sample_input": "3 4 240\n60 90 120\n80 150 80 150\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02623", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1680, "cpu_time_ms": 2207, "memory_kb": 67708}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s597129256", "group_id": "codeNet:p02623", "input_text": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int M = sc.nextInt();\n int K = sc.nextInt();\n int[] A = new int[N + 1];\n int[] B = new int[M + 1];\n A[N] = 0;\n B[N] = 0;\n for (int i = 0; i < N; i++) {\n A[i] = sc.nextInt();\n }\n for (int i = 0; i < M; i++) {\n B[i] = sc.nextInt();\n }\n int T = 0;\n int a = A[0];\n int b = B[0];\n int Ca = 0;\n int Cb = 0;\n while ( T <= K ) {\n if ( a > 0 && a > b ) {\n T = T + a;\n Ca = Ca + 1;\n a = A[Ca];\n } else if (b > 0 && b >= a){\n T = T + b;\n Cb = Cb + 1;\n b = B[Cb];\n } else {\n break;\n }\n }\n System.out.println(Ca + Cb);\n }\n}", "language": "Java", "metadata": {"date": 1593310922, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02623/input.txt", "sample_output_relpath": "derived/input_output/data/p02623/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02623/Java/s597129256.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s597129256", "user_id": "u191257442"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int M = sc.nextInt();\n int K = sc.nextInt();\n int[] A = new int[N + 1];\n int[] B = new int[M + 1];\n A[N] = 0;\n B[N] = 0;\n for (int i = 0; i < N; i++) {\n A[i] = sc.nextInt();\n }\n for (int i = 0; i < M; i++) {\n B[i] = sc.nextInt();\n }\n int T = 0;\n int a = A[0];\n int b = B[0];\n int Ca = 0;\n int Cb = 0;\n while ( T <= K ) {\n if ( a > 0 && a > b ) {\n T = T + a;\n Ca = Ca + 1;\n a = A[Ca];\n } else if (b > 0 && b >= a){\n T = T + b;\n Cb = Cb + 1;\n b = B[Cb];\n } else {\n break;\n }\n }\n System.out.println(Ca + Cb);\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "sample_input": "3 4 240\n60 90 120\n80 150 80 150\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02623", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 977, "cpu_time_ms": 658, "memory_kb": 60716}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s572970437", "group_id": "codeNet:p02623", "input_text": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n, m;\n long k;\n n = sc.nextInt(); m = sc.nextInt(); k = sc.nextLong();\n sc.nextLine();\n int i;\n long N[] = new long[n];\n long M[] = new long[m];\n for(i = 0; i < n; i++) N[i] = sc.nextLong();\n sc.nextLine();\n for(i = 0; i < m; i++) M[i] = sc.nextLong();\n sc.nextLine();\n \n long limit = 0;\n int ntop = 0, mtop = 0;\n while(limit < k){\n \n if(N[ntop] > M[mtop] || mtop >= m){\n if((limit + M[mtop]) < k) limit += M[mtop++];\n else break;\n }else{\n if((limit + N[ntop]) < k) limit += N[ntop++];\n else break;\n }\n\n }\n\n System.out.println(mtop+ntop);\n\n }\n}", "language": "Java", "metadata": {"date": 1593310427, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02623/input.txt", "sample_output_relpath": "derived/input_output/data/p02623/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02623/Java/s572970437.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s572970437", "user_id": "u774810394"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n, m;\n long k;\n n = sc.nextInt(); m = sc.nextInt(); k = sc.nextLong();\n sc.nextLine();\n int i;\n long N[] = new long[n];\n long M[] = new long[m];\n for(i = 0; i < n; i++) N[i] = sc.nextLong();\n sc.nextLine();\n for(i = 0; i < m; i++) M[i] = sc.nextLong();\n sc.nextLine();\n \n long limit = 0;\n int ntop = 0, mtop = 0;\n while(limit < k){\n \n if(N[ntop] > M[mtop] || mtop >= m){\n if((limit + M[mtop]) < k) limit += M[mtop++];\n else break;\n }else{\n if((limit + N[ntop]) < k) limit += N[ntop++];\n else break;\n }\n\n }\n\n System.out.println(mtop+ntop);\n\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "sample_input": "3 4 240\n60 90 120\n80 150 80 150\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02623", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 906, "cpu_time_ms": 743, "memory_kb": 64252}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s582952179", "group_id": "codeNet:p02623", "input_text": "/*\nWritten by Kabir Kanha Arora\n@kabirkanha\n */\n\nimport java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int N = scanner.nextInt();\n int M = scanner.nextInt();\n long K = scanner.nextLong();\n long[] arr_A = new long[N];\n long[] arr_B = new long[M];\n for (int i = 0; i < N; ++i) {\n arr_A[i] = scanner.nextLong();\n }\n for (int i = 0; i < M; ++i) {\n arr_B[i] = scanner.nextLong();\n }\n int cnt = 0;\n long sum = 0;\n for (int i = 0; i < N; ++i) {\n if (sum + arr_A[i] > K)\n break;\n sum += arr_A[i];\n cnt++;\n }\n int max = cnt;\n int marker = cnt - 1;\n for (int i = 0; i < M; ++i) {\n if (sum + arr_B[i] > K)\n break;\n sum += arr_B[i];\n cnt++;\n }\n int j = 0;\n for (int i = marker; i >= 0; --i) {\n sum -= arr_A[i];\n --cnt;\n while (j < M && sum + arr_B[j] <= K) {\n sum += arr_B[j];\n ++j;\n ++cnt;\n max = Math.max(max, cnt);\n }\n }\n System.out.println(max);\n }\n}\n", "language": "Java", "metadata": {"date": 1593310304, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02623/input.txt", "sample_output_relpath": "derived/input_output/data/p02623/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02623/Java/s582952179.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s582952179", "user_id": "u347825215"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "/*\nWritten by Kabir Kanha Arora\n@kabirkanha\n */\n\nimport java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int N = scanner.nextInt();\n int M = scanner.nextInt();\n long K = scanner.nextLong();\n long[] arr_A = new long[N];\n long[] arr_B = new long[M];\n for (int i = 0; i < N; ++i) {\n arr_A[i] = scanner.nextLong();\n }\n for (int i = 0; i < M; ++i) {\n arr_B[i] = scanner.nextLong();\n }\n int cnt = 0;\n long sum = 0;\n for (int i = 0; i < N; ++i) {\n if (sum + arr_A[i] > K)\n break;\n sum += arr_A[i];\n cnt++;\n }\n int max = cnt;\n int marker = cnt - 1;\n for (int i = 0; i < M; ++i) {\n if (sum + arr_B[i] > K)\n break;\n sum += arr_B[i];\n cnt++;\n }\n int j = 0;\n for (int i = marker; i >= 0; --i) {\n sum -= arr_A[i];\n --cnt;\n while (j < M && sum + arr_B[j] <= K) {\n sum += arr_B[j];\n ++j;\n ++cnt;\n max = Math.max(max, cnt);\n }\n }\n System.out.println(max);\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "sample_input": "3 4 240\n60 90 120\n80 150 80 150\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02623", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1298, "cpu_time_ms": 646, "memory_kb": 64328}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s939810644", "group_id": "codeNet:p02623", "input_text": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\nimport java.io.IOException;\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n MyScanner in = new MyScanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n C solver = new C();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class C {\n public void solve(int testNumber, MyScanner in, PrintWriter out) {\n int N = in.Int();\n int M = in.Int();\n int K = in.Int();\n int[] A = in.Int(N);\n int[] B = in.Int(M);\n\n long[] as = new long[N + 1];\n for (int i = 0; i < N; i++) {\n as[i + 1] += as[i] + A[i];\n }\n long[] bs = new long[M + 1];\n for (int i = 0; i < M; i++) {\n bs[i + 1] += bs[i] + B[i];\n }\n int ans = 0;\n int i = 0;\n while (i < N && as[i + 1] <= K) i++;\n int j = 0;\n while (i >= 0) {\n while (j < M && as[i] + bs[j + 1] <= K) j++;\n ans = Math.max(ans, i + j);\n i--;\n }\n out.println(ans);\n// out.println(Arrays.toString(as));\n// out.println(Arrays.toString(bs));\n }\n\n }\n\n static class MyScanner {\n private BufferedReader in;\n private StringTokenizer st;\n\n public MyScanner(InputStream stream) {\n in = new BufferedReader(new InputStreamReader(stream));\n }\n\n public String next() {\n while (st == null || !st.hasMoreTokens()) {\n try {\n String rl = in.readLine();\n if (rl == null) {\n return null;\n }\n st = new StringTokenizer(rl);\n } catch (IOException e) {\n return null;\n }\n }\n return st.nextToken();\n }\n\n public int Int() {\n return Integer.parseInt(next());\n }\n\n public int[] Int(int n) {\n int[] a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = Int();\n }\n return a;\n }\n\n }\n}\n\n", "language": "Java", "metadata": {"date": 1593309762, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02623/input.txt", "sample_output_relpath": "derived/input_output/data/p02623/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02623/Java/s939810644.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s939810644", "user_id": "u305384049"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\nimport java.io.IOException;\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n MyScanner in = new MyScanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n C solver = new C();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class C {\n public void solve(int testNumber, MyScanner in, PrintWriter out) {\n int N = in.Int();\n int M = in.Int();\n int K = in.Int();\n int[] A = in.Int(N);\n int[] B = in.Int(M);\n\n long[] as = new long[N + 1];\n for (int i = 0; i < N; i++) {\n as[i + 1] += as[i] + A[i];\n }\n long[] bs = new long[M + 1];\n for (int i = 0; i < M; i++) {\n bs[i + 1] += bs[i] + B[i];\n }\n int ans = 0;\n int i = 0;\n while (i < N && as[i + 1] <= K) i++;\n int j = 0;\n while (i >= 0) {\n while (j < M && as[i] + bs[j + 1] <= K) j++;\n ans = Math.max(ans, i + j);\n i--;\n }\n out.println(ans);\n// out.println(Arrays.toString(as));\n// out.println(Arrays.toString(bs));\n }\n\n }\n\n static class MyScanner {\n private BufferedReader in;\n private StringTokenizer st;\n\n public MyScanner(InputStream stream) {\n in = new BufferedReader(new InputStreamReader(stream));\n }\n\n public String next() {\n while (st == null || !st.hasMoreTokens()) {\n try {\n String rl = in.readLine();\n if (rl == null) {\n return null;\n }\n st = new StringTokenizer(rl);\n } catch (IOException e) {\n return null;\n }\n }\n return st.nextToken();\n }\n\n public int Int() {\n return Integer.parseInt(next());\n }\n\n public int[] Int(int n) {\n int[] a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = Int();\n }\n return a;\n }\n\n }\n}\n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "sample_input": "3 4 240\n60 90 120\n80 150 80 150\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02623", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2617, "cpu_time_ms": 298, "memory_kb": 60504}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s289384080", "group_id": "codeNet:p02623", "input_text": "import java.util.*;\n \npublic class Main {\n\tstatic int max = 0;\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int M = sc.nextInt();\n long K = sc.nextLong();\n int[] A = new int[N+1];\n for (int i = 1; i < N+1; i++) {\n \tint Ai = sc.nextInt();\n \tA[i] = Ai;\n }\n int[] B = new int[M+1];\n for (int i = 1; i < M+1; i++) {\n \tint Bi = sc.nextInt();\n \tB[i] = Bi;\n }\n calc(0, K, true, A, B, 1, 1);\n calc(0, K, false, A, B, 1, 1);\n System.out.println(max);\n }\n \n private static void calc(int count, long K, boolean isA, int[] A, int[] B, int indexA, int indexB) {\n \tif (isA) {\n \t\tK -= A[indexA];\n \t\tif (K < 0) {\n \t\t\tif (max < count) {\n \t\t\t\tmax = count;\n \t\t\t}\n \t\t\treturn;\n \t\t}\n \t\tindexA++;\n \t\tcount++;\n \t\tif (indexA == A.length && indexB == B.length) {\n \t\t\tif (max < count) {\n \t\t\t\tmax = count;\n \t\t\t}\n \t\treturn;\n \t\t} else if (indexA == A.length) {\n \t\t\tcalc(count, K, false, A , B, indexA, indexB);\n \t\t} else if (indexB == B.length) {\n \t\t\tcalc(count, K, true, A , B, indexA, indexB);\n \t\t} else {\n \t\tcalc(count, K, true, A , B, indexA, indexB);\n \t\tcalc(count, K, false, A , B, indexA, indexB);\n \t\t}\n \t} else {\n \t\tK -= B[indexB];\n \t\tif (K < 0) {\n \t\t\tif (max < count) {\n \t\t\t\tmax = count;\n \t\t\t}\n \t\t\treturn;\n \t\t}\n \t\tindexB++;\n \t\tcount++;\n \t\tif (indexA == A.length && indexB == B.length) {\n \t\t\tif (max < count) {\n \t\t\t\tmax = count;\n \t\t\t}\n \t\treturn;\n \t\t} else if (indexA == A.length) {\n \t\t\tcalc(count, K, false, A , B, indexA, indexB);\n \t\t} else if (indexB == B.length) {\n \t\t\tcalc(count, K, true, A , B, indexA, indexB);\n \t\t} else {\n \t\tcalc(count, K, true, A , B, indexA, indexB);\n \t\tcalc(count, K, false, A , B, indexA, indexB);\n \t\t}\n \t}\n }\n}", "language": "Java", "metadata": {"date": 1593309317, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02623/input.txt", "sample_output_relpath": "derived/input_output/data/p02623/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02623/Java/s289384080.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s289384080", "user_id": "u866594486"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.*;\n \npublic class Main {\n\tstatic int max = 0;\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int M = sc.nextInt();\n long K = sc.nextLong();\n int[] A = new int[N+1];\n for (int i = 1; i < N+1; i++) {\n \tint Ai = sc.nextInt();\n \tA[i] = Ai;\n }\n int[] B = new int[M+1];\n for (int i = 1; i < M+1; i++) {\n \tint Bi = sc.nextInt();\n \tB[i] = Bi;\n }\n calc(0, K, true, A, B, 1, 1);\n calc(0, K, false, A, B, 1, 1);\n System.out.println(max);\n }\n \n private static void calc(int count, long K, boolean isA, int[] A, int[] B, int indexA, int indexB) {\n \tif (isA) {\n \t\tK -= A[indexA];\n \t\tif (K < 0) {\n \t\t\tif (max < count) {\n \t\t\t\tmax = count;\n \t\t\t}\n \t\t\treturn;\n \t\t}\n \t\tindexA++;\n \t\tcount++;\n \t\tif (indexA == A.length && indexB == B.length) {\n \t\t\tif (max < count) {\n \t\t\t\tmax = count;\n \t\t\t}\n \t\treturn;\n \t\t} else if (indexA == A.length) {\n \t\t\tcalc(count, K, false, A , B, indexA, indexB);\n \t\t} else if (indexB == B.length) {\n \t\t\tcalc(count, K, true, A , B, indexA, indexB);\n \t\t} else {\n \t\tcalc(count, K, true, A , B, indexA, indexB);\n \t\tcalc(count, K, false, A , B, indexA, indexB);\n \t\t}\n \t} else {\n \t\tK -= B[indexB];\n \t\tif (K < 0) {\n \t\t\tif (max < count) {\n \t\t\t\tmax = count;\n \t\t\t}\n \t\t\treturn;\n \t\t}\n \t\tindexB++;\n \t\tcount++;\n \t\tif (indexA == A.length && indexB == B.length) {\n \t\t\tif (max < count) {\n \t\t\t\tmax = count;\n \t\t\t}\n \t\treturn;\n \t\t} else if (indexA == A.length) {\n \t\t\tcalc(count, K, false, A , B, indexA, indexB);\n \t\t} else if (indexB == B.length) {\n \t\t\tcalc(count, K, true, A , B, indexA, indexB);\n \t\t} else {\n \t\tcalc(count, K, true, A , B, indexA, indexB);\n \t\tcalc(count, K, false, A , B, indexA, indexB);\n \t\t}\n \t}\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "sample_input": "3 4 240\n60 90 120\n80 150 80 150\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02623", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1975, "cpu_time_ms": 2209, "memory_kb": 86928}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s623237315", "group_id": "codeNet:p02623", "input_text": "import java.util.*;\nimport java.io.*;\nimport java.util.function.*;\n// import lib.util.*;\n// import lib.graph.*;\n// import lib.io.*;\n// import lib.math.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int m = sc.nextInt();\n int k = sc.nextInt();\n int[] a = new int[n];\n int[] b = new int[m];\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextInt();\n }\n for (int i = 0; i < m; i++) {\n b[i] = sc.nextInt();\n }\n ArrayDeque q = new ArrayDeque<>();\n int c = 0;\n int d = 0;\n for (int i = 0; i < n + m; i++) {\n if (c == n) {\n while (d != m) {\n q.add(b[d]);\n d++;\n }\n break;\n }\n if (d == m) {\n while (c != n) {\n q.add(a[c]);\n c++;\n }\n break;\n }\n if (a[c] < b[d]) {\n q.add(a[c]);\n c++;\n } else {\n q.add(b[d]);\n d++;\n }\n }\n int res = 0;\n while (q.size() > 0) {\n k -= q.poll();\n if (k >= 0)\n res++;\n else\n break;\n }\n System.out.println(res);\n }\n\n}\n\nclass UnionFindTree {\n int[] root;\n int[] rank;\n int[] size;\n int m;\n\n public UnionFindTree(int n) {\n this.root = new int[n];\n this.rank = new int[n];\n this.size = new int[n];\n this.m = n;\n for (int i = 0; i < n; i++) {\n root[i] = i;\n size[i] = 1;\n }\n }\n\n public int find(int x) {\n if (root[x] == x)\n return x;\n else {\n return root[x] = find(root[x]);\n }\n }\n\n public void unite(int x, int y) {\n x = find(x);\n y = find(y);\n if (x == y)\n return;\n if (rank[x] < rank[y]) {\n size[find(y)] = size[find(x)];\n root[x] = y;\n } else {\n size[find(x)] = size[find(y)];\n root[y] = x;\n if (rank[x] == rank[y])\n rank[x]++;\n }\n m--;\n }\n\n public boolean same(int x, int y) {\n return find(x) == find(y);\n }\n\n public int size(int i) {\n return this.size[find(i)];\n }\n}\n\nclass Dijkstra {\n private static int prev[];\n private static long dist[];\n\n public Dijkstra(AbstractGraph graph, int s) {\n prev = new int[graph.n];\n dist = new long[graph.n];\n Arrays.fill(prev, -1);\n Arrays.fill(dist, Long.MAX_VALUE);\n PriorityQueue searching = new PriorityQueue<>((x, y) -> Long.compare(dist[x], dist[y]));\n dist[s] = 0;\n searching.add(s);\n while (searching.size() > 0) {\n int now = searching.poll();\n for (Edge e : graph.getEdges(now)) {\n int next = e.to;\n long c = e.cost;\n if (dist[now] + c < dist[next]) {\n dist[next] = dist[now] + c;\n prev[next] = now;\n searching.add(next);\n }\n }\n }\n }\n\n public int[] path(int to) {\n ArrayList rev = new ArrayList<>();\n for (int now = to; now != -1; now = this.prev[now]) {\n rev.add(now);\n }\n int[] path = new int[rev.size()];\n for (int i = 0; i < path.length; i++) {\n path[i] = rev.get(path.length - i - 1);\n }\n return path;\n }\n\n public long getDist(int t) {\n return dist[t];\n }\n}\n\nclass WF {\n private static long[][] dist;\n\n public WF(AbstractGraph graph) {\n dist = new long[graph.n][graph.n];\n for (int i = 0; i < dist.length; i++) {\n Arrays.fill(dist[i], Integer.MAX_VALUE);\n }\n for (int i = 0; i < graph.n; i++) {\n for (Edge e : graph.getEdges(i)) {\n dist[i][e.to] = e.cost;\n }\n dist[i][i] = 0;\n }\n for (int k = 0; k < graph.n; k++) {\n for (int i = 0; i < graph.n; i++) {\n for (int j = 0; j < graph.n; j++) {\n if (dist[i][k] != Integer.MAX_VALUE && dist[k][j] != Integer.MAX_VALUE) {\n dist[i][j] = Math.min(dist[i][j], dist[i][k] + dist[k][j]);\n }\n }\n }\n }\n }\n\n public static long getShortest(int s, int t) {\n return dist[s][t];\n }\n\n public static long[][] getAllDist() {\n return dist;\n }\n\n public static boolean isNegativeLoop() {\n for (int i = 0; i < dist.length; i++) {\n if (dist[i][i] < 0) {\n return true;\n }\n }\n return false;\n }\n}\n\nclass Edge {\n int from, to;\n long cost;\n\n public Edge(int from, int to, long cost) {\n this.from = from;\n this.to = to;\n this.cost = cost;\n }\n\n public Edge(int from, int to) {\n this.from = from;\n this.to = to;\n this.cost = 1;\n }\n\n public Edge reverse() {\n return new Edge(to, from, cost);\n }\n}\n\n@SuppressWarnings(\"unchecked\")\nabstract class AbstractGraph {\n int n;\n int m;\n ArrayList[] edges;\n\n public AbstractGraph(int n) {\n this.n = n;\n this.m = 0;\n this.edges = new ArrayList[n];\n for (int i = 0; i < n; i++) {\n this.edges[i] = new ArrayList();\n }\n }\n\n public void addEdge(Edge e) {\n this.m++;\n this.edges[e.from].add(e);\n }\n\n public int getV() {\n return this.n;\n }\n\n public int getE() {\n return this.m;\n }\n\n public ArrayList getEdges(int v) {\n return this.edges[v];\n }\n\n abstract public boolean isBipartite();\n\n public boolean isTree() {\n // require Modifying.\n return false;\n }\n}\n\nclass Graph extends AbstractGraph {\n int n;\n int m;\n // array of edges which is connect to the node\n ArrayList[] edges;\n\n public Graph(int n) {\n super(n);\n }\n\n public void addEdge(int from, int to, int cost) {\n Edge e = new Edge(from, to, cost);\n super.addEdge(e);\n super.addEdge(e.reverse());\n this.m++;\n }\n\n @Override\n public void addEdge(Edge e) {\n this.edges[e.from].add(e);\n this.edges[e.to].add(e.reverse());\n this.m++;\n }\n\n public int getV(int v) {\n return n;\n }\n\n public int getE() {\n return m;\n }\n\n public boolean isBipartite() {\n int[] color = new int[n];\n PriorityQueue queue = new PriorityQueue<>();\n HashSet visited = new HashSet<>();\n queue.add(0);\n color[0] = 1;\n while (queue.size() > 0) {\n int now = queue.poll();\n visited.add(now);\n for (Edge e : getEdges(now)) {\n if (visited.contains(e.to)) {\n continue;\n }\n if (color[e.to] == color[now])\n return false;\n queue.add(e.to);\n if (color[e.to] == 0)\n color[e.to] = -1 * color[now];\n }\n }\n return true;\n }\n}\n\nclass DirectedGraph extends AbstractGraph {\n private int n;\n private int m;\n private int[] ind;\n // array of edges which is connect to the node\n ArrayList[] edges;\n\n public DirectedGraph(int n) {\n super(n);\n this.ind = new int[n];\n }\n\n public void addEdge(int from, int to, int cost) {\n Edge e = new Edge(from, to, cost);\n super.addEdge(e);\n this.m++;\n this.ind[to]++;\n }\n\n @Override\n public void addEdge(Edge e) {\n this.edges[e.from].add(e);\n this.m++;\n this.ind[e.to]++;\n }\n\n public int getV(int v) {\n return this.n;\n }\n\n public int getE() {\n return this.m;\n }\n\n public int[] getInDimension() {\n return this.ind;\n }\n\n public int getInDimension(int v) {\n return this.ind[v];\n }\n\n public boolean isBipartite() {\n // need to rewrite to work\n return false;\n }\n\n}\n\nclass FastScanner {\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte())\n return buffer[ptr++];\n else\n return -1;\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr]))\n ptr++;\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext())\n throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext())\n throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)\n throw new NumberFormatException();\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n}\n\nclass MyMath {\n public static long gcm(long a, long b) {\n\n // if (a < b)\n // return gcm(b, a);\n\n // if (b == 0 || a % b == 0)\n // return b;\n\n // return gcm(b, a % b);\n if (a < b) {\n long tmp = a;\n a = b;\n b = tmp;\n }\n long r = -1;\n while (r != 0) {\n r = a % b;\n a = b;\n b = r;\n }\n return a;\n }\n\n public static long summation(long a, long b) {\n return b * (b + 1) / 2 - a * (a - 1) / 2;\n }\n\n public static long factorial(long n, long m) {\n\n if (n <= 1)\n return 1;\n else\n return factorial(n - 1, m) * n % m;\n }\n\n public static long[][] binomialTable(int a, long m) {\n long[][] table = new long[a + 1][a + 1];\n for (int i = 0; i < a + 1; i++) {\n table[0][a] = 0;\n table[i][0] = 1;\n table[i][i] = 1;\n }\n for (int i = 1; i < a + 1; i++) {\n for (int j = 1; j < a + 1; j++) {\n if (i < j)\n table[i][j] = 0;\n else {\n table[i][j] = (table[i - 1][j - 1] + table[i - 1][j]) % m;\n }\n }\n }\n return table;\n }\n\n public static long binomial(int n, int k, long m) {\n long res = 1;\n for (int l = n - k + 1; l <= n; l++) {\n res = (res % m) * (l % m) % m;\n }\n for (int r = 1; r <= k; r++) {\n res = (res % m) * modinv(r, m) % m;\n }\n return res;\n }\n\n public static long binomial(long[] facttable, long[] invtable, int n, int k, long m) {\n if (n < k)\n return 0;\n else\n return (facttable[n] % m * (invtable[n - k] % m) * invtable[k] % m) % m;\n }\n\n public static long pow(long a, long n, long p) {\n if (n == 0)\n return 1;\n if (n == 1)\n return a % p;\n if (n % 2 == 1)\n return a * pow(a, n - 1, p) % p;\n long tmp = pow(a, n / 2, p) % p;\n return tmp * tmp % p;\n }\n\n public static long modinv(long a, long p) {\n long b, x, u, q, abs_p, tmp;\n abs_p = Math.abs(p);\n b = p;\n x = 1;\n u = 0;\n while (b > 0) {\n q = a / b;\n tmp = u;\n u = x - q * u;\n x = tmp;\n tmp = b;\n b = a - q * b;\n a = tmp;\n }\n return (x < 0) ? abs_p + x : x;\n }\n\n public static Long[] eratosthenes(int n) {\n Long[] factor_table = new Long[n];\n for (long i = 1; i <= n; i++) {\n factor_table[(int) (i - 1)] = i;\n }\n for (long i = 1; i <= n; i++) {\n if (factor_table[(int) (i - 1)] == i) {\n int j = 2;\n while (i * j <= n) {\n factor_table[(int) (i * j - 1)] = i;\n j++;\n }\n }\n }\n\n return factor_table;\n }\n\n public static HashMap primeFactorization(long n) {\n HashMap primes = new HashMap<>();\n for (long p = 2; p * p <= n; p++) {\n int q = 0;\n while (n % p == 0) {\n n /= p;\n q++;\n }\n if (q > 0)\n primes.put(p, q);\n }\n if (n > 1)\n primes.put(n, 1);\n return primes;\n }\n\n public static ArrayList divisor(int n) {\n ArrayList ret = new ArrayList();\n for (int i = 1; i * i <= n; i++) {\n if (n % i == 0) {\n ret.add(i);\n // n=PQ+0→ PもQも約数. ただし、Q=Pは↑で登録済みなので登録しない\n if (i != n / i)\n ret.add(n / i);\n }\n }\n return ret;\n }\n}\n\nclass nextPermutation {\n public static int[] swap(int data[], int left, int right) {\n\n // Swap the data\n int temp = data[left];\n data[left] = data[right];\n data[right] = temp;\n\n // Return the updated array\n return data;\n }\n\n // Function to reverse the sub-array\n // starting from left to the right\n // both inclusive\n public static int[] reverse(int data[], int left, int right) {\n\n // Reverse the sub-array\n while (left < right) {\n int temp = data[left];\n data[left++] = data[right];\n data[right--] = temp;\n }\n\n // Return the updated array\n return data;\n }\n\n // Function to find the next permutation\n // of the given integer array\n public static boolean findNextPermutation(int data[]) {\n\n // If the given dataset is empty\n // or contains only one element\n // next_permutation is not possible\n if (data.length <= 1)\n return false;\n\n int last = data.length - 2;\n\n // find the longest non-increasing suffix\n // and find the pivot\n while (last >= 0) {\n if (data[last] < data[last + 1]) {\n break;\n }\n last--;\n }\n\n // If there is no increasing pair\n // there is no higher order permutation\n if (last < 0)\n return false;\n\n int nextGreater = data.length - 1;\n\n // Find the rightmost successor to the pivot\n for (int i = data.length - 1; i > last; i--) {\n if (data[i] > data[last]) {\n nextGreater = i;\n break;\n }\n }\n\n // Swap the successor and the pivot\n data = swap(data, nextGreater, last);\n\n // Reverse the suffix\n data = reverse(data, last + 1, data.length - 1);\n\n // Return true as the next_permutation is done\n return true;\n }\n}\n\nclass ArrayUtil {\n private static long INF = 1_000_000_000_0L;\n\n public static int UpperBound(long[] array, long obj) {\n int l = 0, r = array.length - 1;\n while (r - l >= 0) {\n int c = (l + r) / 2;\n if (obj < array[c]) {\n r = c - 1;\n } else {\n l = c + 1;\n }\n }\n return l;\n }\n\n public static int LowerBound(long[] array, long obj) {\n int l = 0, r = array.length - 1;\n while (r - l >= 0) {\n int c = (l + r) / 2;\n if (obj <= array[c]) {\n r = c - 1;\n } else {\n l = c + 1;\n }\n }\n return l;\n }\n\n // return the length of array's LIS\n public static int LIS(long[] array) {\n long[] dp = new long[array.length + 1];\n Arrays.fill(dp, INF);\n for (int i = 0; i < array.length; i++) {\n int idx = LowerBound(dp, array[i]);\n dp[idx] = array[i];\n }\n return LowerBound(dp, INF - 1);\n }\n\n public static int StrictLIS(long[] array) {\n long[] dp = new long[array.length + 1];\n Arrays.fill(dp, INF);\n for (int i = 0; i < array.length; i++) {\n int idx = UpperBound(dp, array[i]);\n dp[idx] = array[i];\n }\n return UpperBound(dp, INF - 1);\n }\n\n public static void debug(int[][] A) {\n for (int i = 0; i < A.length; i++) {\n for (int j = 0; j < A[0].length; j++) {\n System.out.print(A[i][j] + \" \");\n }\n System.out.println();\n }\n }\n}\n\nclass BinaryIndexedTree {\n int[] data;\n long[] tree;\n int n;\n\n public BinaryIndexedTree(int[] data) {\n this.data = data;\n this.n = data.length;\n this.tree = new long[n + 1];\n buildTree();\n }\n\n public void buildTree() {\n for (int i = 0; i < n; i++) {\n add(i + 1, data[i]);\n }\n }\n\n public void add(int index, int value) {\n for (int i = index; i <= n; i += i & -i) {\n tree[i] += value;\n }\n }\n\n public long sum(int from, int to) {\n return sum(to) - sum(from - 1);\n }\n\n public long sum(int index) {\n int sum = 0;\n for (int i = index; i > 0; i -= i & -i) {\n sum += tree[i];\n }\n return sum;\n }\n}\n\nclass TopologicalSort {\n private DirectedGraph g;\n private int[] in;\n private int n, m;\n\n public TopologicalSort(DirectedGraph g) {\n this.g = g;\n this.in = g.getInDimension();\n this.n = g.getV();\n this.m = g.getE();\n }\n\n public int[] sort() {\n int[] ret = new int[this.n];\n ArrayDeque q = new ArrayDeque<>();\n for (int i = 0; i < this.n; i++) {\n if (in[i] == 0) {\n q.push(i);\n }\n }\n int k = 0;\n while (q.size() > 0) {\n int v = q.pollFirst();\n ret[k] = v;\n k++;\n for (Edge e : g.getEdges(v)) {\n if (--in[e.to] == 0)\n q.push(e.to);\n }\n }\n return ret;\n }\n}", "language": "Java", "metadata": {"date": 1593309249, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02623/input.txt", "sample_output_relpath": "derived/input_output/data/p02623/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02623/Java/s623237315.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s623237315", "user_id": "u288042356"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\nimport java.util.function.*;\n// import lib.util.*;\n// import lib.graph.*;\n// import lib.io.*;\n// import lib.math.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int m = sc.nextInt();\n int k = sc.nextInt();\n int[] a = new int[n];\n int[] b = new int[m];\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextInt();\n }\n for (int i = 0; i < m; i++) {\n b[i] = sc.nextInt();\n }\n ArrayDeque q = new ArrayDeque<>();\n int c = 0;\n int d = 0;\n for (int i = 0; i < n + m; i++) {\n if (c == n) {\n while (d != m) {\n q.add(b[d]);\n d++;\n }\n break;\n }\n if (d == m) {\n while (c != n) {\n q.add(a[c]);\n c++;\n }\n break;\n }\n if (a[c] < b[d]) {\n q.add(a[c]);\n c++;\n } else {\n q.add(b[d]);\n d++;\n }\n }\n int res = 0;\n while (q.size() > 0) {\n k -= q.poll();\n if (k >= 0)\n res++;\n else\n break;\n }\n System.out.println(res);\n }\n\n}\n\nclass UnionFindTree {\n int[] root;\n int[] rank;\n int[] size;\n int m;\n\n public UnionFindTree(int n) {\n this.root = new int[n];\n this.rank = new int[n];\n this.size = new int[n];\n this.m = n;\n for (int i = 0; i < n; i++) {\n root[i] = i;\n size[i] = 1;\n }\n }\n\n public int find(int x) {\n if (root[x] == x)\n return x;\n else {\n return root[x] = find(root[x]);\n }\n }\n\n public void unite(int x, int y) {\n x = find(x);\n y = find(y);\n if (x == y)\n return;\n if (rank[x] < rank[y]) {\n size[find(y)] = size[find(x)];\n root[x] = y;\n } else {\n size[find(x)] = size[find(y)];\n root[y] = x;\n if (rank[x] == rank[y])\n rank[x]++;\n }\n m--;\n }\n\n public boolean same(int x, int y) {\n return find(x) == find(y);\n }\n\n public int size(int i) {\n return this.size[find(i)];\n }\n}\n\nclass Dijkstra {\n private static int prev[];\n private static long dist[];\n\n public Dijkstra(AbstractGraph graph, int s) {\n prev = new int[graph.n];\n dist = new long[graph.n];\n Arrays.fill(prev, -1);\n Arrays.fill(dist, Long.MAX_VALUE);\n PriorityQueue searching = new PriorityQueue<>((x, y) -> Long.compare(dist[x], dist[y]));\n dist[s] = 0;\n searching.add(s);\n while (searching.size() > 0) {\n int now = searching.poll();\n for (Edge e : graph.getEdges(now)) {\n int next = e.to;\n long c = e.cost;\n if (dist[now] + c < dist[next]) {\n dist[next] = dist[now] + c;\n prev[next] = now;\n searching.add(next);\n }\n }\n }\n }\n\n public int[] path(int to) {\n ArrayList rev = new ArrayList<>();\n for (int now = to; now != -1; now = this.prev[now]) {\n rev.add(now);\n }\n int[] path = new int[rev.size()];\n for (int i = 0; i < path.length; i++) {\n path[i] = rev.get(path.length - i - 1);\n }\n return path;\n }\n\n public long getDist(int t) {\n return dist[t];\n }\n}\n\nclass WF {\n private static long[][] dist;\n\n public WF(AbstractGraph graph) {\n dist = new long[graph.n][graph.n];\n for (int i = 0; i < dist.length; i++) {\n Arrays.fill(dist[i], Integer.MAX_VALUE);\n }\n for (int i = 0; i < graph.n; i++) {\n for (Edge e : graph.getEdges(i)) {\n dist[i][e.to] = e.cost;\n }\n dist[i][i] = 0;\n }\n for (int k = 0; k < graph.n; k++) {\n for (int i = 0; i < graph.n; i++) {\n for (int j = 0; j < graph.n; j++) {\n if (dist[i][k] != Integer.MAX_VALUE && dist[k][j] != Integer.MAX_VALUE) {\n dist[i][j] = Math.min(dist[i][j], dist[i][k] + dist[k][j]);\n }\n }\n }\n }\n }\n\n public static long getShortest(int s, int t) {\n return dist[s][t];\n }\n\n public static long[][] getAllDist() {\n return dist;\n }\n\n public static boolean isNegativeLoop() {\n for (int i = 0; i < dist.length; i++) {\n if (dist[i][i] < 0) {\n return true;\n }\n }\n return false;\n }\n}\n\nclass Edge {\n int from, to;\n long cost;\n\n public Edge(int from, int to, long cost) {\n this.from = from;\n this.to = to;\n this.cost = cost;\n }\n\n public Edge(int from, int to) {\n this.from = from;\n this.to = to;\n this.cost = 1;\n }\n\n public Edge reverse() {\n return new Edge(to, from, cost);\n }\n}\n\n@SuppressWarnings(\"unchecked\")\nabstract class AbstractGraph {\n int n;\n int m;\n ArrayList[] edges;\n\n public AbstractGraph(int n) {\n this.n = n;\n this.m = 0;\n this.edges = new ArrayList[n];\n for (int i = 0; i < n; i++) {\n this.edges[i] = new ArrayList();\n }\n }\n\n public void addEdge(Edge e) {\n this.m++;\n this.edges[e.from].add(e);\n }\n\n public int getV() {\n return this.n;\n }\n\n public int getE() {\n return this.m;\n }\n\n public ArrayList getEdges(int v) {\n return this.edges[v];\n }\n\n abstract public boolean isBipartite();\n\n public boolean isTree() {\n // require Modifying.\n return false;\n }\n}\n\nclass Graph extends AbstractGraph {\n int n;\n int m;\n // array of edges which is connect to the node\n ArrayList[] edges;\n\n public Graph(int n) {\n super(n);\n }\n\n public void addEdge(int from, int to, int cost) {\n Edge e = new Edge(from, to, cost);\n super.addEdge(e);\n super.addEdge(e.reverse());\n this.m++;\n }\n\n @Override\n public void addEdge(Edge e) {\n this.edges[e.from].add(e);\n this.edges[e.to].add(e.reverse());\n this.m++;\n }\n\n public int getV(int v) {\n return n;\n }\n\n public int getE() {\n return m;\n }\n\n public boolean isBipartite() {\n int[] color = new int[n];\n PriorityQueue queue = new PriorityQueue<>();\n HashSet visited = new HashSet<>();\n queue.add(0);\n color[0] = 1;\n while (queue.size() > 0) {\n int now = queue.poll();\n visited.add(now);\n for (Edge e : getEdges(now)) {\n if (visited.contains(e.to)) {\n continue;\n }\n if (color[e.to] == color[now])\n return false;\n queue.add(e.to);\n if (color[e.to] == 0)\n color[e.to] = -1 * color[now];\n }\n }\n return true;\n }\n}\n\nclass DirectedGraph extends AbstractGraph {\n private int n;\n private int m;\n private int[] ind;\n // array of edges which is connect to the node\n ArrayList[] edges;\n\n public DirectedGraph(int n) {\n super(n);\n this.ind = new int[n];\n }\n\n public void addEdge(int from, int to, int cost) {\n Edge e = new Edge(from, to, cost);\n super.addEdge(e);\n this.m++;\n this.ind[to]++;\n }\n\n @Override\n public void addEdge(Edge e) {\n this.edges[e.from].add(e);\n this.m++;\n this.ind[e.to]++;\n }\n\n public int getV(int v) {\n return this.n;\n }\n\n public int getE() {\n return this.m;\n }\n\n public int[] getInDimension() {\n return this.ind;\n }\n\n public int getInDimension(int v) {\n return this.ind[v];\n }\n\n public boolean isBipartite() {\n // need to rewrite to work\n return false;\n }\n\n}\n\nclass FastScanner {\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte())\n return buffer[ptr++];\n else\n return -1;\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr]))\n ptr++;\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext())\n throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext())\n throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)\n throw new NumberFormatException();\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n}\n\nclass MyMath {\n public static long gcm(long a, long b) {\n\n // if (a < b)\n // return gcm(b, a);\n\n // if (b == 0 || a % b == 0)\n // return b;\n\n // return gcm(b, a % b);\n if (a < b) {\n long tmp = a;\n a = b;\n b = tmp;\n }\n long r = -1;\n while (r != 0) {\n r = a % b;\n a = b;\n b = r;\n }\n return a;\n }\n\n public static long summation(long a, long b) {\n return b * (b + 1) / 2 - a * (a - 1) / 2;\n }\n\n public static long factorial(long n, long m) {\n\n if (n <= 1)\n return 1;\n else\n return factorial(n - 1, m) * n % m;\n }\n\n public static long[][] binomialTable(int a, long m) {\n long[][] table = new long[a + 1][a + 1];\n for (int i = 0; i < a + 1; i++) {\n table[0][a] = 0;\n table[i][0] = 1;\n table[i][i] = 1;\n }\n for (int i = 1; i < a + 1; i++) {\n for (int j = 1; j < a + 1; j++) {\n if (i < j)\n table[i][j] = 0;\n else {\n table[i][j] = (table[i - 1][j - 1] + table[i - 1][j]) % m;\n }\n }\n }\n return table;\n }\n\n public static long binomial(int n, int k, long m) {\n long res = 1;\n for (int l = n - k + 1; l <= n; l++) {\n res = (res % m) * (l % m) % m;\n }\n for (int r = 1; r <= k; r++) {\n res = (res % m) * modinv(r, m) % m;\n }\n return res;\n }\n\n public static long binomial(long[] facttable, long[] invtable, int n, int k, long m) {\n if (n < k)\n return 0;\n else\n return (facttable[n] % m * (invtable[n - k] % m) * invtable[k] % m) % m;\n }\n\n public static long pow(long a, long n, long p) {\n if (n == 0)\n return 1;\n if (n == 1)\n return a % p;\n if (n % 2 == 1)\n return a * pow(a, n - 1, p) % p;\n long tmp = pow(a, n / 2, p) % p;\n return tmp * tmp % p;\n }\n\n public static long modinv(long a, long p) {\n long b, x, u, q, abs_p, tmp;\n abs_p = Math.abs(p);\n b = p;\n x = 1;\n u = 0;\n while (b > 0) {\n q = a / b;\n tmp = u;\n u = x - q * u;\n x = tmp;\n tmp = b;\n b = a - q * b;\n a = tmp;\n }\n return (x < 0) ? abs_p + x : x;\n }\n\n public static Long[] eratosthenes(int n) {\n Long[] factor_table = new Long[n];\n for (long i = 1; i <= n; i++) {\n factor_table[(int) (i - 1)] = i;\n }\n for (long i = 1; i <= n; i++) {\n if (factor_table[(int) (i - 1)] == i) {\n int j = 2;\n while (i * j <= n) {\n factor_table[(int) (i * j - 1)] = i;\n j++;\n }\n }\n }\n\n return factor_table;\n }\n\n public static HashMap primeFactorization(long n) {\n HashMap primes = new HashMap<>();\n for (long p = 2; p * p <= n; p++) {\n int q = 0;\n while (n % p == 0) {\n n /= p;\n q++;\n }\n if (q > 0)\n primes.put(p, q);\n }\n if (n > 1)\n primes.put(n, 1);\n return primes;\n }\n\n public static ArrayList divisor(int n) {\n ArrayList ret = new ArrayList();\n for (int i = 1; i * i <= n; i++) {\n if (n % i == 0) {\n ret.add(i);\n // n=PQ+0→ PもQも約数. ただし、Q=Pは↑で登録済みなので登録しない\n if (i != n / i)\n ret.add(n / i);\n }\n }\n return ret;\n }\n}\n\nclass nextPermutation {\n public static int[] swap(int data[], int left, int right) {\n\n // Swap the data\n int temp = data[left];\n data[left] = data[right];\n data[right] = temp;\n\n // Return the updated array\n return data;\n }\n\n // Function to reverse the sub-array\n // starting from left to the right\n // both inclusive\n public static int[] reverse(int data[], int left, int right) {\n\n // Reverse the sub-array\n while (left < right) {\n int temp = data[left];\n data[left++] = data[right];\n data[right--] = temp;\n }\n\n // Return the updated array\n return data;\n }\n\n // Function to find the next permutation\n // of the given integer array\n public static boolean findNextPermutation(int data[]) {\n\n // If the given dataset is empty\n // or contains only one element\n // next_permutation is not possible\n if (data.length <= 1)\n return false;\n\n int last = data.length - 2;\n\n // find the longest non-increasing suffix\n // and find the pivot\n while (last >= 0) {\n if (data[last] < data[last + 1]) {\n break;\n }\n last--;\n }\n\n // If there is no increasing pair\n // there is no higher order permutation\n if (last < 0)\n return false;\n\n int nextGreater = data.length - 1;\n\n // Find the rightmost successor to the pivot\n for (int i = data.length - 1; i > last; i--) {\n if (data[i] > data[last]) {\n nextGreater = i;\n break;\n }\n }\n\n // Swap the successor and the pivot\n data = swap(data, nextGreater, last);\n\n // Reverse the suffix\n data = reverse(data, last + 1, data.length - 1);\n\n // Return true as the next_permutation is done\n return true;\n }\n}\n\nclass ArrayUtil {\n private static long INF = 1_000_000_000_0L;\n\n public static int UpperBound(long[] array, long obj) {\n int l = 0, r = array.length - 1;\n while (r - l >= 0) {\n int c = (l + r) / 2;\n if (obj < array[c]) {\n r = c - 1;\n } else {\n l = c + 1;\n }\n }\n return l;\n }\n\n public static int LowerBound(long[] array, long obj) {\n int l = 0, r = array.length - 1;\n while (r - l >= 0) {\n int c = (l + r) / 2;\n if (obj <= array[c]) {\n r = c - 1;\n } else {\n l = c + 1;\n }\n }\n return l;\n }\n\n // return the length of array's LIS\n public static int LIS(long[] array) {\n long[] dp = new long[array.length + 1];\n Arrays.fill(dp, INF);\n for (int i = 0; i < array.length; i++) {\n int idx = LowerBound(dp, array[i]);\n dp[idx] = array[i];\n }\n return LowerBound(dp, INF - 1);\n }\n\n public static int StrictLIS(long[] array) {\n long[] dp = new long[array.length + 1];\n Arrays.fill(dp, INF);\n for (int i = 0; i < array.length; i++) {\n int idx = UpperBound(dp, array[i]);\n dp[idx] = array[i];\n }\n return UpperBound(dp, INF - 1);\n }\n\n public static void debug(int[][] A) {\n for (int i = 0; i < A.length; i++) {\n for (int j = 0; j < A[0].length; j++) {\n System.out.print(A[i][j] + \" \");\n }\n System.out.println();\n }\n }\n}\n\nclass BinaryIndexedTree {\n int[] data;\n long[] tree;\n int n;\n\n public BinaryIndexedTree(int[] data) {\n this.data = data;\n this.n = data.length;\n this.tree = new long[n + 1];\n buildTree();\n }\n\n public void buildTree() {\n for (int i = 0; i < n; i++) {\n add(i + 1, data[i]);\n }\n }\n\n public void add(int index, int value) {\n for (int i = index; i <= n; i += i & -i) {\n tree[i] += value;\n }\n }\n\n public long sum(int from, int to) {\n return sum(to) - sum(from - 1);\n }\n\n public long sum(int index) {\n int sum = 0;\n for (int i = index; i > 0; i -= i & -i) {\n sum += tree[i];\n }\n return sum;\n }\n}\n\nclass TopologicalSort {\n private DirectedGraph g;\n private int[] in;\n private int n, m;\n\n public TopologicalSort(DirectedGraph g) {\n this.g = g;\n this.in = g.getInDimension();\n this.n = g.getV();\n this.m = g.getE();\n }\n\n public int[] sort() {\n int[] ret = new int[this.n];\n ArrayDeque q = new ArrayDeque<>();\n for (int i = 0; i < this.n; i++) {\n if (in[i] == 0) {\n q.push(i);\n }\n }\n int k = 0;\n while (q.size() > 0) {\n int v = q.pollFirst();\n ret[k] = v;\n k++;\n for (Edge e : g.getEdges(v)) {\n if (--in[e.to] == 0)\n q.push(e.to);\n }\n }\n return ret;\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "sample_input": "3 4 240\n60 90 120\n80 150 80 150\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02623", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 19602, "cpu_time_ms": 665, "memory_kb": 58668}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s686737241", "group_id": "codeNet:p02623", "input_text": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner(System.in);\n\n\t\tint N = sc.nextInt();\n\t\tint M = sc.nextInt();\n\t\tlong K = sc.nextLong();\n\n\t\tArrayList a_books = new ArrayList(N);\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\ta_books.add(sc.nextLong());\n\t\t}\n\t\tArrayList b_books = new ArrayList(M);\n\t\tfor (int i = 0; i < M; i++) {\n\t\t\tb_books.add(sc.nextLong());\n\t\t}\n\n\t\tint ans = 0;\n\t\tlong total = 0L;\n\t\twhile (total <= K) {\n\t\t\tlong a_book_time = -1;\n\t\t\tif (!a_books.isEmpty()) {\n\t\t\t\ta_book_time = a_books.get(0);\n\n\t\t\t}\n\t\t\tlong b_book_time = -1;\n\t\t\tif (!b_books.isEmpty()) {\n\t\t\t\tb_book_time = b_books.get(0);\n\t\t\t}\n\n\t\t\tif (a_book_time != -1 && a_book_time != -1) {\n\t\t\t\tif (a_book_time < b_book_time) {\n\t\t\t\t\tif (total + a_book_time <= K) {\n\t\t\t\t\t\ttotal += a_book_time;\n\t\t\t\t\t\ta_books.remove(0);\n\t\t\t\t\t\tans++;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (total + b_book_time <= K) {\n\t\t\t\t\t\ttotal += b_book_time;\n\t\t\t\t\t\tb_books.remove(0);\n\t\t\t\t\t\tans++;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (a_book_time != -1) {\n\t\t\t\tif (total + a_book_time <= K) {\n\t\t\t\t\ttotal += a_book_time;\n\t\t\t\t\ta_books.remove(0);\n\t\t\t\t\tans++;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (b_book_time != -1) {\n\t\t\t\tif (total + b_book_time <= K) {\n\t\t\t\t\ttotal += b_book_time;\n\t\t\t\t\tb_books.remove(0);\n\t\t\t\t\tans++;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(ans);\n\t}\n\n\tprivate static class FastScanner {\n\t\tprivate BufferedReader reader = null;\n\t\tprivate StringTokenizer tokenizer = null;\n\n\t\tpublic FastScanner(InputStream in) {\n\t\t\treader = new BufferedReader(new InputStreamReader(in));\n\t\t\ttokenizer = null;\n\t\t}\n\n\t\tpublic String next() {\n\t\t\tif (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\ttokenizer = new StringTokenizer(reader.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new RuntimeException(e);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn tokenizer.nextToken();\n\t\t}\n\n\t\tpublic long nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t}\n}\n", "language": "Java", "metadata": {"date": 1593308668, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02623/input.txt", "sample_output_relpath": "derived/input_output/data/p02623/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02623/Java/s686737241.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s686737241", "user_id": "u474259207"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner(System.in);\n\n\t\tint N = sc.nextInt();\n\t\tint M = sc.nextInt();\n\t\tlong K = sc.nextLong();\n\n\t\tArrayList a_books = new ArrayList(N);\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\ta_books.add(sc.nextLong());\n\t\t}\n\t\tArrayList b_books = new ArrayList(M);\n\t\tfor (int i = 0; i < M; i++) {\n\t\t\tb_books.add(sc.nextLong());\n\t\t}\n\n\t\tint ans = 0;\n\t\tlong total = 0L;\n\t\twhile (total <= K) {\n\t\t\tlong a_book_time = -1;\n\t\t\tif (!a_books.isEmpty()) {\n\t\t\t\ta_book_time = a_books.get(0);\n\n\t\t\t}\n\t\t\tlong b_book_time = -1;\n\t\t\tif (!b_books.isEmpty()) {\n\t\t\t\tb_book_time = b_books.get(0);\n\t\t\t}\n\n\t\t\tif (a_book_time != -1 && a_book_time != -1) {\n\t\t\t\tif (a_book_time < b_book_time) {\n\t\t\t\t\tif (total + a_book_time <= K) {\n\t\t\t\t\t\ttotal += a_book_time;\n\t\t\t\t\t\ta_books.remove(0);\n\t\t\t\t\t\tans++;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (total + b_book_time <= K) {\n\t\t\t\t\t\ttotal += b_book_time;\n\t\t\t\t\t\tb_books.remove(0);\n\t\t\t\t\t\tans++;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (a_book_time != -1) {\n\t\t\t\tif (total + a_book_time <= K) {\n\t\t\t\t\ttotal += a_book_time;\n\t\t\t\t\ta_books.remove(0);\n\t\t\t\t\tans++;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (b_book_time != -1) {\n\t\t\t\tif (total + b_book_time <= K) {\n\t\t\t\t\ttotal += b_book_time;\n\t\t\t\t\tb_books.remove(0);\n\t\t\t\t\tans++;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(ans);\n\t}\n\n\tprivate static class FastScanner {\n\t\tprivate BufferedReader reader = null;\n\t\tprivate StringTokenizer tokenizer = null;\n\n\t\tpublic FastScanner(InputStream in) {\n\t\t\treader = new BufferedReader(new InputStreamReader(in));\n\t\t\ttokenizer = null;\n\t\t}\n\n\t\tpublic String next() {\n\t\t\tif (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\ttokenizer = new StringTokenizer(reader.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new RuntimeException(e);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn tokenizer.nextToken();\n\t\t}\n\n\t\tpublic long nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t}\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "sample_input": "3 4 240\n60 90 120\n80 150 80 150\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02623", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2307, "cpu_time_ms": 2208, "memory_kb": 70496}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s434512004", "group_id": "codeNet:p02623", "input_text": "import java.util.ArrayDeque;\nimport java.util.Deque;\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[]args) {\n\t\ttry(Scanner scan = new Scanner(System.in)){\n\t\t\t\n\t\t\t\n\t\t\tint N = scan.nextInt();\n\t\t\tint M = scan.nextInt();\n\t\t\tint K = scan.nextInt();\n\t\t\tint[]A = new int[N];\n\t\t\tint[]B = new int[M];\n\t\t\tDequeade = new ArrayDeque();\n\t\t\tDequebde = new ArrayDeque();\n\t\t\tfor(int i = 0;iK) {\n\t\t\t\t\tcount--;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tSystem.out.println(count);\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t}\n\t\n\t\t\n\n}\n", "language": "Java", "metadata": {"date": 1593308518, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02623/input.txt", "sample_output_relpath": "derived/input_output/data/p02623/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02623/Java/s434512004.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s434512004", "user_id": "u520067800"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.ArrayDeque;\nimport java.util.Deque;\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[]args) {\n\t\ttry(Scanner scan = new Scanner(System.in)){\n\t\t\t\n\t\t\t\n\t\t\tint N = scan.nextInt();\n\t\t\tint M = scan.nextInt();\n\t\t\tint K = scan.nextInt();\n\t\t\tint[]A = new int[N];\n\t\t\tint[]B = new int[M];\n\t\t\tDequeade = new ArrayDeque();\n\t\t\tDequebde = new ArrayDeque();\n\t\t\tfor(int i = 0;iK) {\n\t\t\t\t\tcount--;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tSystem.out.println(count);\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t}\n\t\n\t\t\n\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "sample_input": "3 4 240\n60 90 120\n80 150 80 150\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02623", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1253, "cpu_time_ms": 2080, "memory_kb": 71252}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s927334371", "group_id": "codeNet:p02623", "input_text": "import java.util.*;\n\nclass Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int m = sc.nextInt();\n int k = sc.nextInt();\n\n\tint n_nums[] = new int[n];\n int m_nums[] = new int[m];\n for(int i = 0; i < n; i++){\n\t\tn_nums[i] = sc.nextInt(); \n }\n \n for(int i = 0; i < m; i++){\n\t\tm_nums[i] = sc.nextInt(); \n }\n \n int ns = 0,ms = 0;\n int sum = 0;\n \n while(true){\n \tint tmp = 0;\n \n \tif(n_nums[ns] > m_nums[ms]){\n \tif(m_nums.length > ms)\n \t\ttmp = m_nums[ms++];\n \telse\n \ttmp = n_nums[ns++];\n }else if(n_nums[ns] < m_nums[ms]){\n \tif(n_nums.length > ns)\n \t\ttmp = n_nums[ns++];\n \telse\n \ttmp = m_nums[ms++];\n }\n \n \tif(sum+tmp > k){\n \tbreak;\n }else{\n \tsum += tmp;\n }\n }\n \n \n }\n}", "language": "Java", "metadata": {"date": 1593308047, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02623/input.txt", "sample_output_relpath": "derived/input_output/data/p02623/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02623/Java/s927334371.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s927334371", "user_id": "u170449890"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.*;\n\nclass Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int m = sc.nextInt();\n int k = sc.nextInt();\n\n\tint n_nums[] = new int[n];\n int m_nums[] = new int[m];\n for(int i = 0; i < n; i++){\n\t\tn_nums[i] = sc.nextInt(); \n }\n \n for(int i = 0; i < m; i++){\n\t\tm_nums[i] = sc.nextInt(); \n }\n \n int ns = 0,ms = 0;\n int sum = 0;\n \n while(true){\n \tint tmp = 0;\n \n \tif(n_nums[ns] > m_nums[ms]){\n \tif(m_nums.length > ms)\n \t\ttmp = m_nums[ms++];\n \telse\n \ttmp = n_nums[ns++];\n }else if(n_nums[ns] < m_nums[ms]){\n \tif(n_nums.length > ns)\n \t\ttmp = n_nums[ns++];\n \telse\n \ttmp = m_nums[ms++];\n }\n \n \tif(sum+tmp > k){\n \tbreak;\n }else{\n \tsum += tmp;\n }\n }\n \n \n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "sample_input": "3 4 240\n60 90 120\n80 150 80 150\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02623", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2208, "memory_kb": 63208}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s735364549", "group_id": "codeNet:p02623", "input_text": "/*\n * Remember a 6.72 student can know more than a 10.0 student.\n * Grades don't determine intelligence, they test obedience.\n * I Never Give Up.\n * I will become Candidate Master.\n * I will defeat Saurabh Anand.\n * Skills are Cheap,Passion is Priceless.\n * Obsession is necessary.\n * Author : Sameer Raj\n */\nimport java.util.*;\nimport java.util.Map.Entry;\nimport java.io.*;\nimport java.lang.Math.*;\nimport java.math.BigInteger;\n\nimport static java.lang.System.*;\nimport static java.util.Arrays.fill;\nimport static java.lang.Math.log;\nimport static java.lang.Math.abs;\nimport static java.lang.Math.pow;\nimport static java.lang.Math.sqrt;\nimport static java.lang.Math.floor;\nimport static java.lang.Math.ceil;\nimport static java.lang.Math.sin;\nimport static java.lang.Math.cos;\nimport static java.lang.Math.tan;\nimport static java.util.Arrays.spliterator;\npublic class Main implements Runnable{\n\tprivate static Reader in=new Reader();\n\tprivate static StringBuilder ans=new StringBuilder();\n\tprivate static long MOD=(long)1e9+7;\n\tprivate static final int N=(int) (2e5+7); // 2e5+7\n\tprivate static ArrayList v[]=new ArrayList[N];\n\tprivate static HashMap cmap=new HashMap();\n\tprivate static boolean mark[]=new boolean[N];\n\t// private static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n\t/*Not try to hack the sort function*/\n\tpublic static void sort(long arr[]){\n\t\tfor(int i=arr.length-1;i>=2;i--){\n\t\t\tint x=new Random().nextInt(i-1);\n\t\t\tlong temp=arr[x];\n\t\t\tarr[x]=arr[i];\n\t\t\tarr[i]=temp;\n\t\t}\n\t\tArrays.sort(arr);\n\t}\n\tpublic static void sort(int arr[]){\n\t\tfor(int i=arr.length-1;i>=2;i--){\n\t\t\tint x=new Random().nextInt(i-1);\n\t\t\tint temp=arr[x];\n\t\t\tarr[x]=arr[i];\n\t\t\tarr[i]=temp;\n\t\t}\n\t\tArrays.sort(arr);\n\t}\n\tpublic static void sort(String arr[]){\n\t\tfor(int i=arr.length-1;i>=2;i--){\n\t\t\tint x=new Random().nextInt(i-1);\n\t\t\tString temp=arr[x];\n\t\t\tarr[x]=arr[i];\n\t\t\tarr[i]=temp;\n\t\t}\n\t\tArrays.sort(arr);\n\t}\n\tpublic static void sort(Pair arr[]){\n\t\tfor(int i=arr.length-1;i>=2;i--){\n\t\t\tint x=new Random().nextInt(i-1);\n\t\t\tPair temp=arr[x];\n\t\t\tarr[x]=arr[i];\n\t\t\tarr[i]=temp;\n\t\t}\n\t\tArrays.sort(arr);\n\t}\n\tprivate static long gcd(long a, long b){\n\t\tif(b==0)return a;\n\t\treturn gcd(b,a%b);\n\t}\n\tpublic static long lcm(long a,long b){\n\t\treturn min(a,b)*(max(a,b)/gcd(a,b));\n\t}\n\t/*--------------------------------------------------------------------------------------------------------------*/\n\t/*Code lies here*/\n\tpublic static int solve(long a[],long b[],long k){\n\t\tlong rem;\n\t\tint l=0,r=0,mid,res=0;\n\t\tfor(int i=0;i implements Comparable{\n\t\tlong l;\n\t\tlong r;\n\t\tPair(){\n\t\t\tl=0;\n\t\t\tr=0;\n\t\t}\n\t\tPair(long k,long v){\n\t\t\tl=k;\n\t\t\tr=v;\n\t\t}\n\t\t@Override\n\t\tpublic int compareTo(Pair o){\n\t\t\tif(l!=o.l)return (int)(l-o.l);\n\t\t\treturn (int)(r-o.r);\n\t\t}\n\t}\n\t/* BINARY SEARCH FUNCTIONS */\n\tpublic static int ceilSearch(int l,int r,int val,int ar[]){\n\t\tint mid;\n\t\twhile(l+1!=r&&l=val)return l;\n\t\telse if(ar[r]>=val)return r;\n\t\telse return -1;\n\t}\n\tpublic static int ceilSearch(int l,int r,long val,long ar[]){\n\t\tint mid;\n\t\twhile(l+1!=r&&l=val)return l;\n\t\telse if(ar[r]>=val)return r;\n\t\telse return -1;\n\t}\n\tpublic static int floorSearch(int l,int r,int val,int ar[]){\n\t\tint mid;\n\t\twhile(l+1!=r&&lval)r=mid;\n\t\t\telse l=mid;\n\t\t}\n\t\tif(ar[r]<=val)return r;\n\t\telse if(ar[l]<=val)return l;\n\t\telse return -1;\n\t}\n\tpublic static int floorSearch(int l,int r,long val,long ar[]){\n\t\tint mid;\n\t\twhile(l+1!=r&&lval)r=mid;\n\t\t\telse l=mid;\n\t\t}\n\t\tif(ar[r]<=val)return r;\n\t\telse if(ar[l]<=val)return l;\n\t\telse return -1;\n\t}\n\t/* MODULAR OPERATIONS */\n\tprivate static long mod(long a,long b){ //a%b\n\t\treturn (b+a%b)%b;\n\t}\n\tprivate static long modInv(long a){\n\t\treturn powmod(a,MOD-2);\n\t}\n\tprivate static long powmod(long x,long n){\n\t\tif(n==0||x==0)return 1;\n\t\telse if(n%2==0)return(powmod((x*x)%MOD,n/2));\n\t\telse return (x*(powmod((x*x)%MOD,(n-1)/2)))%MOD;\n\t}\n\tpublic static long mult(long a,long b){\n\t\treturn mod(mod(a,MOD)*mod(b,MOD),MOD);\n\t}\n\tpublic static long add(long a,long b){\n\t\treturn mod(mod(a,MOD)+mod(b,MOD),MOD);\n\t}\n\tpublic static long sub(long a,long b){\n\t\treturn mod(mod(a,MOD)-mod(b,MOD),MOD);\n\t}\n\t/* MAX-MIN FUNCTIONS */\n\tpublic static long min(long a,long b){\n\t\treturn Math.min(a, b);\n\t}\n\tpublic static int min(int a,int b){\n\t\treturn Math.min(a, b);\n\t}\n\tpublic static long max(long a,long b){\n\t\treturn Math.max(a, b);\n\t}\n\tpublic static int max(int a,int b){\n\t\treturn Math.max(a, b);\n\t}\n\tpublic static long min(long ar[]){\n\t\treturn Arrays.stream(ar).min().getAsLong();\n\t}\n\tpublic static int min(int ar[]){\n\t\treturn Arrays.stream(ar).min().getAsInt();\n\t}\n\tpublic static long max(long ar[]){ return Arrays.stream(ar).max().getAsLong();}\n\tpublic static int max(int ar[]){ return Arrays.stream(ar).max().getAsInt(); }\n\t//Reader Class\n\tstatic class Reader{\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\t\tpublic Reader(){br=new BufferedReader(new InputStreamReader(System.in));}\n\t\tString next(){\n\t\t\twhile(st==null||!st.hasMoreElements()){\n\t\t\t\ttry{st=new StringTokenizer(br.readLine());\n\t\t\t\t}catch(IOException e){e.printStackTrace();}\n\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\t\tint nextInt(){return Integer.parseInt(next());}\n\t\tlong nextLong(){return Long.parseLong(next());}\n\t\tdouble nextDouble(){return Double.parseDouble(next());}\n\t\tString nextLine(){\n\t\t\tString str=\"\";\n\t\t\ttry{\n\t\t\t\tstr=br.readLine();\n\t\t\t}catch(IOException e){\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\treturn str;\n\t\t}\n\t}\n\t//Looping methods\n\tstatic void rep(int ar[],int start,int end){\n\t\tfor(int i=start;i v[]=new ArrayList[N];\n\tprivate static HashMap cmap=new HashMap();\n\tprivate static boolean mark[]=new boolean[N];\n\t// private static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n\t/*Not try to hack the sort function*/\n\tpublic static void sort(long arr[]){\n\t\tfor(int i=arr.length-1;i>=2;i--){\n\t\t\tint x=new Random().nextInt(i-1);\n\t\t\tlong temp=arr[x];\n\t\t\tarr[x]=arr[i];\n\t\t\tarr[i]=temp;\n\t\t}\n\t\tArrays.sort(arr);\n\t}\n\tpublic static void sort(int arr[]){\n\t\tfor(int i=arr.length-1;i>=2;i--){\n\t\t\tint x=new Random().nextInt(i-1);\n\t\t\tint temp=arr[x];\n\t\t\tarr[x]=arr[i];\n\t\t\tarr[i]=temp;\n\t\t}\n\t\tArrays.sort(arr);\n\t}\n\tpublic static void sort(String arr[]){\n\t\tfor(int i=arr.length-1;i>=2;i--){\n\t\t\tint x=new Random().nextInt(i-1);\n\t\t\tString temp=arr[x];\n\t\t\tarr[x]=arr[i];\n\t\t\tarr[i]=temp;\n\t\t}\n\t\tArrays.sort(arr);\n\t}\n\tpublic static void sort(Pair arr[]){\n\t\tfor(int i=arr.length-1;i>=2;i--){\n\t\t\tint x=new Random().nextInt(i-1);\n\t\t\tPair temp=arr[x];\n\t\t\tarr[x]=arr[i];\n\t\t\tarr[i]=temp;\n\t\t}\n\t\tArrays.sort(arr);\n\t}\n\tprivate static long gcd(long a, long b){\n\t\tif(b==0)return a;\n\t\treturn gcd(b,a%b);\n\t}\n\tpublic static long lcm(long a,long b){\n\t\treturn min(a,b)*(max(a,b)/gcd(a,b));\n\t}\n\t/*--------------------------------------------------------------------------------------------------------------*/\n\t/*Code lies here*/\n\tpublic static int solve(long a[],long b[],long k){\n\t\tlong rem;\n\t\tint l=0,r=0,mid,res=0;\n\t\tfor(int i=0;i implements Comparable{\n\t\tlong l;\n\t\tlong r;\n\t\tPair(){\n\t\t\tl=0;\n\t\t\tr=0;\n\t\t}\n\t\tPair(long k,long v){\n\t\t\tl=k;\n\t\t\tr=v;\n\t\t}\n\t\t@Override\n\t\tpublic int compareTo(Pair o){\n\t\t\tif(l!=o.l)return (int)(l-o.l);\n\t\t\treturn (int)(r-o.r);\n\t\t}\n\t}\n\t/* BINARY SEARCH FUNCTIONS */\n\tpublic static int ceilSearch(int l,int r,int val,int ar[]){\n\t\tint mid;\n\t\twhile(l+1!=r&&l=val)return l;\n\t\telse if(ar[r]>=val)return r;\n\t\telse return -1;\n\t}\n\tpublic static int ceilSearch(int l,int r,long val,long ar[]){\n\t\tint mid;\n\t\twhile(l+1!=r&&l=val)return l;\n\t\telse if(ar[r]>=val)return r;\n\t\telse return -1;\n\t}\n\tpublic static int floorSearch(int l,int r,int val,int ar[]){\n\t\tint mid;\n\t\twhile(l+1!=r&&lval)r=mid;\n\t\t\telse l=mid;\n\t\t}\n\t\tif(ar[r]<=val)return r;\n\t\telse if(ar[l]<=val)return l;\n\t\telse return -1;\n\t}\n\tpublic static int floorSearch(int l,int r,long val,long ar[]){\n\t\tint mid;\n\t\twhile(l+1!=r&&lval)r=mid;\n\t\t\telse l=mid;\n\t\t}\n\t\tif(ar[r]<=val)return r;\n\t\telse if(ar[l]<=val)return l;\n\t\telse return -1;\n\t}\n\t/* MODULAR OPERATIONS */\n\tprivate static long mod(long a,long b){ //a%b\n\t\treturn (b+a%b)%b;\n\t}\n\tprivate static long modInv(long a){\n\t\treturn powmod(a,MOD-2);\n\t}\n\tprivate static long powmod(long x,long n){\n\t\tif(n==0||x==0)return 1;\n\t\telse if(n%2==0)return(powmod((x*x)%MOD,n/2));\n\t\telse return (x*(powmod((x*x)%MOD,(n-1)/2)))%MOD;\n\t}\n\tpublic static long mult(long a,long b){\n\t\treturn mod(mod(a,MOD)*mod(b,MOD),MOD);\n\t}\n\tpublic static long add(long a,long b){\n\t\treturn mod(mod(a,MOD)+mod(b,MOD),MOD);\n\t}\n\tpublic static long sub(long a,long b){\n\t\treturn mod(mod(a,MOD)-mod(b,MOD),MOD);\n\t}\n\t/* MAX-MIN FUNCTIONS */\n\tpublic static long min(long a,long b){\n\t\treturn Math.min(a, b);\n\t}\n\tpublic static int min(int a,int b){\n\t\treturn Math.min(a, b);\n\t}\n\tpublic static long max(long a,long b){\n\t\treturn Math.max(a, b);\n\t}\n\tpublic static int max(int a,int b){\n\t\treturn Math.max(a, b);\n\t}\n\tpublic static long min(long ar[]){\n\t\treturn Arrays.stream(ar).min().getAsLong();\n\t}\n\tpublic static int min(int ar[]){\n\t\treturn Arrays.stream(ar).min().getAsInt();\n\t}\n\tpublic static long max(long ar[]){ return Arrays.stream(ar).max().getAsLong();}\n\tpublic static int max(int ar[]){ return Arrays.stream(ar).max().getAsInt(); }\n\t//Reader Class\n\tstatic class Reader{\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\t\tpublic Reader(){br=new BufferedReader(new InputStreamReader(System.in));}\n\t\tString next(){\n\t\t\twhile(st==null||!st.hasMoreElements()){\n\t\t\t\ttry{st=new StringTokenizer(br.readLine());\n\t\t\t\t}catch(IOException e){e.printStackTrace();}\n\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\t\tint nextInt(){return Integer.parseInt(next());}\n\t\tlong nextLong(){return Long.parseLong(next());}\n\t\tdouble nextDouble(){return Double.parseDouble(next());}\n\t\tString nextLine(){\n\t\t\tString str=\"\";\n\t\t\ttry{\n\t\t\t\tstr=br.readLine();\n\t\t\t}catch(IOException e){\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\treturn str;\n\t\t}\n\t}\n\t//Looping methods\n\tstatic void rep(int ar[],int start,int end){\n\t\tfor(int i=start;i s1 = new Stack<>();\n\t\tStack s2 = new Stack<>();\n\n\t\tfor (int i = n - 1; i >= 0; i--)\n\t\t\ts1.push(a[i]);\n\n\t\tfor (int i = m - 1; i >= 0; i--)\n\t\t\ts2.push(b[i]);\n\n\t\twhile (cost < k && !s1.isEmpty() && !s2.isEmpty()) {\n\n\t\t\tlong x = s1.peek();\n\t\t\tlong y = s2.peek();\n\t\t\t// System.out.println(x + \" \" + y + \" \" + cost);\n\t\t\tif (x <= y) {\n\n\t\t\t\tcost += x;\n\n\t\t\t\tif (cost > k)\n\t\t\t\t\tbreak;\n\n\t\t\t\tcount++;\n\t\t\t\ts1.pop();\n\t\t\t} else {\n\n\t\t\t\tcost += y;\n\n\t\t\t\tif (cost > k)\n\t\t\t\t\tbreak;\n\n\t\t\t\tcount++;\n\t\t\t\ts2.pop();\n\t\t\t}\n\t\t}\n\n\t\tif (s1.isEmpty() && !s2.isEmpty()) {\n\n\t\t\twhile (cost < k) {\n\n\t\t\t\tcost += s2.pop();\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\n\t\telse if (s2.isEmpty() && !s1.isEmpty()) {\n\n\t\t\twhile (cost < k) {\n\n\t\t\t\tcost += s1.pop();\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tpr.print(count);\n\t\tpr.close();\n\t}\n\n\tpublic static class MyScanner {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\n\t\tpublic MyScanner() {\n\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\t}\n\n\t\tString next() {\n\t\t\twhile (st == null || !st.hasMoreElements()) {\n\t\t\t\ttry {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tint nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tlong nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tdouble nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tString nextLine() {\n\t\t\tString str = \"\";\n\t\t\ttry {\n\t\t\t\tstr = br.readLine();\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\treturn str;\n\t\t}\n\t}\n}\n", "language": "Java", "metadata": {"date": 1593307740, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02623/input.txt", "sample_output_relpath": "derived/input_output/data/p02623/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02623/Java/s215150302.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s215150302", "user_id": "u928306508"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.Stack;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\n\tpublic static void main(String args[]) throws Exception {\n\n\t\tMyScanner sc = new MyScanner();\n\t\tPrintWriter pr = new PrintWriter(System.out);\n\n\t\tint n = sc.nextInt();\n\t\tint m = sc.nextInt();\n\t\tint k = sc.nextInt();\n\n\t\tlong a[] = new long[n];\n\t\tlong b[] = new long[m];\n\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = sc.nextLong();\n\n\t\tfor (int i = 0; i < m; i++)\n\t\t\tb[i] = sc.nextLong();\n\n\t\tint count = 0;\n\t\tlong cost = 0;\n\n\t\tStack s1 = new Stack<>();\n\t\tStack s2 = new Stack<>();\n\n\t\tfor (int i = n - 1; i >= 0; i--)\n\t\t\ts1.push(a[i]);\n\n\t\tfor (int i = m - 1; i >= 0; i--)\n\t\t\ts2.push(b[i]);\n\n\t\twhile (cost < k && !s1.isEmpty() && !s2.isEmpty()) {\n\n\t\t\tlong x = s1.peek();\n\t\t\tlong y = s2.peek();\n\t\t\t// System.out.println(x + \" \" + y + \" \" + cost);\n\t\t\tif (x <= y) {\n\n\t\t\t\tcost += x;\n\n\t\t\t\tif (cost > k)\n\t\t\t\t\tbreak;\n\n\t\t\t\tcount++;\n\t\t\t\ts1.pop();\n\t\t\t} else {\n\n\t\t\t\tcost += y;\n\n\t\t\t\tif (cost > k)\n\t\t\t\t\tbreak;\n\n\t\t\t\tcount++;\n\t\t\t\ts2.pop();\n\t\t\t}\n\t\t}\n\n\t\tif (s1.isEmpty() && !s2.isEmpty()) {\n\n\t\t\twhile (cost < k) {\n\n\t\t\t\tcost += s2.pop();\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\n\t\telse if (s2.isEmpty() && !s1.isEmpty()) {\n\n\t\t\twhile (cost < k) {\n\n\t\t\t\tcost += s1.pop();\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tpr.print(count);\n\t\tpr.close();\n\t}\n\n\tpublic static class MyScanner {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\n\t\tpublic MyScanner() {\n\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\t}\n\n\t\tString next() {\n\t\t\twhile (st == null || !st.hasMoreElements()) {\n\t\t\t\ttry {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tint nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tlong nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tdouble nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tString nextLine() {\n\t\t\tString str = \"\";\n\t\t\ttry {\n\t\t\t\tstr = br.readLine();\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\treturn str;\n\t\t}\n\t}\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "sample_input": "3 4 240\n60 90 120\n80 150 80 150\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02623", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2128, "cpu_time_ms": 409, "memory_kb": 65496}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s122515298", "group_id": "codeNet:p02623", "input_text": "import java.util.*;\n\nclass Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int m = sc.nextInt();\n int k = sc.nextInt();\n\n\tint n_nums[] = new int[n];\n int m_nums[] = new int[m];\n for(int i = 0; i < n; i++){\n\t\tn_nums[i] = sc.nextInt(); \n }\n \n for(int i = 0; i < m; i++){\n\t\tm_nums[i] = sc.nextInt(); \n }\n \n int ns = 0,ms = 0;\n int sum = 0;\n int count = 0;\n \n while(true){\n \tint tmp = 0;\n \n \tif(n_nums[ns] > m_nums[ms]){\n \ttmp = m_nums[ms++];\n }else if(n_nums[ns] < m_nums[ms]){\n \ttmp = n_nums[ns++];\n }else{\n \tif(n_nums[ns] > m_nums[ms]){\n \t\ttmp = m_nums[ms++];\n \t}else if(n_nums[ns] < m_nums[ms]){\n \t\ttmp = n_nums[ns++];\n }else{\n \ttmp = n_nums[ns++];\n }\n }\n \tif(sum+tmp > k){\n \tbreak;\n }else{\n \tsum += tmp;\n \tcount++;\n }\n }\n \n System.out.println(count);\n \n }\n}", "language": "Java", "metadata": {"date": 1593307608, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02623/input.txt", "sample_output_relpath": "derived/input_output/data/p02623/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02623/Java/s122515298.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s122515298", "user_id": "u170449890"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.*;\n\nclass Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int m = sc.nextInt();\n int k = sc.nextInt();\n\n\tint n_nums[] = new int[n];\n int m_nums[] = new int[m];\n for(int i = 0; i < n; i++){\n\t\tn_nums[i] = sc.nextInt(); \n }\n \n for(int i = 0; i < m; i++){\n\t\tm_nums[i] = sc.nextInt(); \n }\n \n int ns = 0,ms = 0;\n int sum = 0;\n int count = 0;\n \n while(true){\n \tint tmp = 0;\n \n \tif(n_nums[ns] > m_nums[ms]){\n \ttmp = m_nums[ms++];\n }else if(n_nums[ns] < m_nums[ms]){\n \ttmp = n_nums[ns++];\n }else{\n \tif(n_nums[ns] > m_nums[ms]){\n \t\ttmp = m_nums[ms++];\n \t}else if(n_nums[ns] < m_nums[ms]){\n \t\ttmp = n_nums[ns++];\n }else{\n \ttmp = n_nums[ns++];\n }\n }\n \tif(sum+tmp > k){\n \tbreak;\n }else{\n \tsum += tmp;\n \tcount++;\n }\n }\n \n System.out.println(count);\n \n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "sample_input": "3 4 240\n60 90 120\n80 150 80 150\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02623", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 677, "memory_kb": 61132}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s512869345", "group_id": "codeNet:p02623", "input_text": "\n\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n long N = sc.nextLong();\n long M = sc.nextLong();\n long k = sc.nextLong();\n long[] arr = new long[(int)(N+M)];\n for(int i = 0; i < (M+N); i++) {\n arr[i] = sc.nextLong();\n }\n Arrays.sort(arr);\n\n long res = 0;\n long total = 0;\n for(int i = 0; i < (M+N); i++) {\n total += arr[i];\n if(total > k) break;\n res++;\n }\n System.out.println(res);\n }\n}\n", "language": "Java", "metadata": {"date": 1593307481, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02623/input.txt", "sample_output_relpath": "derived/input_output/data/p02623/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02623/Java/s512869345.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s512869345", "user_id": "u114722370"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "\n\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n long N = sc.nextLong();\n long M = sc.nextLong();\n long k = sc.nextLong();\n long[] arr = new long[(int)(N+M)];\n for(int i = 0; i < (M+N); i++) {\n arr[i] = sc.nextLong();\n }\n Arrays.sort(arr);\n\n long res = 0;\n long total = 0;\n for(int i = 0; i < (M+N); i++) {\n total += arr[i];\n if(total > k) break;\n res++;\n }\n System.out.println(res);\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "sample_input": "3 4 240\n60 90 120\n80 150 80 150\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02623", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 736, "memory_kb": 62436}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s964473043", "group_id": "codeNet:p02623", "input_text": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n \tint n = sc.nextInt();\n \tint m = sc.nextInt();\n \tlong k = sc.nextLong();\n \tlong[] a = new long[n];\n \tlong[] b = new long[m];\n \tboolean bFlag = true;\n \tlong ans = 0;\n \tlong tmp = 0;\n \tfor(int i=0;i k ){\n ans--;\n break;\n }\n if( i < m ){\n tmp += b[i];\n ans++;\n }\n if( tmp > k ){\n ans--;\n break;\n }\n }\n \tSystem.out.println(ans);\n\t}\n}", "language": "Java", "metadata": {"date": 1593307072, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02623/input.txt", "sample_output_relpath": "derived/input_output/data/p02623/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02623/Java/s964473043.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s964473043", "user_id": "u436783461"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n \tint n = sc.nextInt();\n \tint m = sc.nextInt();\n \tlong k = sc.nextLong();\n \tlong[] a = new long[n];\n \tlong[] b = new long[m];\n \tboolean bFlag = true;\n \tlong ans = 0;\n \tlong tmp = 0;\n \tfor(int i=0;i k ){\n ans--;\n break;\n }\n if( i < m ){\n tmp += b[i];\n ans++;\n }\n if( tmp > k ){\n ans--;\n break;\n }\n }\n \tSystem.out.println(ans);\n\t}\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "sample_input": "3 4 240\n60 90 120\n80 150 80 150\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02623", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \\leq i \\leq M).\n\nConsider the following action:\n\nChoose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.\n\nHow many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.\n\nConstraints\n\n1 \\leq N, M \\leq 200000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i, B_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 M K\nA_1 A_2 \\ldots A_N\nB_1 B_2 \\ldots B_M\n\nOutput\n\nPrint an integer representing the maximum number of books that can be read.\n\nSample Input 1\n\n3 4 240\n60 90 120\n80 150 80 150\n\nSample Output 1\n\n3\n\nIn this case, it takes us 60, 90, 120 minutes to read the 1-st, 2-nd, 3-rd books from the top on Desk A, and 80, 150, 80, 150 minutes to read the 1-st, 2-nd, 3-rd, 4-th books from the top on Desk B, respectively.\n\nWe can read three books in 230 minutes, as shown below, and this is the maximum number of books we can read within 240 minutes.\n\nRead the topmost book on Desk A in 60 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk B in 80 minutes, and remove that book from the desk.\n\nRead the topmost book on Desk A in 90 minutes, and remove that book from the desk.\n\nSample Input 2\n\n3 4 730\n60 90 120\n80 150 80 150\n\nSample Output 2\n\n7\n\nSample Input 3\n\n5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n0\n\nWatch out for integer overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 876, "cpu_time_ms": 687, "memory_kb": 53208}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s142856806", "group_id": "codeNet:p02624", "input_text": "import java.util.*;\n \npublic class Main {\n\tScanner sc = new Scanner(System.in);\n\tfinal int MOD = (int)1e9 + 7;\n\tfinal int MAX = Integer.MAX_VALUE;\n\tfinal long LMAX = Long.MAX_VALUE;\n\tint len = (int)1e7;\n\t\n\t\n\tvoid doIt() {\n\t\tint N = sc.nextInt();\n\t\tlong[] num = new long[N + 1];\n\t\tArrays.fill(num, 2);\n\t\tnum[1] = 1;\n\t\tfor(int i = 2; i <= N; i++) {\n\t\t\tfor(int j = i * 2; j <= N; j += i) {\n\t\t\t\tnum[j]++;\n\t\t\t}\n\t\t}\n\t\tlong sum = 0;\n\t\tfor(int i = 1; i <= N; i++) {\n\t\t\tsum += i * num[i];\n\t\t}\n\t\tSystem.out.println(sum);\n\t\t//System.out.println(Arrays.toString(num));\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\tnew Main().doIt();\n\t}\n \n}", "language": "Java", "metadata": {"date": 1594676114, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02624.html", "problem_id": "p02624", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02624/input.txt", "sample_output_relpath": "derived/input_output/data/p02624/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02624/Java/s142856806.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s142856806", "user_id": "u159117533"}, "prompt_components": {"gold_output": "23\n", "input_to_evaluate": "import java.util.*;\n \npublic class Main {\n\tScanner sc = new Scanner(System.in);\n\tfinal int MOD = (int)1e9 + 7;\n\tfinal int MAX = Integer.MAX_VALUE;\n\tfinal long LMAX = Long.MAX_VALUE;\n\tint len = (int)1e7;\n\t\n\t\n\tvoid doIt() {\n\t\tint N = sc.nextInt();\n\t\tlong[] num = new long[N + 1];\n\t\tArrays.fill(num, 2);\n\t\tnum[1] = 1;\n\t\tfor(int i = 2; i <= N; i++) {\n\t\t\tfor(int j = i * 2; j <= N; j += i) {\n\t\t\t\tnum[j]++;\n\t\t\t}\n\t\t}\n\t\tlong sum = 0;\n\t\tfor(int i = 1; i <= N; i++) {\n\t\t\tsum += i * num[i];\n\t\t}\n\t\tSystem.out.println(sum);\n\t\t//System.out.println(Arrays.toString(num));\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\tnew Main().doIt();\n\t}\n \n}", "problem_context": "Score : 400 points\n\nProblem Statement\n\nFor a positive integer X, let f(X) be the number of positive divisors of X.\n\nGiven a positive integer N, find \\sum_{K=1}^N K\\times f(K).\n\nConstraints\n\n1 \\leq N \\leq 10^7\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the value \\sum_{K=1}^N K\\times f(K).\n\nSample Input 1\n\n4\n\nSample Output 1\n\n23\n\nWe have f(1)=1, f(2)=2, f(3)=2, and f(4)=3, so the answer is 1\\times 1 + 2\\times 2 + 3\\times 2 + 4\\times 3 =23.\n\nSample Input 2\n\n100\n\nSample Output 2\n\n26879\n\nSample Input 3\n\n10000000\n\nSample Output 3\n\n838627288460105\n\nWatch out for overflows.", "sample_input": "4\n"}, "reference_outputs": ["23\n"], "source_document_id": "p02624", "source_text": "Score : 400 points\n\nProblem Statement\n\nFor a positive integer X, let f(X) be the number of positive divisors of X.\n\nGiven a positive integer N, find \\sum_{K=1}^N K\\times f(K).\n\nConstraints\n\n1 \\leq N \\leq 10^7\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the value \\sum_{K=1}^N K\\times f(K).\n\nSample Input 1\n\n4\n\nSample Output 1\n\n23\n\nWe have f(1)=1, f(2)=2, f(3)=2, and f(4)=3, so the answer is 1\\times 1 + 2\\times 2 + 3\\times 2 + 4\\times 3 =23.\n\nSample Input 2\n\n100\n\nSample Output 2\n\n26879\n\nSample Input 3\n\n10000000\n\nSample Output 3\n\n838627288460105\n\nWatch out for overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 631, "cpu_time_ms": 1369, "memory_kb": 116144}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s028880231", "group_id": "codeNet:p02624", "input_text": "import java.io.*; \nimport java.util.*; \n//import javafx.util.*; \nimport java.math.*;\n//import java.lang.*;\npublic class Main \n{ \n \n // static int n;\n// static HashSet adj[];\n\n // static int dist[];\n // static int remove[];\n// static boolean isLeaf[];\n // static Long dp[][];\n // static int arr[];\n // static boolean ok;\n // static long arr[];\n // static long sum[];\n // static boolean ok;\n static long mod=1000000007;\n // static HashSet adjacency[];\n static final long oo=(long)1e18;\n public static void main(String[] args) throws IOException { \n // Scanner sc=new Scanner(System.in);\n PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n br = new BufferedReader(new InputStreamReader(System.in));\n // int test=nextInt();\n int test=1;\n \n outer: while(test--!=0){\n \n // String s=next();\n long n=nextLong();\n boolean prime[]=new boolean[(int)n+1];\n long ans=(n*(n+1))/2;\n for(int i=2;i<=n;i++){\n for(int j=i;j<=n;j+=i){\n\n ans+=j;\n }\n \n }\n pw.println(ans);\n \n\n }\n \n pw.close();\n }\n\n static class Pair implements Comparable{\n double g,ai,bi,sa,sb;\n Pair(double g,double ai,double bi){\n // this.index=index;\n this.g=g;\n this.ai=ai;\n this.bi=bi;\n sa=g/ai;\n sb=g/bi;\n //this.z=z;\n } \n public int compareTo(Pair p){\n double a=Math.abs(sa-sb);\n double b=Math.abs(p.sa-p.sb);\n if(a>b){\n return 1;\n }\n else if(a==b){\n return 0;\n\n }\n else{\n return -1;\n }\n }\n }\n static void update(long tree[],int idx,long val){\n //println(idx);\n while(idx<1000006){\n \n tree[idx]+=val;\n idx+=(idx)&(-idx);\n }\n } \n static long sum(long tree[],int idx){\n long sum=0;\n while(idx>0){\n \n sum+=tree[idx];\n idx-=(idx)&(-idx);\n }\n return sum;\n }\n public static BufferedReader br;\n public static StringTokenizer st;\n public static String next() {\n while (st == null || !st.hasMoreTokens()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (Exception e) {\n throw new RuntimeException(e);\n }\n }\n return st.nextToken();\n }\n \n public static Integer nextInt() {\n return Integer.parseInt(next());\n }\n public static Long nextLong() {\n return Long.parseLong(next());\n }\n \n public static Double nextDouble() {\n return Double.parseDouble(next());\n }\n // static class Pair{\n // int x;int y;\n // Pair(int x,int y,int z){\n // this.x=x;\n // this.y=y;\n // // this.z=z;\n // // this.z=z;\n // // this.i=i;\n // }\n // }\n // static class sorting implements Comparator{\n // public int compare(Pair a,Pair b){\n // //return (a.y)-(b.y);\n // if(a.y==b.y){\n // return -1*(a.z-b.z);\n // }\n // return (a.y-b.y);\n // }\n // }\n\n static long ncr(long n,long r){\n \n if(r==0)\n return 1l;\n long val=ncr(n-1,r-1);\n val=(n*val);\n val=(val/r);\n return val;\n }\n\n public static int[] na(int n)throws IOException{\n int[] a = new int[n];\n for(int i = 0;i < n;i++)a[i] = nextInt();\n return a;\n }\n static class query implements Comparable{\n int l,r,idx,block;\n static int len;\n query(int l,int r,int i){\n this.l=l;\n this.r=r;\n this.idx=i;\n this.block=l/len;\n } \n public int compareTo(query a){\n return block==a.block?r-a.r:block-a.block;\n }\n }\n \n // static class sorting implements Comparator{ \n // public int compare(Pair a1,Pair a2){ \n // if(o1.a==o2.a)\n // return (o1.b>o2.b)?1:-1; \n // else if(o1.a>o2.a) \n // return 1; \n // else \n // return -1; \n // }\n // } \n static boolean isPrime(int n) { \n if (n <= 1) \n return false; \n if (n <= 3) \n return true; \n if (n % 2 == 0 || \n n % 3 == 0) \n return false; \n \n for (int i = 5; \n i * i <= n; i = i + 6) \n if (n % i == 0 || \n n % (i + 2) == 0) \n return false; \n \n return true; \n } \n static int gcd(int a, int b) { \n if (b == 0) \n return a; \n return gcd(b, a % b); \n } \n // To compute x^y under modulo m \n static long power(long x, long y, long m){ \n if (y == 0) \n return 1; \n long p = power(x, y / 2, m) % m; \n p = (p * p) % m; \n \n if (y % 2 == 0) \n return p; \n else\n return (x * p) % m; \n }\n static long fast_pow(long base,long n,long M){\n if(n==0)\n return 1;\n if(n==1)\n return base;\n long halfn=fast_pow(base,n/2,M);\n if(n%2==0)\n return ( halfn * halfn ) % M;\n else\n return ( ( ( halfn * halfn ) % M ) * base ) % M;\n }\n static long modInverse(long n,long M){\n return fast_pow(n,M-2,M);\n }\n // (1,1) \n\n // (3,2) (3,5)\n\n} ", "language": "Java", "metadata": {"date": 1593368846, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02624.html", "problem_id": "p02624", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02624/input.txt", "sample_output_relpath": "derived/input_output/data/p02624/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02624/Java/s028880231.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s028880231", "user_id": "u466687881"}, "prompt_components": {"gold_output": "23\n", "input_to_evaluate": "import java.io.*; \nimport java.util.*; \n//import javafx.util.*; \nimport java.math.*;\n//import java.lang.*;\npublic class Main \n{ \n \n // static int n;\n// static HashSet adj[];\n\n // static int dist[];\n // static int remove[];\n// static boolean isLeaf[];\n // static Long dp[][];\n // static int arr[];\n // static boolean ok;\n // static long arr[];\n // static long sum[];\n // static boolean ok;\n static long mod=1000000007;\n // static HashSet adjacency[];\n static final long oo=(long)1e18;\n public static void main(String[] args) throws IOException { \n // Scanner sc=new Scanner(System.in);\n PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n br = new BufferedReader(new InputStreamReader(System.in));\n // int test=nextInt();\n int test=1;\n \n outer: while(test--!=0){\n \n // String s=next();\n long n=nextLong();\n boolean prime[]=new boolean[(int)n+1];\n long ans=(n*(n+1))/2;\n for(int i=2;i<=n;i++){\n for(int j=i;j<=n;j+=i){\n\n ans+=j;\n }\n \n }\n pw.println(ans);\n \n\n }\n \n pw.close();\n }\n\n static class Pair implements Comparable{\n double g,ai,bi,sa,sb;\n Pair(double g,double ai,double bi){\n // this.index=index;\n this.g=g;\n this.ai=ai;\n this.bi=bi;\n sa=g/ai;\n sb=g/bi;\n //this.z=z;\n } \n public int compareTo(Pair p){\n double a=Math.abs(sa-sb);\n double b=Math.abs(p.sa-p.sb);\n if(a>b){\n return 1;\n }\n else if(a==b){\n return 0;\n\n }\n else{\n return -1;\n }\n }\n }\n static void update(long tree[],int idx,long val){\n //println(idx);\n while(idx<1000006){\n \n tree[idx]+=val;\n idx+=(idx)&(-idx);\n }\n } \n static long sum(long tree[],int idx){\n long sum=0;\n while(idx>0){\n \n sum+=tree[idx];\n idx-=(idx)&(-idx);\n }\n return sum;\n }\n public static BufferedReader br;\n public static StringTokenizer st;\n public static String next() {\n while (st == null || !st.hasMoreTokens()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (Exception e) {\n throw new RuntimeException(e);\n }\n }\n return st.nextToken();\n }\n \n public static Integer nextInt() {\n return Integer.parseInt(next());\n }\n public static Long nextLong() {\n return Long.parseLong(next());\n }\n \n public static Double nextDouble() {\n return Double.parseDouble(next());\n }\n // static class Pair{\n // int x;int y;\n // Pair(int x,int y,int z){\n // this.x=x;\n // this.y=y;\n // // this.z=z;\n // // this.z=z;\n // // this.i=i;\n // }\n // }\n // static class sorting implements Comparator{\n // public int compare(Pair a,Pair b){\n // //return (a.y)-(b.y);\n // if(a.y==b.y){\n // return -1*(a.z-b.z);\n // }\n // return (a.y-b.y);\n // }\n // }\n\n static long ncr(long n,long r){\n \n if(r==0)\n return 1l;\n long val=ncr(n-1,r-1);\n val=(n*val);\n val=(val/r);\n return val;\n }\n\n public static int[] na(int n)throws IOException{\n int[] a = new int[n];\n for(int i = 0;i < n;i++)a[i] = nextInt();\n return a;\n }\n static class query implements Comparable{\n int l,r,idx,block;\n static int len;\n query(int l,int r,int i){\n this.l=l;\n this.r=r;\n this.idx=i;\n this.block=l/len;\n } \n public int compareTo(query a){\n return block==a.block?r-a.r:block-a.block;\n }\n }\n \n // static class sorting implements Comparator{ \n // public int compare(Pair a1,Pair a2){ \n // if(o1.a==o2.a)\n // return (o1.b>o2.b)?1:-1; \n // else if(o1.a>o2.a) \n // return 1; \n // else \n // return -1; \n // }\n // } \n static boolean isPrime(int n) { \n if (n <= 1) \n return false; \n if (n <= 3) \n return true; \n if (n % 2 == 0 || \n n % 3 == 0) \n return false; \n \n for (int i = 5; \n i * i <= n; i = i + 6) \n if (n % i == 0 || \n n % (i + 2) == 0) \n return false; \n \n return true; \n } \n static int gcd(int a, int b) { \n if (b == 0) \n return a; \n return gcd(b, a % b); \n } \n // To compute x^y under modulo m \n static long power(long x, long y, long m){ \n if (y == 0) \n return 1; \n long p = power(x, y / 2, m) % m; \n p = (p * p) % m; \n \n if (y % 2 == 0) \n return p; \n else\n return (x * p) % m; \n }\n static long fast_pow(long base,long n,long M){\n if(n==0)\n return 1;\n if(n==1)\n return base;\n long halfn=fast_pow(base,n/2,M);\n if(n%2==0)\n return ( halfn * halfn ) % M;\n else\n return ( ( ( halfn * halfn ) % M ) * base ) % M;\n }\n static long modInverse(long n,long M){\n return fast_pow(n,M-2,M);\n }\n // (1,1) \n\n // (3,2) (3,5)\n\n} ", "problem_context": "Score : 400 points\n\nProblem Statement\n\nFor a positive integer X, let f(X) be the number of positive divisors of X.\n\nGiven a positive integer N, find \\sum_{K=1}^N K\\times f(K).\n\nConstraints\n\n1 \\leq N \\leq 10^7\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the value \\sum_{K=1}^N K\\times f(K).\n\nSample Input 1\n\n4\n\nSample Output 1\n\n23\n\nWe have f(1)=1, f(2)=2, f(3)=2, and f(4)=3, so the answer is 1\\times 1 + 2\\times 2 + 3\\times 2 + 4\\times 3 =23.\n\nSample Input 2\n\n100\n\nSample Output 2\n\n26879\n\nSample Input 3\n\n10000000\n\nSample Output 3\n\n838627288460105\n\nWatch out for overflows.", "sample_input": "4\n"}, "reference_outputs": ["23\n"], "source_document_id": "p02624", "source_text": "Score : 400 points\n\nProblem Statement\n\nFor a positive integer X, let f(X) be the number of positive divisors of X.\n\nGiven a positive integer N, find \\sum_{K=1}^N K\\times f(K).\n\nConstraints\n\n1 \\leq N \\leq 10^7\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the value \\sum_{K=1}^N K\\times f(K).\n\nSample Input 1\n\n4\n\nSample Output 1\n\n23\n\nWe have f(1)=1, f(2)=2, f(3)=2, and f(4)=3, so the answer is 1\\times 1 + 2\\times 2 + 3\\times 2 + 4\\times 3 =23.\n\nSample Input 2\n\n100\n\nSample Output 2\n\n26879\n\nSample Input 3\n\n10000000\n\nSample Output 3\n\n838627288460105\n\nWatch out for overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 5806, "cpu_time_ms": 318, "memory_kb": 42708}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s509311483", "group_id": "codeNet:p02624", "input_text": "\nimport java.util.*;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\t// 入力\n\t\tScanner sc = new Scanner(System.in);\n\t\tlong n = new Integer(Integer.parseInt(sc.next()));\n\n\t\tlong result = 0;\n\t\tfor (long i = 1; i <= n; i++) {\n\t\t\tlong kosuu = n / i;\n\t\t\tresult += (i + (i * kosuu)) * kosuu / 2;\n\t\t}\n\n\t\tSystem.out.println(result);\n\n\t}\n}\n", "language": "Java", "metadata": {"date": 1593310172, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02624.html", "problem_id": "p02624", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02624/input.txt", "sample_output_relpath": "derived/input_output/data/p02624/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02624/Java/s509311483.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s509311483", "user_id": "u788489345"}, "prompt_components": {"gold_output": "23\n", "input_to_evaluate": "\nimport java.util.*;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\t// 入力\n\t\tScanner sc = new Scanner(System.in);\n\t\tlong n = new Integer(Integer.parseInt(sc.next()));\n\n\t\tlong result = 0;\n\t\tfor (long i = 1; i <= n; i++) {\n\t\t\tlong kosuu = n / i;\n\t\t\tresult += (i + (i * kosuu)) * kosuu / 2;\n\t\t}\n\n\t\tSystem.out.println(result);\n\n\t}\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nFor a positive integer X, let f(X) be the number of positive divisors of X.\n\nGiven a positive integer N, find \\sum_{K=1}^N K\\times f(K).\n\nConstraints\n\n1 \\leq N \\leq 10^7\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the value \\sum_{K=1}^N K\\times f(K).\n\nSample Input 1\n\n4\n\nSample Output 1\n\n23\n\nWe have f(1)=1, f(2)=2, f(3)=2, and f(4)=3, so the answer is 1\\times 1 + 2\\times 2 + 3\\times 2 + 4\\times 3 =23.\n\nSample Input 2\n\n100\n\nSample Output 2\n\n26879\n\nSample Input 3\n\n10000000\n\nSample Output 3\n\n838627288460105\n\nWatch out for overflows.", "sample_input": "4\n"}, "reference_outputs": ["23\n"], "source_document_id": "p02624", "source_text": "Score : 400 points\n\nProblem Statement\n\nFor a positive integer X, let f(X) be the number of positive divisors of X.\n\nGiven a positive integer N, find \\sum_{K=1}^N K\\times f(K).\n\nConstraints\n\n1 \\leq N \\leq 10^7\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the value \\sum_{K=1}^N K\\times f(K).\n\nSample Input 1\n\n4\n\nSample Output 1\n\n23\n\nWe have f(1)=1, f(2)=2, f(3)=2, and f(4)=3, so the answer is 1\\times 1 + 2\\times 2 + 3\\times 2 + 4\\times 3 =23.\n\nSample Input 2\n\n100\n\nSample Output 2\n\n26879\n\nSample Input 3\n\n10000000\n\nSample Output 3\n\n838627288460105\n\nWatch out for overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 352, "cpu_time_ms": 226, "memory_kb": 35504}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s119629262", "group_id": "codeNet:p02624", "input_text": "import java.util.Scanner;\n\npublic class Main{\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint n = Integer.parseInt(scanner.nextLine());\n\t\tint i = 1;\n\t\tlong ans = 0;\n\n\t\tlong[] list = divisor(n);\n\t\twhile(i <= n) {\n\n\t\t\tans += list[i] * i;\n\t\t\ti++;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\n\tprivate static long[] divisor(long num) {\n\t\tint MAX = (int)num;\n\t\tlong[] cnt = new long[(MAX + 2)];\n\n\t\tint i = 0;\n int j = 0;\n\t\tcnt[1] = 1;\n\t\tfor(i = 2; i <= MAX; i++) cnt[i] = 2;\n\t\tfor(i=2; i<=MAX/2; i++) {\n\t\t\tfor(j = 2*i; j <= MAX; j += i) { cnt[j]++;}\n\t\t}\n\n\t\treturn cnt;\n\n\t}\n}\n", "language": "Java", "metadata": {"date": 1593309743, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02624.html", "problem_id": "p02624", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02624/input.txt", "sample_output_relpath": "derived/input_output/data/p02624/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02624/Java/s119629262.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s119629262", "user_id": "u960002659"}, "prompt_components": {"gold_output": "23\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main{\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint n = Integer.parseInt(scanner.nextLine());\n\t\tint i = 1;\n\t\tlong ans = 0;\n\n\t\tlong[] list = divisor(n);\n\t\twhile(i <= n) {\n\n\t\t\tans += list[i] * i;\n\t\t\ti++;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\n\tprivate static long[] divisor(long num) {\n\t\tint MAX = (int)num;\n\t\tlong[] cnt = new long[(MAX + 2)];\n\n\t\tint i = 0;\n int j = 0;\n\t\tcnt[1] = 1;\n\t\tfor(i = 2; i <= MAX; i++) cnt[i] = 2;\n\t\tfor(i=2; i<=MAX/2; i++) {\n\t\t\tfor(j = 2*i; j <= MAX; j += i) { cnt[j]++;}\n\t\t}\n\n\t\treturn cnt;\n\n\t}\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nFor a positive integer X, let f(X) be the number of positive divisors of X.\n\nGiven a positive integer N, find \\sum_{K=1}^N K\\times f(K).\n\nConstraints\n\n1 \\leq N \\leq 10^7\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the value \\sum_{K=1}^N K\\times f(K).\n\nSample Input 1\n\n4\n\nSample Output 1\n\n23\n\nWe have f(1)=1, f(2)=2, f(3)=2, and f(4)=3, so the answer is 1\\times 1 + 2\\times 2 + 3\\times 2 + 4\\times 3 =23.\n\nSample Input 2\n\n100\n\nSample Output 2\n\n26879\n\nSample Input 3\n\n10000000\n\nSample Output 3\n\n838627288460105\n\nWatch out for overflows.", "sample_input": "4\n"}, "reference_outputs": ["23\n"], "source_document_id": "p02624", "source_text": "Score : 400 points\n\nProblem Statement\n\nFor a positive integer X, let f(X) be the number of positive divisors of X.\n\nGiven a positive integer N, find \\sum_{K=1}^N K\\times f(K).\n\nConstraints\n\n1 \\leq N \\leq 10^7\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the value \\sum_{K=1}^N K\\times f(K).\n\nSample Input 1\n\n4\n\nSample Output 1\n\n23\n\nWe have f(1)=1, f(2)=2, f(3)=2, and f(4)=3, so the answer is 1\\times 1 + 2\\times 2 + 3\\times 2 + 4\\times 3 =23.\n\nSample Input 2\n\n100\n\nSample Output 2\n\n26879\n\nSample Input 3\n\n10000000\n\nSample Output 3\n\n838627288460105\n\nWatch out for overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1321, "memory_kb": 115960}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s114788751", "group_id": "codeNet:p02624", "input_text": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n\tstatic int n;\n\tstatic int[] primes;\n\tstatic int div2[];\n\tstatic void solve() {\n\t\tn = ni();\n\t\tif(n == 1) {\n\t\t\tout.println(1);\n\t\t\treturn;\n\t\t}\n\t\tprimes = eratos(n);\n\t\tdiv2 = new int[n+1];\n\t\tdiv2[2] = 1;\n\t\tfor(int i=3;i<=n;i++) {\n\t\t\tif(i % 2 == 0) {\n\t\t\t\tdiv2[i] = div2[i/2] + 1;\n\t\t\t}\n\t\t}\n\t\tlong dp[] = new long[n+1];\n\t\tdp[1] = 1;\n\t\tfor(int i=2;i<=n;i++) {\n\t\t\tif(dp[i] != 0)continue;\n\t\t\tif(primes[i] == 0) {\n\t\t\t\tdp[i] = 2;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tint x = i;\n\t\t\tif(x % 2 == 0) {\n\t\t\t\tx /= pow(2, div2[i]);\n\t\t\t\tdp[i] = dp[x] * (div2[i]+1);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t\n\t\t\tint cnt = 0;\n\t\t\twhile(x % primes[i] == 0) {\n\t\t\t\tx /= primes[i];\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t\tdp[i] = dp[x] * (cnt + 1);\t\t\t\n\t\t}\n\t\tlong ans = 0;\n\t\tfor(int i=1;i<=n;i++) {\n\t\t\tans += i * dp[i];\n\t\t}\n\t\tout.println(ans);\n\t}\n\t\n\tstatic int[] eratos(int x) {\n\t\tint[] era = new int[x+1];\n\t\tfill(era, -1); \n\t\tfor(int i=2;i<=n;i++) {\n\t\t\tif(era[i]!=-1)continue;\n\t\t\tera[i] = 0;//0が素数\n\t\t\tfor(int j=i+i;j<=n;j+=i) {\n\t\t\t\tera[j] = i;//自分を割れる素数\n\t\t\t}\n\t\t}\n\t\treturn era;\n\t}\n\t\n\tstatic int factCnt(int x) {\n\t\tSet set = new HashSet<>();\n\t\tfor(int i=1;i*i<=x;i++) {\n\t\t\tif(x % i == 0) {\n\t\t\t\tset.add(i);\n\t\t\t\tset.add(x / i);\n\t\t\t}\n\t\t}\n\t\treturn set.size();\n\t}\n\t\n\t//constant\n\tstatic final int inf = Integer.MAX_VALUE / 2;\n\tstatic final long linf = Long.MAX_VALUE / 3;\n\tstatic final double dinf = Double.MAX_VALUE / 3;\n\tstatic final long mod = (long) 1e9 + 7;\n\tstatic final int[] dx = { -1, 0, 1, 0 }, dy = { 0, -1, 0, 1 }, dx8 = { -1, -1, -1, 0, 0, 1, 1, 1 }, dy8 = { -1, 0, 1, -1, 1, -1, 0, 1 };\n\tstatic final double eps = 1e-10, pi = Math.PI;\n\tstatic StringBuilder sb = new StringBuilder();\n\t\n\t//libraries\n\tstatic void reverse(int ar[]) {\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tint t = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = t;\n\t\t}\n\t}\n\tstatic void reverse(long ar[]) {\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tlong t = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = t;\n\t\t}\n\t}\n\tstatic void reverse(double ar[]) {\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tdouble t = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = t;\n\t\t}\n\t}\n\tstatic void reverse(char ar[]) {\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tchar t = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = t;\n\t\t}\n\t}\n\tstatic String getReverse(String s) {\n\t\tchar c[] = s.toCharArray();\n\t\treverse(c);\n\t\ts = String.valueOf(c);\n\t\treturn s;\n\t}\n\tstatic void reverse(List ls) {\n\t\tint sz = ls.size();\n\t\tfor (int i = 0; i < sz / 2; i++) {\n\t\t\tT t = ls.get(i);\n\t\t\tls.set(i, ls.get(sz - 1 - i));\n\t\t\tls.set(sz - 1 - i, t);\n\t\t}\n\t}\n\tstatic void reverse(T[] ar) {\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tT t = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = t;\n\t\t}\n\t}\n\tstatic void sbnl() {//StringBuilderに改行文字をappendする\n\t\tsb.append(\"\\n\");\n\t}\n\tstatic int lowerBound(int[] a, int x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] < x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\tstatic int upperBound(int[] a, int x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] <= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\tstatic int rlowerBound(int[] a, int x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] > x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\tstatic int rupperBound(int[] a, int x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] >= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\tstatic int lowerBound(long[] a, long x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] < x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\tstatic int upperBound(long[] a, long x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] <= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\tstatic int rlowerBound(long[] a, long x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] > x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\tstatic int rupperBound(long[] a, long x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] >= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\tstatic int lowerBound(double[] a, double x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] < x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\tstatic int upperBound(double[] a, double x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] <= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\tstatic int rlowerBound(double[] a, double x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] > x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\tstatic int rupperBound(double[] a, double x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] >= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\tstatic int lowerBound(char[] a, char x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] < x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\tstatic int upperBound(char[] a, char x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] <= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\tstatic int rlowerBound(char[] a, char x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] > x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\tstatic int rupperBound(char[] a, char x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] >= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\tstatic int lowerBound(List ls, T x) throws RuntimeException {\n\t\tif (ls.size() == 0)\n\t\t\treturn -1;\n\t\tif (ls.get(0) instanceof Integer) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) >= 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Long) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) >= 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Double) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) >= 0 ? 1 : -1);\n\t\t} else {\n\t\t\tSystem.err.println(\n\t\t\t\t\tString.format(\"%s:数値でないリストを二分探索しています。\", Thread.currentThread().getStackTrace()[1].getMethodName()));\n\t\t\tthrow new RuntimeException();\n\t\t}\n\t}\n\tstatic int upperBound(List ls, T x) throws RuntimeException {\n\t\tif (ls.size() == 0)\n\t\t\treturn -1;\n\t\tif (ls.get(0) instanceof Integer) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) > 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Long) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) > 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Double) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) > 0 ? 1 : -1);\n\t\t} else {\n\t\t\tSystem.err.println(\n\t\t\t\t\tString.format(\"%s:数値でないリストを二分探索しています。\", Thread.currentThread().getStackTrace()[1].getMethodName()));\n\t\t\tthrow new RuntimeException();\n\t\t}\n\t}\n\tstatic int rupperBound(List ls, T x) throws RuntimeException {\n\t\tif (ls.size() == 0)\n\t\t\treturn -1;\n\t\tif (ls.get(0) instanceof Integer) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) < 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Long) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) < 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Double) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) < 0 ? 1 : -1);\n\t\t} else {\n\t\t\tSystem.err.println(\n\t\t\t\t\tString.format(\"%s:数値でないリストを二分探索しています。\", Thread.currentThread().getStackTrace()[1].getMethodName()));\n\t\t\tthrow new RuntimeException();\n\t\t}\n\t}\n\tstatic int rlowerBound(List ls, T x) {\n\t\tif (ls.size() == 0)\n\t\t\treturn -1;\n\t\tif (ls.get(0) instanceof Integer) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) <= 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Long) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) <= 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Double) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) <= 0 ? 1 : -1);\n\t\t} else {\n\t\t\tSystem.err.println(\n\t\t\t\t\tString.format(\"%s:数値でないリストを二分探索しています。\", Thread.currentThread().getStackTrace()[1].getMethodName()));\n\t\t\tthrow new RuntimeException();\n\t\t}\n\t}\n\tstatic int[] concat(int x, int arr[]) {\n\t\tint ret[] = new int[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 1, ret.length - 1);\n\t\tret[0] = x;\n\t\treturn ret;\n\t}\n\tstatic int[] concat(int arr[], int x) {\n\t\tint ret[] = new int[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 0, ret.length - 1);\n\t\tret[ret.length - 1] = x;\n\t\treturn ret;\n\t}\n\tstatic long[] concat(long x, long arr[]) {\n\t\tlong ret[] = new long[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 1, ret.length - 1);\n\t\tret[0] = x;\n\t\treturn ret;\n\t}\n\tstatic long[] concat(long arr[], long x) {\n\t\tlong ret[] = new long[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 0, ret.length - 1);\n\t\tret[ret.length - 1] = x;\n\t\treturn ret;\n\t}\n\tstatic char[] concat(char x, char arr[]) {\n\t\tchar ret[] = new char[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 0, ret.length - 1);\n\t\tret[ret.length - 1] = x;\n\t\treturn ret;\n\t}\n\tstatic char[] concat(char arr[], char x) {\n\t\tchar ret[] = new char[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 0, ret.length - 1);\n\t\tret[ret.length - 1] = x;\n\t\treturn ret;\n\t}\n\tstatic int max(int x, int y) {\n\t\treturn Math.max(x, y);\n\t}\n\tstatic int min(int x, int y) {\n\t\treturn Math.min(x, y);\n\t}\n\tstatic int max(int x, int y, int z) {\n\t\tx = Math.max(x, y);\n\t\tx = Math.max(x, z);\n\t\treturn x;\n\t}\n\tstatic int min(int x, int y, int z) {\n\t\tx = Math.min(x, y);\n\t\tx = Math.min(x, z);\n\t\treturn x;\n\t}\n\tstatic long max(long x, long y) {\n\t\treturn Math.max(x, y);\n\t}\n\tstatic long min(long x, long y) {\n\t\treturn Math.min(x, y);\n\t}\n\tstatic long max(long x, long y, long z) {\n\t\tx = Math.max(x, y);\n\t\tx = Math.max(x, z);\n\t\treturn x;\n\t}\n\tstatic long min(long x, long y, long z) {\n\t\tx = Math.min(x, y);\n\t\tx = Math.min(x, z);\n\t\treturn x;\n\t}\n\tstatic double max(double x, double y) {\n\t\treturn Math.max(x, y);\n\t}\n\tstatic double min(double x, double y) {\n\t\treturn Math.min(x, y);\n\t}\n\tstatic double max(double x, double y, double z) {\n\t\tx = Math.max(x, y);\n\t\tx = Math.max(x, z);\n\t\treturn x;\n\t}\n\tstatic double min(double x, double y, double z) {\n\t\tx = Math.min(x, y);\n\t\tx = Math.min(x, z);\n\t\treturn x;\n\t}\n\tstatic void sort(int[] ar) {\n\t\tArrays.sort(ar);\n\t}\n\tstatic void sort(long[] ar) {\n\t\tArrays.sort(ar);\n\t}\n\tstatic void sort(double[] ar) {\n\t\tArrays.sort(ar);\n\t}\n\tstatic void sort(char[] ar) {\n\t\tArrays.sort(ar);\n\t}\n\tstatic void rsort(int[] ar) {\n\t\tArrays.sort(ar);\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tint tmp = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = tmp;\n\t\t}\n\t}\n\tstatic void rsort(long[] ar) {\n\t\tArrays.sort(ar);\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tlong tmp = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = tmp;\n\t\t}\n\t}\n\tstatic void rsort(double[] ar) {\n\t\tArrays.sort(ar);\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tdouble tmp = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = tmp;\n\t\t}\n\t}\n\tstatic void rsort(char[] ar) {\n\t\tArrays.sort(ar);\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tchar tmp = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = tmp;\n\t\t}\n\t}\n\tstatic void fill(int arr[], int x) {\n\t\tArrays.fill(arr, x);\n\t}\n\tstatic void fill(long arr[], long x) {\n\t\tArrays.fill(arr, x);\n\t}\n\tstatic void fill(boolean arr[], boolean x) {\n\t\tArrays.fill(arr, x);\n\t}\n\tstatic void fill(double arr[], double x) {\n\t\tArrays.fill(arr, x);\n\t}\n\tstatic void fill(int arr[][], int x) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tArrays.fill(arr[i], x);\n\t}\n\tstatic void fill(long arr[][], long x) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tArrays.fill(arr[i], x);\n\t}\n\tstatic void fill(double arr[][], double x) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tArrays.fill(arr[i], x);\n\t}\n\tstatic void fill(boolean arr[][], boolean x) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tArrays.fill(arr[i], x);\n\t}\n\t//MOD culc\n\tstatic long plus(long x, long y) {\n\t\tlong res = (x + y) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\tstatic long sub(long x, long y) {\n\t\tlong res = (x - y) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\tstatic long mul(long x, long y) {\n\t\tlong res = (x * y) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\tstatic long div(long x, long y) {\n\t\tlong res = x * pow(y, mod - 2) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\tstatic long pow(long x, long y) {\n\t\tif (y < 0)\n\t\t\treturn 0;\n\t\tif (y == 0)\n\t\t\treturn 1;\n\t\tif (y % 2 == 1)\n\t\t\treturn (x * pow(x, y - 1)) % mod;\n\t\tlong root = pow(x, y / 2);\n\t\treturn root * root % mod;\n\t}\n\tpublic static void main(String[] args) throws Exception {\n\t\tis = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());\n\t\tout = new PrintWriter(System.out);\n\t\tsolve();\n\t\tout.flush();\n\t}\n\t//input\n\tstatic InputStream is;\n\tstatic PrintWriter out;\n\tstatic String INPUT = \"\";\n\tprivate static byte[] inbuf = new byte[1024];\n\tstatic int lenbuf = 0, ptrbuf = 0;\n\tprivate static int readByte() {\n\t\tif (lenbuf == -1)\n\t\t\tthrow new InputMismatchException();\n\t\tif (ptrbuf >= lenbuf) {\n\t\t\tptrbuf = 0;\n\t\t\ttry {\n\t\t\t\tlenbuf = is.read(inbuf);\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new InputMismatchException();\n\t\t\t}\n\t\t\tif (lenbuf <= 0)\n\t\t\t\treturn -1;\n\t\t}\n\t\treturn inbuf[ptrbuf++];\n\t}\n\tprivate static boolean isSpaceChar(int c) {\n\t\treturn !(c >= 33 && c <= 126);\n\t}\n\tprivate static int skip() {\n\t\tint b;\n\t\twhile ((b = readByte()) != -1 && isSpaceChar(b))\n\t\t\t;\n\t\treturn b;\n\t}\n\t@SuppressWarnings(\"unused\")\n\tprivate static double nd() {\n\t\treturn Double.parseDouble(ns());\n\t}\n\t@SuppressWarnings(\"unused\")\n\tprivate static char nc() {\n\t\treturn (char) skip();\n\t}\n\tprivate static String ns() {\n\t\tint b = skip();\n\t\tStringBuilder sb = new StringBuilder();\n\t\twhile (!(isSpaceChar(b))) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\tprivate static char[] ns(int n) {\n\t\tchar[] buf = new char[n];\n\t\tint b = skip(), p = 0;\n\t\twhile (p < n && !(isSpaceChar(b))) {\n\t\t\tbuf[p++] = (char) b;\n\t\t\tb = readByte();\n\t\t}\n\t\treturn n == p ? buf : Arrays.copyOf(buf, p);\n\t}\n\t@SuppressWarnings(\"unused\")\n\tprivate static char[][] nm(int n, int m) {\n\t\tchar[][] map = new char[n][];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tmap[i] = ns(m);\n\t\treturn map;\n\t}\n\t@SuppressWarnings(\"unused\")\n\tprivate static int[] na(int n) {\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = ni();\n\t\treturn a;\n\t}\n\t@SuppressWarnings(\"unused\")\n\tprivate static long[] nla(int n) {\n\t\tlong[] a = new long[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = nl();\n\t\treturn a;\n\t}\n\tprivate static int ni() {\n\t\tint num = 0, b;\n\t\tboolean minus = false;\n\t\twhile ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))\n\t\t\t;\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\t\n\t\twhile (true) {\n\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t} else {\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\t@SuppressWarnings(\"unused\")\n\tprivate static long nl() {\n\t\tlong num = 0;\n\t\tint b;\n\t\tboolean minus = false;\n\t\twhile ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))\n\t\t\t;\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\t\n\t\twhile (true) {\n\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t} else {\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n}\n", "language": "Java", "metadata": {"date": 1593309019, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02624.html", "problem_id": "p02624", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02624/input.txt", "sample_output_relpath": "derived/input_output/data/p02624/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02624/Java/s114788751.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s114788751", "user_id": "u881359256"}, "prompt_components": {"gold_output": "23\n", "input_to_evaluate": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n\tstatic int n;\n\tstatic int[] primes;\n\tstatic int div2[];\n\tstatic void solve() {\n\t\tn = ni();\n\t\tif(n == 1) {\n\t\t\tout.println(1);\n\t\t\treturn;\n\t\t}\n\t\tprimes = eratos(n);\n\t\tdiv2 = new int[n+1];\n\t\tdiv2[2] = 1;\n\t\tfor(int i=3;i<=n;i++) {\n\t\t\tif(i % 2 == 0) {\n\t\t\t\tdiv2[i] = div2[i/2] + 1;\n\t\t\t}\n\t\t}\n\t\tlong dp[] = new long[n+1];\n\t\tdp[1] = 1;\n\t\tfor(int i=2;i<=n;i++) {\n\t\t\tif(dp[i] != 0)continue;\n\t\t\tif(primes[i] == 0) {\n\t\t\t\tdp[i] = 2;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tint x = i;\n\t\t\tif(x % 2 == 0) {\n\t\t\t\tx /= pow(2, div2[i]);\n\t\t\t\tdp[i] = dp[x] * (div2[i]+1);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t\n\t\t\tint cnt = 0;\n\t\t\twhile(x % primes[i] == 0) {\n\t\t\t\tx /= primes[i];\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t\tdp[i] = dp[x] * (cnt + 1);\t\t\t\n\t\t}\n\t\tlong ans = 0;\n\t\tfor(int i=1;i<=n;i++) {\n\t\t\tans += i * dp[i];\n\t\t}\n\t\tout.println(ans);\n\t}\n\t\n\tstatic int[] eratos(int x) {\n\t\tint[] era = new int[x+1];\n\t\tfill(era, -1); \n\t\tfor(int i=2;i<=n;i++) {\n\t\t\tif(era[i]!=-1)continue;\n\t\t\tera[i] = 0;//0が素数\n\t\t\tfor(int j=i+i;j<=n;j+=i) {\n\t\t\t\tera[j] = i;//自分を割れる素数\n\t\t\t}\n\t\t}\n\t\treturn era;\n\t}\n\t\n\tstatic int factCnt(int x) {\n\t\tSet set = new HashSet<>();\n\t\tfor(int i=1;i*i<=x;i++) {\n\t\t\tif(x % i == 0) {\n\t\t\t\tset.add(i);\n\t\t\t\tset.add(x / i);\n\t\t\t}\n\t\t}\n\t\treturn set.size();\n\t}\n\t\n\t//constant\n\tstatic final int inf = Integer.MAX_VALUE / 2;\n\tstatic final long linf = Long.MAX_VALUE / 3;\n\tstatic final double dinf = Double.MAX_VALUE / 3;\n\tstatic final long mod = (long) 1e9 + 7;\n\tstatic final int[] dx = { -1, 0, 1, 0 }, dy = { 0, -1, 0, 1 }, dx8 = { -1, -1, -1, 0, 0, 1, 1, 1 }, dy8 = { -1, 0, 1, -1, 1, -1, 0, 1 };\n\tstatic final double eps = 1e-10, pi = Math.PI;\n\tstatic StringBuilder sb = new StringBuilder();\n\t\n\t//libraries\n\tstatic void reverse(int ar[]) {\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tint t = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = t;\n\t\t}\n\t}\n\tstatic void reverse(long ar[]) {\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tlong t = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = t;\n\t\t}\n\t}\n\tstatic void reverse(double ar[]) {\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tdouble t = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = t;\n\t\t}\n\t}\n\tstatic void reverse(char ar[]) {\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tchar t = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = t;\n\t\t}\n\t}\n\tstatic String getReverse(String s) {\n\t\tchar c[] = s.toCharArray();\n\t\treverse(c);\n\t\ts = String.valueOf(c);\n\t\treturn s;\n\t}\n\tstatic void reverse(List ls) {\n\t\tint sz = ls.size();\n\t\tfor (int i = 0; i < sz / 2; i++) {\n\t\t\tT t = ls.get(i);\n\t\t\tls.set(i, ls.get(sz - 1 - i));\n\t\t\tls.set(sz - 1 - i, t);\n\t\t}\n\t}\n\tstatic void reverse(T[] ar) {\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tT t = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = t;\n\t\t}\n\t}\n\tstatic void sbnl() {//StringBuilderに改行文字をappendする\n\t\tsb.append(\"\\n\");\n\t}\n\tstatic int lowerBound(int[] a, int x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] < x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\tstatic int upperBound(int[] a, int x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] <= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\tstatic int rlowerBound(int[] a, int x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] > x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\tstatic int rupperBound(int[] a, int x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] >= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\tstatic int lowerBound(long[] a, long x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] < x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\tstatic int upperBound(long[] a, long x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] <= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\tstatic int rlowerBound(long[] a, long x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] > x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\tstatic int rupperBound(long[] a, long x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] >= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\tstatic int lowerBound(double[] a, double x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] < x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\tstatic int upperBound(double[] a, double x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] <= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\tstatic int rlowerBound(double[] a, double x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] > x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\tstatic int rupperBound(double[] a, double x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] >= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\tstatic int lowerBound(char[] a, char x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] < x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\tstatic int upperBound(char[] a, char x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] <= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\tstatic int rlowerBound(char[] a, char x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] > x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\tstatic int rupperBound(char[] a, char x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] >= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\tstatic int lowerBound(List ls, T x) throws RuntimeException {\n\t\tif (ls.size() == 0)\n\t\t\treturn -1;\n\t\tif (ls.get(0) instanceof Integer) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) >= 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Long) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) >= 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Double) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) >= 0 ? 1 : -1);\n\t\t} else {\n\t\t\tSystem.err.println(\n\t\t\t\t\tString.format(\"%s:数値でないリストを二分探索しています。\", Thread.currentThread().getStackTrace()[1].getMethodName()));\n\t\t\tthrow new RuntimeException();\n\t\t}\n\t}\n\tstatic int upperBound(List ls, T x) throws RuntimeException {\n\t\tif (ls.size() == 0)\n\t\t\treturn -1;\n\t\tif (ls.get(0) instanceof Integer) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) > 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Long) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) > 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Double) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) > 0 ? 1 : -1);\n\t\t} else {\n\t\t\tSystem.err.println(\n\t\t\t\t\tString.format(\"%s:数値でないリストを二分探索しています。\", Thread.currentThread().getStackTrace()[1].getMethodName()));\n\t\t\tthrow new RuntimeException();\n\t\t}\n\t}\n\tstatic int rupperBound(List ls, T x) throws RuntimeException {\n\t\tif (ls.size() == 0)\n\t\t\treturn -1;\n\t\tif (ls.get(0) instanceof Integer) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) < 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Long) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) < 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Double) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) < 0 ? 1 : -1);\n\t\t} else {\n\t\t\tSystem.err.println(\n\t\t\t\t\tString.format(\"%s:数値でないリストを二分探索しています。\", Thread.currentThread().getStackTrace()[1].getMethodName()));\n\t\t\tthrow new RuntimeException();\n\t\t}\n\t}\n\tstatic int rlowerBound(List ls, T x) {\n\t\tif (ls.size() == 0)\n\t\t\treturn -1;\n\t\tif (ls.get(0) instanceof Integer) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) <= 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Long) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) <= 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Double) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) <= 0 ? 1 : -1);\n\t\t} else {\n\t\t\tSystem.err.println(\n\t\t\t\t\tString.format(\"%s:数値でないリストを二分探索しています。\", Thread.currentThread().getStackTrace()[1].getMethodName()));\n\t\t\tthrow new RuntimeException();\n\t\t}\n\t}\n\tstatic int[] concat(int x, int arr[]) {\n\t\tint ret[] = new int[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 1, ret.length - 1);\n\t\tret[0] = x;\n\t\treturn ret;\n\t}\n\tstatic int[] concat(int arr[], int x) {\n\t\tint ret[] = new int[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 0, ret.length - 1);\n\t\tret[ret.length - 1] = x;\n\t\treturn ret;\n\t}\n\tstatic long[] concat(long x, long arr[]) {\n\t\tlong ret[] = new long[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 1, ret.length - 1);\n\t\tret[0] = x;\n\t\treturn ret;\n\t}\n\tstatic long[] concat(long arr[], long x) {\n\t\tlong ret[] = new long[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 0, ret.length - 1);\n\t\tret[ret.length - 1] = x;\n\t\treturn ret;\n\t}\n\tstatic char[] concat(char x, char arr[]) {\n\t\tchar ret[] = new char[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 0, ret.length - 1);\n\t\tret[ret.length - 1] = x;\n\t\treturn ret;\n\t}\n\tstatic char[] concat(char arr[], char x) {\n\t\tchar ret[] = new char[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 0, ret.length - 1);\n\t\tret[ret.length - 1] = x;\n\t\treturn ret;\n\t}\n\tstatic int max(int x, int y) {\n\t\treturn Math.max(x, y);\n\t}\n\tstatic int min(int x, int y) {\n\t\treturn Math.min(x, y);\n\t}\n\tstatic int max(int x, int y, int z) {\n\t\tx = Math.max(x, y);\n\t\tx = Math.max(x, z);\n\t\treturn x;\n\t}\n\tstatic int min(int x, int y, int z) {\n\t\tx = Math.min(x, y);\n\t\tx = Math.min(x, z);\n\t\treturn x;\n\t}\n\tstatic long max(long x, long y) {\n\t\treturn Math.max(x, y);\n\t}\n\tstatic long min(long x, long y) {\n\t\treturn Math.min(x, y);\n\t}\n\tstatic long max(long x, long y, long z) {\n\t\tx = Math.max(x, y);\n\t\tx = Math.max(x, z);\n\t\treturn x;\n\t}\n\tstatic long min(long x, long y, long z) {\n\t\tx = Math.min(x, y);\n\t\tx = Math.min(x, z);\n\t\treturn x;\n\t}\n\tstatic double max(double x, double y) {\n\t\treturn Math.max(x, y);\n\t}\n\tstatic double min(double x, double y) {\n\t\treturn Math.min(x, y);\n\t}\n\tstatic double max(double x, double y, double z) {\n\t\tx = Math.max(x, y);\n\t\tx = Math.max(x, z);\n\t\treturn x;\n\t}\n\tstatic double min(double x, double y, double z) {\n\t\tx = Math.min(x, y);\n\t\tx = Math.min(x, z);\n\t\treturn x;\n\t}\n\tstatic void sort(int[] ar) {\n\t\tArrays.sort(ar);\n\t}\n\tstatic void sort(long[] ar) {\n\t\tArrays.sort(ar);\n\t}\n\tstatic void sort(double[] ar) {\n\t\tArrays.sort(ar);\n\t}\n\tstatic void sort(char[] ar) {\n\t\tArrays.sort(ar);\n\t}\n\tstatic void rsort(int[] ar) {\n\t\tArrays.sort(ar);\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tint tmp = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = tmp;\n\t\t}\n\t}\n\tstatic void rsort(long[] ar) {\n\t\tArrays.sort(ar);\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tlong tmp = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = tmp;\n\t\t}\n\t}\n\tstatic void rsort(double[] ar) {\n\t\tArrays.sort(ar);\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tdouble tmp = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = tmp;\n\t\t}\n\t}\n\tstatic void rsort(char[] ar) {\n\t\tArrays.sort(ar);\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tchar tmp = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = tmp;\n\t\t}\n\t}\n\tstatic void fill(int arr[], int x) {\n\t\tArrays.fill(arr, x);\n\t}\n\tstatic void fill(long arr[], long x) {\n\t\tArrays.fill(arr, x);\n\t}\n\tstatic void fill(boolean arr[], boolean x) {\n\t\tArrays.fill(arr, x);\n\t}\n\tstatic void fill(double arr[], double x) {\n\t\tArrays.fill(arr, x);\n\t}\n\tstatic void fill(int arr[][], int x) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tArrays.fill(arr[i], x);\n\t}\n\tstatic void fill(long arr[][], long x) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tArrays.fill(arr[i], x);\n\t}\n\tstatic void fill(double arr[][], double x) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tArrays.fill(arr[i], x);\n\t}\n\tstatic void fill(boolean arr[][], boolean x) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tArrays.fill(arr[i], x);\n\t}\n\t//MOD culc\n\tstatic long plus(long x, long y) {\n\t\tlong res = (x + y) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\tstatic long sub(long x, long y) {\n\t\tlong res = (x - y) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\tstatic long mul(long x, long y) {\n\t\tlong res = (x * y) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\tstatic long div(long x, long y) {\n\t\tlong res = x * pow(y, mod - 2) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\tstatic long pow(long x, long y) {\n\t\tif (y < 0)\n\t\t\treturn 0;\n\t\tif (y == 0)\n\t\t\treturn 1;\n\t\tif (y % 2 == 1)\n\t\t\treturn (x * pow(x, y - 1)) % mod;\n\t\tlong root = pow(x, y / 2);\n\t\treturn root * root % mod;\n\t}\n\tpublic static void main(String[] args) throws Exception {\n\t\tis = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());\n\t\tout = new PrintWriter(System.out);\n\t\tsolve();\n\t\tout.flush();\n\t}\n\t//input\n\tstatic InputStream is;\n\tstatic PrintWriter out;\n\tstatic String INPUT = \"\";\n\tprivate static byte[] inbuf = new byte[1024];\n\tstatic int lenbuf = 0, ptrbuf = 0;\n\tprivate static int readByte() {\n\t\tif (lenbuf == -1)\n\t\t\tthrow new InputMismatchException();\n\t\tif (ptrbuf >= lenbuf) {\n\t\t\tptrbuf = 0;\n\t\t\ttry {\n\t\t\t\tlenbuf = is.read(inbuf);\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new InputMismatchException();\n\t\t\t}\n\t\t\tif (lenbuf <= 0)\n\t\t\t\treturn -1;\n\t\t}\n\t\treturn inbuf[ptrbuf++];\n\t}\n\tprivate static boolean isSpaceChar(int c) {\n\t\treturn !(c >= 33 && c <= 126);\n\t}\n\tprivate static int skip() {\n\t\tint b;\n\t\twhile ((b = readByte()) != -1 && isSpaceChar(b))\n\t\t\t;\n\t\treturn b;\n\t}\n\t@SuppressWarnings(\"unused\")\n\tprivate static double nd() {\n\t\treturn Double.parseDouble(ns());\n\t}\n\t@SuppressWarnings(\"unused\")\n\tprivate static char nc() {\n\t\treturn (char) skip();\n\t}\n\tprivate static String ns() {\n\t\tint b = skip();\n\t\tStringBuilder sb = new StringBuilder();\n\t\twhile (!(isSpaceChar(b))) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\tprivate static char[] ns(int n) {\n\t\tchar[] buf = new char[n];\n\t\tint b = skip(), p = 0;\n\t\twhile (p < n && !(isSpaceChar(b))) {\n\t\t\tbuf[p++] = (char) b;\n\t\t\tb = readByte();\n\t\t}\n\t\treturn n == p ? buf : Arrays.copyOf(buf, p);\n\t}\n\t@SuppressWarnings(\"unused\")\n\tprivate static char[][] nm(int n, int m) {\n\t\tchar[][] map = new char[n][];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tmap[i] = ns(m);\n\t\treturn map;\n\t}\n\t@SuppressWarnings(\"unused\")\n\tprivate static int[] na(int n) {\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = ni();\n\t\treturn a;\n\t}\n\t@SuppressWarnings(\"unused\")\n\tprivate static long[] nla(int n) {\n\t\tlong[] a = new long[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = nl();\n\t\treturn a;\n\t}\n\tprivate static int ni() {\n\t\tint num = 0, b;\n\t\tboolean minus = false;\n\t\twhile ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))\n\t\t\t;\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\t\n\t\twhile (true) {\n\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t} else {\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\t@SuppressWarnings(\"unused\")\n\tprivate static long nl() {\n\t\tlong num = 0;\n\t\tint b;\n\t\tboolean minus = false;\n\t\twhile ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))\n\t\t\t;\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\t\n\t\twhile (true) {\n\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t} else {\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nFor a positive integer X, let f(X) be the number of positive divisors of X.\n\nGiven a positive integer N, find \\sum_{K=1}^N K\\times f(K).\n\nConstraints\n\n1 \\leq N \\leq 10^7\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the value \\sum_{K=1}^N K\\times f(K).\n\nSample Input 1\n\n4\n\nSample Output 1\n\n23\n\nWe have f(1)=1, f(2)=2, f(3)=2, and f(4)=3, so the answer is 1\\times 1 + 2\\times 2 + 3\\times 2 + 4\\times 3 =23.\n\nSample Input 2\n\n100\n\nSample Output 2\n\n26879\n\nSample Input 3\n\n10000000\n\nSample Output 3\n\n838627288460105\n\nWatch out for overflows.", "sample_input": "4\n"}, "reference_outputs": ["23\n"], "source_document_id": "p02624", "source_text": "Score : 400 points\n\nProblem Statement\n\nFor a positive integer X, let f(X) be the number of positive divisors of X.\n\nGiven a positive integer N, find \\sum_{K=1}^N K\\times f(K).\n\nConstraints\n\n1 \\leq N \\leq 10^7\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the value \\sum_{K=1}^N K\\times f(K).\n\nSample Input 1\n\n4\n\nSample Output 1\n\n23\n\nWe have f(1)=1, f(2)=2, f(3)=2, and f(4)=3, so the answer is 1\\times 1 + 2\\times 2 + 3\\times 2 + 4\\times 3 =23.\n\nSample Input 2\n\n100\n\nSample Output 2\n\n26879\n\nSample Input 3\n\n10000000\n\nSample Output 3\n\n838627288460105\n\nWatch out for overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 16274, "cpu_time_ms": 686, "memory_kb": 184212}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s607250877", "group_id": "codeNet:p02624", "input_text": "import java.io.*;\nimport java.util.*;\npublic class Main{\n public static void main(String args[]) throws IOException{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));\n \n int n = Integer.parseInt(br.readLine().trim());\n long a[] = new long[n+1];\n Arrays.fill(a, 1);\n a[0]=0;\n for(int i=2;i<=n;i++){\n for(int j=i;j<=n;j+=i){\n a[j]++;\n }\n }\n for(int i=1;i<=n;i++){\n a[i] *= i;\n a[i] += a[i-1];\n }\n out.println(a[n]);\n out.flush();\n }\n}", "language": "Java", "metadata": {"date": 1593307900, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02624.html", "problem_id": "p02624", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02624/input.txt", "sample_output_relpath": "derived/input_output/data/p02624/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02624/Java/s607250877.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s607250877", "user_id": "u798929025"}, "prompt_components": {"gold_output": "23\n", "input_to_evaluate": "import java.io.*;\nimport java.util.*;\npublic class Main{\n public static void main(String args[]) throws IOException{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));\n \n int n = Integer.parseInt(br.readLine().trim());\n long a[] = new long[n+1];\n Arrays.fill(a, 1);\n a[0]=0;\n for(int i=2;i<=n;i++){\n for(int j=i;j<=n;j+=i){\n a[j]++;\n }\n }\n for(int i=1;i<=n;i++){\n a[i] *= i;\n a[i] += a[i-1];\n }\n out.println(a[n]);\n out.flush();\n }\n}", "problem_context": "Score : 400 points\n\nProblem Statement\n\nFor a positive integer X, let f(X) be the number of positive divisors of X.\n\nGiven a positive integer N, find \\sum_{K=1}^N K\\times f(K).\n\nConstraints\n\n1 \\leq N \\leq 10^7\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the value \\sum_{K=1}^N K\\times f(K).\n\nSample Input 1\n\n4\n\nSample Output 1\n\n23\n\nWe have f(1)=1, f(2)=2, f(3)=2, and f(4)=3, so the answer is 1\\times 1 + 2\\times 2 + 3\\times 2 + 4\\times 3 =23.\n\nSample Input 2\n\n100\n\nSample Output 2\n\n26879\n\nSample Input 3\n\n10000000\n\nSample Output 3\n\n838627288460105\n\nWatch out for overflows.", "sample_input": "4\n"}, "reference_outputs": ["23\n"], "source_document_id": "p02624", "source_text": "Score : 400 points\n\nProblem Statement\n\nFor a positive integer X, let f(X) be the number of positive divisors of X.\n\nGiven a positive integer N, find \\sum_{K=1}^N K\\times f(K).\n\nConstraints\n\n1 \\leq N \\leq 10^7\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the value \\sum_{K=1}^N K\\times f(K).\n\nSample Input 1\n\n4\n\nSample Output 1\n\n23\n\nWe have f(1)=1, f(2)=2, f(3)=2, and f(4)=3, so the answer is 1\\times 1 + 2\\times 2 + 3\\times 2 + 4\\times 3 =23.\n\nSample Input 2\n\n100\n\nSample Output 2\n\n26879\n\nSample Input 3\n\n10000000\n\nSample Output 3\n\n838627288460105\n\nWatch out for overflows.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 685, "cpu_time_ms": 1485, "memory_kb": 112620}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s465158781", "group_id": "codeNet:p02642", "input_text": "\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n if(n == 1) {\n System.out.println(1);\n }else {\n sc.nextLine();\n String[] str = sc.nextLine().split(\" \");\n\n ArrayList aList = new ArrayList();\n for(int i = 0;i < n;i++) {\n aList.add(Integer.parseInt(str[i]));\n }\n Collections.sort(aList);\n\n if(aList.contains(1)) {\n if(aList.get(1) != 1) {\n System.out.println(1);\n }else {\n System.out.println(0);\n }\n }else {\n int max = Collections.max(aList);\n boolean[] bArray = new boolean[max+1];\n int cnt = 0;\n\n for(int i = 0;i < max+1 ; i++) {\n if(aList.contains(i)) {\n bArray[i] = true;\n cnt++;\n }else {\n bArray[i] = false;\n }\n }\n\n for(int i = 1;i < n;i++) {\n if(bArray[aList.get(i)]) {\n for(int j = 0;j < i;j++) {\n if(aList.get(i) % aList.get(j) == 0) {\n int c = 1;\n for(int k = aList.get(i);k <= max; k = c * aList.get(i)) {\n if(aList.contains(k)) {\n bArray[k] = false;\n cnt--;\n }\n c++;\n }\n break;\n }\n if(aList.get(i) / aList.get(j) <= 2) {\n break;\n }\n }\n }\n }\n System.out.println(cnt);\n }\n }\n\n }\n}\n", "language": "Java", "metadata": {"date": 1593927500, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02642/input.txt", "sample_output_relpath": "derived/input_output/data/p02642/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02642/Java/s465158781.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s465158781", "user_id": "u580010448"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n if(n == 1) {\n System.out.println(1);\n }else {\n sc.nextLine();\n String[] str = sc.nextLine().split(\" \");\n\n ArrayList aList = new ArrayList();\n for(int i = 0;i < n;i++) {\n aList.add(Integer.parseInt(str[i]));\n }\n Collections.sort(aList);\n\n if(aList.contains(1)) {\n if(aList.get(1) != 1) {\n System.out.println(1);\n }else {\n System.out.println(0);\n }\n }else {\n int max = Collections.max(aList);\n boolean[] bArray = new boolean[max+1];\n int cnt = 0;\n\n for(int i = 0;i < max+1 ; i++) {\n if(aList.contains(i)) {\n bArray[i] = true;\n cnt++;\n }else {\n bArray[i] = false;\n }\n }\n\n for(int i = 1;i < n;i++) {\n if(bArray[aList.get(i)]) {\n for(int j = 0;j < i;j++) {\n if(aList.get(i) % aList.get(j) == 0) {\n int c = 1;\n for(int k = aList.get(i);k <= max; k = c * aList.get(i)) {\n if(aList.contains(k)) {\n bArray[k] = false;\n cnt--;\n }\n c++;\n }\n break;\n }\n if(aList.get(i) / aList.get(j) <= 2) {\n break;\n }\n }\n }\n }\n System.out.println(cnt);\n }\n }\n\n }\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a number sequence A of length N.\n\nFind the number of integers i \\left(1 \\leq i \\leq N\\right) with the following property:\n\nFor every integer j \\left(1 \\leq j \\leq N\\right) such that i \\neq j , A_j does not divide A_i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^6\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 the answer.\n\nSample Input 1\n\n5\n24 11 8 3 16\n\nSample Output 1\n\n3\n\nThe integers with the property are 2, 3, and 4.\n\nSample Input 2\n\n4\n5 5 5 5\n\nSample Output 2\n\n0\n\nNote that there can be multiple equal numbers.\n\nSample Input 3\n\n10\n33 18 45 28 8 19 89 86 2 4\n\nSample Output 3\n\n5", "sample_input": "5\n24 11 8 3 16\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02642", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a number sequence A of length N.\n\nFind the number of integers i \\left(1 \\leq i \\leq N\\right) with the following property:\n\nFor every integer j \\left(1 \\leq j \\leq N\\right) such that i \\neq j , A_j does not divide A_i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^6\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 the answer.\n\nSample Input 1\n\n5\n24 11 8 3 16\n\nSample Output 1\n\n3\n\nThe integers with the property are 2, 3, and 4.\n\nSample Input 2\n\n4\n5 5 5 5\n\nSample Output 2\n\n0\n\nNote that there can be multiple equal numbers.\n\nSample Input 3\n\n10\n33 18 45 28 8 19 89 86 2 4\n\nSample Output 3\n\n5", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1656, "cpu_time_ms": 2208, "memory_kb": 75768}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s078878290", "group_id": "codeNet:p02642", "input_text": "import java.util.*;\nimport java.io.*;\npublic class Main{\n\tstatic int[] a;\n\tstatic ArrayList x = new ArrayList();\n public static void main(String[] main) throws Exception{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st = new StringTokenizer(br.readLine());\n PrintWriter out = new PrintWriter(System.out);\n int n = Integer.parseInt(st.nextToken());\n st = new StringTokenizer(br.readLine());\n a = new int[n];\n for(int i = 0; i < n; i++)\n a[i] = Integer.parseInt(st.nextToken());\n Arrays.sort(a);\n sieve();\n out.println(x.size());\n out.close();\n }\n static void sieve() {\n\t boolean[] dp = new boolean[1000001];\n\t for(int i = 0; i < dp.length; i++)\n\t\t dp[i] = true;\n\t for(int i = 0; i < a.length; i++) {\n\t\t if(dp[a[i]] && a[i] <= 500000) {\n\t\t\t for(int j = a[i]*2; j < 1000001; j += a[i]) {\n\t\t\t\t dp[j] = false;\n\t\t\t }\n\t\t }\n\t }\n\t HashSet elements = new HashSet();\n\t HashSet dup = new HashSet();\n\t for(int i = 0; i < a.length; i++) {\n\t\t if(elements.contains(a[i]))\n\t\t\t dup.add(a[i]);\n\t\t elements.add(a[i]);\n\t }\n\t for(int i = 0; i < a.length; i++)\n\t\t if(dp[a[i]] && !dup.contains(a[i]))\n\t\t\t x.add(a[i]);\n }\n}", "language": "Java", "metadata": {"date": 1593846437, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02642/input.txt", "sample_output_relpath": "derived/input_output/data/p02642/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02642/Java/s078878290.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s078878290", "user_id": "u926632269"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\npublic class Main{\n\tstatic int[] a;\n\tstatic ArrayList x = new ArrayList();\n public static void main(String[] main) throws Exception{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st = new StringTokenizer(br.readLine());\n PrintWriter out = new PrintWriter(System.out);\n int n = Integer.parseInt(st.nextToken());\n st = new StringTokenizer(br.readLine());\n a = new int[n];\n for(int i = 0; i < n; i++)\n a[i] = Integer.parseInt(st.nextToken());\n Arrays.sort(a);\n sieve();\n out.println(x.size());\n out.close();\n }\n static void sieve() {\n\t boolean[] dp = new boolean[1000001];\n\t for(int i = 0; i < dp.length; i++)\n\t\t dp[i] = true;\n\t for(int i = 0; i < a.length; i++) {\n\t\t if(dp[a[i]] && a[i] <= 500000) {\n\t\t\t for(int j = a[i]*2; j < 1000001; j += a[i]) {\n\t\t\t\t dp[j] = false;\n\t\t\t }\n\t\t }\n\t }\n\t HashSet elements = new HashSet();\n\t HashSet dup = new HashSet();\n\t for(int i = 0; i < a.length; i++) {\n\t\t if(elements.contains(a[i]))\n\t\t\t dup.add(a[i]);\n\t\t elements.add(a[i]);\n\t }\n\t for(int i = 0; i < a.length; i++)\n\t\t if(dp[a[i]] && !dup.contains(a[i]))\n\t\t\t x.add(a[i]);\n }\n}", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a number sequence A of length N.\n\nFind the number of integers i \\left(1 \\leq i \\leq N\\right) with the following property:\n\nFor every integer j \\left(1 \\leq j \\leq N\\right) such that i \\neq j , A_j does not divide A_i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^6\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 the answer.\n\nSample Input 1\n\n5\n24 11 8 3 16\n\nSample Output 1\n\n3\n\nThe integers with the property are 2, 3, and 4.\n\nSample Input 2\n\n4\n5 5 5 5\n\nSample Output 2\n\n0\n\nNote that there can be multiple equal numbers.\n\nSample Input 3\n\n10\n33 18 45 28 8 19 89 86 2 4\n\nSample Output 3\n\n5", "sample_input": "5\n24 11 8 3 16\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02642", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a number sequence A of length N.\n\nFind the number of integers i \\left(1 \\leq i \\leq N\\right) with the following property:\n\nFor every integer j \\left(1 \\leq j \\leq N\\right) such that i \\neq j , A_j does not divide A_i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^6\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 the answer.\n\nSample Input 1\n\n5\n24 11 8 3 16\n\nSample Output 1\n\n3\n\nThe integers with the property are 2, 3, and 4.\n\nSample Input 2\n\n4\n5 5 5 5\n\nSample Output 2\n\n0\n\nNote that there can be multiple equal numbers.\n\nSample Input 3\n\n10\n33 18 45 28 8 19 89 86 2 4\n\nSample Output 3\n\n5", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1311, "cpu_time_ms": 2207, "memory_kb": 66936}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s286958674", "group_id": "codeNet:p02642", "input_text": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint n = sc.nextInt();\n\t\tint[] input = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tinput[i] = sc.nextInt();\n\t\t}\n\t\tArrays.sort(input);\n\n\t\tboolean[] dp = new boolean[n];\n\t\tArrays.fill(dp, true);\n\n\t\tint count = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\n\t\t\tif (dp[i]) {\n\t\t\t\tfor (int j = i + 1; j < n; j++) {\n\t\t\t\t\tif (dp[j]) {\n\t\t\t\t\t\tif (input[i] == input[j])\n\t\t\t\t\t\t\tdp[i] = dp[j] = false;\n\n\t\t\t\t\t\telse if (input[j] % input[i] == 0)\n\t\t\t\t\t\t\tdp[j] = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (dp[i])\n\t\t\t\tcount++;\n\t\t}\n\n\t\tSystem.out.println(count);\n\t}\n}\n", "language": "Java", "metadata": {"date": 1592530912, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02642/input.txt", "sample_output_relpath": "derived/input_output/data/p02642/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02642/Java/s286958674.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s286958674", "user_id": "u503398887"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint n = sc.nextInt();\n\t\tint[] input = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tinput[i] = sc.nextInt();\n\t\t}\n\t\tArrays.sort(input);\n\n\t\tboolean[] dp = new boolean[n];\n\t\tArrays.fill(dp, true);\n\n\t\tint count = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\n\t\t\tif (dp[i]) {\n\t\t\t\tfor (int j = i + 1; j < n; j++) {\n\t\t\t\t\tif (dp[j]) {\n\t\t\t\t\t\tif (input[i] == input[j])\n\t\t\t\t\t\t\tdp[i] = dp[j] = false;\n\n\t\t\t\t\t\telse if (input[j] % input[i] == 0)\n\t\t\t\t\t\t\tdp[j] = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (dp[i])\n\t\t\t\tcount++;\n\t\t}\n\n\t\tSystem.out.println(count);\n\t}\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a number sequence A of length N.\n\nFind the number of integers i \\left(1 \\leq i \\leq N\\right) with the following property:\n\nFor every integer j \\left(1 \\leq j \\leq N\\right) such that i \\neq j , A_j does not divide A_i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^6\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 the answer.\n\nSample Input 1\n\n5\n24 11 8 3 16\n\nSample Output 1\n\n3\n\nThe integers with the property are 2, 3, and 4.\n\nSample Input 2\n\n4\n5 5 5 5\n\nSample Output 2\n\n0\n\nNote that there can be multiple equal numbers.\n\nSample Input 3\n\n10\n33 18 45 28 8 19 89 86 2 4\n\nSample Output 3\n\n5", "sample_input": "5\n24 11 8 3 16\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02642", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a number sequence A of length N.\n\nFind the number of integers i \\left(1 \\leq i \\leq N\\right) with the following property:\n\nFor every integer j \\left(1 \\leq j \\leq N\\right) such that i \\neq j , A_j does not divide A_i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^6\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 the answer.\n\nSample Input 1\n\n5\n24 11 8 3 16\n\nSample Output 1\n\n3\n\nThe integers with the property are 2, 3, and 4.\n\nSample Input 2\n\n4\n5 5 5 5\n\nSample Output 2\n\n0\n\nNote that there can be multiple equal numbers.\n\nSample Input 3\n\n10\n33 18 45 28 8 19 89 86 2 4\n\nSample Output 3\n\n5", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 686, "cpu_time_ms": 2207, "memory_kb": 61156}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s046243464", "group_id": "codeNet:p02642", "input_text": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n\n var N = scanner.nextInt();\n var A = new int[N];\n var isP = new boolean[N];\n\n for(int i=0; i();\n for(int i=0; i ite = A.iterator(); ite.hasNext(); ) {\n int next = ite.next();\n if(next % p == 0) ite.remove();\n if(next == p) isPExistInRemains = true;\n }\n if(!isPExistInRemains) numP++;\n }\n System.out.println(numP);\n }\n}", "language": "Java", "metadata": {"date": 1592488008, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02642/input.txt", "sample_output_relpath": "derived/input_output/data/p02642/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02642/Java/s947759071.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s947759071", "user_id": "u479049927"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n\n var N = scanner.nextInt();\n var A = new LinkedList();\n for(int i=0; i ite = A.iterator(); ite.hasNext(); ) {\n int next = ite.next();\n if(next % p == 0) ite.remove();\n if(next == p) isPExistInRemains = true;\n }\n if(!isPExistInRemains) numP++;\n }\n System.out.println(numP);\n }\n}", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a number sequence A of length N.\n\nFind the number of integers i \\left(1 \\leq i \\leq N\\right) with the following property:\n\nFor every integer j \\left(1 \\leq j \\leq N\\right) such that i \\neq j , A_j does not divide A_i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^6\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 the answer.\n\nSample Input 1\n\n5\n24 11 8 3 16\n\nSample Output 1\n\n3\n\nThe integers with the property are 2, 3, and 4.\n\nSample Input 2\n\n4\n5 5 5 5\n\nSample Output 2\n\n0\n\nNote that there can be multiple equal numbers.\n\nSample Input 3\n\n10\n33 18 45 28 8 19 89 86 2 4\n\nSample Output 3\n\n5", "sample_input": "5\n24 11 8 3 16\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02642", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a number sequence A of length N.\n\nFind the number of integers i \\left(1 \\leq i \\leq N\\right) with the following property:\n\nFor every integer j \\left(1 \\leq j \\leq N\\right) such that i \\neq j , A_j does not divide A_i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^6\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 the answer.\n\nSample Input 1\n\n5\n24 11 8 3 16\n\nSample Output 1\n\n3\n\nThe integers with the property are 2, 3, and 4.\n\nSample Input 2\n\n4\n5 5 5 5\n\nSample Output 2\n\n0\n\nNote that there can be multiple equal numbers.\n\nSample Input 3\n\n10\n33 18 45 28 8 19 89 86 2 4\n\nSample Output 3\n\n5", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 896, "cpu_time_ms": 2364, "memory_kb": 174688}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s313080196", "group_id": "codeNet:p02642", "input_text": "import java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args){\n\t\ttry(Scanner sc = new Scanner(System.in)) {\n\t\t\t\n\t\t\tint n = sc.nextInt();\n\t\t\t\n\t\t\tint[] aArray = new int[n];\n\t\t\tHashMap dupMap = new HashMap<>(); \n\t\t\t\n\t\t\tfor(int i = 0 ; i < n ; i++ ) {\n\t\t\t\taArray[i] = sc.nextInt();\n\t\t\t\tif ( dupMap.containsKey(aArray[i]) ) {\n\t\t\t\t\tint current = dupMap.get(aArray[i]);\n\t\t\t\t\tdupMap.put(aArray[i], current+1);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tdupMap.put(aArray[i], 1);\n\t\t\t\t}\n\t\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tlong ans = 0;\n\t\t\t\n\t\t\tList uniqList = new ArrayList<>(dupMap.keySet());\n\t\t\tCollections.sort(uniqList);\n\t\t\t\n\t\t\tfor(int i = 0 ; i < uniqList.size() ; i++ ) {\n\t\t\t\tint ai = uniqList.get(i);\n\t\t\t\t\n\t\t\t\tif (dupMap.get(ai) > 1) {\n\t\t\t\t\t//duplicate itself\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tint rootAi = ai / 2 + 1;\n\t\t\t\t\n\t\t\t\tboolean isOK = true;\n\t\t\t\tfor(int j = 0 ; j < i ; j++ ) {\n\t\t\t\t\tint aj = uniqList.get(j);\n\t\t\t\t\t\n\t\t\t\t\tif ( ai % aj == 0 ) {\n\t\t\t\t\t\tisOK = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif ( aj > rootAi) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif ( isOK ) {\n//\t\t\t\t\tSystem.out.println(ai);\n\t\t\t\t\tans++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tSystem.out.println(ans);\n\t\t\t\n\t\t}\n\t}\n\n}", "language": "Java", "metadata": {"date": 1592235540, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02642/input.txt", "sample_output_relpath": "derived/input_output/data/p02642/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02642/Java/s313080196.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s313080196", "user_id": "u542279262"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args){\n\t\ttry(Scanner sc = new Scanner(System.in)) {\n\t\t\t\n\t\t\tint n = sc.nextInt();\n\t\t\t\n\t\t\tint[] aArray = new int[n];\n\t\t\tHashMap dupMap = new HashMap<>(); \n\t\t\t\n\t\t\tfor(int i = 0 ; i < n ; i++ ) {\n\t\t\t\taArray[i] = sc.nextInt();\n\t\t\t\tif ( dupMap.containsKey(aArray[i]) ) {\n\t\t\t\t\tint current = dupMap.get(aArray[i]);\n\t\t\t\t\tdupMap.put(aArray[i], current+1);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tdupMap.put(aArray[i], 1);\n\t\t\t\t}\n\t\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tlong ans = 0;\n\t\t\t\n\t\t\tList uniqList = new ArrayList<>(dupMap.keySet());\n\t\t\tCollections.sort(uniqList);\n\t\t\t\n\t\t\tfor(int i = 0 ; i < uniqList.size() ; i++ ) {\n\t\t\t\tint ai = uniqList.get(i);\n\t\t\t\t\n\t\t\t\tif (dupMap.get(ai) > 1) {\n\t\t\t\t\t//duplicate itself\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tint rootAi = ai / 2 + 1;\n\t\t\t\t\n\t\t\t\tboolean isOK = true;\n\t\t\t\tfor(int j = 0 ; j < i ; j++ ) {\n\t\t\t\t\tint aj = uniqList.get(j);\n\t\t\t\t\t\n\t\t\t\t\tif ( ai % aj == 0 ) {\n\t\t\t\t\t\tisOK = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif ( aj > rootAi) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif ( isOK ) {\n//\t\t\t\t\tSystem.out.println(ai);\n\t\t\t\t\tans++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tSystem.out.println(ans);\n\t\t\t\n\t\t}\n\t}\n\n}", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a number sequence A of length N.\n\nFind the number of integers i \\left(1 \\leq i \\leq N\\right) with the following property:\n\nFor every integer j \\left(1 \\leq j \\leq N\\right) such that i \\neq j , A_j does not divide A_i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^6\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 the answer.\n\nSample Input 1\n\n5\n24 11 8 3 16\n\nSample Output 1\n\n3\n\nThe integers with the property are 2, 3, and 4.\n\nSample Input 2\n\n4\n5 5 5 5\n\nSample Output 2\n\n0\n\nNote that there can be multiple equal numbers.\n\nSample Input 3\n\n10\n33 18 45 28 8 19 89 86 2 4\n\nSample Output 3\n\n5", "sample_input": "5\n24 11 8 3 16\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02642", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a number sequence A of length N.\n\nFind the number of integers i \\left(1 \\leq i \\leq N\\right) with the following property:\n\nFor every integer j \\left(1 \\leq j \\leq N\\right) such that i \\neq j , A_j does not divide A_i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^6\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 the answer.\n\nSample Input 1\n\n5\n24 11 8 3 16\n\nSample Output 1\n\n3\n\nThe integers with the property are 2, 3, and 4.\n\nSample Input 2\n\n4\n5 5 5 5\n\nSample Output 2\n\n0\n\nNote that there can be multiple equal numbers.\n\nSample Input 3\n\n10\n33 18 45 28 8 19 89 86 2 4\n\nSample Output 3\n\n5", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1281, "cpu_time_ms": 2208, "memory_kb": 73468}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s963716760", "group_id": "codeNet:p02642", "input_text": "import java.util.*;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] as = new int[n];\n\t\tint[] count = new int[1000001];\n\t\tboolean[] hantei = new boolean[1000001];\n\t\tfor(int i=0; i= 2){\n\t\t\t\tint j = 2;\n\t\t\t\tint tmp = as[i];\n\t\t\t\twhile(tmp <= 1000000){\n\t\t\t\t\thantei[tmp] = true;\n\t\t\t\t\ttmp = as[i]*j;\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t} else if(count[as[i]] >= 1){\n\t\t\t\tint j = 2;\n\t\t\t\tint tmp = as[i]*j;\n\t\t\t\twhile(tmp <= 1000000){\n\t\t\t\t\thantei[tmp] = true;\n\t\t\t\t\tj++;\n\t\t\t\t\ttmp = as[i]*j;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tint ans = 0;\n\t\tfor(int a: as){\n\t\t\tif(!hantei[a]) ans++;\n\t\t}\n\t\tSystem.out.println(ans);\n\n\t}\n}\n", "language": "Java", "metadata": {"date": 1592199161, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02642/input.txt", "sample_output_relpath": "derived/input_output/data/p02642/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02642/Java/s963716760.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s963716760", "user_id": "u248433238"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] as = new int[n];\n\t\tint[] count = new int[1000001];\n\t\tboolean[] hantei = new boolean[1000001];\n\t\tfor(int i=0; i= 2){\n\t\t\t\tint j = 2;\n\t\t\t\tint tmp = as[i];\n\t\t\t\twhile(tmp <= 1000000){\n\t\t\t\t\thantei[tmp] = true;\n\t\t\t\t\ttmp = as[i]*j;\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t} else if(count[as[i]] >= 1){\n\t\t\t\tint j = 2;\n\t\t\t\tint tmp = as[i]*j;\n\t\t\t\twhile(tmp <= 1000000){\n\t\t\t\t\thantei[tmp] = true;\n\t\t\t\t\tj++;\n\t\t\t\t\ttmp = as[i]*j;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tint ans = 0;\n\t\tfor(int a: as){\n\t\t\tif(!hantei[a]) ans++;\n\t\t}\n\t\tSystem.out.println(ans);\n\n\t}\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a number sequence A of length N.\n\nFind the number of integers i \\left(1 \\leq i \\leq N\\right) with the following property:\n\nFor every integer j \\left(1 \\leq j \\leq N\\right) such that i \\neq j , A_j does not divide A_i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^6\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 the answer.\n\nSample Input 1\n\n5\n24 11 8 3 16\n\nSample Output 1\n\n3\n\nThe integers with the property are 2, 3, and 4.\n\nSample Input 2\n\n4\n5 5 5 5\n\nSample Output 2\n\n0\n\nNote that there can be multiple equal numbers.\n\nSample Input 3\n\n10\n33 18 45 28 8 19 89 86 2 4\n\nSample Output 3\n\n5", "sample_input": "5\n24 11 8 3 16\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02642", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a number sequence A of length N.\n\nFind the number of integers i \\left(1 \\leq i \\leq N\\right) with the following property:\n\nFor every integer j \\left(1 \\leq j \\leq N\\right) such that i \\neq j , A_j does not divide A_i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^6\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 the answer.\n\nSample Input 1\n\n5\n24 11 8 3 16\n\nSample Output 1\n\n3\n\nThe integers with the property are 2, 3, and 4.\n\nSample Input 2\n\n4\n5 5 5 5\n\nSample Output 2\n\n0\n\nNote that there can be multiple equal numbers.\n\nSample Input 3\n\n10\n33 18 45 28 8 19 89 86 2 4\n\nSample Output 3\n\n5", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 761, "cpu_time_ms": 2207, "memory_kb": 55900}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s216898326", "group_id": "codeNet:p02642", "input_text": "import java.util.Scanner;\nimport java.util.Arrays;\n\npublic class Main { \n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int[] A = new int[N];\n for (int i =0; i map = new HashMap(N);\n\t/*for ( キーのデータ型 key : マップの名前.keySet() ) {\n\t\tデータのデータ型 data = マップの名前.get( key );\n\t\t\n\t\t// keyやdataを使った処理;\n\t}*/\n\t//int i = Integer.parseInt(s);\n\t//Queue qq=new ArrayDeque<>(); //add,poll,peek BFSは前から実行される\n\t//Deque dd=new ArrayDeque<>();//push後ろに入れる,poll(pop)後ろからとる,peek addは先頭に入るからバグ注意 \n\t//stackdfsは後ろから実行される\n\t//ArrayList cc = new ArrayList<>(N);\n\t//cc.contains(tmp)\n\t//Arrays.asList(c).contains(\"a\")\n\t//list.set(1,\"walk\");//1 1 2 3 5\n\n\t\n\n\n\t\n\tprivate static void slover() {\n\t\t\n\t\tint N=sc.nextInt();\n\t\tint A[]=sc.nextIntArray(N, false);\n\t\tint ans=0;\n\t\t\n\t\t\n\t\tArrays.sort(A);\n\t\tif(N==1) {\n\t\t\tp(1);\n\t\t}else \n\t\tif(A[0]==A[N-1]) {\n\t\t\tp(0);\n\t\t}\n\t\telse {\n\t\t\tt:for(int i=0;i=0&&A[i-1]==A[i])||(i+10&&A[i]%(A[i]/a)==0&&Arrays.binarySearch(A,(A[i]/a))>=0)continue t;\n\t\t\t\t}\n\t\t\t\tfor(int a=0;aA[i])break;\n\t\t\t\t\tif(A[i]%A[a]==0)continue t;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tans++;\n\t\t\t}\n\t\t\tp(ans);\n\t\t}\n\t}\n\t\n\t\n\t\n\t\n\t\n\t\n\tstatic long Nsin(long t) {\n\t\tlong sum=0;\n\t\tlong v=1;\n\t\tlong tt=1;\n\t\tfor(long k=0;k<(t+\"\").length();k++) {\n\t\t\tsum+=(t%(tt*10)-t%tt)/tt*v;\n\t\t\tv*=t;\n\t\t\ttt*=10;\n\t\t}\n\t\treturn sum;\n\t}\n\t\n\tstatic long so(long n) {\n\t\tfor(long i=2;i*i<=n;i++) {\n\t\t\tif(n%i==0) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t\t\n\t}\n\t\n\t\n\t \n\t static void nibun(int a,int b,int target) { \n\t \t \n\t \t int ok=a;\n\t \t int ng=b;\n\t \t \n\t \t \n\t \t int t=2;\n\t \t \n\t \t while(aok) {\n\t \t\t\t \n\t \t\t }\n\t \t\t if(t>ng) {\n\t \t\t\t \n\t \t\t }\n\t \t\t \n\t \t\t \n\t \t\t \n\t \t }\n\t \t \n\t \t \n\t \t \n\t }\n\t \n\t \n\t \n\n\t\n\t\t//StringBuffer str = new StringBuffer(sc.nextInt());\n\t\t//for(int i=0;i map = new HashMap(N);\n\t/*for ( キーのデータ型 key : マップの名前.keySet() ) {\n\t\tデータのデータ型 data = マップの名前.get( key );\n\t\t\n\t\t// keyやdataを使った処理;\n\t}*/\n\t//int i = Integer.parseInt(s);\n\t//Queue qq=new ArrayDeque<>(); //add,poll,peek BFSは前から実行される\n\t//Deque dd=new ArrayDeque<>();//push後ろに入れる,poll(pop)後ろからとる,peek addは先頭に入るからバグ注意 \n\t//stackdfsは後ろから実行される\n\t//ArrayList cc = new ArrayList<>(N);\n\t//cc.contains(tmp)\n\t//Arrays.asList(c).contains(\"a\")\n\t//list.set(1,\"walk\");//1 1 2 3 5\n\n\t\n\n\n\t\n\tprivate static void slover() {\n\t\t\n\t\tint N=sc.nextInt();\n\t\tint A[]=sc.nextIntArray(N, false);\n\t\tint ans=0;\n\t\t\n\t\t\n\t\tArrays.sort(A);\n\t\tif(N==1) {\n\t\t\tp(1);\n\t\t}else \n\t\tif(A[0]==A[N-1]) {\n\t\t\tp(0);\n\t\t}\n\t\telse {\n\t\t\tt:for(int i=0;i=0&&A[i-1]==A[i])||(i+10&&A[i]%(A[i]/a)==0&&Arrays.binarySearch(A,(A[i]/a))>=0)continue t;\n\t\t\t\t}\n\t\t\t\tfor(int a=0;aA[i])break;\n\t\t\t\t\tif(A[i]%A[a]==0)continue t;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tans++;\n\t\t\t}\n\t\t\tp(ans);\n\t\t}\n\t}\n\t\n\t\n\t\n\t\n\t\n\t\n\tstatic long Nsin(long t) {\n\t\tlong sum=0;\n\t\tlong v=1;\n\t\tlong tt=1;\n\t\tfor(long k=0;k<(t+\"\").length();k++) {\n\t\t\tsum+=(t%(tt*10)-t%tt)/tt*v;\n\t\t\tv*=t;\n\t\t\ttt*=10;\n\t\t}\n\t\treturn sum;\n\t}\n\t\n\tstatic long so(long n) {\n\t\tfor(long i=2;i*i<=n;i++) {\n\t\t\tif(n%i==0) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t\t\n\t}\n\t\n\t\n\t \n\t static void nibun(int a,int b,int target) { \n\t \t \n\t \t int ok=a;\n\t \t int ng=b;\n\t \t \n\t \t \n\t \t int t=2;\n\t \t \n\t \t while(aok) {\n\t \t\t\t \n\t \t\t }\n\t \t\t if(t>ng) {\n\t \t\t\t \n\t \t\t }\n\t \t\t \n\t \t\t \n\t \t\t \n\t \t }\n\t \t \n\t \t \n\t \t \n\t }\n\t \n\t \n\t \n\n\t\n\t\t//StringBuffer str = new StringBuffer(sc.nextInt());\n\t\t//for(int i=0;i map = new HashMap();\n\t\tfor(int i=0;i list = new ArrayList(map.size());\n\t\tfor(int x:map.keySet()) {\n\t\t\tif(map.get(x)==1) {\n\t\t\t\tlist.add(x);\n\t\t\t}\n\t\t}\n\n\t\tif(list.size()==0) {\n\t\t\tpw.println(0);\n\t\t\treturn;\n\t\t}\n\t\tboolean[] x = new boolean[(int)1e6+1];\n\t\tArrays.fill(x,false);\n\t\tint n=0;\n\t\tfor(int i=0;i map = new HashMap();\n\t\tfor(int i=0;i list = new ArrayList(map.size());\n\t\tfor(int x:map.keySet()) {\n\t\t\tif(map.get(x)==1) {\n\t\t\t\tlist.add(x);\n\t\t\t}\n\t\t}\n\n\t\tif(list.size()==0) {\n\t\t\tpw.println(0);\n\t\t\treturn;\n\t\t}\n\t\tboolean[] x = new boolean[(int)1e6+1];\n\t\tArrays.fill(x,false);\n\t\tint n=0;\n\t\tfor(int i=0;i list = new ArrayList<>();\n\t\t\tint[] numCount = new int[1000001];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tint value = sc.nextInt();\n\t\t\t\tnumCount[value]++;\n\t\t\t\tif (value == 1) {\n\t\t\t\t\tSystem.out.println(0);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlist.add(value);\n\t\t\t}\n\n\t\t\tCollections.sort(list);\n\t\t\tCollections.reverse(list);\n\n\t\t\tint count = 0;\n\t\t\tfor (int i = 0; i < n; i++) {\n\n\n\t\t\t\tif (numCount[list.get(i)] >1) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(prime.isPrime(list.get(i))) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tboolean flag = true;\n\t\t\t\tfor (int j = i + 1; j < n; j++) {\n\n\t\t\t\t\tif (list.get(i) % list.get(j) == 0) {\n\t\t\t\t\t\tflag = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (flag)\n\t\t\t\t\tcount++;\n\n\t\t\t}\n\n\t\t\tSystem.out.println(count);\n\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\n\t\t}\n\t}\n}\n\nclass Prime {\n\tpublic ArrayList primes = new ArrayList<>();\n\tpublic long max;\n\n\tpublic Prime(long max) {\n\t\tthis.max = max;\n\t\tprimes.add(2l);\n\t\tfor (long i = 3; i <= max; i += 2) {\n\t\t\tif (isPrime(i))\n\t\t\t\tprimes.add(i);\n\t\t}\n\t}\n\n\tpublic boolean isPrime(long value) {\n\t\tif (value <= 1l) {\n\t\t\treturn false;\n\t\t} else if (value == 2l) {\n\t\t\treturn true;\n\t\t}\n\n\t\tboolean flag = true;\n\t\tfor (long i = 3l; i * i <= value; i += 2l) {\n\t\t\tif (value % i == 0) {\n\t\t\t\tflag = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn flag;\n\t}\n\n\tpublic HashMap primeFact(long value){\n\t\tHashMap returns = new HashMap<>();\n\t\tint i = 0;\n\t\tint count = 0;\n\t\tif(primes.contains(value)) {\n\t\t\treturns.put(value, 1);\n\t\t\treturn returns;\n\t\t}\n\n\t\twhile(true) {\n\t\t\tif(value % primes.get(i) == 0) {\n\t\t\t\tcount++;\n\t\t\t\tvalue /= primes.get(i);\n\t\t\t}else {\n\t\t\t\tif(count !=0) {\n\t\t\t\t\treturns.put(primes.get(i), count);\n\t\t\t\t}\n\n\t\t\t\ti++;\n\t\t\t\tcount = 0;\n\t\t\t}\n\n\t\t\tif(value == 1) {\n\t\t\t\treturns.put(primes.get(i), count);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\n\t\treturn returns;\n\t}\n}", "language": "Java", "metadata": {"date": 1592188215, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02642/input.txt", "sample_output_relpath": "derived/input_output/data/p02642/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02642/Java/s897123981.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s897123981", "user_id": "u578649289"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\ttry (Scanner sc = new Scanner(System.in);) {\n\t\t\tPrime prime = new Prime(1000000);\n\t\t\tint n = sc.nextInt();\n\n\t\t\tArrayList list = new ArrayList<>();\n\t\t\tint[] numCount = new int[1000001];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tint value = sc.nextInt();\n\t\t\t\tnumCount[value]++;\n\t\t\t\tif (value == 1) {\n\t\t\t\t\tSystem.out.println(0);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlist.add(value);\n\t\t\t}\n\n\t\t\tCollections.sort(list);\n\t\t\tCollections.reverse(list);\n\n\t\t\tint count = 0;\n\t\t\tfor (int i = 0; i < n; i++) {\n\n\n\t\t\t\tif (numCount[list.get(i)] >1) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(prime.isPrime(list.get(i))) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tboolean flag = true;\n\t\t\t\tfor (int j = i + 1; j < n; j++) {\n\n\t\t\t\t\tif (list.get(i) % list.get(j) == 0) {\n\t\t\t\t\t\tflag = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (flag)\n\t\t\t\t\tcount++;\n\n\t\t\t}\n\n\t\t\tSystem.out.println(count);\n\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\n\t\t}\n\t}\n}\n\nclass Prime {\n\tpublic ArrayList primes = new ArrayList<>();\n\tpublic long max;\n\n\tpublic Prime(long max) {\n\t\tthis.max = max;\n\t\tprimes.add(2l);\n\t\tfor (long i = 3; i <= max; i += 2) {\n\t\t\tif (isPrime(i))\n\t\t\t\tprimes.add(i);\n\t\t}\n\t}\n\n\tpublic boolean isPrime(long value) {\n\t\tif (value <= 1l) {\n\t\t\treturn false;\n\t\t} else if (value == 2l) {\n\t\t\treturn true;\n\t\t}\n\n\t\tboolean flag = true;\n\t\tfor (long i = 3l; i * i <= value; i += 2l) {\n\t\t\tif (value % i == 0) {\n\t\t\t\tflag = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn flag;\n\t}\n\n\tpublic HashMap primeFact(long value){\n\t\tHashMap returns = new HashMap<>();\n\t\tint i = 0;\n\t\tint count = 0;\n\t\tif(primes.contains(value)) {\n\t\t\treturns.put(value, 1);\n\t\t\treturn returns;\n\t\t}\n\n\t\twhile(true) {\n\t\t\tif(value % primes.get(i) == 0) {\n\t\t\t\tcount++;\n\t\t\t\tvalue /= primes.get(i);\n\t\t\t}else {\n\t\t\t\tif(count !=0) {\n\t\t\t\t\treturns.put(primes.get(i), count);\n\t\t\t\t}\n\n\t\t\t\ti++;\n\t\t\t\tcount = 0;\n\t\t\t}\n\n\t\t\tif(value == 1) {\n\t\t\t\treturns.put(primes.get(i), count);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\n\t\treturn returns;\n\t}\n}", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a number sequence A of length N.\n\nFind the number of integers i \\left(1 \\leq i \\leq N\\right) with the following property:\n\nFor every integer j \\left(1 \\leq j \\leq N\\right) such that i \\neq j , A_j does not divide A_i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^6\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 the answer.\n\nSample Input 1\n\n5\n24 11 8 3 16\n\nSample Output 1\n\n3\n\nThe integers with the property are 2, 3, and 4.\n\nSample Input 2\n\n4\n5 5 5 5\n\nSample Output 2\n\n0\n\nNote that there can be multiple equal numbers.\n\nSample Input 3\n\n10\n33 18 45 28 8 19 89 86 2 4\n\nSample Output 3\n\n5", "sample_input": "5\n24 11 8 3 16\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02642", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a number sequence A of length N.\n\nFind the number of integers i \\left(1 \\leq i \\leq N\\right) with the following property:\n\nFor every integer j \\left(1 \\leq j \\leq N\\right) such that i \\neq j , A_j does not divide A_i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^6\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 the answer.\n\nSample Input 1\n\n5\n24 11 8 3 16\n\nSample Output 1\n\n3\n\nThe integers with the property are 2, 3, and 4.\n\nSample Input 2\n\n4\n5 5 5 5\n\nSample Output 2\n\n0\n\nNote that there can be multiple equal numbers.\n\nSample Input 3\n\n10\n33 18 45 28 8 19 89 86 2 4\n\nSample Output 3\n\n5", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2108, "cpu_time_ms": 2208, "memory_kb": 72720}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s332649282", "group_id": "codeNet:p02642", "input_text": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.NoSuchElementException;\n\npublic class Main {\n\n static int count = 0;\n\n public static void main(String[] args) {\n FastScanner scanner = new FastScanner();\n int n = scanner.nextInt();\n Integer[] sequence = new Integer[n];\n for (int i = 0; i < n; i++) {\n sequence[i] = scanner.nextInt();\n }\n List list = Arrays.asList(sequence);\n for (int i = 0; i < n; i++) {\n boolean isDivisible = true;\n if (isPrimeNumber(sequence[i]) && !list.contains(sequence[i])) {\n count++;\n continue;\n } else {\n for (int j = 0; j < n; j++) {\n if (i != j) {\n if (sequence[i] % sequence[j] != 0) {\n isDivisible = false;\n } else {\n isDivisible = true;\n break;\n }\n }\n }\n if (!isDivisible) {\n count++;\n }\n }\n }\n System.out.println(count);\n }\n\n private static boolean isPrimeNumber(int number) {\n if (number < 2) return false;\n else if (number == 2) return true;\n else if (number % 2 == 0) return false;\n\n double sqrtNum = Math.sqrt(number);\n for (int i = 3; i <= sqrtNum; i += 2) {\n if (number % i == 0) {\n return false;\n }\n }\n return true;\n }\n}\n\nclass FastScanner {\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte())\n return buffer[ptr++];\n else\n return -1;\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr]))\n ptr++;\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext())\n throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext())\n throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)\n throw new NumberFormatException();\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n}", "language": "Java", "metadata": {"date": 1592187821, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02642/input.txt", "sample_output_relpath": "derived/input_output/data/p02642/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02642/Java/s332649282.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s332649282", "user_id": "u135341926"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.NoSuchElementException;\n\npublic class Main {\n\n static int count = 0;\n\n public static void main(String[] args) {\n FastScanner scanner = new FastScanner();\n int n = scanner.nextInt();\n Integer[] sequence = new Integer[n];\n for (int i = 0; i < n; i++) {\n sequence[i] = scanner.nextInt();\n }\n List list = Arrays.asList(sequence);\n for (int i = 0; i < n; i++) {\n boolean isDivisible = true;\n if (isPrimeNumber(sequence[i]) && !list.contains(sequence[i])) {\n count++;\n continue;\n } else {\n for (int j = 0; j < n; j++) {\n if (i != j) {\n if (sequence[i] % sequence[j] != 0) {\n isDivisible = false;\n } else {\n isDivisible = true;\n break;\n }\n }\n }\n if (!isDivisible) {\n count++;\n }\n }\n }\n System.out.println(count);\n }\n\n private static boolean isPrimeNumber(int number) {\n if (number < 2) return false;\n else if (number == 2) return true;\n else if (number % 2 == 0) return false;\n\n double sqrtNum = Math.sqrt(number);\n for (int i = 3; i <= sqrtNum; i += 2) {\n if (number % i == 0) {\n return false;\n }\n }\n return true;\n }\n}\n\nclass FastScanner {\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte())\n return buffer[ptr++];\n else\n return -1;\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr]))\n ptr++;\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext())\n throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext())\n throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)\n throw new NumberFormatException();\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n}", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a number sequence A of length N.\n\nFind the number of integers i \\left(1 \\leq i \\leq N\\right) with the following property:\n\nFor every integer j \\left(1 \\leq j \\leq N\\right) such that i \\neq j , A_j does not divide A_i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^6\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 the answer.\n\nSample Input 1\n\n5\n24 11 8 3 16\n\nSample Output 1\n\n3\n\nThe integers with the property are 2, 3, and 4.\n\nSample Input 2\n\n4\n5 5 5 5\n\nSample Output 2\n\n0\n\nNote that there can be multiple equal numbers.\n\nSample Input 3\n\n10\n33 18 45 28 8 19 89 86 2 4\n\nSample Output 3\n\n5", "sample_input": "5\n24 11 8 3 16\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02642", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a number sequence A of length N.\n\nFind the number of integers i \\left(1 \\leq i \\leq N\\right) with the following property:\n\nFor every integer j \\left(1 \\leq j \\leq N\\right) such that i \\neq j , A_j does not divide A_i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^6\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 the answer.\n\nSample Input 1\n\n5\n24 11 8 3 16\n\nSample Output 1\n\n3\n\nThe integers with the property are 2, 3, and 4.\n\nSample Input 2\n\n4\n5 5 5 5\n\nSample Output 2\n\n0\n\nNote that there can be multiple equal numbers.\n\nSample Input 3\n\n10\n33 18 45 28 8 19 89 86 2 4\n\nSample Output 3\n\n5", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3904, "cpu_time_ms": 2207, "memory_kb": 45724}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s725239929", "group_id": "codeNet:p02642", "input_text": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n\n if(n == 1){\n System.out.println(0);\n return;\n }\n\n int a[] = new int[n];\n for(int i = 0; i < n; i++) {\n a[i] = sc.nextInt();\n }\n\n Arrays.sort(a);\n int count = n;\n if(a[0] == a[1]){count--;}\n for(int i = n-1; i >= 0; i--){\n int half = a[i] / 2;\n for(int j = 0; j <= i-1; j++){\n if(a[i] == a[j]){\n count--;\n break;\n }\n if(a[j] > half){\n break;\n }\n if(a[i] % a[j] == 0){\n count--;\n break;\n }\n }\n }\n System.out.println(count);\n }\n}", "language": "Java", "metadata": {"date": 1592187767, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02642/input.txt", "sample_output_relpath": "derived/input_output/data/p02642/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02642/Java/s725239929.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s725239929", "user_id": "u126700827"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n\n if(n == 1){\n System.out.println(0);\n return;\n }\n\n int a[] = new int[n];\n for(int i = 0; i < n; i++) {\n a[i] = sc.nextInt();\n }\n\n Arrays.sort(a);\n int count = n;\n if(a[0] == a[1]){count--;}\n for(int i = n-1; i >= 0; i--){\n int half = a[i] / 2;\n for(int j = 0; j <= i-1; j++){\n if(a[i] == a[j]){\n count--;\n break;\n }\n if(a[j] > half){\n break;\n }\n if(a[i] % a[j] == 0){\n count--;\n break;\n }\n }\n }\n System.out.println(count);\n }\n}", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a number sequence A of length N.\n\nFind the number of integers i \\left(1 \\leq i \\leq N\\right) with the following property:\n\nFor every integer j \\left(1 \\leq j \\leq N\\right) such that i \\neq j , A_j does not divide A_i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^6\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 the answer.\n\nSample Input 1\n\n5\n24 11 8 3 16\n\nSample Output 1\n\n3\n\nThe integers with the property are 2, 3, and 4.\n\nSample Input 2\n\n4\n5 5 5 5\n\nSample Output 2\n\n0\n\nNote that there can be multiple equal numbers.\n\nSample Input 3\n\n10\n33 18 45 28 8 19 89 86 2 4\n\nSample Output 3\n\n5", "sample_input": "5\n24 11 8 3 16\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02642", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a number sequence A of length N.\n\nFind the number of integers i \\left(1 \\leq i \\leq N\\right) with the following property:\n\nFor every integer j \\left(1 \\leq j \\leq N\\right) such that i \\neq j , A_j does not divide A_i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^6\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 the answer.\n\nSample Input 1\n\n5\n24 11 8 3 16\n\nSample Output 1\n\n3\n\nThe integers with the property are 2, 3, and 4.\n\nSample Input 2\n\n4\n5 5 5 5\n\nSample Output 2\n\n0\n\nNote that there can be multiple equal numbers.\n\nSample Input 3\n\n10\n33 18 45 28 8 19 89 86 2 4\n\nSample Output 3\n\n5", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 951, "cpu_time_ms": 2207, "memory_kb": 60464}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s779759641", "group_id": "codeNet:p02642", "input_text": "import java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n long N = sc.nextLong();\n List p = new ArrayList<>();\n // Set p = new HashSet();\n for (long i = 0; i < N; i++) {\n long pi = sc.nextLong();\n if (!p.contains(pi)) {\n p.add(pi);\n }\n }\n sc.close();\n if (p.size() == 1) {\n System.out.println(0);\n return;\n }\n\n Collections.sort(p);\n\n int count = 0;\n for (int i = 0; i < N; i++) {\n boolean flg = true;\n\n for (int j = 0; j < N; j++) {\n if (i == j) {\n continue;\n }\n if (p.get(i) % p.get(j) == 0) {\n flg = false;\n break;\n }\n }\n\n if (flg) {\n count++;\n }\n }\n System.out.println(count);\n }\n}\n", "language": "Java", "metadata": {"date": 1592187142, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02642/input.txt", "sample_output_relpath": "derived/input_output/data/p02642/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02642/Java/s779759641.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s779759641", "user_id": "u433305888"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n long N = sc.nextLong();\n List p = new ArrayList<>();\n // Set p = new HashSet();\n for (long i = 0; i < N; i++) {\n long pi = sc.nextLong();\n if (!p.contains(pi)) {\n p.add(pi);\n }\n }\n sc.close();\n if (p.size() == 1) {\n System.out.println(0);\n return;\n }\n\n Collections.sort(p);\n\n int count = 0;\n for (int i = 0; i < N; i++) {\n boolean flg = true;\n\n for (int j = 0; j < N; j++) {\n if (i == j) {\n continue;\n }\n if (p.get(i) % p.get(j) == 0) {\n flg = false;\n break;\n }\n }\n\n if (flg) {\n count++;\n }\n }\n System.out.println(count);\n }\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a number sequence A of length N.\n\nFind the number of integers i \\left(1 \\leq i \\leq N\\right) with the following property:\n\nFor every integer j \\left(1 \\leq j \\leq N\\right) such that i \\neq j , A_j does not divide A_i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^6\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 the answer.\n\nSample Input 1\n\n5\n24 11 8 3 16\n\nSample Output 1\n\n3\n\nThe integers with the property are 2, 3, and 4.\n\nSample Input 2\n\n4\n5 5 5 5\n\nSample Output 2\n\n0\n\nNote that there can be multiple equal numbers.\n\nSample Input 3\n\n10\n33 18 45 28 8 19 89 86 2 4\n\nSample Output 3\n\n5", "sample_input": "5\n24 11 8 3 16\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02642", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a number sequence A of length N.\n\nFind the number of integers i \\left(1 \\leq i \\leq N\\right) with the following property:\n\nFor every integer j \\left(1 \\leq j \\leq N\\right) such that i \\neq j , A_j does not divide A_i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^6\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 the answer.\n\nSample Input 1\n\n5\n24 11 8 3 16\n\nSample Output 1\n\n3\n\nThe integers with the property are 2, 3, and 4.\n\nSample Input 2\n\n4\n5 5 5 5\n\nSample Output 2\n\n0\n\nNote that there can be multiple equal numbers.\n\nSample Input 3\n\n10\n33 18 45 28 8 19 89 86 2 4\n\nSample Output 3\n\n5", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2207, "memory_kb": 60392}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s479898827", "group_id": "codeNet:p02642", "input_text": "import java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Scanner;\nimport java.util.Set;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tList list = new ArrayList<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlist.add(sc.nextInt());\n\t\t}\n\t\tCollections.sort(list);\n\t\tboolean[] array = new boolean[list.get(list.size() - 1) * 2 + 100];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint num = list.get(i);\n\t\t\tfor (int j = num * 2; j < list.get(list.size() - 1) * 2 + 100; j += num) {\n\t\t\t\tarray[j] = true;\n\t\t\t}\n\t\t}\n\t\tint count = 0;\n\t\tSet delList = new HashSet<>();\n\t\tfor (int i = 0; i < n - 1; i++) {\n\t\t\tif (list.get(i) == list.get(i + 1)) {\n\t\t\t\tdelList.add(list.get(i));\n\t\t\t}\n\t\t}\n\t\tlist.removeAll(delList);\n\t\tfor (int num : list) {\n\t\t\tif (!array[num]) {\n\t\t\t\t++count;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}\n", "language": "Java", "metadata": {"date": 1592186944, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02642/input.txt", "sample_output_relpath": "derived/input_output/data/p02642/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02642/Java/s479898827.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s479898827", "user_id": "u289565504"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Scanner;\nimport java.util.Set;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tList list = new ArrayList<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlist.add(sc.nextInt());\n\t\t}\n\t\tCollections.sort(list);\n\t\tboolean[] array = new boolean[list.get(list.size() - 1) * 2 + 100];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint num = list.get(i);\n\t\t\tfor (int j = num * 2; j < list.get(list.size() - 1) * 2 + 100; j += num) {\n\t\t\t\tarray[j] = true;\n\t\t\t}\n\t\t}\n\t\tint count = 0;\n\t\tSet delList = new HashSet<>();\n\t\tfor (int i = 0; i < n - 1; i++) {\n\t\t\tif (list.get(i) == list.get(i + 1)) {\n\t\t\t\tdelList.add(list.get(i));\n\t\t\t}\n\t\t}\n\t\tlist.removeAll(delList);\n\t\tfor (int num : list) {\n\t\t\tif (!array[num]) {\n\t\t\t\t++count;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a number sequence A of length N.\n\nFind the number of integers i \\left(1 \\leq i \\leq N\\right) with the following property:\n\nFor every integer j \\left(1 \\leq j \\leq N\\right) such that i \\neq j , A_j does not divide A_i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^6\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 the answer.\n\nSample Input 1\n\n5\n24 11 8 3 16\n\nSample Output 1\n\n3\n\nThe integers with the property are 2, 3, and 4.\n\nSample Input 2\n\n4\n5 5 5 5\n\nSample Output 2\n\n0\n\nNote that there can be multiple equal numbers.\n\nSample Input 3\n\n10\n33 18 45 28 8 19 89 86 2 4\n\nSample Output 3\n\n5", "sample_input": "5\n24 11 8 3 16\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02642", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a number sequence A of length N.\n\nFind the number of integers i \\left(1 \\leq i \\leq N\\right) with the following property:\n\nFor every integer j \\left(1 \\leq j \\leq N\\right) such that i \\neq j , A_j does not divide A_i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^6\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 the answer.\n\nSample Input 1\n\n5\n24 11 8 3 16\n\nSample Output 1\n\n3\n\nThe integers with the property are 2, 3, and 4.\n\nSample Input 2\n\n4\n5 5 5 5\n\nSample Output 2\n\n0\n\nNote that there can be multiple equal numbers.\n\nSample Input 3\n\n10\n33 18 45 28 8 19 89 86 2 4\n\nSample Output 3\n\n5", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 953, "cpu_time_ms": 808, "memory_kb": 65088}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s417206996", "group_id": "codeNet:p02642", "input_text": "\n\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.InputMismatchException;\nimport java.util.Map.Entry;\nimport java.util.TreeMap;\n\npublic class Main {\n\t//author: Nagabhushan S Baddi\n\t\n\tprivate static class Trie {\n\t\tprivate class Node {\n\t\t\tHashMap child;\n\t\t\tint end;\n\t\t\t\n\t\t\tpublic Node() {\n\t\t\t\tchild = new HashMap<>();\n\t\t\t\tend = 0;\n\t\t\t}\n\t\t}\n\t\t\n\t\tprivate Node root;\n\t\t\n\t\tpublic Trie() {\n\t\t\troot = new Node();\n\t\t}\n\t\t\n\t\tpublic void add(TreeMap map) {\n\t\t\tNode node = root;\n\t\t\tfor(Entry e: map.entrySet()) {\n\t\t\t\tfor(int j=0; j e: node.child.entrySet()) {\n\t\t\t\tcount += solve(e.getValue(), e.getKey());\n\t\t\t}\n\t\t\t\n\t\t\treturn count;\n\t\t}\n\t}\n\n\tprivate static int n;\n\tprivate static int[] a;\n\tprivate static int d;\n\tprivate static String s;\n\tprivate static HashMap> g;\n\n\tpublic static void main(String[] args) {\n\t\tn = ini();\n\t\ta = ina(n);\n\t\t\n\t\tint MX = (int)1e6+10;\n\t\tboolean[] map = new boolean[MX];\n\t\t\n\t\tint[] count = new int[MX];\n\t\t\n\t\tfor(int x: a) {\n\t\t\tmap[x] = true;\n\t\t\tcount[x]++;\n\t\t}\n\t\t\n\t\tfor(int x: a) {\n\t\t\tfor(int j=2*x; j> g = new HashMap<>(); //alpha,p\n//\t\t\n//\t\tfor(int x: a) {\n//\t\t\tg.put(x, new HashSet<>());\n//\t\t}\n//\t\tint MX = (int)1e6+5;\n//\t\tboolean[] isPrime = new boolean[MX];\n//\n//\t\tArrays.fill(isPrime, true);\n//\t\t\n//\t\tisPrime[0] = isPrime[1] = false;\n//\t\t\n//\t\tfor(int i=2; ij) {\n////\t\t\t\t\t\t\t\thigh=mid-1;\n////\t\t\t\t\t\t\t} else {\n////\t\t\t\t\t\t\t\tlow=mid+1;\n////\t\t\t\t\t\t\t}\n////\t\t\t\t\t\t}\n////\t\t\t\t\t\tg.get(j).add(new int[] {i, mid});\n//\t\t\t\t\t}\n//\t\t\t\t}\n//\t\t\t}\n//\t\t}\n//\t\t\n//\t\tTrie tree = new Trie();\n//\t\t\n//\t\tfor(int i=0; i mp = new TreeMap<>();\n//\t\t\tfor(int[] u: g.get(a[i])) {\n//\t\t\t\tmp.put(u[0], u[1]);\n//\t\t\t}\n//\t\t\ttree.add(mp);\n//\t\t}\n//\t\t\n//\t\tprintln(tree.solve());\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n//\t\tint[] count = new int[MX];\n//\t\t\n//\t\tfor(int x: a) {\n//\t\t\tfor(int v: g.get(x)) {\n//\t\t\t\tcount[v]++;\n//\t\t\t}\n//\t\t}\n\t\t\n//\t\tint ans = 0;\n//\t\tout:\n//\t\tfor(int i=0; i1) {\n//\t\t\t\t\tcontinue out;\n//\t\t\t\t}\n//\t\t\t}\n//\t\t\tSystem.out.println(a[i]);\n//\t\t\tans++;\n//\t\t}\n//\t\t\n//\t\tprintln(ans);\n\t\t\n\t\tout.flush();\n\t\tout.close();\n\n\t}\n\n\t//CONSTANTS\n\tprivate static final int MOD = (int) 1e9 + 7;\n\n\t//NONPROBLEM CODE\n\n\tprivate static InputReader in = new InputReader(System.in);\n\tprivate static PrintWriter out = new PrintWriter(System.out);\n\n\tprivate static class InputReader {\n\n\t\tprivate final InputStream stream;\n\t\tprivate final byte[] buf = new byte[8192];\n\t\tprivate int curChar, snumChars;\n\n\t\tpublic InputReader(InputStream st) {\n\t\t\tthis.stream = st;\n\t\t}\n\n\t\tpublic int read() {\n\t\t\tif (snumChars == -1)\n\t\t\t\tthrow new InputMismatchException();\n\t\t\tif (curChar >= snumChars) {\n\t\t\t\tcurChar = 0;\n\t\t\t\ttry {\n\t\t\t\t\tsnumChars = stream.read(buf);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t\tif (snumChars <= 0)\n\t\t\t\t\treturn -1;\n\t\t\t}\n\t\t\treturn buf[curChar++];\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\tint c = read();\n\t\t\twhile (isSpaceChar(c)) {\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tint sgn = 1;\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tint res = 0;\n\t\t\tdo {\n\t\t\t\tres *= 10;\n\t\t\t\tres += c - '0';\n\t\t\t\tc = read();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn res * sgn;\n\t\t}\n\n\t\tpublic long nextLong() {\n\t\t\tint c = read();\n\t\t\twhile (isSpaceChar(c)) {\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tint sgn = 1;\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tlong res = 0;\n\t\t\tdo {\n\t\t\t\tres *= 10;\n\t\t\t\tres += c - '0';\n\t\t\t\tc = read();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn res * sgn;\n\t\t}\n\n\t\tpublic String readString() {\n\t\t\tint c = read();\n\t\t\twhile (isSpaceChar(c)) {\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tStringBuilder res = new StringBuilder();\n\t\t\tdo {\n\t\t\t\tres.appendCodePoint(c);\n\t\t\t\tc = read();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn res.toString();\n\t\t}\n\n\t\tpublic String nextLine() {\n\t\t\tint c = read();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = read();\n\t\t\tStringBuilder res = new StringBuilder();\n\t\t\tdo {\n\t\t\t\tres.appendCodePoint(c);\n\t\t\t\tc = read();\n\t\t\t} while (!isEndOfLine(c));\n\t\t\treturn res.toString();\n\t\t}\n\n\t\tpublic boolean isSpaceChar(int c) {\n\t\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t\t}\n\n\t\tprivate boolean isEndOfLine(int c) {\n\t\t\treturn c == '\\n' || c == '\\r' || c == -1;\n\t\t}\n\n\t}\n\n\t//SORT SHORTCUTS\n\n\tprivate static void sort(int[] a) {\n\t\tint n = a.length;\n\t\tInteger[] b = new Integer[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tb[i] = a[i];\n\t\t}\n\n\t\tArrays.sort(b);\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = b[i];\n\t\t}\n\t}\n\n\tprivate static void sort(long[] a) {\n\t\tint n = a.length;\n\t\tLong[] b = new Long[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tb[i] = a[i];\n\t\t}\n\n\t\tArrays.sort(b);\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = b[i];\n\t\t}\n\t}\n\n\t//INPUT SHORTCUTS\n\n\tprivate static int[] ina(int n) {\n\t\tint[] temp = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ttemp[i] = in.nextInt();\n\t\t}\n\t\treturn temp;\n\t}\n\n\tprivate static int ini() {\n\t\treturn in.nextInt();\n\t}\n\n\tprivate static long inl() {\n\t\treturn in.nextLong();\n\t}\n\n\tprivate static String ins() {\n\t\treturn in.readString();\n\t}\n\n\t//PRINT SHORTCUTS\n\n\tprivate static void println(Object... o) {\n\t\tfor (Object x : o) {\n\t\t\tout.write(x + \"\");\n\t\t}\n\t\tout.write(\"\\n\");\n\t}\n\n\tprivate static void pd(Object... o) {\n\t\tfor (Object x : o) {\n\t\t\tout.write(x + \"\");\n\t\t}\n\t\tout.flush();\n\t\tout.write(\"\\n\");\n\t}\n\n\tprivate static void print(Object... o) {\n\t\tfor (Object x : o) {\n\t\t\tout.write(x + \"\");\n\t\t}\n\t}\n\n\t//GRAPH SHORTCUTS\n\n\tprivate static HashMap> intree(int n) {\n\n\t\tHashMap> g = new HashMap<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tg.put(i, new ArrayList<>());\n\t\t}\n\n\t\tfor (int i = 0; i < n - 1; i++) {\n\t\t\tint u = ini() - 1;\n\t\t\tint v = ini() - 1;\n\t\t\tg.get(u).add(v);\n\t\t\tg.get(v).add(u);\n\t\t}\n\n\t\treturn g;\n\t}\n\n\tprivate static HashMap> ingraph(int n, int m) {\n\t\tHashMap> g = new HashMap<>();\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tg.put(i, new ArrayList<>());\n\t\t}\n\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tint u = ini() - 1;\n\t\t\tint v = ini() - 1;\n\t\t\tg.get(u).add(v);\n\t\t\tg.get(v).add(u);\n\t\t}\n\n\t\treturn g;\n\n\t}\n\n\tprivate static HashMap> inweightedgraph(int n, int m) {\n\t\tHashMap> g = new HashMap<>();\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tg.put(i, new ArrayList<>());\n\t\t}\n\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tint u = ini() - 1;\n\t\t\tint v = ini() - 1;\n\t\t\tint w = ini();\n\t\t\tEdge edge = new Edge(u, v, w);\n\t\t\tg.get(u).add(edge);\n\t\t\tg.get(v).add(edge);\n\t\t}\n\n\t\treturn g;\n\n\t}\n\n\tprivate static class Edge implements Comparable {\n\t\tprivate int u, v;\n\t\tprivate long w;\n\n\t\tpublic Edge(int a, int b, long c) {\n\t\t\tu = a;\n\t\t\tv = b;\n\t\t\tw = c;\n\t\t}\n\n\t\tpublic int other(int x) {\n\t\t\treturn (x == u ? v : u);\n\t\t}\n\n\t\tpublic int compareTo(Edge edge) {\n\t\t\treturn Long.compare(w, edge.w);\n\t\t}\n\t}\n\n\tprivate static class Pair {\n\t\tprivate int u, v;\n\n\t\tpublic Pair(int a, int b) {\n\t\t\tu = a;\n\t\t\tv = b;\n\t\t}\n\n\t\tpublic int hashCode() {\n\t\t\treturn u + v + u * v;\n\t\t}\n\n\t\tpublic boolean equals(Object object) {\n\t\t\tPair pair = (Pair) object;\n\t\t\treturn u == pair.u && v == pair.v;\n\t\t}\n\t}\n\n\tprivate static class Node implements Comparable {\n\t\tprivate int u;\n\t\tprivate long dist;\n\n\t\tpublic Node(int a, long b) {\n\t\t\tu = a;\n\t\t\tdist = b;\n\t\t}\n\n\t\tpublic int compareTo(Node node) {\n\t\t\treturn Long.compare(dist, node.dist);\n\t\t}\n\t}\n\n\t//MATHS AND NUMBER THEORY SHORTCUTS\n\n\tprivate static int gcd(int a, int b) {\n\t\t//O(log(min(a,b)))\n\t\tif (b == 0)\n\t\t\treturn a;\n\n\t\treturn gcd(b, a % b);\n\t}\n\n\tprivate static long modExp(long a, long b) {\n\t\tif (b == 0)\n\t\t\treturn 1;\n\n\t\ta %= MOD;\n\n\t\tlong exp = modExp(a, b / 2);\n\n\t\tif (b % 2 == 0) {\n\t\t\treturn (exp * exp) % MOD;\n\t\t} else {\n\t\t\treturn (a * ((exp * exp) % MOD)) % MOD;\n\t\t}\n\t}\n}\n", "language": "Java", "metadata": {"date": 1592186338, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02642/input.txt", "sample_output_relpath": "derived/input_output/data/p02642/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02642/Java/s417206996.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s417206996", "user_id": "u887200576"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "\n\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.InputMismatchException;\nimport java.util.Map.Entry;\nimport java.util.TreeMap;\n\npublic class Main {\n\t//author: Nagabhushan S Baddi\n\t\n\tprivate static class Trie {\n\t\tprivate class Node {\n\t\t\tHashMap child;\n\t\t\tint end;\n\t\t\t\n\t\t\tpublic Node() {\n\t\t\t\tchild = new HashMap<>();\n\t\t\t\tend = 0;\n\t\t\t}\n\t\t}\n\t\t\n\t\tprivate Node root;\n\t\t\n\t\tpublic Trie() {\n\t\t\troot = new Node();\n\t\t}\n\t\t\n\t\tpublic void add(TreeMap map) {\n\t\t\tNode node = root;\n\t\t\tfor(Entry e: map.entrySet()) {\n\t\t\t\tfor(int j=0; j e: node.child.entrySet()) {\n\t\t\t\tcount += solve(e.getValue(), e.getKey());\n\t\t\t}\n\t\t\t\n\t\t\treturn count;\n\t\t}\n\t}\n\n\tprivate static int n;\n\tprivate static int[] a;\n\tprivate static int d;\n\tprivate static String s;\n\tprivate static HashMap> g;\n\n\tpublic static void main(String[] args) {\n\t\tn = ini();\n\t\ta = ina(n);\n\t\t\n\t\tint MX = (int)1e6+10;\n\t\tboolean[] map = new boolean[MX];\n\t\t\n\t\tint[] count = new int[MX];\n\t\t\n\t\tfor(int x: a) {\n\t\t\tmap[x] = true;\n\t\t\tcount[x]++;\n\t\t}\n\t\t\n\t\tfor(int x: a) {\n\t\t\tfor(int j=2*x; j> g = new HashMap<>(); //alpha,p\n//\t\t\n//\t\tfor(int x: a) {\n//\t\t\tg.put(x, new HashSet<>());\n//\t\t}\n//\t\tint MX = (int)1e6+5;\n//\t\tboolean[] isPrime = new boolean[MX];\n//\n//\t\tArrays.fill(isPrime, true);\n//\t\t\n//\t\tisPrime[0] = isPrime[1] = false;\n//\t\t\n//\t\tfor(int i=2; ij) {\n////\t\t\t\t\t\t\t\thigh=mid-1;\n////\t\t\t\t\t\t\t} else {\n////\t\t\t\t\t\t\t\tlow=mid+1;\n////\t\t\t\t\t\t\t}\n////\t\t\t\t\t\t}\n////\t\t\t\t\t\tg.get(j).add(new int[] {i, mid});\n//\t\t\t\t\t}\n//\t\t\t\t}\n//\t\t\t}\n//\t\t}\n//\t\t\n//\t\tTrie tree = new Trie();\n//\t\t\n//\t\tfor(int i=0; i mp = new TreeMap<>();\n//\t\t\tfor(int[] u: g.get(a[i])) {\n//\t\t\t\tmp.put(u[0], u[1]);\n//\t\t\t}\n//\t\t\ttree.add(mp);\n//\t\t}\n//\t\t\n//\t\tprintln(tree.solve());\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n//\t\tint[] count = new int[MX];\n//\t\t\n//\t\tfor(int x: a) {\n//\t\t\tfor(int v: g.get(x)) {\n//\t\t\t\tcount[v]++;\n//\t\t\t}\n//\t\t}\n\t\t\n//\t\tint ans = 0;\n//\t\tout:\n//\t\tfor(int i=0; i1) {\n//\t\t\t\t\tcontinue out;\n//\t\t\t\t}\n//\t\t\t}\n//\t\t\tSystem.out.println(a[i]);\n//\t\t\tans++;\n//\t\t}\n//\t\t\n//\t\tprintln(ans);\n\t\t\n\t\tout.flush();\n\t\tout.close();\n\n\t}\n\n\t//CONSTANTS\n\tprivate static final int MOD = (int) 1e9 + 7;\n\n\t//NONPROBLEM CODE\n\n\tprivate static InputReader in = new InputReader(System.in);\n\tprivate static PrintWriter out = new PrintWriter(System.out);\n\n\tprivate static class InputReader {\n\n\t\tprivate final InputStream stream;\n\t\tprivate final byte[] buf = new byte[8192];\n\t\tprivate int curChar, snumChars;\n\n\t\tpublic InputReader(InputStream st) {\n\t\t\tthis.stream = st;\n\t\t}\n\n\t\tpublic int read() {\n\t\t\tif (snumChars == -1)\n\t\t\t\tthrow new InputMismatchException();\n\t\t\tif (curChar >= snumChars) {\n\t\t\t\tcurChar = 0;\n\t\t\t\ttry {\n\t\t\t\t\tsnumChars = stream.read(buf);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t\tif (snumChars <= 0)\n\t\t\t\t\treturn -1;\n\t\t\t}\n\t\t\treturn buf[curChar++];\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\tint c = read();\n\t\t\twhile (isSpaceChar(c)) {\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tint sgn = 1;\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tint res = 0;\n\t\t\tdo {\n\t\t\t\tres *= 10;\n\t\t\t\tres += c - '0';\n\t\t\t\tc = read();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn res * sgn;\n\t\t}\n\n\t\tpublic long nextLong() {\n\t\t\tint c = read();\n\t\t\twhile (isSpaceChar(c)) {\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tint sgn = 1;\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tlong res = 0;\n\t\t\tdo {\n\t\t\t\tres *= 10;\n\t\t\t\tres += c - '0';\n\t\t\t\tc = read();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn res * sgn;\n\t\t}\n\n\t\tpublic String readString() {\n\t\t\tint c = read();\n\t\t\twhile (isSpaceChar(c)) {\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tStringBuilder res = new StringBuilder();\n\t\t\tdo {\n\t\t\t\tres.appendCodePoint(c);\n\t\t\t\tc = read();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn res.toString();\n\t\t}\n\n\t\tpublic String nextLine() {\n\t\t\tint c = read();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = read();\n\t\t\tStringBuilder res = new StringBuilder();\n\t\t\tdo {\n\t\t\t\tres.appendCodePoint(c);\n\t\t\t\tc = read();\n\t\t\t} while (!isEndOfLine(c));\n\t\t\treturn res.toString();\n\t\t}\n\n\t\tpublic boolean isSpaceChar(int c) {\n\t\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t\t}\n\n\t\tprivate boolean isEndOfLine(int c) {\n\t\t\treturn c == '\\n' || c == '\\r' || c == -1;\n\t\t}\n\n\t}\n\n\t//SORT SHORTCUTS\n\n\tprivate static void sort(int[] a) {\n\t\tint n = a.length;\n\t\tInteger[] b = new Integer[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tb[i] = a[i];\n\t\t}\n\n\t\tArrays.sort(b);\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = b[i];\n\t\t}\n\t}\n\n\tprivate static void sort(long[] a) {\n\t\tint n = a.length;\n\t\tLong[] b = new Long[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tb[i] = a[i];\n\t\t}\n\n\t\tArrays.sort(b);\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = b[i];\n\t\t}\n\t}\n\n\t//INPUT SHORTCUTS\n\n\tprivate static int[] ina(int n) {\n\t\tint[] temp = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ttemp[i] = in.nextInt();\n\t\t}\n\t\treturn temp;\n\t}\n\n\tprivate static int ini() {\n\t\treturn in.nextInt();\n\t}\n\n\tprivate static long inl() {\n\t\treturn in.nextLong();\n\t}\n\n\tprivate static String ins() {\n\t\treturn in.readString();\n\t}\n\n\t//PRINT SHORTCUTS\n\n\tprivate static void println(Object... o) {\n\t\tfor (Object x : o) {\n\t\t\tout.write(x + \"\");\n\t\t}\n\t\tout.write(\"\\n\");\n\t}\n\n\tprivate static void pd(Object... o) {\n\t\tfor (Object x : o) {\n\t\t\tout.write(x + \"\");\n\t\t}\n\t\tout.flush();\n\t\tout.write(\"\\n\");\n\t}\n\n\tprivate static void print(Object... o) {\n\t\tfor (Object x : o) {\n\t\t\tout.write(x + \"\");\n\t\t}\n\t}\n\n\t//GRAPH SHORTCUTS\n\n\tprivate static HashMap> intree(int n) {\n\n\t\tHashMap> g = new HashMap<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tg.put(i, new ArrayList<>());\n\t\t}\n\n\t\tfor (int i = 0; i < n - 1; i++) {\n\t\t\tint u = ini() - 1;\n\t\t\tint v = ini() - 1;\n\t\t\tg.get(u).add(v);\n\t\t\tg.get(v).add(u);\n\t\t}\n\n\t\treturn g;\n\t}\n\n\tprivate static HashMap> ingraph(int n, int m) {\n\t\tHashMap> g = new HashMap<>();\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tg.put(i, new ArrayList<>());\n\t\t}\n\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tint u = ini() - 1;\n\t\t\tint v = ini() - 1;\n\t\t\tg.get(u).add(v);\n\t\t\tg.get(v).add(u);\n\t\t}\n\n\t\treturn g;\n\n\t}\n\n\tprivate static HashMap> inweightedgraph(int n, int m) {\n\t\tHashMap> g = new HashMap<>();\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tg.put(i, new ArrayList<>());\n\t\t}\n\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tint u = ini() - 1;\n\t\t\tint v = ini() - 1;\n\t\t\tint w = ini();\n\t\t\tEdge edge = new Edge(u, v, w);\n\t\t\tg.get(u).add(edge);\n\t\t\tg.get(v).add(edge);\n\t\t}\n\n\t\treturn g;\n\n\t}\n\n\tprivate static class Edge implements Comparable {\n\t\tprivate int u, v;\n\t\tprivate long w;\n\n\t\tpublic Edge(int a, int b, long c) {\n\t\t\tu = a;\n\t\t\tv = b;\n\t\t\tw = c;\n\t\t}\n\n\t\tpublic int other(int x) {\n\t\t\treturn (x == u ? v : u);\n\t\t}\n\n\t\tpublic int compareTo(Edge edge) {\n\t\t\treturn Long.compare(w, edge.w);\n\t\t}\n\t}\n\n\tprivate static class Pair {\n\t\tprivate int u, v;\n\n\t\tpublic Pair(int a, int b) {\n\t\t\tu = a;\n\t\t\tv = b;\n\t\t}\n\n\t\tpublic int hashCode() {\n\t\t\treturn u + v + u * v;\n\t\t}\n\n\t\tpublic boolean equals(Object object) {\n\t\t\tPair pair = (Pair) object;\n\t\t\treturn u == pair.u && v == pair.v;\n\t\t}\n\t}\n\n\tprivate static class Node implements Comparable {\n\t\tprivate int u;\n\t\tprivate long dist;\n\n\t\tpublic Node(int a, long b) {\n\t\t\tu = a;\n\t\t\tdist = b;\n\t\t}\n\n\t\tpublic int compareTo(Node node) {\n\t\t\treturn Long.compare(dist, node.dist);\n\t\t}\n\t}\n\n\t//MATHS AND NUMBER THEORY SHORTCUTS\n\n\tprivate static int gcd(int a, int b) {\n\t\t//O(log(min(a,b)))\n\t\tif (b == 0)\n\t\t\treturn a;\n\n\t\treturn gcd(b, a % b);\n\t}\n\n\tprivate static long modExp(long a, long b) {\n\t\tif (b == 0)\n\t\t\treturn 1;\n\n\t\ta %= MOD;\n\n\t\tlong exp = modExp(a, b / 2);\n\n\t\tif (b % 2 == 0) {\n\t\t\treturn (exp * exp) % MOD;\n\t\t} else {\n\t\t\treturn (a * ((exp * exp) % MOD)) % MOD;\n\t\t}\n\t}\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a number sequence A of length N.\n\nFind the number of integers i \\left(1 \\leq i \\leq N\\right) with the following property:\n\nFor every integer j \\left(1 \\leq j \\leq N\\right) such that i \\neq j , A_j does not divide A_i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^6\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 the answer.\n\nSample Input 1\n\n5\n24 11 8 3 16\n\nSample Output 1\n\n3\n\nThe integers with the property are 2, 3, and 4.\n\nSample Input 2\n\n4\n5 5 5 5\n\nSample Output 2\n\n0\n\nNote that there can be multiple equal numbers.\n\nSample Input 3\n\n10\n33 18 45 28 8 19 89 86 2 4\n\nSample Output 3\n\n5", "sample_input": "5\n24 11 8 3 16\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02642", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a number sequence A of length N.\n\nFind the number of integers i \\left(1 \\leq i \\leq N\\right) with the following property:\n\nFor every integer j \\left(1 \\leq j \\leq N\\right) such that i \\neq j , A_j does not divide A_i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^6\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 the answer.\n\nSample Input 1\n\n5\n24 11 8 3 16\n\nSample Output 1\n\n3\n\nThe integers with the property are 2, 3, and 4.\n\nSample Input 2\n\n4\n5 5 5 5\n\nSample Output 2\n\n0\n\nNote that there can be multiple equal numbers.\n\nSample Input 3\n\n10\n33 18 45 28 8 19 89 86 2 4\n\nSample Output 3\n\n5", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 9179, "cpu_time_ms": 2207, "memory_kb": 42700}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s408506395", "group_id": "codeNet:p02642", "input_text": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\t\n\tpublic static void main(String[] args) {\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tInputReader in = new InputReader(inputStream);\n\t\tPrintWriter out = new PrintWriter(outputStream);\n\t\tSolution sol = new Solution();\n\t\tsol.solve(in, out);\n\t\tout.close();\n\t}\n\n\tprivate static class Solution {\n\t\tfinal int[] a = new int[2_00_000_0];\n\t\tprivate void solve(InputReader in, PrintWriter out) {\n\t\t\tint n = in.ni();\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\ta[i] = in.ni();\n\t\t\t}\n\t\t\tint total = 0;\n\t\t\tfor (int i = 0; i < n; ++i) {\n\t\t\t\tint k=0;\n\t\t\t\tfor (int j = i+1; j < n; ++j) {\n\t\t\t\t\tif (a[i]%a[j] != 0) ++k;\n\t\t\t\t\tif (k == i+1) ++total;\n\t\t\t\t}\n\t\t\t}\n if (total == 0) {\n\t\t\t\tout.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tout.println(total-1);\n\t\t}\n\t}\n\n\tprivate static class InputReader {\n\t\tprivate BufferedReader reader;\n\t\tprivate StringTokenizer tokenizer;\n\n\t\tprivate InputReader(InputStream stream) {\n\t\t\treader = new BufferedReader(new InputStreamReader(stream), 32768);\n\t\t\ttokenizer = null;\n\t\t}\n\n\t\tprivate String n() {\n\t\t\twhile (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\ttokenizer = new StringTokenizer(reader.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new RuntimeException(e);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn tokenizer.nextToken();\n\t\t}\n\n\t\tprivate int ni() {\n\t\t\treturn Integer.parseInt(n());\n\t\t}\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1592185631, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02642/input.txt", "sample_output_relpath": "derived/input_output/data/p02642/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02642/Java/s408506395.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s408506395", "user_id": "u681013601"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\t\n\tpublic static void main(String[] args) {\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tInputReader in = new InputReader(inputStream);\n\t\tPrintWriter out = new PrintWriter(outputStream);\n\t\tSolution sol = new Solution();\n\t\tsol.solve(in, out);\n\t\tout.close();\n\t}\n\n\tprivate static class Solution {\n\t\tfinal int[] a = new int[2_00_000_0];\n\t\tprivate void solve(InputReader in, PrintWriter out) {\n\t\t\tint n = in.ni();\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\ta[i] = in.ni();\n\t\t\t}\n\t\t\tint total = 0;\n\t\t\tfor (int i = 0; i < n; ++i) {\n\t\t\t\tint k=0;\n\t\t\t\tfor (int j = i+1; j < n; ++j) {\n\t\t\t\t\tif (a[i]%a[j] != 0) ++k;\n\t\t\t\t\tif (k == i+1) ++total;\n\t\t\t\t}\n\t\t\t}\n if (total == 0) {\n\t\t\t\tout.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tout.println(total-1);\n\t\t}\n\t}\n\n\tprivate static class InputReader {\n\t\tprivate BufferedReader reader;\n\t\tprivate StringTokenizer tokenizer;\n\n\t\tprivate InputReader(InputStream stream) {\n\t\t\treader = new BufferedReader(new InputStreamReader(stream), 32768);\n\t\t\ttokenizer = null;\n\t\t}\n\n\t\tprivate String n() {\n\t\t\twhile (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\ttokenizer = new StringTokenizer(reader.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new RuntimeException(e);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn tokenizer.nextToken();\n\t\t}\n\n\t\tprivate int ni() {\n\t\t\treturn Integer.parseInt(n());\n\t\t}\n\t}\n\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a number sequence A of length N.\n\nFind the number of integers i \\left(1 \\leq i \\leq N\\right) with the following property:\n\nFor every integer j \\left(1 \\leq j \\leq N\\right) such that i \\neq j , A_j does not divide A_i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^6\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 the answer.\n\nSample Input 1\n\n5\n24 11 8 3 16\n\nSample Output 1\n\n3\n\nThe integers with the property are 2, 3, and 4.\n\nSample Input 2\n\n4\n5 5 5 5\n\nSample Output 2\n\n0\n\nNote that there can be multiple equal numbers.\n\nSample Input 3\n\n10\n33 18 45 28 8 19 89 86 2 4\n\nSample Output 3\n\n5", "sample_input": "5\n24 11 8 3 16\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02642", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a number sequence A of length N.\n\nFind the number of integers i \\left(1 \\leq i \\leq N\\right) with the following property:\n\nFor every integer j \\left(1 \\leq j \\leq N\\right) such that i \\neq j , A_j does not divide A_i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^6\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 the answer.\n\nSample Input 1\n\n5\n24 11 8 3 16\n\nSample Output 1\n\n3\n\nThe integers with the property are 2, 3, and 4.\n\nSample Input 2\n\n4\n5 5 5 5\n\nSample Output 2\n\n0\n\nNote that there can be multiple equal numbers.\n\nSample Input 3\n\n10\n33 18 45 28 8 19 89 86 2 4\n\nSample Output 3\n\n5", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1582, "cpu_time_ms": 2208, "memory_kb": 58448}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s391681028", "group_id": "codeNet:p02642", "input_text": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.io.IOException;\nimport java.util.Random;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\nimport java.util.BitSet;\nimport java.io.BufferedReader;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author AnandOza\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n DNotDivisible solver = new DNotDivisible();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class DNotDivisible {\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.nextInt();\n int[] a = in.readIntArray(n);\n Util.safeSort(a);\n BitSet composite = new BitSet(n);\n int MAX = Util.max(a);\n\n int answer = 0;\n for (int i = 0; i < n; i++) {\n int p = a[i];\n if (composite.get(p)) {\n continue;\n }\n\n if (!(i + 1 < n && a[i + 1] == a[i]))\n answer++;\n\n if (p == 1) {\n break;\n }\n\n for (int j = p; j <= MAX; j += p) {\n composite.set(j);\n }\n }\n\n out.println(answer);\n }\n\n }\n\n static class Util {\n public static int max(int... x) {\n int max = Integer.MIN_VALUE;\n for (int i : x) {\n max = Math.max(i, max);\n }\n return max;\n }\n\n public static void safeSort(int[] x) {\n shuffle(x);\n Arrays.sort(x);\n }\n\n public static void shuffle(int[] x) {\n Random r = new Random();\n\n for (int i = 0; i <= x.length - 2; i++) {\n int j = i + r.nextInt(x.length - i);\n swap(x, i, j);\n }\n }\n\n public static void swap(int[] x, int i, int j) {\n int t = x[i];\n x[i] = x[j];\n x[j] = t;\n }\n\n private Util() {\n }\n\n }\n\n static class InputReader {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public int[] readIntArray(int n) {\n int[] x = new int[n];\n for (int i = 0; i < n; i++) {\n x[i] = nextInt();\n }\n return x;\n }\n\n }\n}\n\n", "language": "Java", "metadata": {"date": 1592185598, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02642/input.txt", "sample_output_relpath": "derived/input_output/data/p02642/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02642/Java/s391681028.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s391681028", "user_id": "u670376790"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.io.IOException;\nimport java.util.Random;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\nimport java.util.BitSet;\nimport java.io.BufferedReader;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author AnandOza\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n DNotDivisible solver = new DNotDivisible();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class DNotDivisible {\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.nextInt();\n int[] a = in.readIntArray(n);\n Util.safeSort(a);\n BitSet composite = new BitSet(n);\n int MAX = Util.max(a);\n\n int answer = 0;\n for (int i = 0; i < n; i++) {\n int p = a[i];\n if (composite.get(p)) {\n continue;\n }\n\n if (!(i + 1 < n && a[i + 1] == a[i]))\n answer++;\n\n if (p == 1) {\n break;\n }\n\n for (int j = p; j <= MAX; j += p) {\n composite.set(j);\n }\n }\n\n out.println(answer);\n }\n\n }\n\n static class Util {\n public static int max(int... x) {\n int max = Integer.MIN_VALUE;\n for (int i : x) {\n max = Math.max(i, max);\n }\n return max;\n }\n\n public static void safeSort(int[] x) {\n shuffle(x);\n Arrays.sort(x);\n }\n\n public static void shuffle(int[] x) {\n Random r = new Random();\n\n for (int i = 0; i <= x.length - 2; i++) {\n int j = i + r.nextInt(x.length - i);\n swap(x, i, j);\n }\n }\n\n public static void swap(int[] x, int i, int j) {\n int t = x[i];\n x[i] = x[j];\n x[j] = t;\n }\n\n private Util() {\n }\n\n }\n\n static class InputReader {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public int[] readIntArray(int n) {\n int[] x = new int[n];\n for (int i = 0; i < n; i++) {\n x[i] = nextInt();\n }\n return x;\n }\n\n }\n}\n\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a number sequence A of length N.\n\nFind the number of integers i \\left(1 \\leq i \\leq N\\right) with the following property:\n\nFor every integer j \\left(1 \\leq j \\leq N\\right) such that i \\neq j , A_j does not divide A_i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^6\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 the answer.\n\nSample Input 1\n\n5\n24 11 8 3 16\n\nSample Output 1\n\n3\n\nThe integers with the property are 2, 3, and 4.\n\nSample Input 2\n\n4\n5 5 5 5\n\nSample Output 2\n\n0\n\nNote that there can be multiple equal numbers.\n\nSample Input 3\n\n10\n33 18 45 28 8 19 89 86 2 4\n\nSample Output 3\n\n5", "sample_input": "5\n24 11 8 3 16\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02642", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a number sequence A of length N.\n\nFind the number of integers i \\left(1 \\leq i \\leq N\\right) with the following property:\n\nFor every integer j \\left(1 \\leq j \\leq N\\right) such that i \\neq j , A_j does not divide A_i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^6\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 the answer.\n\nSample Input 1\n\n5\n24 11 8 3 16\n\nSample Output 1\n\n3\n\nThe integers with the property are 2, 3, and 4.\n\nSample Input 2\n\n4\n5 5 5 5\n\nSample Output 2\n\n0\n\nNote that there can be multiple equal numbers.\n\nSample Input 3\n\n10\n33 18 45 28 8 19 89 86 2 4\n\nSample Output 3\n\n5", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3362, "cpu_time_ms": 313, "memory_kb": 49304}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s017878442", "group_id": "codeNet:p02642", "input_text": "import java.util.*;\n\npublic class Main {\n private static final int MOD = 1_000_000_007;\n private static final String YES = \"Yes\";\n private static final String NO = \"No\";\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int N = sc.nextInt();\n int[] A = new int[N];\n for (int i=0; i ans = new ArrayList();\n if (A[0] == A[N-1]) return 0;\n\n check: for (int i=0; i ans = new ArrayList();\n if (A[0] == A[N-1]) return 0;\n\n check: for (int i=0; i out.close()));\n try {\n main.run(args);\n } catch (Exception e) {\n e.printStackTrace();\n }\n }\n\n private void run(String[] arguments) throws Exception {\n MyScanner sc = new MyScanner();\n out = new PrintWriter(new BufferedOutputStream(System.out));\n\n int n = sc.nextInt();\n TreeSet treeNumbers = new TreeSet<>(Comparator.reverseOrder());\n\n for (int i = 0; i < n; i++) {\n treeNumbers.add(sc.nextInt());\n }\n\n int ans = 0;\n while (!treeNumbers.isEmpty()) {\n\n if (treeNumbers.size() == 1) {\n break;\n }\n\n boolean isOK = true;\n int first = treeNumbers.first();\n\n for (Integer num : treeNumbers) {\n int rest = first % num;\n if (rest == 0) {\n isOK = false;\n treeNumbers.remove(first);\n break;\n }\n }\n if (!isOK) {\n ans++;\n }\n }\n out.println(ans);\n out.close();\n }\n\n /*\n * Form: http://codeforces.com/blog/entry/7018\n */\n private class MyScanner {\n\n BufferedReader br;\n StringTokenizer st;\n\n MyScanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n String nextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1592185350, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02642/input.txt", "sample_output_relpath": "derived/input_output/data/p02642/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02642/Java/s993412809.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s993412809", "user_id": "u327180328"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.io.BufferedOutputStream;\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.Comparator;\nimport java.util.StringTokenizer;\nimport java.util.TreeSet;\n\npublic class Main {\n\n private static PrintWriter out;\n\n public static void main(String[] args) {\n Main main = new Main();\n Runtime.getRuntime().addShutdownHook(new Thread(() -> out.close()));\n try {\n main.run(args);\n } catch (Exception e) {\n e.printStackTrace();\n }\n }\n\n private void run(String[] arguments) throws Exception {\n MyScanner sc = new MyScanner();\n out = new PrintWriter(new BufferedOutputStream(System.out));\n\n int n = sc.nextInt();\n TreeSet treeNumbers = new TreeSet<>(Comparator.reverseOrder());\n\n for (int i = 0; i < n; i++) {\n treeNumbers.add(sc.nextInt());\n }\n\n int ans = 0;\n while (!treeNumbers.isEmpty()) {\n\n if (treeNumbers.size() == 1) {\n break;\n }\n\n boolean isOK = true;\n int first = treeNumbers.first();\n\n for (Integer num : treeNumbers) {\n int rest = first % num;\n if (rest == 0) {\n isOK = false;\n treeNumbers.remove(first);\n break;\n }\n }\n if (!isOK) {\n ans++;\n }\n }\n out.println(ans);\n out.close();\n }\n\n /*\n * Form: http://codeforces.com/blog/entry/7018\n */\n private class MyScanner {\n\n BufferedReader br;\n StringTokenizer st;\n\n MyScanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n String nextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n }\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a number sequence A of length N.\n\nFind the number of integers i \\left(1 \\leq i \\leq N\\right) with the following property:\n\nFor every integer j \\left(1 \\leq j \\leq N\\right) such that i \\neq j , A_j does not divide A_i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^6\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 the answer.\n\nSample Input 1\n\n5\n24 11 8 3 16\n\nSample Output 1\n\n3\n\nThe integers with the property are 2, 3, and 4.\n\nSample Input 2\n\n4\n5 5 5 5\n\nSample Output 2\n\n0\n\nNote that there can be multiple equal numbers.\n\nSample Input 3\n\n10\n33 18 45 28 8 19 89 86 2 4\n\nSample Output 3\n\n5", "sample_input": "5\n24 11 8 3 16\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02642", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a number sequence A of length N.\n\nFind the number of integers i \\left(1 \\leq i \\leq N\\right) with the following property:\n\nFor every integer j \\left(1 \\leq j \\leq N\\right) such that i \\neq j , A_j does not divide A_i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^6\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 the answer.\n\nSample Input 1\n\n5\n24 11 8 3 16\n\nSample Output 1\n\n3\n\nThe integers with the property are 2, 3, and 4.\n\nSample Input 2\n\n4\n5 5 5 5\n\nSample Output 2\n\n0\n\nNote that there can be multiple equal numbers.\n\nSample Input 3\n\n10\n33 18 45 28 8 19 89 86 2 4\n\nSample Output 3\n\n5", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2232, "cpu_time_ms": 559, "memory_kb": 63472}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s283008852", "group_id": "codeNet:p02642", "input_text": "import java.util.Scanner;\npublic class Main {\npublic static void main(String[] args) {\n\tScanner sc = new Scanner(System.in);\n\tint n = sc.nextInt(),p=0,ans=0;\n\tint [] a = new int [n];\n\tfor (int i=0;i0) System.out.println(p);\n\telse {\n\t\tfor (int i=0;i0) System.out.println(p);\n\telse {\n\t\tfor (int i=0;i= 0 && A[i] == A[i - 1]) {\n } else if (used[A[i]]) {\n } else {\n count++;\n }\n if (!used[A[i]]) {\n for (int j = A[i]; j < used.length; j += A[i]) {\n used[j] = true;\n }\n }\n }\n\n System.out.println(count);\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1592184628, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02642/input.txt", "sample_output_relpath": "derived/input_output/data/p02642/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02642/Java/s109713353.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s109713353", "user_id": "u552502395"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n try (Scanner sc = new Scanner(System.in)) {\n int N = sc.nextInt();\n int[] A = new int[N];\n for (int i = 0; i < N; i++) {\n A[i] = sc.nextInt();\n }\n\n Arrays.sort(A);\n\n int count = 0;\n boolean[] used = new boolean[(int) (1e6 + 1)];\n for (int i = 0; i < N; i++) {\n if (i + 1 < N && A[i] == A[i + 1]) {\n } else if (i - 1 >= 0 && A[i] == A[i - 1]) {\n } else if (used[A[i]]) {\n } else {\n count++;\n }\n if (!used[A[i]]) {\n for (int j = A[i]; j < used.length; j += A[i]) {\n used[j] = true;\n }\n }\n }\n\n System.out.println(count);\n }\n }\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a number sequence A of length N.\n\nFind the number of integers i \\left(1 \\leq i \\leq N\\right) with the following property:\n\nFor every integer j \\left(1 \\leq j \\leq N\\right) such that i \\neq j , A_j does not divide A_i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^6\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 the answer.\n\nSample Input 1\n\n5\n24 11 8 3 16\n\nSample Output 1\n\n3\n\nThe integers with the property are 2, 3, and 4.\n\nSample Input 2\n\n4\n5 5 5 5\n\nSample Output 2\n\n0\n\nNote that there can be multiple equal numbers.\n\nSample Input 3\n\n10\n33 18 45 28 8 19 89 86 2 4\n\nSample Output 3\n\n5", "sample_input": "5\n24 11 8 3 16\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02642", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a number sequence A of length N.\n\nFind the number of integers i \\left(1 \\leq i \\leq N\\right) with the following property:\n\nFor every integer j \\left(1 \\leq j \\leq N\\right) such that i \\neq j , A_j does not divide A_i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^6\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 the answer.\n\nSample Input 1\n\n5\n24 11 8 3 16\n\nSample Output 1\n\n3\n\nThe integers with the property are 2, 3, and 4.\n\nSample Input 2\n\n4\n5 5 5 5\n\nSample Output 2\n\n0\n\nNote that there can be multiple equal numbers.\n\nSample Input 3\n\n10\n33 18 45 28 8 19 89 86 2 4\n\nSample Output 3\n\n5", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 971, "cpu_time_ms": 548, "memory_kb": 49928}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s456933027", "group_id": "codeNet:p02642", "input_text": "// created on : Sun Jun 14 2020\n \nimport java.io.*;\nimport java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) throws IOException {\n int n = in.nextInt();\n HashMap map = new HashMap<>();\n for(int i = 0; i < n; i++){\n int num = in.nextInt();\n map.put(num, map.getOrDefault(num, 0) + 1);\n }\n int ans = 0;\n outer:\n for(int num: map.keySet()){\n if(map.get(num) == 1){\n List div = divisors(num);\n for(int d: div){\n if(d != num){\n if(map.containsKey(d)){\n continue outer;\n }\n }\n }\n ans++;\n }\n }\n println(ans);\n in.close();\n out.close();\n }\n\n public static ArrayList divisors(int n){\n ArrayList A = new ArrayList<>();\n for(int i = 1; i*i <= n; i++){\n if(n % i == 0){\n if(i == n/i){\n A.add(i); \n }\n else{\n A.add(i);\n A.add(n/i);\n }\n }\n }\n return A;\n } \n\n static int MIN = Integer.MIN_VALUE;\n static int MAX = Integer.MAX_VALUE;\n static Reader in = new Reader();\n static PrintWriter out = new PrintWriter(System.out);\n\n static int[] readInt(int N) throws IOException { \n \tint arr[] = new int[N];\n \tfor(int i = 0; i < N; i++){ \n \t\tarr[i] = in.nextInt(); \n \t} \n \treturn arr;\n }\n \n static long[] readLong(int N) throws IOException { \n \tlong arr[] = new long[N];\n \tfor(int i = 0; i < N; i++){ \n \t\tarr[i] = in.nextLong(); \n \t} \n \treturn arr;\n }\n \n static void print(Object O) { \n \tout.print(O); \n }\n \n static void println(Object O) { \n \tout.println(O); \n }\n \n static void println(int arr[]) { \n \tfor(int i = 0; i < arr.length; i++){ \n \t\tprint(arr[i] + \" \"); \n \t} \n \tprintln(\"\"); \n }\n \n static void displayRuntime(long startTime){\n long stopTime = System.currentTimeMillis();\n long elapsedTime = stopTime - startTime;\n System.out.println(\"Runtime: \" + elapsedTime / 1000D);\n }\n}\n\nclass Reader {\n BufferedReader reader;\n StringTokenizer tokenizer;\n\n Reader() {\n reader = new BufferedReader(new InputStreamReader(System.in));\n tokenizer = new StringTokenizer(\"\");\n }\n\n String next() throws IOException {\n while (!tokenizer.hasMoreTokens() ) { \n tokenizer = new StringTokenizer(reader.readLine()); \n }\n return tokenizer.nextToken();\n }\n\n int nextInt() throws IOException { \n return Integer.parseInt(next()); \n }\n \n double nextDouble() throws IOException { \n return Double.parseDouble(next());\n }\n \n long nextLong() throws IOException { \n return Long.parseLong(next()); \n }\n \n String nextLine() throws IOException { \n return reader.readLine(); \n }\n \n void close() throws IOException { \n reader.close(); \n }\n}\n", "language": "Java", "metadata": {"date": 1592183927, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02642/input.txt", "sample_output_relpath": "derived/input_output/data/p02642/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02642/Java/s456933027.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s456933027", "user_id": "u633090093"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "// created on : Sun Jun 14 2020\n \nimport java.io.*;\nimport java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) throws IOException {\n int n = in.nextInt();\n HashMap map = new HashMap<>();\n for(int i = 0; i < n; i++){\n int num = in.nextInt();\n map.put(num, map.getOrDefault(num, 0) + 1);\n }\n int ans = 0;\n outer:\n for(int num: map.keySet()){\n if(map.get(num) == 1){\n List div = divisors(num);\n for(int d: div){\n if(d != num){\n if(map.containsKey(d)){\n continue outer;\n }\n }\n }\n ans++;\n }\n }\n println(ans);\n in.close();\n out.close();\n }\n\n public static ArrayList divisors(int n){\n ArrayList A = new ArrayList<>();\n for(int i = 1; i*i <= n; i++){\n if(n % i == 0){\n if(i == n/i){\n A.add(i); \n }\n else{\n A.add(i);\n A.add(n/i);\n }\n }\n }\n return A;\n } \n\n static int MIN = Integer.MIN_VALUE;\n static int MAX = Integer.MAX_VALUE;\n static Reader in = new Reader();\n static PrintWriter out = new PrintWriter(System.out);\n\n static int[] readInt(int N) throws IOException { \n \tint arr[] = new int[N];\n \tfor(int i = 0; i < N; i++){ \n \t\tarr[i] = in.nextInt(); \n \t} \n \treturn arr;\n }\n \n static long[] readLong(int N) throws IOException { \n \tlong arr[] = new long[N];\n \tfor(int i = 0; i < N; i++){ \n \t\tarr[i] = in.nextLong(); \n \t} \n \treturn arr;\n }\n \n static void print(Object O) { \n \tout.print(O); \n }\n \n static void println(Object O) { \n \tout.println(O); \n }\n \n static void println(int arr[]) { \n \tfor(int i = 0; i < arr.length; i++){ \n \t\tprint(arr[i] + \" \"); \n \t} \n \tprintln(\"\"); \n }\n \n static void displayRuntime(long startTime){\n long stopTime = System.currentTimeMillis();\n long elapsedTime = stopTime - startTime;\n System.out.println(\"Runtime: \" + elapsedTime / 1000D);\n }\n}\n\nclass Reader {\n BufferedReader reader;\n StringTokenizer tokenizer;\n\n Reader() {\n reader = new BufferedReader(new InputStreamReader(System.in));\n tokenizer = new StringTokenizer(\"\");\n }\n\n String next() throws IOException {\n while (!tokenizer.hasMoreTokens() ) { \n tokenizer = new StringTokenizer(reader.readLine()); \n }\n return tokenizer.nextToken();\n }\n\n int nextInt() throws IOException { \n return Integer.parseInt(next()); \n }\n \n double nextDouble() throws IOException { \n return Double.parseDouble(next());\n }\n \n long nextLong() throws IOException { \n return Long.parseLong(next()); \n }\n \n String nextLine() throws IOException { \n return reader.readLine(); \n }\n \n void close() throws IOException { \n reader.close(); \n }\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a number sequence A of length N.\n\nFind the number of integers i \\left(1 \\leq i \\leq N\\right) with the following property:\n\nFor every integer j \\left(1 \\leq j \\leq N\\right) such that i \\neq j , A_j does not divide A_i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^6\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 the answer.\n\nSample Input 1\n\n5\n24 11 8 3 16\n\nSample Output 1\n\n3\n\nThe integers with the property are 2, 3, and 4.\n\nSample Input 2\n\n4\n5 5 5 5\n\nSample Output 2\n\n0\n\nNote that there can be multiple equal numbers.\n\nSample Input 3\n\n10\n33 18 45 28 8 19 89 86 2 4\n\nSample Output 3\n\n5", "sample_input": "5\n24 11 8 3 16\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02642", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a number sequence A of length N.\n\nFind the number of integers i \\left(1 \\leq i \\leq N\\right) with the following property:\n\nFor every integer j \\left(1 \\leq j \\leq N\\right) such that i \\neq j , A_j does not divide A_i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^6\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 the answer.\n\nSample Input 1\n\n5\n24 11 8 3 16\n\nSample Output 1\n\n3\n\nThe integers with the property are 2, 3, and 4.\n\nSample Input 2\n\n4\n5 5 5 5\n\nSample Output 2\n\n0\n\nNote that there can be multiple equal numbers.\n\nSample Input 3\n\n10\n33 18 45 28 8 19 89 86 2 4\n\nSample Output 3\n\n5", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3203, "cpu_time_ms": 1104, "memory_kb": 63388}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s323777456", "group_id": "codeNet:p02658", "input_text": "import java.util.*;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong ans = 1;\n\t\tlong max = 1000000000000000000l;\n\t\t// System.out.println(max);\n\t\tList arr = new ArrayList<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarr.add(sc.nextLong());\n\t\t}\n\t\tCollections.sort(arr);\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (arr.get(i) > max) {\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tans *= arr.get(i);\n\t\t\tif (ans > max) {\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (ans == 0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}\n\n\n\n\n\n\n", "language": "Java", "metadata": {"date": 1596160330, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s323777456.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s323777456", "user_id": "u579190390"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong ans = 1;\n\t\tlong max = 1000000000000000000l;\n\t\t// System.out.println(max);\n\t\tList arr = new ArrayList<>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarr.add(sc.nextLong());\n\t\t}\n\t\tCollections.sort(arr);\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (arr.get(i) > max) {\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tans *= arr.get(i);\n\t\t\tif (ans > max) {\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (ans == 0) {\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}\n\n\n\n\n\n\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 604, "cpu_time_ms": 594, "memory_kb": 61700}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s642330233", "group_id": "codeNet:p02658", "input_text": "import java.util.*;\n\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tif(n > 1 && n < 100000) {\n\t\t\tlong total = 1;\n\t\t\tfor(int i = 0;i < n;i++) {\n\t\t\t\tlong y = sc.nextLong();\n\t\t\t\ttotal *= y;\n\t\t\t}\n\t\t\tif(total > 1000000000000000000l) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t}else if(total >= 0){\n\t\t\t\tSystem.out.println(total);\n\t\t\t}\n\t\t}\n }\n}", "language": "Java", "metadata": {"date": 1595360115, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s642330233.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s642330233", "user_id": "u285734280"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tif(n > 1 && n < 100000) {\n\t\t\tlong total = 1;\n\t\t\tfor(int i = 0;i < n;i++) {\n\t\t\t\tlong y = sc.nextLong();\n\t\t\t\ttotal *= y;\n\t\t\t}\n\t\t\tif(total > 1000000000000000000l) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t}else if(total >= 0){\n\t\t\t\tSystem.out.println(total);\n\t\t\t}\n\t\t}\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 409, "cpu_time_ms": 478, "memory_kb": 60188}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s820136286", "group_id": "codeNet:p02658", "input_text": "import java.util.*;\n \npublic class Main {\n \n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n int N = scan.nextInt();\n \n double product = 1;\n double limit = (double) Math.pow(10, 18);\n \n for (int i = 1; i <= N; i++) {\n double A_i = scan.nextDouble();\n product = product * A_i;\n }\n \n if (product > limit) {\n System.out.println(\"-1\");\n return;\n } \n \n else {\n System.out.println(product);\n }\n \n }\n \n}", "language": "Java", "metadata": {"date": 1595002035, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s820136286.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s820136286", "user_id": "u523115706"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.util.*;\n \npublic class Main {\n \n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n int N = scan.nextInt();\n \n double product = 1;\n double limit = (double) Math.pow(10, 18);\n \n for (int i = 1; i <= N; i++) {\n double A_i = scan.nextDouble();\n product = product * A_i;\n }\n \n if (product > limit) {\n System.out.println(\"-1\");\n return;\n } \n \n else {\n System.out.println(product);\n }\n \n }\n \n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 575, "cpu_time_ms": 942, "memory_kb": 63196}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s479850595", "group_id": "codeNet:p02658", "input_text": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] a = new long[n];\n\t\tlong ans = 1;\n\t\tlong max = (long)Math.pow(10,18);\n\t\t\n\t\tfor(int i=0; i 0) {\n\t\t\tarr[t] = sc.nextLong();\n\t\t\tproduct*=arr[t];\n\t\t\tif (arr[t] == 0) {\n\t\t\t\tproduct = 0;\n\t\t\t\tbreak;\n\t\t\t} \n\t\t}\n\t\tSystem.out.println(product <= upperLimit ? product : \"-1\" );\n\t}\n}\n", "language": "Java", "metadata": {"date": 1594397442, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s649809581.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s649809581", "user_id": "u411433053"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\nimport java.lang.*;\n\npublic class Main {\n\tpublic static void main (String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint t = sc.nextInt();\n\t\tlong[] arr = new long[t];\n\t\tlong product = 1; long upperLimit = 1000000000000000000L;\n\t\twhile(t-- > 0) {\n\t\t\tarr[t] = sc.nextLong();\n\t\t\tproduct*=arr[t];\n\t\t\tif (arr[t] == 0) {\n\t\t\t\tproduct = 0;\n\t\t\t\tbreak;\n\t\t\t} \n\t\t}\n\t\tSystem.out.println(product <= upperLimit ? product : \"-1\" );\n\t}\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 467, "cpu_time_ms": 473, "memory_kb": 61844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s867407895", "group_id": "codeNet:p02658", "input_text": "import java.math.BigInteger;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tScanner kb = new Scanner(System.in);\n\t\tBigInteger count = new BigInteger(\"1\");\n\t\tboolean t = true;\n\t\tint n = kb.nextInt();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (t = true) {\n\t\t\t\tlong j = kb.nextLong();\n\t\t\t\tcount = count.multiply(BigInteger.valueOf(j));\n\t\t\t\tif (count.compareTo(new BigInteger(\"1000000000000000000\")) == 1) {\n\t\t\t\t\tt = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tint res = count.compareTo(new BigInteger(\"1000000000000000000\"));\n\t\tif (res == 1) {\n\t\t\tSystem.out.println(-1);\n\t\t} else {\n\t\t\tSystem.out.println(count);\n\t\t}\n\n\t\tkb.close();\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1594334500, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s867407895.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s867407895", "user_id": "u163375557"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.math.BigInteger;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tScanner kb = new Scanner(System.in);\n\t\tBigInteger count = new BigInteger(\"1\");\n\t\tboolean t = true;\n\t\tint n = kb.nextInt();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (t = true) {\n\t\t\t\tlong j = kb.nextLong();\n\t\t\t\tcount = count.multiply(BigInteger.valueOf(j));\n\t\t\t\tif (count.compareTo(new BigInteger(\"1000000000000000000\")) == 1) {\n\t\t\t\t\tt = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tint res = count.compareTo(new BigInteger(\"1000000000000000000\"));\n\t\tif (res == 1) {\n\t\t\tSystem.out.println(-1);\n\t\t} else {\n\t\t\tSystem.out.println(count);\n\t\t}\n\n\t\tkb.close();\n\t}\n\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 692, "cpu_time_ms": 2207, "memory_kb": 49588}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s886041022", "group_id": "codeNet:p02658", "input_text": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.io.BufferedWriter;\nimport java.io.Writer;\nimport java.io.OutputStreamWriter;\nimport java.util.InputMismatchException;\nimport java.io.IOException;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n OutputWriter out = new OutputWriter(outputStream);\n BMultiplication2 solver = new BMultiplication2();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class BMultiplication2 {\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n int ntc = 1;\n// ntc = in.nextInt();\n while ((ntc--) > 0) {\n int n = in.nextInt();\n long[] arr = in.nextLongArray(n);\n long prod = 1;\n boolean ok = true;\n for (int i = 0; i < n; i++) {\n prod *= arr[i];\n if (prod > (long) 1e18) {\n ok = false;\n }\n if (arr[i] == 0) {\n out.println(0);\n return;\n }\n }\n if (!ok) {\n out.println(-1);\n } else {\n out.println(prod);\n }\n }\n }\n\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private InputReader.SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public long nextLong() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }\n\n public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public long[] nextLongArray(int n) {\n return nextLongArray(n, 0);\n }\n\n public long[] nextLongArray(int n, int startFrom) {\n long[] array = new long[n];\n for (int i = startFrom; i < n; ++i) array[i] = nextLong();\n return array;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }\n\n static class OutputWriter {\n private final PrintWriter writer;\n\n public OutputWriter(OutputStream outputStream) {\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n }\n\n public OutputWriter(Writer writer) {\n this.writer = new PrintWriter(writer);\n }\n\n public void close() {\n writer.close();\n }\n\n public void println(long i) {\n writer.println(i);\n }\n\n }\n}\n\n", "language": "Java", "metadata": {"date": 1593914555, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s886041022.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s886041022", "user_id": "u777337771"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.io.BufferedWriter;\nimport java.io.Writer;\nimport java.io.OutputStreamWriter;\nimport java.util.InputMismatchException;\nimport java.io.IOException;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n OutputWriter out = new OutputWriter(outputStream);\n BMultiplication2 solver = new BMultiplication2();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class BMultiplication2 {\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n int ntc = 1;\n// ntc = in.nextInt();\n while ((ntc--) > 0) {\n int n = in.nextInt();\n long[] arr = in.nextLongArray(n);\n long prod = 1;\n boolean ok = true;\n for (int i = 0; i < n; i++) {\n prod *= arr[i];\n if (prod > (long) 1e18) {\n ok = false;\n }\n if (arr[i] == 0) {\n out.println(0);\n return;\n }\n }\n if (!ok) {\n out.println(-1);\n } else {\n out.println(prod);\n }\n }\n }\n\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private InputReader.SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public long nextLong() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }\n\n public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public long[] nextLongArray(int n) {\n return nextLongArray(n, 0);\n }\n\n public long[] nextLongArray(int n, int startFrom) {\n long[] array = new long[n];\n for (int i = startFrom; i < n; ++i) array[i] = nextLong();\n return array;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }\n\n static class OutputWriter {\n private final PrintWriter writer;\n\n public OutputWriter(OutputStream outputStream) {\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n }\n\n public OutputWriter(Writer writer) {\n this.writer = new PrintWriter(writer);\n }\n\n public void close() {\n writer.close();\n }\n\n public void println(long i) {\n writer.println(i);\n }\n\n }\n}\n\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 4928, "cpu_time_ms": 112, "memory_kb": 33960}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s825842305", "group_id": "codeNet:p02658", "input_text": "import java.util.Arrays;\nimport java.util.Scanner;\n \npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n //入力\n \tint n = sc.nextInt();\n long a[] = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextLong();\n }\n \t\t//0を見つけたいので昇順にソート\n Arrays.sort(a);\n \t\t//10の18乗\n final long K = (long) Math.pow(10, 18);\n \t\t//0があるとき\n if (a[0] == 0) {\n System.out.println(0);\n return;\n }\n \n long result = 1;\n \t//取り出した値を格納する変数:順に取り出したい配列\n for (long l : a) {\n if (result > K / l) {\n System.out.println(-1);\n return;\n }\n //取り出した値を掛ける\n result *= l;\n }\n System.out.println(result);\n \n }\n}", "language": "Java", "metadata": {"date": 1593800254, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s825842305.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s825842305", "user_id": "u778581260"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.util.Arrays;\nimport java.util.Scanner;\n \npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n //入力\n \tint n = sc.nextInt();\n long a[] = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextLong();\n }\n \t\t//0を見つけたいので昇順にソート\n Arrays.sort(a);\n \t\t//10の18乗\n final long K = (long) Math.pow(10, 18);\n \t\t//0があるとき\n if (a[0] == 0) {\n System.out.println(0);\n return;\n }\n \n long result = 1;\n \t//取り出した値を格納する変数:順に取り出したい配列\n for (long l : a) {\n if (result > K / l) {\n System.out.println(-1);\n return;\n }\n //取り出した値を掛ける\n result *= l;\n }\n System.out.println(result);\n \n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 941, "cpu_time_ms": 496, "memory_kb": 62316}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s363793028", "group_id": "codeNet:p02658", "input_text": "import java.util.*;\nimport java.math.BigInteger;\n \npublic class Main{\n \n public static void main(String[] args){\n \n Scanner sc = new Scanner(System.in);\n int num = sc.nextInt();\n \n BigInteger ans = BigInteger.ONE;\n while(sc.hasNext()){\n long a = sc.nextLong();\n ans = ans.multiply(BigInteger.valueOf(a));\n }\n long l = (long)Math.pow(10,18);\n BigInteger L = BigInteger.valueOf(l);\n \n if(ans.compareTo(L) <= 0){\n System.out.println(ans);\n }else{\n System.out.println(-1);\n }\n } \n}", "language": "Java", "metadata": {"date": 1593718367, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s363793028.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s363793028", "user_id": "u251825204"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.util.*;\nimport java.math.BigInteger;\n \npublic class Main{\n \n public static void main(String[] args){\n \n Scanner sc = new Scanner(System.in);\n int num = sc.nextInt();\n \n BigInteger ans = BigInteger.ONE;\n while(sc.hasNext()){\n long a = sc.nextLong();\n ans = ans.multiply(BigInteger.valueOf(a));\n }\n long l = (long)Math.pow(10,18);\n BigInteger L = BigInteger.valueOf(l);\n \n if(ans.compareTo(L) <= 0){\n System.out.println(ans);\n }else{\n System.out.println(-1);\n }\n } \n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 563, "cpu_time_ms": 2207, "memory_kb": 62080}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s550726800", "group_id": "codeNet:p02658", "input_text": "import java.util.*; \nimport java.io.*;\n\npublic class Main {\n static StringTokenizer st;\n static BufferedReader br; \n static PrintWriter out;\n \n public static void main(String[] args) throws IOException {\n br = new BufferedReader(new InputStreamReader(System.in));\n\n int N = nextInt();\n long[] input = new long[N];\n\n for (int i=0; i= 18) && ans * input[i] != 1e18){\n //if(ans> 1e18/ input[i]){ \n // > not working, need use <=, because 1e18/ input[i] will lose 0.000001\n if(!(ans<= (long)(1e18)/ input[i])){ \n System.out.println(-1);\n return;\n }\n ans = ans * input[i];\n }\n\n System.out.println(ans);\n \n }\n \n \n public static int nextInt() throws IOException {\n return Integer.parseInt(next());\n }\n public static long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n\n public static double nextDouble() throws IOException {\n return Double.parseDouble(next());\n }\n\n static String next() throws IOException {\n while (st == null || !st.hasMoreTokens())\n st = new StringTokenizer(br.readLine().trim());\n return st.nextToken();\n }\n}\n", "language": "Java", "metadata": {"date": 1593170410, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s550726800.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s550726800", "user_id": "u431953168"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.util.*; \nimport java.io.*;\n\npublic class Main {\n static StringTokenizer st;\n static BufferedReader br; \n static PrintWriter out;\n \n public static void main(String[] args) throws IOException {\n br = new BufferedReader(new InputStreamReader(System.in));\n\n int N = nextInt();\n long[] input = new long[N];\n\n for (int i=0; i= 18) && ans * input[i] != 1e18){\n //if(ans> 1e18/ input[i]){ \n // > not working, need use <=, because 1e18/ input[i] will lose 0.000001\n if(!(ans<= (long)(1e18)/ input[i])){ \n System.out.println(-1);\n return;\n }\n ans = ans * input[i];\n }\n\n System.out.println(ans);\n \n }\n \n \n public static int nextInt() throws IOException {\n return Integer.parseInt(next());\n }\n public static long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n\n public static double nextDouble() throws IOException {\n return Double.parseDouble(next());\n }\n\n static String next() throws IOException {\n while (st == null || !st.hasMoreTokens())\n st = new StringTokenizer(br.readLine().trim());\n return st.nextToken();\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1641, "cpu_time_ms": 218, "memory_kb": 48736}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s415027355", "group_id": "codeNet:p02658", "input_text": "import java.util.*;\nimport java.lang.*;\n\npublic class Main{\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int a = scan.nextInt();\n\n long sum = 1;\n long [] c = new long[a];\n for (int i=0;i18){\n System.out.println(-1);\n return;\n }\n sum*=c[j];\n }\n System.out.println(sum);\n }\n}\n", "language": "Java", "metadata": {"date": 1592946195, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s415027355.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s415027355", "user_id": "u114053864"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.util.*;\nimport java.lang.*;\n\npublic class Main{\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int a = scan.nextInt();\n\n long sum = 1;\n long [] c = new long[a];\n for (int i=0;i18){\n System.out.println(-1);\n return;\n }\n sum*=c[j];\n }\n System.out.println(sum);\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 479, "memory_kb": 61880}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s304266970", "group_id": "codeNet:p02658", "input_text": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long a = 1;\n \n for (int i = 0; i < n; i++) {\n a *= sc.nextInt();\n }\n \n if (a > 1000000000000000000L) a = -1;\n \n System.out.println(a);\n }\n}\n", "language": "Java", "metadata": {"date": 1592004263, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s304266970.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s304266970", "user_id": "u205144881"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long a = 1;\n \n for (int i = 0; i < n; i++) {\n a *= sc.nextInt();\n }\n \n if (a > 1000000000000000000L) a = -1;\n \n System.out.println(a);\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 336, "memory_kb": 48268}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s120762249", "group_id": "codeNet:p02658", "input_text": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.List;\nimport java.util.Scanner;\nimport java.util.ArrayList;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Multiplication2 solver = new Multiplication2();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class Multiplication2 {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int num = in.nextInt();\n long ans = 1;\n\n long border = pow(10, 18);\n List lists = new ArrayList<>();\n\n for (int i = 0; i < num; i++) {\n long a = in.nextLong();\n lists.add(a);\n }\n if (lists.contains(0L)) {\n out.append(\"0\\n\");\n return;\n }\n for (Long a : lists) {\n ans *= a;\n if (ans > border) {\n out.append(\"-1\\n\");\n return;\n }\n }\n out.append(String.valueOf(ans));\n }\n\n static long pow(long x, long n) {\n\n if (n == 0) {\n return 1;\n }\n long result = pow(x, n / 2);\n\n if (n % 2 == 0) {\n return (result * result);\n }\n return ((result * result)) * x;\n }\n\n }\n}\n\n", "language": "Java", "metadata": {"date": 1591823764, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s120762249.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s120762249", "user_id": "u745688558"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.List;\nimport java.util.Scanner;\nimport java.util.ArrayList;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Multiplication2 solver = new Multiplication2();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class Multiplication2 {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int num = in.nextInt();\n long ans = 1;\n\n long border = pow(10, 18);\n List lists = new ArrayList<>();\n\n for (int i = 0; i < num; i++) {\n long a = in.nextLong();\n lists.add(a);\n }\n if (lists.contains(0L)) {\n out.append(\"0\\n\");\n return;\n }\n for (Long a : lists) {\n ans *= a;\n if (ans > border) {\n out.append(\"-1\\n\");\n return;\n }\n }\n out.append(String.valueOf(ans));\n }\n\n static long pow(long x, long n) {\n\n if (n == 0) {\n return 1;\n }\n long result = pow(x, n / 2);\n\n if (n % 2 == 0) {\n return (result * result);\n }\n return ((result * result)) * x;\n }\n\n }\n}\n\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1697, "cpu_time_ms": 499, "memory_kb": 60980}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s351104180", "group_id": "codeNet:p02658", "input_text": "\n\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(final String[] args) {\n Scanner scanner = new Scanner(System.in);\n\n int N = scanner.nextInt();\n\n long result = 1;\n\n long a = (long) Math.pow(10, 18);\n\n for (int i = 0; i < N; i++) {\n long A = scanner.nextLong();\n result = result * A;\n if(result==0){\n break;\n }\n\n if(result<0){\n result=-1;\n }\n }\n\n\n if(a>=result && result>=0){\n System.out.print(result);\n }\n if(a=result && result>=0){\n System.out.print(result);\n }\n if(a list = new ArrayList();\n\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tlist.add(scan.nextLong());\n\t\t}\n\n\t\t// ansに掛け算の結果\n\t\tfor(int i = 0; i < list.size(); i++) {\n\t\t\tans = ans.multiply(BigInteger.valueOf(list.get(i)));\n\t\t}\n\n\t\t//9223372036854775807\n\n\t\t//18446744073709551616\n\t\tSystem.out.println(ans.toString());\n\t\tSystem.out.println(ans.toString().length() );\n\t\tif(ans.toString().length() > 18 ) {\n\t\t\tSystem.out.println(-1);\n\t\t}else {\n\t\t\tSystem.out.println(ans);\n\t\t}\n\n\t}\n\n}", "language": "Java", "metadata": {"date": 1591205654, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s419852735.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s419852735", "user_id": "u510558844"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.math.BigInteger;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner scan = new Scanner(System.in);\n\n\t\t// 整数の数\n\t\tint N = scan.nextInt();\n\n\t\tBigInteger ans = BigInteger.ONE;\n\n\t\tList list = new ArrayList();\n\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tlist.add(scan.nextLong());\n\t\t}\n\n\t\t// ansに掛け算の結果\n\t\tfor(int i = 0; i < list.size(); i++) {\n\t\t\tans = ans.multiply(BigInteger.valueOf(list.get(i)));\n\t\t}\n\n\t\t//9223372036854775807\n\n\t\t//18446744073709551616\n\t\tSystem.out.println(ans.toString());\n\t\tSystem.out.println(ans.toString().length() );\n\t\tif(ans.toString().length() > 18 ) {\n\t\t\tSystem.out.println(-1);\n\t\t}else {\n\t\t\tSystem.out.println(ans);\n\t\t}\n\n\t}\n\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 780, "cpu_time_ms": 2207, "memory_kb": 54060}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s024402047", "group_id": "codeNet:p02658", "input_text": "import java.math.BigInteger;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner scan = new Scanner(System.in);\n\n\t\t// 整数の数\n\t\tint N = scan.nextInt();\n\n\t\tBigInteger ans = BigInteger.ONE;\n\n\t\tList list = new ArrayList();\n\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tlist.add(scan.nextLong());\n\t\t}\n\n\t\t// ansに掛け算の結果\n\t\tfor(int i = 0; i < list.size(); i++) {\n\t\t\tans = ans.multiply(BigInteger.valueOf(list.get(i)));\n\t\t}\n\n\t\t//9223372036854775807\n\n\t\t//18446744073709551616\n\t\tSystem.out.println(ans.toString().length() );\n\t\tif(ans.toString().length() > 19 ) {\n\t\t\tSystem.out.println(-1);\n\t\t}else {\n\t\t\tSystem.out.println(ans.longValue());\n\t\t}\n\n\t}\n\n}", "language": "Java", "metadata": {"date": 1591204896, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s024402047.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s024402047", "user_id": "u510558844"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.math.BigInteger;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner scan = new Scanner(System.in);\n\n\t\t// 整数の数\n\t\tint N = scan.nextInt();\n\n\t\tBigInteger ans = BigInteger.ONE;\n\n\t\tList list = new ArrayList();\n\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tlist.add(scan.nextLong());\n\t\t}\n\n\t\t// ansに掛け算の結果\n\t\tfor(int i = 0; i < list.size(); i++) {\n\t\t\tans = ans.multiply(BigInteger.valueOf(list.get(i)));\n\t\t}\n\n\t\t//9223372036854775807\n\n\t\t//18446744073709551616\n\t\tSystem.out.println(ans.toString().length() );\n\t\tif(ans.toString().length() > 19 ) {\n\t\t\tSystem.out.println(-1);\n\t\t}else {\n\t\t\tSystem.out.println(ans.longValue());\n\t\t}\n\n\t}\n\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2207, "memory_kb": 54040}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s076823649", "group_id": "codeNet:p02658", "input_text": "import java.util.*;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N=sc.nextInt();\n\t\tlong num[]=new long[N];\n\t\tfor(int i=0;iborder/num[i]) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tSystem.exit(0);\n\t\t\t}else {\n\t\t\t\tresult*=num[i];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(result);\n\t}\n}", "language": "Java", "metadata": {"date": 1591055440, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s076823649.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s076823649", "user_id": "u669271572"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N=sc.nextInt();\n\t\tlong num[]=new long[N];\n\t\tfor(int i=0;iborder/num[i]) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tSystem.exit(0);\n\t\t\t}else {\n\t\t\t\tresult*=num[i];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(result);\n\t}\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 468, "memory_kb": 61252}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s131366391", "group_id": "codeNet:p02658", "input_text": "import java.util.*;\nimport java.io.*;\n\npublic class Main {\n\tpublic static void main (String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint t = sc.nextInt();\n\t\tlong[] arr = new long[t];\n\t\tfor (int i=0; i= max) \n\t\t result = -1;\n\t\t System.out.println(result);\n\t}\n}", "language": "Java", "metadata": {"date": 1591043302, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s131366391.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s131366391", "user_id": "u411433053"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\n\npublic class Main {\n\tpublic static void main (String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint t = sc.nextInt();\n\t\tlong[] arr = new long[t];\n\t\tfor (int i=0; i= max) \n\t\t result = -1;\n\t\t System.out.println(result);\n\t}\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 476, "memory_kb": 61240}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s738964228", "group_id": "codeNet:p02658", "input_text": "import java.util.Scanner;\n\npublic class Main { //クラス名はMain\n public static void main(String[] args) {\n //コード\n Scanner sc = new Scanner(System.in);\n int cnt = Integer.parseInt(sc.next());\n int y = 0;\n try {\n for (int i = 0; i < cnt; i++){\n if (i == 0){\n y = Integer.parseInt(sc.next());\n } else {\n y *= Integer.parseInt(sc.next());\n }\n }\n System.out.println(y);\n } catch(Exception e){\n System.out.println(-1);\n }\n\n sc.close();\n }\n}", "language": "Java", "metadata": {"date": 1591040151, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s738964228.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s738964228", "user_id": "u256768162"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main { //クラス名はMain\n public static void main(String[] args) {\n //コード\n Scanner sc = new Scanner(System.in);\n int cnt = Integer.parseInt(sc.next());\n int y = 0;\n try {\n for (int i = 0; i < cnt; i++){\n if (i == 0){\n y = Integer.parseInt(sc.next());\n } else {\n y *= Integer.parseInt(sc.next());\n }\n }\n System.out.println(y);\n } catch(Exception e){\n System.out.println(-1);\n }\n\n sc.close();\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 284, "memory_kb": 57096}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s965945331", "group_id": "codeNet:p02658", "input_text": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Scanner;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main\n{\n public static void main(String[] args)\n {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Task solver = new Task();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class Task\n {\n public void solve(int testNumber, Scanner in, PrintWriter out)\n {\n int N = in.nextInt();\n long A[] = CPUtils.readLongArray(N, in);\n long answer = 1;\n\n for (long a : A)\n {\n if (a == 0)\n {\n out.println(0);\n return;\n }\n }\n for (long a : A)\n {\n answer *= a;\n if (answer < 0)\n {\n out.println(-1);\n return;\n }\n }\n if (answer > 1_000_000_000_000_000_000L)\n {\n out.println(-1);\n return;\n }\n out.println(answer);\n }\n\n }\n\n static class CPUtils\n {\n public static long[] readLongArray(int size, Scanner in)\n {\n long[] array = new long[size];\n for (int i = 0; i < size; i++)\n {\n array[i] = in.nextLong();\n }\n return array;\n }\n\n }\n}\n\n", "language": "Java", "metadata": {"date": 1590998824, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s965945331.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s965945331", "user_id": "u541033696"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Scanner;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main\n{\n public static void main(String[] args)\n {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Task solver = new Task();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class Task\n {\n public void solve(int testNumber, Scanner in, PrintWriter out)\n {\n int N = in.nextInt();\n long A[] = CPUtils.readLongArray(N, in);\n long answer = 1;\n\n for (long a : A)\n {\n if (a == 0)\n {\n out.println(0);\n return;\n }\n }\n for (long a : A)\n {\n answer *= a;\n if (answer < 0)\n {\n out.println(-1);\n return;\n }\n }\n if (answer > 1_000_000_000_000_000_000L)\n {\n out.println(-1);\n return;\n }\n out.println(answer);\n }\n\n }\n\n static class CPUtils\n {\n public static long[] readLongArray(int size, Scanner in)\n {\n long[] array = new long[size];\n for (int i = 0; i < size; i++)\n {\n array[i] = in.nextLong();\n }\n return array;\n }\n\n }\n}\n\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1701, "cpu_time_ms": 394, "memory_kb": 50560}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s181190222", "group_id": "codeNet:p02658", "input_text": "import java.util.*;\nimport java.lang.Math;\npublic class Main {\n public static void main (String [] args)\n {\n long max = (long)Math.pow(10,18);\n Scanner s = new Scanner(System.in);\n \n int len = s.nextInt();\n boolean isZero = false;\n boolean tooLong = false;\n int[] nums = new int[len];\n for(int i = 0; i < len; i++)\n {\n nums[i] = s.nextInt();\n if(nums[i] == 0)\n {\n isZero = true;\n }\n }\n int result = 1;\n \n for(int i = 0; i < len && !isZero; i++)\n {\n if(1000000000000000001L/result >= nums[i])\n {\n result *= nums[i];\n }\n else\n {\n tooLong = true;\n break;\n }\n }\n\n if(isZero)\n {\n System.out.println(0);\n }\n else if(tooLong)\n {\n System.out.println(-1);\n }\n else\n {\n System.out.println(result);\n }\n }\n}", "language": "Java", "metadata": {"date": 1590994551, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s181190222.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s181190222", "user_id": "u434421846"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.util.*;\nimport java.lang.Math;\npublic class Main {\n public static void main (String [] args)\n {\n long max = (long)Math.pow(10,18);\n Scanner s = new Scanner(System.in);\n \n int len = s.nextInt();\n boolean isZero = false;\n boolean tooLong = false;\n int[] nums = new int[len];\n for(int i = 0; i < len; i++)\n {\n nums[i] = s.nextInt();\n if(nums[i] == 0)\n {\n isZero = true;\n }\n }\n int result = 1;\n \n for(int i = 0; i < len && !isZero; i++)\n {\n if(1000000000000000001L/result >= nums[i])\n {\n result *= nums[i];\n }\n else\n {\n tooLong = true;\n break;\n }\n }\n\n if(isZero)\n {\n System.out.println(0);\n }\n else if(tooLong)\n {\n System.out.println(-1);\n }\n else\n {\n System.out.println(result);\n }\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1075, "cpu_time_ms": 348, "memory_kb": 49076}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s842907899", "group_id": "codeNet:p02658", "input_text": "import java.util.*;\nimport java.math.*;\n\nclass Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tfinal int N = sc.nextInt();\n\t\tBigInteger ans = new BigInteger(\"1\");\n\t\tfinal BigInteger TEN_EIGHTEEN = new BigInteger(\"1000000000000000000\");\n\t\tfinal BigInteger ZERO = new BigInteger(\"0\");\n\t\tfinal BigInteger OVER = new BigInteger(\"-1\");\n\t\tString[] s = new String[N];\n\t\tBoolean flag_z = false;\n\t\tfor (int i = 0; i < N; ++i) {\n\t\t\ts[i] = sc.next();\n\t\t\tif (s[i].equals(\"0\")) {\n\t\t\t\tflag_z = true;\n\t\t\t}\n\t\t}\n\t\tif (flag_z) {\n\t\t\tans = ZERO;\n\t\t} else {\n\t\t\tfor (int i = 0; i < N; ++i) {\n\t\t\t\tBigInteger A = new BigInteger(s[i]);\n\t\t\t\tif (A.compareTo(ZERO) != 0) {\n\t\t\t\t\tif (ans.multiply(A).compareTo(TEN_EIGHTEEN) <= 0) {\n\t\t\t\t\t\tans = ans.multiply(A);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tans = OVER;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tans = ZERO;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// System.out.println(\" \"+ans.toString());\n\t\tsc.close();\n\t\tif (ans.compareTo(ZERO) == -1) {\n\t\t\tSystem.out.println(\"-1\");\n\t\t}else{\n\t\t\tSystem.out.println(ans.toString());\n\t\t}\n\t}\n}\n", "language": "Java", "metadata": {"date": 1590989653, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s842907899.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s842907899", "user_id": "u064404510"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.util.*;\nimport java.math.*;\n\nclass Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tfinal int N = sc.nextInt();\n\t\tBigInteger ans = new BigInteger(\"1\");\n\t\tfinal BigInteger TEN_EIGHTEEN = new BigInteger(\"1000000000000000000\");\n\t\tfinal BigInteger ZERO = new BigInteger(\"0\");\n\t\tfinal BigInteger OVER = new BigInteger(\"-1\");\n\t\tString[] s = new String[N];\n\t\tBoolean flag_z = false;\n\t\tfor (int i = 0; i < N; ++i) {\n\t\t\ts[i] = sc.next();\n\t\t\tif (s[i].equals(\"0\")) {\n\t\t\t\tflag_z = true;\n\t\t\t}\n\t\t}\n\t\tif (flag_z) {\n\t\t\tans = ZERO;\n\t\t} else {\n\t\t\tfor (int i = 0; i < N; ++i) {\n\t\t\t\tBigInteger A = new BigInteger(s[i]);\n\t\t\t\tif (A.compareTo(ZERO) != 0) {\n\t\t\t\t\tif (ans.multiply(A).compareTo(TEN_EIGHTEEN) <= 0) {\n\t\t\t\t\t\tans = ans.multiply(A);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tans = OVER;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tans = ZERO;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// System.out.println(\" \"+ans.toString());\n\t\tsc.close();\n\t\tif (ans.compareTo(ZERO) == -1) {\n\t\t\tSystem.out.println(\"-1\");\n\t\t}else{\n\t\t\tSystem.out.println(ans.toString());\n\t\t}\n\t}\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1062, "cpu_time_ms": 337, "memory_kb": 66620}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s660984833", "group_id": "codeNet:p02658", "input_text": "import java.io.FileNotFoundException;\nimport java.io.IOException;\nimport java.io.PrintWriter;\nimport java.io.FileInputStream;\nimport java.util.Arrays;\nimport java.math.BigInteger;\nimport java.io.InputStream;\nimport java.util.InputMismatchException;\n\npublic class Main {\n InputStream is;\n\n int __t__ = 1;\n int __f__ = 0;\n int __FILE_DEBUG_FLAG__ = __f__;\n String __DEBUG_FILE_NAME__ = \"src/D3\";\n\n FastScanner in;\n PrintWriter out;\n\n public void solve() {\n int n = in.nextInt();\n long[] a = in.nextLongArray(n);\n for (int i = 0; i < n; i++) {\n if (a[i] == 0) {\n System.out.println(\"0\");\n return;\n }\n }\n\n long res = 1;\n for (int i = 0; i < n; i++) {\n if ((res * a[i]) / a[i] != res) {\n System.out.println(\"-1\");\n return;\n }\n res *= a[i];\n }\n System.out.println(res > (long) 1e18 ? -1 : res);\n }\n\n public void run() {\n if (__FILE_DEBUG_FLAG__ == __t__) {\n try {\n is = new FileInputStream(__DEBUG_FILE_NAME__);\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n System.out.println(\"FILE_INPUT!\");\n } else {\n is = System.in;\n }\n in = new FastScanner(is);\n out = new PrintWriter(System.out);\n\n solve();\n }\n\n public static void main(final String[] args) {\n new Main().run();\n }\n}\n\n\nclass FastScanner {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n\n public FastScanner(InputStream stream) {\n this.stream = stream;\n // stream = new FileInputStream(new File(\"dec.in\"));\n }\n\n int read() {\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public boolean isEndline(int c) {\n return c == '\\n' || c == '\\r' || c == -1;\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public int[] nextIntArray(int n) {\n int[] array = new int[n];\n for (int i = 0; i < n; i++)\n array[i] = nextInt();\n\n return array;\n }\n\n public int[][] nextIntMap(int n, int m) {\n int[][] map = new int[n][m];\n for (int i = 0; i < n; i++) {\n map[i] = nextIntArray(m);\n }\n return map;\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public long[] nextLongArray(int n) {\n long[] array = new long[n];\n for (int i = 0; i < n; i++)\n array[i] = nextLong();\n\n return array;\n }\n\n public long[][] nextLongMap(int n, int m) {\n long[][] map = new long[n][m];\n for (int i = 0; i < n; i++) {\n map[i] = nextLongArray(m);\n }\n return map;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public double[] nextDoubleArray(int n) {\n double[] array = new double[n];\n for (int i = 0; i < n; i++)\n array[i] = nextDouble();\n\n return array;\n }\n\n public double[][] nextDoubleMap(int n, int m) {\n double[][] map = new double[n][m];\n for (int i = 0; i < n; i++) {\n map[i] = nextDoubleArray(m);\n }\n return map;\n }\n\n public String next() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isSpaceChar(c));\n return res.toString();\n }\n\n public String[] nextStringArray(int n) {\n String[] array = new String[n];\n for (int i = 0; i < n; i++)\n array[i] = next();\n\n return array;\n }\n\n public String nextLine() {\n int c = read();\n while (isEndline(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isEndline(c));\n return res.toString();\n }\n\n public int[][] nextPackedIntArrays(int packN, int size) {\n int[][] res = new int[packN][size];\n for (int i = 0; i < size; i++) {\n for (int j = 0; j < packN; j++) {\n res[j][i] = nextInt();\n }\n }\n return res;\n }\n}\n", "language": "Java", "metadata": {"date": 1590986109, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s660984833.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s660984833", "user_id": "u617255029"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.io.FileNotFoundException;\nimport java.io.IOException;\nimport java.io.PrintWriter;\nimport java.io.FileInputStream;\nimport java.util.Arrays;\nimport java.math.BigInteger;\nimport java.io.InputStream;\nimport java.util.InputMismatchException;\n\npublic class Main {\n InputStream is;\n\n int __t__ = 1;\n int __f__ = 0;\n int __FILE_DEBUG_FLAG__ = __f__;\n String __DEBUG_FILE_NAME__ = \"src/D3\";\n\n FastScanner in;\n PrintWriter out;\n\n public void solve() {\n int n = in.nextInt();\n long[] a = in.nextLongArray(n);\n for (int i = 0; i < n; i++) {\n if (a[i] == 0) {\n System.out.println(\"0\");\n return;\n }\n }\n\n long res = 1;\n for (int i = 0; i < n; i++) {\n if ((res * a[i]) / a[i] != res) {\n System.out.println(\"-1\");\n return;\n }\n res *= a[i];\n }\n System.out.println(res > (long) 1e18 ? -1 : res);\n }\n\n public void run() {\n if (__FILE_DEBUG_FLAG__ == __t__) {\n try {\n is = new FileInputStream(__DEBUG_FILE_NAME__);\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n System.out.println(\"FILE_INPUT!\");\n } else {\n is = System.in;\n }\n in = new FastScanner(is);\n out = new PrintWriter(System.out);\n\n solve();\n }\n\n public static void main(final String[] args) {\n new Main().run();\n }\n}\n\n\nclass FastScanner {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n\n public FastScanner(InputStream stream) {\n this.stream = stream;\n // stream = new FileInputStream(new File(\"dec.in\"));\n }\n\n int read() {\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public boolean isEndline(int c) {\n return c == '\\n' || c == '\\r' || c == -1;\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public int[] nextIntArray(int n) {\n int[] array = new int[n];\n for (int i = 0; i < n; i++)\n array[i] = nextInt();\n\n return array;\n }\n\n public int[][] nextIntMap(int n, int m) {\n int[][] map = new int[n][m];\n for (int i = 0; i < n; i++) {\n map[i] = nextIntArray(m);\n }\n return map;\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public long[] nextLongArray(int n) {\n long[] array = new long[n];\n for (int i = 0; i < n; i++)\n array[i] = nextLong();\n\n return array;\n }\n\n public long[][] nextLongMap(int n, int m) {\n long[][] map = new long[n][m];\n for (int i = 0; i < n; i++) {\n map[i] = nextLongArray(m);\n }\n return map;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public double[] nextDoubleArray(int n) {\n double[] array = new double[n];\n for (int i = 0; i < n; i++)\n array[i] = nextDouble();\n\n return array;\n }\n\n public double[][] nextDoubleMap(int n, int m) {\n double[][] map = new double[n][m];\n for (int i = 0; i < n; i++) {\n map[i] = nextDoubleArray(m);\n }\n return map;\n }\n\n public String next() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isSpaceChar(c));\n return res.toString();\n }\n\n public String[] nextStringArray(int n) {\n String[] array = new String[n];\n for (int i = 0; i < n; i++)\n array[i] = next();\n\n return array;\n }\n\n public String nextLine() {\n int c = read();\n while (isEndline(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isEndline(c));\n return res.toString();\n }\n\n public int[][] nextPackedIntArrays(int packN, int size) {\n int[][] res = new int[packN][size];\n for (int i = 0; i < size; i++) {\n for (int j = 0; j < packN; j++) {\n res[j][i] = nextInt();\n }\n }\n return res;\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 4909, "cpu_time_ms": 164, "memory_kb": 52224}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s860930719", "group_id": "codeNet:p02658", "input_text": "import java.io.*;\nimport java.util.*;\nclass Main{\n\tstatic final long MOD = 1_000_000_007; // 10^9+7\n\tstatic final int MAX = 2_147_483_646; // intMax \n\tstatic final int INF = 1_000_000_000; // 10^9 \n\tpublic static void main(String[] args) throws Exception{\n\t\thayami saori = new hayami();\n\t\tint n = saori.saori_hayami();\n\t\tlong ans = 1L;\n\t\tlong[] a = new long[n];\n\t\tfor(int i = 0;i < n;i++){\n\t\t\ta[i] = saori.saorihayami();\n\t\t\tif(a[i] == 0){\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tfor(int i = 0;i < n;i++){\n\t\t\tif(ans > 1000000000000000000L/a[i]){\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tans *= a[i];\n\t\t}\n\t\tSystem.out.println(ans);\n\t\tsaori.close();\n\t}\n}\n\nclass hayami implements Closeable {\n\tprivate final InputStream in = System.in;\n\tprivate final byte[] hayami = new byte[1024];\n\tprivate int Hayami = 0;\n\tprivate int saori = 0;\n\tprivate boolean HayamiSaori() {\n\t\tif (Hayami < saori) {\n\t\t\treturn true;\n\t\t}else{\n\t\t\tHayami = 0;\n\t\t\ttry {\n\t\t\t\tsaori = in.read(hayami);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (saori <= 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\tprivate int SaoriHayami() { \n\t\tif (HayamiSaori()) {\n return hayami[Hayami++];\n }else{\n return -1;\n }\n\t}\n\tprivate static boolean hayami_saori(int hayami) { \n\t\treturn 33 <= hayami && hayami <= 126;\n\t}\n\tpublic boolean hayamisaori() { \n\t\twhile(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();\n\t}\n\tpublic String nextHayami() {\n\t\tif (!hayamisaori()) throw new NoSuchElementException();\n\t\tStringBuilder hayamin = new StringBuilder();\n\t\tint saori = SaoriHayami();\n\t\twhile(hayami_saori(saori)) {\n\t\t\thayamin.appendCodePoint(saori);\n\t\t\tsaori = SaoriHayami();\n\t\t}\n\t\treturn hayamin.toString();\n\t}\n\tpublic long saorihayami() {//nextLong\n\t\tif (!hayamisaori()) throw new NoSuchElementException();\n\t\tlong hayami = 0;\n\t\tboolean misao = false;\n\t\tint saori = SaoriHayami();\n\t\tif (saori == '-') {\n\t\t\tmisao = true;\n\t\t\tsaori = SaoriHayami();\n\t\t}\n\t\tif (saori < '0' || '9' < saori) {\n\t\t\tthrow new NumberFormatException();\n\t\t}\n\t\twhile(true){\n\t\t\tif ('0' <= saori && saori <= '9') {\n\t\t\t\thayami *= 10;\n\t\t\t\thayami += saori - '0';\n\t\t\t}else if(saori == -1 || !hayami_saori(saori)){\n\t\t\t\treturn misao ? -hayami : hayami;\n\t\t\t}else{\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tsaori = SaoriHayami();\n\t\t}\n\t}\n\tpublic int saori_hayami() {//nextInt\n\t\tlong hayami = saorihayami();\n\t\tif (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();\n\t\treturn (int) hayami;\n\t}\n\tpublic double Hayamin() { //nextDouble\n\t\treturn Double.parseDouble(nextHayami());\n\t}\n\tpublic void close() {\n\t\ttry {\n\t\t\tin.close();\n\t\t} catch (IOException e) {\n\t\t}\n }\n \n}\n", "language": "Java", "metadata": {"date": 1590982870, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s860930719.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s860930719", "user_id": "u676749446"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.io.*;\nimport java.util.*;\nclass Main{\n\tstatic final long MOD = 1_000_000_007; // 10^9+7\n\tstatic final int MAX = 2_147_483_646; // intMax \n\tstatic final int INF = 1_000_000_000; // 10^9 \n\tpublic static void main(String[] args) throws Exception{\n\t\thayami saori = new hayami();\n\t\tint n = saori.saori_hayami();\n\t\tlong ans = 1L;\n\t\tlong[] a = new long[n];\n\t\tfor(int i = 0;i < n;i++){\n\t\t\ta[i] = saori.saorihayami();\n\t\t\tif(a[i] == 0){\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tfor(int i = 0;i < n;i++){\n\t\t\tif(ans > 1000000000000000000L/a[i]){\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tans *= a[i];\n\t\t}\n\t\tSystem.out.println(ans);\n\t\tsaori.close();\n\t}\n}\n\nclass hayami implements Closeable {\n\tprivate final InputStream in = System.in;\n\tprivate final byte[] hayami = new byte[1024];\n\tprivate int Hayami = 0;\n\tprivate int saori = 0;\n\tprivate boolean HayamiSaori() {\n\t\tif (Hayami < saori) {\n\t\t\treturn true;\n\t\t}else{\n\t\t\tHayami = 0;\n\t\t\ttry {\n\t\t\t\tsaori = in.read(hayami);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (saori <= 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\tprivate int SaoriHayami() { \n\t\tif (HayamiSaori()) {\n return hayami[Hayami++];\n }else{\n return -1;\n }\n\t}\n\tprivate static boolean hayami_saori(int hayami) { \n\t\treturn 33 <= hayami && hayami <= 126;\n\t}\n\tpublic boolean hayamisaori() { \n\t\twhile(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();\n\t}\n\tpublic String nextHayami() {\n\t\tif (!hayamisaori()) throw new NoSuchElementException();\n\t\tStringBuilder hayamin = new StringBuilder();\n\t\tint saori = SaoriHayami();\n\t\twhile(hayami_saori(saori)) {\n\t\t\thayamin.appendCodePoint(saori);\n\t\t\tsaori = SaoriHayami();\n\t\t}\n\t\treturn hayamin.toString();\n\t}\n\tpublic long saorihayami() {//nextLong\n\t\tif (!hayamisaori()) throw new NoSuchElementException();\n\t\tlong hayami = 0;\n\t\tboolean misao = false;\n\t\tint saori = SaoriHayami();\n\t\tif (saori == '-') {\n\t\t\tmisao = true;\n\t\t\tsaori = SaoriHayami();\n\t\t}\n\t\tif (saori < '0' || '9' < saori) {\n\t\t\tthrow new NumberFormatException();\n\t\t}\n\t\twhile(true){\n\t\t\tif ('0' <= saori && saori <= '9') {\n\t\t\t\thayami *= 10;\n\t\t\t\thayami += saori - '0';\n\t\t\t}else if(saori == -1 || !hayami_saori(saori)){\n\t\t\t\treturn misao ? -hayami : hayami;\n\t\t\t}else{\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tsaori = SaoriHayami();\n\t\t}\n\t}\n\tpublic int saori_hayami() {//nextInt\n\t\tlong hayami = saorihayami();\n\t\tif (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();\n\t\treturn (int) hayami;\n\t}\n\tpublic double Hayamin() { //nextDouble\n\t\treturn Double.parseDouble(nextHayami());\n\t}\n\tpublic void close() {\n\t\ttry {\n\t\t\tin.close();\n\t\t} catch (IOException e) {\n\t\t}\n }\n \n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2722, "cpu_time_ms": 95, "memory_kb": 34164}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s257272228", "group_id": "codeNet:p02658", "input_text": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n long ans = 1;\n int n = sc.nextInt();\n\n for (int i = 0; i < n; i++) {\n long next = sc.nextLong();\n\n if (ans != -1) {\n if (1000000000000000000L / next < ans) {\n ans = -1;\n } else {\n ans *= next;\n }\n } else {\n if (next == 0) {\n ans = 0;\n break;\n }\n }\n }\n\n System.out.println(ans);\n }\n}\n", "language": "Java", "metadata": {"date": 1590980004, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s257272228.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s257272228", "user_id": "u954503321"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n long ans = 1;\n int n = sc.nextInt();\n\n for (int i = 0; i < n; i++) {\n long next = sc.nextLong();\n\n if (ans != -1) {\n if (1000000000000000000L / next < ans) {\n ans = -1;\n } else {\n ans *= next;\n }\n } else {\n if (next == 0) {\n ans = 0;\n break;\n }\n }\n }\n\n System.out.println(ans);\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 516, "cpu_time_ms": 486, "memory_kb": 59676}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s781819403", "group_id": "codeNet:p02658", "input_text": "import java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int N = scanner.nextInt();\n long prod = 1;\n for (int i = 0; i < N; ++i) {\n prod *= scanner.nextLong();\n if (prod>1000000000000000000L)\n {\n prod=-1;\n break;\n }\n }\n System.out.println(prod);\n }\n}\n", "language": "Java", "metadata": {"date": 1590979951, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s781819403.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s781819403", "user_id": "u347825215"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int N = scanner.nextInt();\n long prod = 1;\n for (int i = 0; i < N; ++i) {\n prod *= scanner.nextLong();\n if (prod>1000000000000000000L)\n {\n prod=-1;\n break;\n }\n }\n System.out.println(prod);\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 501, "cpu_time_ms": 338, "memory_kb": 59980}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s164471526", "group_id": "codeNet:p02658", "input_text": "import java.math.BigDecimal;\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n Long N = sc.nextLong();\n BigDecimal result = new BigDecimal(1);\n BigDecimal max = new BigDecimal(1000000000).multiply(new BigDecimal(1000000000));\n for(long i = 0; i1000000000000000000L){\n \tC=-1;\n }\n }\n \n System.out.println(C);\n \n }\n}", "language": "Java", "metadata": {"date": 1590979039, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s428933388.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s428933388", "user_id": "u429253715"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n\tpublic static void main(String[] arags) {\n Scanner sc = new Scanner(System.in);\n int N=sc.nextInt();\n long[] B=new long[100000];\n long C=1L;\n \n for(int i=0;i1000000000000000000L){\n \tC=-1;\n }\n }\n \n System.out.println(C);\n \n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 500, "memory_kb": 61264}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s673939220", "group_id": "codeNet:p02658", "input_text": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\t// 整数の入力\n\t\tlong n = sc.nextLong(); sc.nextLine();\n long total=1;\n \nfor(int i=0;i(long) Math.pow(10, 18)){\nSystem.out.println(\"-1\");\n }else{\n\t\t// 出力\n\t\tSystem.out.println(total);\n\n }\n\t}\n}", "language": "Java", "metadata": {"date": 1590978617, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s673939220.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s673939220", "user_id": "u832737962"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\t// 整数の入力\n\t\tlong n = sc.nextLong(); sc.nextLine();\n long total=1;\n \nfor(int i=0;i(long) Math.pow(10, 18)){\nSystem.out.println(\"-1\");\n }else{\n\t\t// 出力\n\t\tSystem.out.println(total);\n\n }\n\t}\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 402, "cpu_time_ms": 501, "memory_kb": 59600}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s259011439", "group_id": "codeNet:p02658", "input_text": "import java.util.ArrayList;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tArrayList receive = new ArrayList<>();\n\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\treceive.add(sc.nextLong());\n\t\t}\n\n\t\tsc.close();\n\n\t\tdouble b = Math.pow(10, 18);\n\t\t//System.out.println(b);\n\t\tlong answer = -1;\n\n\t\t//超えるか超えないか\n\t\tfor(int i = 0; i < receive.size(); i++) {\n\t\t\tif(receive.get(i) == 0) {\n\t\t\t\tanswer = 0;\n\t\t\t\tbreak;\n\t\t\t}else {\n\t\t\t\tb = b/receive.get(i);\n\t\t\t}\n\t\t}\n\n\n\t\tif(b >= 1) {\n\t\t\tanswer = 1;\n\t\t\tfor(int i = 0; i < receive.size(); i++) {\n\t\t\t\tanswer *= receive.get(i);\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(answer);\n\t}\n}\n", "language": "Java", "metadata": {"date": 1590978403, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s259011439.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s259011439", "user_id": "u602322080"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.util.ArrayList;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tArrayList receive = new ArrayList<>();\n\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\treceive.add(sc.nextLong());\n\t\t}\n\n\t\tsc.close();\n\n\t\tdouble b = Math.pow(10, 18);\n\t\t//System.out.println(b);\n\t\tlong answer = -1;\n\n\t\t//超えるか超えないか\n\t\tfor(int i = 0; i < receive.size(); i++) {\n\t\t\tif(receive.get(i) == 0) {\n\t\t\t\tanswer = 0;\n\t\t\t\tbreak;\n\t\t\t}else {\n\t\t\t\tb = b/receive.get(i);\n\t\t\t}\n\t\t}\n\n\n\t\tif(b >= 1) {\n\t\t\tanswer = 1;\n\t\t\tfor(int i = 0; i < receive.size(); i++) {\n\t\t\t\tanswer *= receive.get(i);\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(answer);\n\t}\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 776, "cpu_time_ms": 511, "memory_kb": 61020}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s989772052", "group_id": "codeNet:p02658", "input_text": "import java.io.FileNotFoundException;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) throws FileNotFoundException {\n\n// \tFile file = new File(\"src/in.txt\");\n\n //コード\n// \tScanner sc = new Scanner(file);\n \tScanner sc = new Scanner(System.in);\n\n \tint N = sc.nextInt();\n\n \tlong[] A = new long[N];\n\n \tlong times = 1;\n \tlong K = (long) Math.pow(10,18);\n\n \tboolean flg = true;\n \tboolean haszero = false;\n\n \tfor(int i=0;iK) {\n \t\t\tflg = false;\n \t\t\tbreak;\n \t\t}\n \t}\n\n \tif(flg) {\n \t\tSystem.out.println(times);\n \t} else {\n \t\tSystem.out.println(\"-1\");\n \t}\n\n \t} else {\n \t\tSystem.out.println(\"0\");\n \t}\n }\n}", "language": "Java", "metadata": {"date": 1590978310, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s989772052.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s989772052", "user_id": "u397604928"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.io.FileNotFoundException;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) throws FileNotFoundException {\n\n// \tFile file = new File(\"src/in.txt\");\n\n //コード\n// \tScanner sc = new Scanner(file);\n \tScanner sc = new Scanner(System.in);\n\n \tint N = sc.nextInt();\n\n \tlong[] A = new long[N];\n\n \tlong times = 1;\n \tlong K = (long) Math.pow(10,18);\n\n \tboolean flg = true;\n \tboolean haszero = false;\n\n \tfor(int i=0;iK) {\n \t\t\tflg = false;\n \t\t\tbreak;\n \t\t}\n \t}\n\n \tif(flg) {\n \t\tSystem.out.println(times);\n \t} else {\n \t\tSystem.out.println(\"-1\");\n \t}\n\n \t} else {\n \t\tSystem.out.println(\"0\");\n \t}\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1006, "cpu_time_ms": 433, "memory_kb": 50624}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s920165709", "group_id": "codeNet:p02658", "input_text": "import java.util.*;\nimport java.io.*;\nimport java.lang.*;\nimport java.math.*;\nclass Main{\n public static void main(String[] args) throws IOException{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st;\n String str = br.readLine().trim();\n int n = Integer.parseInt(str);\n BigInteger b1 = new BigInteger(\"1\");\n BigInteger b3 ;\n st = new StringTokenizer(br.readLine());\n while(n-->0){\n \n b3 = new BigInteger(st.nextToken());\n //System.out.println(b3);\n b1 = b1.multiply(b3);\n }\n // BigInteger b2 = new BigInteger(\"1000000000000000000\");\n // System.out.println();\n //BigInteger n1 = b2.divide(b1);\n String s = String.valueOf(b1);\n // System.out.println(n1);\n if(b1.toString().length()>18 && s.charAt(s.length()-1)!='0')\n System.out.println(\"-1\");\n else\n System.out.println(b1);\n \n \n \n \n \n \n \n \n }\n}\n", "language": "Java", "metadata": {"date": 1590978304, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s920165709.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s920165709", "user_id": "u547407782"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\nimport java.lang.*;\nimport java.math.*;\nclass Main{\n public static void main(String[] args) throws IOException{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st;\n String str = br.readLine().trim();\n int n = Integer.parseInt(str);\n BigInteger b1 = new BigInteger(\"1\");\n BigInteger b3 ;\n st = new StringTokenizer(br.readLine());\n while(n-->0){\n \n b3 = new BigInteger(st.nextToken());\n //System.out.println(b3);\n b1 = b1.multiply(b3);\n }\n // BigInteger b2 = new BigInteger(\"1000000000000000000\");\n // System.out.println();\n //BigInteger n1 = b2.divide(b1);\n String s = String.valueOf(b1);\n // System.out.println(n1);\n if(b1.toString().length()>18 && s.charAt(s.length()-1)!='0')\n System.out.println(\"-1\");\n else\n System.out.println(b1);\n \n \n \n \n \n \n \n \n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 949, "cpu_time_ms": 2207, "memory_kb": 58120}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s391164004", "group_id": "codeNet:p02658", "input_text": "import java.util.Scanner;\nimport java.math.BigDecimal;\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sn = new Scanner(System.in);\n\t\tInteger cnt = Integer.parseInt(sn.next());\n\t\tBigDecimal sum = new BigDecimal(sn.next());\n for (int i=0; i < cnt -1; i++){\n\t\t\tsum = sum.multiply(new BigDecimal(sn.next()));\n }\n BigDecimal a = new BigDecimal(Math.pow(10, 18));\n \t\tif (sum.compareTo(a) > 0) {\n\t\t\tSystem.out.print(-1);\n\t\t}else {\n\t\t\tSystem.out.print(sum);\n\t\t}\n\t}\n}\n", "language": "Java", "metadata": {"date": 1590977806, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s391164004.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s391164004", "user_id": "u914164919"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.util.Scanner;\nimport java.math.BigDecimal;\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sn = new Scanner(System.in);\n\t\tInteger cnt = Integer.parseInt(sn.next());\n\t\tBigDecimal sum = new BigDecimal(sn.next());\n for (int i=0; i < cnt -1; i++){\n\t\t\tsum = sum.multiply(new BigDecimal(sn.next()));\n }\n BigDecimal a = new BigDecimal(Math.pow(10, 18));\n \t\tif (sum.compareTo(a) > 0) {\n\t\t\tSystem.out.print(-1);\n\t\t}else {\n\t\t\tSystem.out.print(sum);\n\t\t}\n\t}\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 507, "cpu_time_ms": 2208, "memory_kb": 62292}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s809790017", "group_id": "codeNet:p02658", "input_text": "import java.math.BigDecimal;\nimport java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n // 整数の入力\n int length = sc.nextInt();\n BigDecimal ans = new BigDecimal(\"1\");\n boolean isBreak = false;\n BigDecimal max = new BigDecimal(\"1000000000000000000\");\n for (int i = 0; i < length; i++) {\n // 0確認\n BigDecimal tmp = new BigDecimal(sc.next());\n if (tmp.equals(BigDecimal.ZERO)) {\n System.out.println(0);\n isBreak = true;\n break;\n }\n\n ans = ans.multiply(tmp);\n }\n\n if (!isBreak) {\n // 上限超過\n if (ans.compareTo(max) > 1) {\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1590977756, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s809790017.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s809790017", "user_id": "u699658874"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.math.BigDecimal;\nimport java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n // 整数の入力\n int length = sc.nextInt();\n BigDecimal ans = new BigDecimal(\"1\");\n boolean isBreak = false;\n BigDecimal max = new BigDecimal(\"1000000000000000000\");\n for (int i = 0; i < length; i++) {\n // 0確認\n BigDecimal tmp = new BigDecimal(sc.next());\n if (tmp.equals(BigDecimal.ZERO)) {\n System.out.println(0);\n isBreak = true;\n break;\n }\n\n ans = ans.multiply(tmp);\n }\n\n if (!isBreak) {\n // 上限超過\n if (ans.compareTo(max) > 1) {\n System.out.println(-1);\n } else {\n System.out.println(ans);\n }\n }\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 919, "cpu_time_ms": 2208, "memory_kb": 62716}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s932092914", "group_id": "codeNet:p02658", "input_text": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args ) throws Exception {\n Scanner sc = new Scanner(System.in);\n int num = sc.nextInt();\n\tdouble mul[] = new double[num];\n\tfor (int i = 0; i < num; i++) {\n mul[i] = sc.nextInt();\n }\n double ans = 1;\n for (int j = 0; j < num; j++) {\n ans = ans * mul[j];\n }\n \n double b = Math.pow(10,18);\n if (ans <= b) {\n String ansStr = Double.toString(ans);\n int k = ansStr.length();\n System.out.println(ansStr.substring(0,k-2));\n } \n}\n}", "language": "Java", "metadata": {"date": 1590977243, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s932092914.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s932092914", "user_id": "u277630670"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args ) throws Exception {\n Scanner sc = new Scanner(System.in);\n int num = sc.nextInt();\n\tdouble mul[] = new double[num];\n\tfor (int i = 0; i < num; i++) {\n mul[i] = sc.nextInt();\n }\n double ans = 1;\n for (int j = 0; j < num; j++) {\n ans = ans * mul[j];\n }\n \n double b = Math.pow(10,18);\n if (ans <= b) {\n String ansStr = Double.toString(ans);\n int k = ansStr.length();\n System.out.println(ansStr.substring(0,k-2));\n } \n}\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 577, "cpu_time_ms": 356, "memory_kb": 61188}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s038455126", "group_id": "codeNet:p02658", "input_text": "import java.util.Scanner;\nimport java.util.ArrayList;\n\npublic class Main\n{\n public static void main(String[] args)\n {\n String[] lines = getStdin();\n\n int n = Integer.parseInt(lines[0]);\n String[] inputs = lines[1].split(\" \");\n\n Long[] val = new Long[n];\n for (int i = 0;i (long)Math.pow(10, 18)){\n System.out.println(-1);\n return;\n }\n }\n System.out.println((long)mul);\n }\n\n private static String[] getStdin()\n {\n Scanner scanner = new Scanner(System.in);\n ArrayList lines = new ArrayList<>();\n while (scanner.hasNext()) {\n lines.add(scanner.nextLine());\n }\n return lines.toArray(new String[lines.size()]);\n }\n}\n", "language": "Java", "metadata": {"date": 1590977187, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s038455126.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s038455126", "user_id": "u004723708"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.util.Scanner;\nimport java.util.ArrayList;\n\npublic class Main\n{\n public static void main(String[] args)\n {\n String[] lines = getStdin();\n\n int n = Integer.parseInt(lines[0]);\n String[] inputs = lines[1].split(\" \");\n\n Long[] val = new Long[n];\n for (int i = 0;i (long)Math.pow(10, 18)){\n System.out.println(-1);\n return;\n }\n }\n System.out.println((long)mul);\n }\n\n private static String[] getStdin()\n {\n Scanner scanner = new Scanner(System.in);\n ArrayList lines = new ArrayList<>();\n while (scanner.hasNext()) {\n lines.add(scanner.nextLine());\n }\n return lines.toArray(new String[lines.size()]);\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1053, "cpu_time_ms": 367, "memory_kb": 60860}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s876615508", "group_id": "codeNet:p02658", "input_text": "import java.math.*;\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.OutputStreamWriter;\nimport java.io.PrintWriter;\nimport java.io.StreamTokenizer;\nimport java.util.*;\npublic class Main {\n public static long num[] = new long[1023];\n public static int k=0;\n public static void main(String args[])throws IOException\n {\n StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));\n PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));\n in.nextToken();\n int n = (int)in.nval;\n long sum=1,temp=0;\n boolean dui = false;\n long m=1000000000;\n for(int i=0;im*m)\n out.println(-1);\n else\n out.println(sum);\n out.flush();\n }\n }", "language": "Java", "metadata": {"date": 1590977135, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s876615508.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s876615508", "user_id": "u632065351"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.math.*;\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.OutputStreamWriter;\nimport java.io.PrintWriter;\nimport java.io.StreamTokenizer;\nimport java.util.*;\npublic class Main {\n public static long num[] = new long[1023];\n public static int k=0;\n public static void main(String args[])throws IOException\n {\n StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));\n PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));\n in.nextToken();\n int n = (int)in.nval;\n long sum=1,temp=0;\n boolean dui = false;\n long m=1000000000;\n for(int i=0;im*m)\n out.println(-1);\n else\n out.println(sum);\n out.flush();\n }\n }", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 130, "memory_kb": 29032}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s825105056", "group_id": "codeNet:p02658", "input_text": "import java.math.BigDecimal;\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n BigDecimal[] nums = new BigDecimal[N];\n for (int i = 0; i < N; i++) {\n nums[i] = new BigDecimal(sc.next());\n }\n Arrays.sort(nums);\n BigDecimal ans = nums[0];\n if (ans.longValue() == 0) {\n System.out.println(0);\n } else {\n boolean over = false;\n for (int i = 1; i < N; i++) {\n ans = ans.multiply(nums[i]);\n if (1000000000000000000L < ans.longValue()) {\n System.out.println(-1);\n over = true;\n break;\n }\n }\n if (!over) {\n System.out.println(ans.longValue());\n }\n }\n }\n}", "language": "Java", "metadata": {"date": 1590976949, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s825105056.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s825105056", "user_id": "u600841758"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.math.BigDecimal;\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n BigDecimal[] nums = new BigDecimal[N];\n for (int i = 0; i < N; i++) {\n nums[i] = new BigDecimal(sc.next());\n }\n Arrays.sort(nums);\n BigDecimal ans = nums[0];\n if (ans.longValue() == 0) {\n System.out.println(0);\n } else {\n boolean over = false;\n for (int i = 1; i < N; i++) {\n ans = ans.multiply(nums[i]);\n if (1000000000000000000L < ans.longValue()) {\n System.out.println(-1);\n over = true;\n break;\n }\n }\n if (!over) {\n System.out.println(ans.longValue());\n }\n }\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 943, "cpu_time_ms": 490, "memory_kb": 65428}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s405638957", "group_id": "codeNet:p02658", "input_text": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n // Your code here!\n Scanner sc = new Scanner(System.in);\n long N = sc.nextLong();\n List kazu = new ArrayList<>();\n \n long ans = 1;\n long max = 1000000000000000000l;\n for(int i = 0;i < N;i++){\n long temp = sc.nextLong();;\n kazu.add(temp);\n }\n for(int i = 0;i < N;i++){\n long temp2 = kazu.get(i);\n ans *= temp2;\n if(ans >= max){\n break;\n }\n }\n //System.out.println(kazu);\n if(kazu.contains(0l)){\n System.out.println(0);\n }\n else if(ans <= max){\n System.out.println(ans);\n }else{\n System.out.println(-1);\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1590976699, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s405638957.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s405638957", "user_id": "u155138322"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n // Your code here!\n Scanner sc = new Scanner(System.in);\n long N = sc.nextLong();\n List kazu = new ArrayList<>();\n \n long ans = 1;\n long max = 1000000000000000000l;\n for(int i = 0;i < N;i++){\n long temp = sc.nextLong();;\n kazu.add(temp);\n }\n for(int i = 0;i < N;i++){\n long temp2 = kazu.get(i);\n ans *= temp2;\n if(ans >= max){\n break;\n }\n }\n //System.out.println(kazu);\n if(kazu.contains(0l)){\n System.out.println(0);\n }\n else if(ans <= max){\n System.out.println(ans);\n }else{\n System.out.println(-1);\n }\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 490, "memory_kb": 61696}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s818237617", "group_id": "codeNet:p02658", "input_text": "import java.util.*;\n\nclass Main {\n\n\tstatic Scanner sc = new Scanner(System.in);\n\n\tpublic static void main(String[] args) {\n\t\tint n = sc.nextInt();\n\t\tint ans = 1;\n\t\tlong ansl = 1;\n\t\tboolean f = true;\n\t\ttry {\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tint temp = sc.nextInt();\n\t\t\t\tif (temp == 0) {\n \tansl=0;\n \tf=false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tansl *= temp;\n\t\t\t\tans = (int) ansl;\n\t\t\t}\n\n\t\t} catch (InputMismatchException e) {\n\t\t\tSystem.out.println(-1);\n\t\t\tf=false;\n\t\t}\n\t\tif (ansl <= (long) Math.pow(10, 18)&&f) {\n\t\t\tSystem.out.println(ansl);\n\t\t} else {\n\t\t\tif(f)\n\t\t\tSystem.out.println(-1);\n\t\t}\n\n\t}\n}", "language": "Java", "metadata": {"date": 1590976429, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s818237617.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s818237617", "user_id": "u699628455"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.util.*;\n\nclass Main {\n\n\tstatic Scanner sc = new Scanner(System.in);\n\n\tpublic static void main(String[] args) {\n\t\tint n = sc.nextInt();\n\t\tint ans = 1;\n\t\tlong ansl = 1;\n\t\tboolean f = true;\n\t\ttry {\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tint temp = sc.nextInt();\n\t\t\t\tif (temp == 0) {\n \tansl=0;\n \tf=false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tansl *= temp;\n\t\t\t\tans = (int) ansl;\n\t\t\t}\n\n\t\t} catch (InputMismatchException e) {\n\t\t\tSystem.out.println(-1);\n\t\t\tf=false;\n\t\t}\n\t\tif (ansl <= (long) Math.pow(10, 18)&&f) {\n\t\t\tSystem.out.println(ansl);\n\t\t} else {\n\t\t\tif(f)\n\t\t\tSystem.out.println(-1);\n\t\t}\n\n\t}\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 347, "memory_kb": 58504}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s146993292", "group_id": "codeNet:p02658", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tprivate static final long MAX = 1000000000000000000L;\n\tpublic static void main(final String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tboolean over = false;\n\t\tlong answer = 1L;\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tlong A = sc.nextLong();\n\t\t\tif((answer * A) < 0 || (answer * A) > MAX) {\n\t\t\t\tover = true;\n\t\t\t} else {\n\t\t\t\tover = false;\n\t\t\t}\n\t\t\tif(!over) answer *= A;\n\t\t}\n\t\tsc.close();\n\t\tprtln(over ? -1 : answer);\n\t}\n\n\tpublic static void prtln(T t) { System.out.println(t); }\n}", "language": "Java", "metadata": {"date": 1590976096, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s146993292.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s146993292", "user_id": "u176590289"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tprivate static final long MAX = 1000000000000000000L;\n\tpublic static void main(final String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tboolean over = false;\n\t\tlong answer = 1L;\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tlong A = sc.nextLong();\n\t\t\tif((answer * A) < 0 || (answer * A) > MAX) {\n\t\t\t\tover = true;\n\t\t\t} else {\n\t\t\t\tover = false;\n\t\t\t}\n\t\t\tif(!over) answer *= A;\n\t\t}\n\t\tsc.close();\n\t\tprtln(over ? -1 : answer);\n\t}\n\n\tpublic static void prtln(T t) { System.out.println(t); }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 555, "cpu_time_ms": 393, "memory_kb": 49400}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s246426815", "group_id": "codeNet:p02658", "input_text": "\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.Scanner;\n\npublic class Main{\n public static void main(String [] args) {\n Scanner sc = new Scanner(System.in);\n int a= sc.nextInt();\n long sum=1;\n while(a--!=0){\n long x=sc.nextLong();\n sum*=x;\n }\n\n if(sum>(long)1e18) System.out.print(-1);\n else System.out.print((long)sum);\n //System.out.println(101*9901*999999000001l);\n }\n}", "language": "Java", "metadata": {"date": 1590975832, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s246426815.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s246426815", "user_id": "u117427020"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.Scanner;\n\npublic class Main{\n public static void main(String [] args) {\n Scanner sc = new Scanner(System.in);\n int a= sc.nextInt();\n long sum=1;\n while(a--!=0){\n long x=sc.nextLong();\n sum*=x;\n }\n\n if(sum>(long)1e18) System.out.print(-1);\n else System.out.print((long)sum);\n //System.out.println(101*9901*999999000001l);\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 455, "cpu_time_ms": 477, "memory_kb": 59504}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s706623853", "group_id": "codeNet:p02658", "input_text": "import java.util.Scanner;\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner scan =new Scanner(System.in);\n\t\tlong N=scan.nextLong();\n\t\tlong sum=1;\n\t\tint b=18;\n\t\tlong bmax=1;\n\t\tfor(int i=0;i new Double(\n 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10).longValue()) {\n System.out.println(-1);\n flg = false;\n }\n }\n if (flg) {\n System.out.println(totalnum);\n }\n }\n }\n}", "language": "Java", "metadata": {"date": 1590975536, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s560408676.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s560408676", "user_id": "u247775641"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n try (Scanner sc = new Scanner(System.in)) {\n int kazu = Integer.parseInt(sc.next());\n long totalnum = 1;\n Boolean flg = true;\n for (int i = 0; i < kazu; i++) {\n totalnum *= Long.parseLong(sc.next());\n if (totalnum > new Double(\n 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10).longValue()) {\n System.out.println(-1);\n flg = false;\n }\n }\n if (flg) {\n System.out.println(totalnum);\n }\n }\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 768, "memory_kb": 59904}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s002239852", "group_id": "codeNet:p02658", "input_text": "import java.util.*;\npublic class Main{\n\tpublic static void main(String args[]){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tlong[] A = new long[N];\n\t\tlong ans = 1;\n\t\tint keta = 1;\n\t\tint ansKeta = 1;\n\t\tfor(int i = 0;i < N;i++){\n\t\t\tA[i] = sc.nextLong();\n\t\t\tketa = (int)Math.floor(Math.log10((double)A[i]));\n\t\t\tif(A[i] == 0){\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}else if(ansKeta + keta < 19 && ansKeta + keta > -1){\n\t\t\t\tans *= A[i];\n\t\t\t\tansKeta = (int)Math.floor(Math.log10((double)ans));\n\t\t\t}else{\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(ans > 1000000000000000000L){\n\t\t\tans = -1;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}", "language": "Java", "metadata": {"date": 1590975522, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s002239852.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s002239852", "user_id": "u207845630"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.util.*;\npublic class Main{\n\tpublic static void main(String args[]){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tlong[] A = new long[N];\n\t\tlong ans = 1;\n\t\tint keta = 1;\n\t\tint ansKeta = 1;\n\t\tfor(int i = 0;i < N;i++){\n\t\t\tA[i] = sc.nextLong();\n\t\t\tketa = (int)Math.floor(Math.log10((double)A[i]));\n\t\t\tif(A[i] == 0){\n\t\t\t\tans = 0;\n\t\t\t\tbreak;\n\t\t\t}else if(ansKeta + keta < 19 && ansKeta + keta > -1){\n\t\t\t\tans *= A[i];\n\t\t\t\tansKeta = (int)Math.floor(Math.log10((double)ans));\n\t\t\t}else{\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(ans > 1000000000000000000L){\n\t\t\tans = -1;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 624, "cpu_time_ms": 347, "memory_kb": 49680}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s967204661", "group_id": "codeNet:p02658", "input_text": "import java.math.BigInteger;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] numberList = new long[n];\n\t\tBigInteger answer = BigInteger.ONE;\n\t\tfor(int i = 0;i < n;i++) {\n\t\t\tlong number = sc.nextLong();\n\t\t\tif(number == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tnumberList[i] = number;\n\n\t\t}\n\n\t\tfor(int i =0;i < n;i++) {\n\n\t\t\tanswer = answer.multiply(new BigInteger(String.valueOf(numberList[i])));\n\t\t\tif(answer.compareTo(new BigInteger(String.valueOf((long)Math.pow(10, 18)))) >=1) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(answer);\n\t}\n\n}", "language": "Java", "metadata": {"date": 1590975340, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s967204661.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s967204661", "user_id": "u268132693"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.math.BigInteger;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] numberList = new long[n];\n\t\tBigInteger answer = BigInteger.ONE;\n\t\tfor(int i = 0;i < n;i++) {\n\t\t\tlong number = sc.nextLong();\n\t\t\tif(number == 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tnumberList[i] = number;\n\n\t\t}\n\n\t\tfor(int i =0;i < n;i++) {\n\n\t\t\tanswer = answer.multiply(new BigInteger(String.valueOf(numberList[i])));\n\t\t\tif(answer.compareTo(new BigInteger(String.valueOf((long)Math.pow(10, 18)))) >=1) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(answer);\n\t}\n\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 690, "cpu_time_ms": 540, "memory_kb": 61992}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s116694688", "group_id": "codeNet:p02658", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\ttry (Scanner scn = new Scanner(System.in)) {\n\t\t\tint N = scn.nextInt();\n\t\t\tlong[] a = new long[N];\n\n\t\t\tfor(int i = 0; i < N; i++) {\n\t\t\t\ta[i] = scn.nextLong();\n\t\t\t\tif(a[i] == 0) {\n\t\t\t\t\tSystem.out.println(0);\n\t\t\t\t\tSystem.exit(0);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlong max = (long) Math.pow(10, 18);\n\t\t\tlong chk = (long) Math.pow(10, 12);\n\n\t\t\tlong tmp = a[0];\n\t\t\tfor(int i = 1; i < N; i++){\n\t\t\t\tif(tmp > chk && a[i] > chk) {\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\tSystem.exit(0);\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\ttmp = Math.multiplyExact(tmp, a[i]);\n\t\t } catch (ArithmeticException e) {\n\t\t \tSystem.out.println(-1);\n\t\t\t\t\tSystem.exit(0);\n\t\t }\n\t\t\t}\n\t\t\tSystem.out.println(tmp);\n\t\t}\n\t}\n}", "language": "Java", "metadata": {"date": 1590975248, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s116694688.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s116694688", "user_id": "u268397939"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\ttry (Scanner scn = new Scanner(System.in)) {\n\t\t\tint N = scn.nextInt();\n\t\t\tlong[] a = new long[N];\n\n\t\t\tfor(int i = 0; i < N; i++) {\n\t\t\t\ta[i] = scn.nextLong();\n\t\t\t\tif(a[i] == 0) {\n\t\t\t\t\tSystem.out.println(0);\n\t\t\t\t\tSystem.exit(0);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlong max = (long) Math.pow(10, 18);\n\t\t\tlong chk = (long) Math.pow(10, 12);\n\n\t\t\tlong tmp = a[0];\n\t\t\tfor(int i = 1; i < N; i++){\n\t\t\t\tif(tmp > chk && a[i] > chk) {\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\tSystem.exit(0);\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\ttmp = Math.multiplyExact(tmp, a[i]);\n\t\t } catch (ArithmeticException e) {\n\t\t \tSystem.out.println(-1);\n\t\t\t\t\tSystem.exit(0);\n\t\t }\n\t\t\t}\n\t\t\tSystem.out.println(tmp);\n\t\t}\n\t}\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 756, "cpu_time_ms": 453, "memory_kb": 61184}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s696578251", "group_id": "codeNet:p02658", "input_text": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\npublic class Main {\n public static void main(String args[]) throws IOException {\n\n\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\tlong N = Long.parseLong(br.readLine());\n\tString array[] = br.readLine().split(\" \");\n\tlong result = 1;\n\tfor (int i = 0; i < N; i++) {\n\t result *= Long.parseLong(array[i]);\n\t if (result > 1000000000000000000L) {\n\t\tresult = -1;\n\t }\n\t}\n\n\tSystem.out.println(result);\n\n }\n}", "language": "Java", "metadata": {"date": 1590975062, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s696578251.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s696578251", "user_id": "u768246830"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\npublic class Main {\n public static void main(String args[]) throws IOException {\n\n\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\tlong N = Long.parseLong(br.readLine());\n\tString array[] = br.readLine().split(\" \");\n\tlong result = 1;\n\tfor (int i = 0; i < N; i++) {\n\t result *= Long.parseLong(array[i]);\n\t if (result > 1000000000000000000L) {\n\t\tresult = -1;\n\t }\n\t}\n\n\tSystem.out.println(result);\n\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 534, "cpu_time_ms": 204, "memory_kb": 49360}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s375620223", "group_id": "codeNet:p02658", "input_text": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.*;\n\npublic class Main {\n private static final int MOD = (int) Math.pow(10, 9);\n private static final long EIGHT = (long) 1e18;\n private static final int[][] DIRS = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};\n\n public static void main(String[] args) {\n FastReader sc = new FastReader();\n int n = sc.nextInt();\n long res = 1;\n long[] nums = new long[n];\n for (int i = 0; i < n; i++) {\n long m = sc.nextLong();\n if (m == 0) {\n print(\"0\");\n System.exit(0);\n }\n nums[i] = m;\n }\n\n for (int i = 0; i < n; i++) {\n if (res >= (EIGHT)) {\n res = -1;\n break;\n }\n res *= nums[i];\n if (res > (EIGHT)) {\n res = -1;\n break;\n }\n }\n\n print(\"\"+res);\n System.exit(0);\n }\n\n static private void swap(int[] nums, int x, int y) {\n int tmp = nums[x];\n nums[x] = nums[y];\n nums[y] = tmp;\n }\n\n static private void reverse(int[] nums, int left, int right) {\n while (left < right) {\n swap(nums, left, right);\n left++;\n right--;\n }\n }\n\n static private boolean findNextPermutation(int[] nums) {\n if (nums.length <= 1) {\n return false;\n }\n\n int last = nums.length - 2;\n\n while (last >= 0) {\n if (nums[last] < nums[last + 1]){\n break;\n }\n last--;\n }\n\n if (last < 0) { return false; }\n int nextGenerater = nums.length - 1;\n\n for (int i = nums.length - 1; i > last; i--) {\n if (nums[i] > nums[last]) {\n nextGenerater = i;\n break;\n }\n }\n\n swap(nums, nextGenerater, last);\n reverse(nums, last + 1, nums.length - 1);\n return true;\n }\n\n static private int[] generateNArray(int n) {\n int[] res = new int[n];\n\n for (int i = 0; i < n; i++) {\n res[i] = i + 1;\n }\n\n return res;\n }\n\n static private void print(String s) {\n System.out.println(s);\n }\n\n static private void printArray(int[] e) {\n for (int s: e) {\n System.out.print(s + \" \");\n }\n print(\"\");\n }\n\n static private int log2(int x) {\n return (int)(Math.log(x) / Math.log(2));\n }\n\n static private long gcd(long m, long n) {\n if (m < n) { return gcd(n, m); }\n if (m % n == 0) { return n; }\n return gcd(n, m%n);\n }\n\n static class FastReader {\n BufferedReader br;\n StringTokenizer st;\n\n public FastReader() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n String nextLine() {\n String str = \"\";\n try{\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1590974753, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s375620223.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s375620223", "user_id": "u587721314"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.*;\n\npublic class Main {\n private static final int MOD = (int) Math.pow(10, 9);\n private static final long EIGHT = (long) 1e18;\n private static final int[][] DIRS = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};\n\n public static void main(String[] args) {\n FastReader sc = new FastReader();\n int n = sc.nextInt();\n long res = 1;\n long[] nums = new long[n];\n for (int i = 0; i < n; i++) {\n long m = sc.nextLong();\n if (m == 0) {\n print(\"0\");\n System.exit(0);\n }\n nums[i] = m;\n }\n\n for (int i = 0; i < n; i++) {\n if (res >= (EIGHT)) {\n res = -1;\n break;\n }\n res *= nums[i];\n if (res > (EIGHT)) {\n res = -1;\n break;\n }\n }\n\n print(\"\"+res);\n System.exit(0);\n }\n\n static private void swap(int[] nums, int x, int y) {\n int tmp = nums[x];\n nums[x] = nums[y];\n nums[y] = tmp;\n }\n\n static private void reverse(int[] nums, int left, int right) {\n while (left < right) {\n swap(nums, left, right);\n left++;\n right--;\n }\n }\n\n static private boolean findNextPermutation(int[] nums) {\n if (nums.length <= 1) {\n return false;\n }\n\n int last = nums.length - 2;\n\n while (last >= 0) {\n if (nums[last] < nums[last + 1]){\n break;\n }\n last--;\n }\n\n if (last < 0) { return false; }\n int nextGenerater = nums.length - 1;\n\n for (int i = nums.length - 1; i > last; i--) {\n if (nums[i] > nums[last]) {\n nextGenerater = i;\n break;\n }\n }\n\n swap(nums, nextGenerater, last);\n reverse(nums, last + 1, nums.length - 1);\n return true;\n }\n\n static private int[] generateNArray(int n) {\n int[] res = new int[n];\n\n for (int i = 0; i < n; i++) {\n res[i] = i + 1;\n }\n\n return res;\n }\n\n static private void print(String s) {\n System.out.println(s);\n }\n\n static private void printArray(int[] e) {\n for (int s: e) {\n System.out.print(s + \" \");\n }\n print(\"\");\n }\n\n static private int log2(int x) {\n return (int)(Math.log(x) / Math.log(2));\n }\n\n static private long gcd(long m, long n) {\n if (m < n) { return gcd(n, m); }\n if (m % n == 0) { return n; }\n return gcd(n, m%n);\n }\n\n static class FastReader {\n BufferedReader br;\n StringTokenizer st;\n\n public FastReader() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n String nextLine() {\n String str = \"\";\n try{\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3736, "cpu_time_ms": 254, "memory_kb": 51252}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s841552613", "group_id": "codeNet:p02658", "input_text": "import java.util.Map.Entry;\nimport java.util.*;\nimport java.math.*;\nimport org.w3c.dom.css.Counter;\n \npublic class Main{\n public static void main(final String[] args){\n \n final Scanner sc = new Scanner(System.in);\n final int N = sc.nextInt();\n long An = 1;\n long temp =1;\n int flag=0;\n //final long answer=1;\n final long max = 1000000000000000000l;\n\n\n for(long i = 0; i < N; i++) {\n temp = sc.nextInt();\n if(temp == 0){\n System.out.println(0);\n return;\n }else{\n An = An * temp;\n }\n if(An >max){\n flag = 1;\n An =1;\n }\n }\n\n if(flag != 0){\n System.out.println(-1);\n }else{\n System.out.println(An);\n }\n \n }\n}", "language": "Java", "metadata": {"date": 1590974542, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s841552613.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s841552613", "user_id": "u186052266"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.util.Map.Entry;\nimport java.util.*;\nimport java.math.*;\nimport org.w3c.dom.css.Counter;\n \npublic class Main{\n public static void main(final String[] args){\n \n final Scanner sc = new Scanner(System.in);\n final int N = sc.nextInt();\n long An = 1;\n long temp =1;\n int flag=0;\n //final long answer=1;\n final long max = 1000000000000000000l;\n\n\n for(long i = 0; i < N; i++) {\n temp = sc.nextInt();\n if(temp == 0){\n System.out.println(0);\n return;\n }else{\n An = An * temp;\n }\n if(An >max){\n flag = 1;\n An =1;\n }\n }\n\n if(flag != 0){\n System.out.println(-1);\n }else{\n System.out.println(An);\n }\n \n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 860, "cpu_time_ms": 350, "memory_kb": 59608}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s286516359", "group_id": "codeNet:p02658", "input_text": "import java.util.*;\nimport java.math.*;\n\npublic class Main {\n\n public static void main (String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n BigDecimal[] A = new BigDecimal[N+1];\n BigDecimal a = new BigDecimal(1);\n BigDecimal b = new BigDecimal(Math.pow(10,18));\n for (int i =1; i<=N; i++) {\n A[i] = sc.nextBigDecimal();\n a = a.multiply(A[i]);\n if (i == N) {\n if (a.compareTo(b) > 0) {\n a = new BigDecimal(-1);\n break;\n }\n }\n }\n System.out.println(a);\n }\n}", "language": "Java", "metadata": {"date": 1590974526, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s286516359.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s286516359", "user_id": "u538283043"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.util.*;\nimport java.math.*;\n\npublic class Main {\n\n public static void main (String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n BigDecimal[] A = new BigDecimal[N+1];\n BigDecimal a = new BigDecimal(1);\n BigDecimal b = new BigDecimal(Math.pow(10,18));\n for (int i =1; i<=N; i++) {\n A[i] = sc.nextBigDecimal();\n a = a.multiply(A[i]);\n if (i == N) {\n if (a.compareTo(b) > 0) {\n a = new BigDecimal(-1);\n break;\n }\n }\n }\n System.out.println(a);\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 556, "cpu_time_ms": 2208, "memory_kb": 54104}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s543706414", "group_id": "codeNet:p02658", "input_text": "import java.util.*;\npublic class Main{\n public static void main (String args[]){\n Scanner sc = new Scanner(System.in);\n \n int n = sc.nextInt();\n \n long ans = 1;\n \n long max = 1000000000000000000L;\n \n for(int i = 0; i < n; i++){\n long l = sc.nextLong();\n ans = ans*l;\n }\n \n if (ans > max){\n ans = -1;\n }\n \n System.out.println(ans);\n }\n}", "language": "Java", "metadata": {"date": 1590974438, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s543706414.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s543706414", "user_id": "u819124222"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.util.*;\npublic class Main{\n public static void main (String args[]){\n Scanner sc = new Scanner(System.in);\n \n int n = sc.nextInt();\n \n long ans = 1;\n \n long max = 1000000000000000000L;\n \n for(int i = 0; i < n; i++){\n long l = sc.nextLong();\n ans = ans*l;\n }\n \n if (ans > max){\n ans = -1;\n }\n \n System.out.println(ans);\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 488, "memory_kb": 59704}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s547057821", "group_id": "codeNet:p02658", "input_text": "// created on : Sun May 31 2020\n \n\nimport java.io.*;\nimport java.math.BigInteger;\nimport java.util.*;\n\npublic class Main{\n\n public static void main(String[] args) throws IOException {\n int N = in.nextInt();\n long A[] = new long[N];\n boolean zero = false;\n for(int i = 0; i < N; i++){\n A[i] = in.nextLong();\n if(A[i] == 0){\n zero = true;\n }\n }\n \n if(zero){\n println(0);\n }\n else{\n BigInteger limit = new BigInteger(\"1000000000000000000\");\n BigInteger a = new BigInteger(\"1\");\n boolean overflow = false;\n for(int i = 0; i < N; i++){\n a = a.multiply(BigInteger.valueOf(A[i]));\n if(a.compareTo(limit) > 0){\n overflow = true;\n }\n }\n\n if(overflow){\n println(-1);\n }\n else{\n println(a);\n }\n }\n in.close();\n out.close();\n }\n\n static int MIN = Integer.MIN_VALUE;\n static int MAX = Integer.MAX_VALUE;\n static Reader in = new Reader();\n static PrintWriter out = new PrintWriter(System.out);\n\n static int[] readInt(int N) throws IOException { \n \tint arr[] = new int[N];\n \tfor(int i = 0; i < N; i++){ \n \t\tarr[i] = in.nextInt(); \n \t} \n \treturn arr;\n }\n \n static long[] readLong(int N) throws IOException { \n \tlong arr[] = new long[N];\n \tfor(int i = 0; i < N; i++){ \n \t\tarr[i] = in.nextLong(); \n \t} \n \treturn arr;\n }\n \n static String[] readString(int N) throws IOException { \n \tString arr[] = new String[N];\n \tfor(int i = 0; i < N; i++){ \n \t\tarr[i] = in.next(); \n \t} \n \treturn arr;\n }\n \n static void print(Object O) { \n \tout.print(O); \n }\n \n static void println(Object O) { \n \tout.println(O); \n }\n \n static void println(int arr[]) { \n \tfor(int i = 0; i < arr.length; i++){ \n \t\tprint(arr[i] + \" \"); \n \t} \n \tprintln(\"\"); \n }\n \n static void debug(Object ... O) { \n \tfor(Object obj: O){\n \t\tSystem.out.print(obj + \" \");\n \t}\n \tSystem.out.println();\n }\n}\n\nclass Reader {\n BufferedReader reader;\n StringTokenizer tokenizer;\n\n Reader() {\n reader = new BufferedReader(new InputStreamReader(System.in));\n tokenizer = new StringTokenizer(\"\");\n }\n\n String next() throws IOException {\n while (!tokenizer.hasMoreTokens() ) { \n tokenizer = new StringTokenizer(reader.readLine()); \n }\n return tokenizer.nextToken();\n }\n\n int nextInt() throws IOException { \n return Integer.parseInt(next()); \n }\n \n double nextDouble() throws IOException { \n return Double.parseDouble(next());\n }\n \n long nextLong() throws IOException { \n return Long.parseLong(next()); \n }\n \n String nextLine() throws IOException { \n return reader.readLine(); \n }\n \n void close() throws IOException { \n reader.close(); \n }\n}", "language": "Java", "metadata": {"date": 1590974415, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s547057821.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s547057821", "user_id": "u633090093"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "// created on : Sun May 31 2020\n \n\nimport java.io.*;\nimport java.math.BigInteger;\nimport java.util.*;\n\npublic class Main{\n\n public static void main(String[] args) throws IOException {\n int N = in.nextInt();\n long A[] = new long[N];\n boolean zero = false;\n for(int i = 0; i < N; i++){\n A[i] = in.nextLong();\n if(A[i] == 0){\n zero = true;\n }\n }\n \n if(zero){\n println(0);\n }\n else{\n BigInteger limit = new BigInteger(\"1000000000000000000\");\n BigInteger a = new BigInteger(\"1\");\n boolean overflow = false;\n for(int i = 0; i < N; i++){\n a = a.multiply(BigInteger.valueOf(A[i]));\n if(a.compareTo(limit) > 0){\n overflow = true;\n }\n }\n\n if(overflow){\n println(-1);\n }\n else{\n println(a);\n }\n }\n in.close();\n out.close();\n }\n\n static int MIN = Integer.MIN_VALUE;\n static int MAX = Integer.MAX_VALUE;\n static Reader in = new Reader();\n static PrintWriter out = new PrintWriter(System.out);\n\n static int[] readInt(int N) throws IOException { \n \tint arr[] = new int[N];\n \tfor(int i = 0; i < N; i++){ \n \t\tarr[i] = in.nextInt(); \n \t} \n \treturn arr;\n }\n \n static long[] readLong(int N) throws IOException { \n \tlong arr[] = new long[N];\n \tfor(int i = 0; i < N; i++){ \n \t\tarr[i] = in.nextLong(); \n \t} \n \treturn arr;\n }\n \n static String[] readString(int N) throws IOException { \n \tString arr[] = new String[N];\n \tfor(int i = 0; i < N; i++){ \n \t\tarr[i] = in.next(); \n \t} \n \treturn arr;\n }\n \n static void print(Object O) { \n \tout.print(O); \n }\n \n static void println(Object O) { \n \tout.println(O); \n }\n \n static void println(int arr[]) { \n \tfor(int i = 0; i < arr.length; i++){ \n \t\tprint(arr[i] + \" \"); \n \t} \n \tprintln(\"\"); \n }\n \n static void debug(Object ... O) { \n \tfor(Object obj: O){\n \t\tSystem.out.print(obj + \" \");\n \t}\n \tSystem.out.println();\n }\n}\n\nclass Reader {\n BufferedReader reader;\n StringTokenizer tokenizer;\n\n Reader() {\n reader = new BufferedReader(new InputStreamReader(System.in));\n tokenizer = new StringTokenizer(\"\");\n }\n\n String next() throws IOException {\n while (!tokenizer.hasMoreTokens() ) { \n tokenizer = new StringTokenizer(reader.readLine()); \n }\n return tokenizer.nextToken();\n }\n\n int nextInt() throws IOException { \n return Integer.parseInt(next()); \n }\n \n double nextDouble() throws IOException { \n return Double.parseDouble(next());\n }\n \n long nextLong() throws IOException { \n return Long.parseLong(next()); \n }\n \n String nextLine() throws IOException { \n return reader.readLine(); \n }\n \n void close() throws IOException { \n reader.close(); \n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3089, "cpu_time_ms": 2207, "memory_kb": 49764}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s194310936", "group_id": "codeNet:p02658", "input_text": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n // Your code here!\n Scanner sc = new Scanner(System.in);\n long N = sc.nextLong();\n List kazu = new ArrayList<>();\n long ans = 1;\n for(int i = 0;i < N;i++){\n long temp = sc.nextLong();;\n ans *= temp;\n }\n long max = 1000000000000000000l;\n if(ans <= max){\n System.out.println(ans);\n }else{\n System.out.println(-1);\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1590974313, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s194310936.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s194310936", "user_id": "u155138322"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n // Your code here!\n Scanner sc = new Scanner(System.in);\n long N = sc.nextLong();\n List kazu = new ArrayList<>();\n long ans = 1;\n for(int i = 0;i < N;i++){\n long temp = sc.nextLong();;\n ans *= temp;\n }\n long max = 1000000000000000000l;\n if(ans <= max){\n System.out.println(ans);\n }else{\n System.out.println(-1);\n }\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 554, "cpu_time_ms": 479, "memory_kb": 59212}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s701914740", "group_id": "codeNet:p02658", "input_text": "import java.math.BigInteger;\nimport java.util.Scanner;\n\npublic class Main {\n private static final int MOD = 1_000_000_007;\n private static final String YES = \"Yes\";\n private static final String NO = \"No\";\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int N = sc.nextInt();\n long[] A = new long[N];\n for (int i=0; i 0) return \"-1\";\n }\n\n\n return b.toString();\n }\n}", "language": "Java", "metadata": {"date": 1590974285, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s701914740.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s701914740", "user_id": "u487252913"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.math.BigInteger;\nimport java.util.Scanner;\n\npublic class Main {\n private static final int MOD = 1_000_000_007;\n private static final String YES = \"Yes\";\n private static final String NO = \"No\";\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int N = sc.nextInt();\n long[] A = new long[N];\n for (int i=0; i 0) return \"-1\";\n }\n\n\n return b.toString();\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 930, "cpu_time_ms": 460, "memory_kb": 61572}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s715346385", "group_id": "codeNet:p02658", "input_text": "import java.util.*;\n\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint N = sc.nextInt();\n\t\t\n\t\tLong ans = (long) 1;\n\t\tLong limit = (long) Math.pow(10,18);\n \tboolean flag = false;\n\n\t\tfor(int i=0; ilimit){\n flag = true;\n\t\t\t}\n\t\t}\n\t\tif(flag){\n\t\t\tSystem.out.println(\"-1\");\n\t\t\treturn;\n\t\t}\n\t\tSystem.out.println(ans);\n\t\treturn;\n\t}\n}", "language": "Java", "metadata": {"date": 1590974187, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s715346385.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s715346385", "user_id": "u960958946"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint N = sc.nextInt();\n\t\t\n\t\tLong ans = (long) 1;\n\t\tLong limit = (long) Math.pow(10,18);\n \tboolean flag = false;\n\n\t\tfor(int i=0; ilimit){\n flag = true;\n\t\t\t}\n\t\t}\n\t\tif(flag){\n\t\t\tSystem.out.println(\"-1\");\n\t\t\treturn;\n\t\t}\n\t\tSystem.out.println(ans);\n\t\treturn;\n\t}\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 635, "cpu_time_ms": 494, "memory_kb": 59720}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s082664280", "group_id": "codeNet:p02658", "input_text": "// This template is based on Mr. tonymontaro's template (https://atcoder.jp/users/tonymontaro).\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.OutputStreamWriter;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\n\n// For flatten() required Java8\nimport java.util.stream.Stream;\nimport java.util.stream.IntStream;\n\nimport java.util.Queue;\nimport java.util.ArrayDeque;\n\nimport java.util.ArrayList;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\n\npublic class Main {\n static PrintWriter out;\n static CF_Reader in;\n\n static int INTMAX = 2147483647;\n\n // Start: 大きな数\n // 10^20くらいまで\n // long a = 0;\n // End: 大きな数\n public static void main(String[] args) throws IOException {\n out = new PrintWriter(new OutputStreamWriter(System.out));\n in = new CF_Reader();\n StringBuilder result = new StringBuilder();\n\n // Start: int型の整数N Mを取得する\n // // N M 形式\n long N = in.longNext();\n // int M = in.longNext();\n\n long res = 1L;\n for (int i = 0; i < N; i++) {\n res *= in.longNext();\n }\n String s = \"1000000000000000000\";\n long a = 1000000000000000000L;\n if (res != a && String.valueOf(res).length() >= 19) {\n res = -1;\n }\n\n result.append(res);\n\n\n //[補足]\n // N M\n // A B 形式だと\n // int N = in.intNext();\n // int M = in.intNext();\n // int A = in.intNext();\n // int B = in.intNext();\n // End: int型の整数N Mを取得する\n\n // Start: int型の整数Nと配列Aを取得する\n // // N\n // // A1 A2 A3... AN 形式\n // int n = in.intNext();\n // int[] A = in.nextIntArray(n);\n // End: int型の整数Nと配列Aを取得する\n\n // Start: Char型の文字をInt型に変換する\n // Integer.parseInt(String.valueOf(charText))\n // End: Char型の文字をInt型に変換する\n\n // Start: 文字列を1文字ずつ出力する\n // String text = in.next();\n // char[] work = new char[text.length()];\n // for(int i = 0; i < text.length(); i++){\n // work[i] = text.charAt(i); // Char型の文字\n // out.println(work[i]);\n // }\n // End: 文字列を1文字ずつ出力する\n\n // Start: 配列の定義\n // int[] a = new int[N];\n // int[][] b = new int[N][M];\n // End: 配列の定義\n\n // Start: キューの定義\n // Queue queue = new ArrayDeque();\n // Start: キューの定義\n\n // Start: リストのリスト\n // @SuppressWarnings(\"unchecked\")\n // List[] adjacents = new ArrayList[N];\n // Start: リストのリスト\n\n // Start: forEach文\n // for (int elem: elements) {\n // }\n // Start: forEach文\n\n out.println(result);\n\n out.close();\n }\n\n // 素数判定。\n public static boolean isPrime(int N) {\n if (N == 1) return false;\n for (int i = 2; i * i <= N; ++i) {\n if (N % i == 0) return false;\n }\n return true;\n }\n\n // 使い方\n // List list = new ArrayList();\n // permutation(list, \"abc\", \"\");\n // for (String str : list) {\n // out.print(str + \" \");\n // }\n // >> abc acb bac bca cab cba\n public static List permutation(List list, String target, String ans){\n if(target.length() <= 1) {\n list.add(ans + target);\n } else {\n for (int i = 0; i < target.length(); i++) {\n permutation(\n list,\n target.substring(0, i) + target.substring(i + 1),\n ans + target.charAt(i));\n }\n }\n return list;\n }\n\n // 使い方\n // String[] list2 = { \"A\", \"B\", \"C\", \"D\"};\n // List res = combination(list2, 3);\n // for (String[] arr : res) {\n // out.print(\"[\");\n // for (String a : arr) {\n // out.print(a + \", \");\n // }\n // out.print(\"], \");\n // }\n // >> [A, B, C], [A, B, D], [A, C, D], [B, C, D]\n static List combination(String[] data, int k) {\n List result = new ArrayList();\n combination(data, 0, new String[k], 0, result);\n return result;\n }\n\n static void combination(String[] data, int di, String[] comb, int ci, List result) {\n if (ci == comb.length) {\n result.add(comb.clone());\n return;\n }\n for ( ; di <= data.length - (comb.length - ci); di++) {\n comb[ci] = data[di];\n combination(data, di + 1, comb, ci + 1, result);\n }\n }\n\n public static int[] flatten(int[][] arr) {\n return Stream.of(arr)\n .flatMapToInt(row -> IntStream.of(row))\n .toArray();\n }\n\n public static int maxIntValueFromArray(int[] array) {\n\n int intMax = array[0];\n\n for (int i = 1; i < array.length; i++ ) {\n if(intMax < array[i]) {\n intMax = array[i];\n }\n }\n return intMax;\n }\n\n public static int minIntValueFromArray(int[] array) {\n\n int intMin = array[0];\n\n for (int i = 1; i < array.length; i++ ) {\n if(intMin > array[i]) {\n intMin = array[i];\n }\n }\n return intMin;\n }\n\n static class CF_Reader {\n BufferedReader br;\n StringTokenizer st;\n\n public CF_Reader() throws IOException {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n String next() throws IOException {\n while (st == null || !st.hasMoreTokens())\n st = new StringTokenizer(br.readLine().trim());\n return st.nextToken();\n }\n\n long longNext() throws IOException {\n return Long.parseLong(next());\n }\n\n int intNext() throws IOException {\n return Integer.parseInt(next());\n }\n\n double doubleNext() throws IOException {\n return Double.parseDouble(next());\n }\n\n char charNext() throws IOException {\n return next().charAt(0);\n }\n\n public int[] nextIntArray(final int n) throws IOException {\n final int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = intNext();\n return a;\n }\n\n public long[] nextLongArray(final int n) throws IOException {\n final long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = longNext();\n return a;\n }\n\n String line() throws IOException {\n return br.readLine().trim();\n }\n }\n}", "language": "Java", "metadata": {"date": 1590974150, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s082664280.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s082664280", "user_id": "u509377162"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "// This template is based on Mr. tonymontaro's template (https://atcoder.jp/users/tonymontaro).\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.OutputStreamWriter;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\n\n// For flatten() required Java8\nimport java.util.stream.Stream;\nimport java.util.stream.IntStream;\n\nimport java.util.Queue;\nimport java.util.ArrayDeque;\n\nimport java.util.ArrayList;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\n\npublic class Main {\n static PrintWriter out;\n static CF_Reader in;\n\n static int INTMAX = 2147483647;\n\n // Start: 大きな数\n // 10^20くらいまで\n // long a = 0;\n // End: 大きな数\n public static void main(String[] args) throws IOException {\n out = new PrintWriter(new OutputStreamWriter(System.out));\n in = new CF_Reader();\n StringBuilder result = new StringBuilder();\n\n // Start: int型の整数N Mを取得する\n // // N M 形式\n long N = in.longNext();\n // int M = in.longNext();\n\n long res = 1L;\n for (int i = 0; i < N; i++) {\n res *= in.longNext();\n }\n String s = \"1000000000000000000\";\n long a = 1000000000000000000L;\n if (res != a && String.valueOf(res).length() >= 19) {\n res = -1;\n }\n\n result.append(res);\n\n\n //[補足]\n // N M\n // A B 形式だと\n // int N = in.intNext();\n // int M = in.intNext();\n // int A = in.intNext();\n // int B = in.intNext();\n // End: int型の整数N Mを取得する\n\n // Start: int型の整数Nと配列Aを取得する\n // // N\n // // A1 A2 A3... AN 形式\n // int n = in.intNext();\n // int[] A = in.nextIntArray(n);\n // End: int型の整数Nと配列Aを取得する\n\n // Start: Char型の文字をInt型に変換する\n // Integer.parseInt(String.valueOf(charText))\n // End: Char型の文字をInt型に変換する\n\n // Start: 文字列を1文字ずつ出力する\n // String text = in.next();\n // char[] work = new char[text.length()];\n // for(int i = 0; i < text.length(); i++){\n // work[i] = text.charAt(i); // Char型の文字\n // out.println(work[i]);\n // }\n // End: 文字列を1文字ずつ出力する\n\n // Start: 配列の定義\n // int[] a = new int[N];\n // int[][] b = new int[N][M];\n // End: 配列の定義\n\n // Start: キューの定義\n // Queue queue = new ArrayDeque();\n // Start: キューの定義\n\n // Start: リストのリスト\n // @SuppressWarnings(\"unchecked\")\n // List[] adjacents = new ArrayList[N];\n // Start: リストのリスト\n\n // Start: forEach文\n // for (int elem: elements) {\n // }\n // Start: forEach文\n\n out.println(result);\n\n out.close();\n }\n\n // 素数判定。\n public static boolean isPrime(int N) {\n if (N == 1) return false;\n for (int i = 2; i * i <= N; ++i) {\n if (N % i == 0) return false;\n }\n return true;\n }\n\n // 使い方\n // List list = new ArrayList();\n // permutation(list, \"abc\", \"\");\n // for (String str : list) {\n // out.print(str + \" \");\n // }\n // >> abc acb bac bca cab cba\n public static List permutation(List list, String target, String ans){\n if(target.length() <= 1) {\n list.add(ans + target);\n } else {\n for (int i = 0; i < target.length(); i++) {\n permutation(\n list,\n target.substring(0, i) + target.substring(i + 1),\n ans + target.charAt(i));\n }\n }\n return list;\n }\n\n // 使い方\n // String[] list2 = { \"A\", \"B\", \"C\", \"D\"};\n // List res = combination(list2, 3);\n // for (String[] arr : res) {\n // out.print(\"[\");\n // for (String a : arr) {\n // out.print(a + \", \");\n // }\n // out.print(\"], \");\n // }\n // >> [A, B, C], [A, B, D], [A, C, D], [B, C, D]\n static List combination(String[] data, int k) {\n List result = new ArrayList();\n combination(data, 0, new String[k], 0, result);\n return result;\n }\n\n static void combination(String[] data, int di, String[] comb, int ci, List result) {\n if (ci == comb.length) {\n result.add(comb.clone());\n return;\n }\n for ( ; di <= data.length - (comb.length - ci); di++) {\n comb[ci] = data[di];\n combination(data, di + 1, comb, ci + 1, result);\n }\n }\n\n public static int[] flatten(int[][] arr) {\n return Stream.of(arr)\n .flatMapToInt(row -> IntStream.of(row))\n .toArray();\n }\n\n public static int maxIntValueFromArray(int[] array) {\n\n int intMax = array[0];\n\n for (int i = 1; i < array.length; i++ ) {\n if(intMax < array[i]) {\n intMax = array[i];\n }\n }\n return intMax;\n }\n\n public static int minIntValueFromArray(int[] array) {\n\n int intMin = array[0];\n\n for (int i = 1; i < array.length; i++ ) {\n if(intMin > array[i]) {\n intMin = array[i];\n }\n }\n return intMin;\n }\n\n static class CF_Reader {\n BufferedReader br;\n StringTokenizer st;\n\n public CF_Reader() throws IOException {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n String next() throws IOException {\n while (st == null || !st.hasMoreTokens())\n st = new StringTokenizer(br.readLine().trim());\n return st.nextToken();\n }\n\n long longNext() throws IOException {\n return Long.parseLong(next());\n }\n\n int intNext() throws IOException {\n return Integer.parseInt(next());\n }\n\n double doubleNext() throws IOException {\n return Double.parseDouble(next());\n }\n\n char charNext() throws IOException {\n return next().charAt(0);\n }\n\n public int[] nextIntArray(final int n) throws IOException {\n final int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = intNext();\n return a;\n }\n\n public long[] nextLongArray(final int n) throws IOException {\n final long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = longNext();\n return a;\n }\n\n String line() throws IOException {\n return br.readLine().trim();\n }\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 6848, "cpu_time_ms": 211, "memory_kb": 48560}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s176755621", "group_id": "codeNet:p02658", "input_text": "import java.awt.*;\nimport java.io.*;\nimport java.lang.reflect.Array;\nimport java.math.BigInteger;\nimport java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n FastReader sc = new FastReader();\n int n=sc.nextInt();\n BigInteger x=BigInteger.ONE;\n long a[]=new long[n];\n for (int i=0;i=1){\n System.out.println(-1);\n return;\n }\n }\n System.out.println(x);\n }\n static class FastReader {\n BufferedReader br;\n StringTokenizer st;\n\n public FastReader() {\n br = new BufferedReader(new\n InputStreamReader(System.in));\n }\n\n String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n String nextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n }\n}", "language": "Java", "metadata": {"date": 1590974150, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s176755621.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s176755621", "user_id": "u276423984"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.awt.*;\nimport java.io.*;\nimport java.lang.reflect.Array;\nimport java.math.BigInteger;\nimport java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n FastReader sc = new FastReader();\n int n=sc.nextInt();\n BigInteger x=BigInteger.ONE;\n long a[]=new long[n];\n for (int i=0;i=1){\n System.out.println(-1);\n return;\n }\n }\n System.out.println(x);\n }\n static class FastReader {\n BufferedReader br;\n StringTokenizer st;\n\n public FastReader() {\n br = new BufferedReader(new\n InputStreamReader(System.in));\n }\n\n String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n String nextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1827, "cpu_time_ms": 298, "memory_kb": 48844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s090999308", "group_id": "codeNet:p02658", "input_text": "\nimport java.util.*;\n\n\npublic class Main {\n\n \n public static void main(String[] args) {\n Scanner scanner= new Scanner(System.in);\n int N = scanner.nextInt();\n double[] nums = new double[N];\n for(int i= 0 ; iMath.pow(10,18)){\n System.out.println(\"-1\");\n } else{\n System.out.println(product);\n }\n }\n \n}\n", "language": "Java", "metadata": {"date": 1590974120, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s090999308.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s090999308", "user_id": "u362532770"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "\nimport java.util.*;\n\n\npublic class Main {\n\n \n public static void main(String[] args) {\n Scanner scanner= new Scanner(System.in);\n int N = scanner.nextInt();\n double[] nums = new double[N];\n for(int i= 0 ; iMath.pow(10,18)){\n System.out.println(\"-1\");\n } else{\n System.out.println(product);\n }\n }\n \n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 960, "memory_kb": 62964}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s490321537", "group_id": "codeNet:p02658", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] array = new long[n];\n\t\tfor(int i=0;itmp) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tans = ans*i;\n\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}\n", "language": "Java", "metadata": {"date": 1590973925, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s490321537.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s490321537", "user_id": "u732488108"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] array = new long[n];\n\t\tfor(int i=0;itmp) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tans = ans*i;\n\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 591, "cpu_time_ms": 440, "memory_kb": 49572}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s504761520", "group_id": "codeNet:p02658", "input_text": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.math.BigInteger;\nimport java.util.Arrays;\nimport java.util.NoSuchElementException;\n\n\t\npublic class Main{\n\t\n\tpublic static void main(String[] args) {\n\t\tnew Main().run();\n\t}\n\n\tvoid run() {\n\t\tFastScanner sc=new FastScanner();\n\t\tint N=sc.nextInt();\n\t\tBigInteger prd=BigInteger.valueOf(1);\n\t\tfor (int i=0;i Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }\n \n public double nextDouble() { return Double.parseDouble(next());}\n}\n", "language": "Java", "metadata": {"date": 1590973479, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02658/input.txt", "sample_output_relpath": "derived/input_output/data/p02658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02658/Java/s504761520.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s504761520", "user_id": "u313111801"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.math.BigInteger;\nimport java.util.Arrays;\nimport java.util.NoSuchElementException;\n\n\t\npublic class Main{\n\t\n\tpublic static void main(String[] args) {\n\t\tnew Main().run();\n\t}\n\n\tvoid run() {\n\t\tFastScanner sc=new FastScanner();\n\t\tint N=sc.nextInt();\n\t\tBigInteger prd=BigInteger.valueOf(1);\n\t\tfor (int i=0;i Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }\n \n public double nextDouble() { return Double.parseDouble(next());}\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "sample_input": "2\n1000000000 1000000000\n"}, "reference_outputs": ["1000000000000000000\n"], "source_document_id": "p02658", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{18}\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\nPrint the value A_1 \\times ... \\times A_N as an integer, or -1 if the value exceeds 10^{18}.\n\nSample Input 1\n\n2\n1000000000 1000000000\n\nSample Output 1\n\n1000000000000000000\n\nWe have 1000000000 \\times 1000000000 = 1000000000000000000.\n\nSample Input 2\n\n3\n101 9901 999999000001\n\nSample Output 2\n\n-1\n\nWe have 101 \\times 9901 \\times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.\n\nSample Input 3\n\n31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2840, "cpu_time_ms": 146, "memory_kb": 47948}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s134424951", "group_id": "codeNet:p02659", "input_text": "import java.util.*;\nimport java.io.*;\n\npublic class Main {\n\n private static final int M = 1_000_000_007;\n\n public Main(FastScanner in, PrintWriter out, int test) {\n long A = in.nextLong();\n String[] B = in.next().split(\"\\\\.\");\n int b = Integer.parseInt(B[0]) * 100 + Integer.parseInt(B[1]);\n out.println(A * b / 100);\n }\n\n private long pow(int x, int p) {\n long res = 1, a = x;\n while (p > 1) {\n if (p % 2 == 1)\n res = res * a % M;\n\n a = a * a % M;\n p /= 2;\n }\n res = res * a % M;\n return res;\n }\n\n public static void main(String[] args) {\n PrintWriter out = new PrintWriter(System.out);\n // Scanner in = new Scanner(\n // new BufferedReader(new InputStreamReader(System.in)));\n FastScanner in = new FastScanner(System.in);\n\n // int T = in.nextInt();\n for (int t = 1; t <= 1; t++) {\n Main sol = new Main(in, out, t);\n }\n\n out.close();\n }\n}\n\n\nclass FastScanner{\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n\n public FastScanner(InputStream stream)\n {\n this.stream = stream;\n }\n\n int read()\n {\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars){\n curChar = 0;\n try{\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n boolean isSpaceChar(int c)\n {\n return c==' '||c=='\\n'||c=='\\r'||c=='\\t'||c==-1;\n }\n\n boolean isEndline(int c)\n {\n return c=='\\n'||c=='\\r'||c==-1;\n }\n\n int nextInt()\n {\n return Integer.parseInt(next());\n }\n\n long nextLong()\n {\n return Long.parseLong(next());\n }\n\n double nextDouble()\n {\n return Double.parseDouble(next());\n }\n\n String next(){\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do{\n res.appendCodePoint(c);\n c = read();\n }while(!isSpaceChar(c));\n return res.toString();\n }\n\n String nextLine(){\n int c = read();\n while (isEndline(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do{\n res.appendCodePoint(c);\n c = read();\n }while(!isEndline(c));\n return res.toString();\n }\n}", "language": "Java", "metadata": {"date": 1596032386, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02659.html", "problem_id": "p02659", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02659/input.txt", "sample_output_relpath": "derived/input_output/data/p02659/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02659/Java/s134424951.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s134424951", "user_id": "u276152693"}, "prompt_components": {"gold_output": "217\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\n\npublic class Main {\n\n private static final int M = 1_000_000_007;\n\n public Main(FastScanner in, PrintWriter out, int test) {\n long A = in.nextLong();\n String[] B = in.next().split(\"\\\\.\");\n int b = Integer.parseInt(B[0]) * 100 + Integer.parseInt(B[1]);\n out.println(A * b / 100);\n }\n\n private long pow(int x, int p) {\n long res = 1, a = x;\n while (p > 1) {\n if (p % 2 == 1)\n res = res * a % M;\n\n a = a * a % M;\n p /= 2;\n }\n res = res * a % M;\n return res;\n }\n\n public static void main(String[] args) {\n PrintWriter out = new PrintWriter(System.out);\n // Scanner in = new Scanner(\n // new BufferedReader(new InputStreamReader(System.in)));\n FastScanner in = new FastScanner(System.in);\n\n // int T = in.nextInt();\n for (int t = 1; t <= 1; t++) {\n Main sol = new Main(in, out, t);\n }\n\n out.close();\n }\n}\n\n\nclass FastScanner{\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n\n public FastScanner(InputStream stream)\n {\n this.stream = stream;\n }\n\n int read()\n {\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars){\n curChar = 0;\n try{\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n boolean isSpaceChar(int c)\n {\n return c==' '||c=='\\n'||c=='\\r'||c=='\\t'||c==-1;\n }\n\n boolean isEndline(int c)\n {\n return c=='\\n'||c=='\\r'||c==-1;\n }\n\n int nextInt()\n {\n return Integer.parseInt(next());\n }\n\n long nextLong()\n {\n return Long.parseLong(next());\n }\n\n double nextDouble()\n {\n return Double.parseDouble(next());\n }\n\n String next(){\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do{\n res.appendCodePoint(c);\n c = read();\n }while(!isSpaceChar(c));\n return res.toString();\n }\n\n String nextLine(){\n int c = read();\n while (isEndline(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do{\n res.appendCodePoint(c);\n c = read();\n }while(!isEndline(c));\n return res.toString();\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "sample_input": "198 1.10\n"}, "reference_outputs": ["217\n"], "source_document_id": "p02659", "source_text": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2694, "cpu_time_ms": 85, "memory_kb": 32508}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s109884605", "group_id": "codeNet:p02659", "input_text": "import java.util.*;\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n long a = sc.nextLong();\n float b = sc.nextFloat();\n long ans = a * (long)(b*100+0.5);\n System.out.println(ans/100);\n\n }\n}\n", "language": "Java", "metadata": {"date": 1595680633, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02659.html", "problem_id": "p02659", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02659/input.txt", "sample_output_relpath": "derived/input_output/data/p02659/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02659/Java/s109884605.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s109884605", "user_id": "u806768852"}, "prompt_components": {"gold_output": "217\n", "input_to_evaluate": "import java.util.*;\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n long a = sc.nextLong();\n float b = sc.nextFloat();\n long ans = a * (long)(b*100+0.5);\n System.out.println(ans/100);\n\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "sample_input": "198 1.10\n"}, "reference_outputs": ["217\n"], "source_document_id": "p02659", "source_text": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 137, "memory_kb": 37236}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s583417206", "group_id": "codeNet:p02659", "input_text": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\npublic class Main {\n private static class FastScanner {\n private BufferedReader reader = null;\n private StringTokenizer tokenizer = null;\n\n public FastScanner(InputStream in) {\n reader = new BufferedReader(new InputStreamReader(in));\n tokenizer = null;\n }\n\n public String next() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public String nextLine() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n return reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n\n return tokenizer.nextToken(\"\\n\");\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public int[] nextIntArray(int n) {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n return a;\n }\n\n public long[] nextLongArray(int n) {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = nextLong();\n return a;\n }\n }\n\n public static void main(String[] args) {\n FastScanner sc = new FastScanner(System.in);\n long a = sc.nextLong();\n String b = sc.next();\n long bn = Long.parseLong(b.replace(\".\", \"\"));\n System.out.println((a * bn) / 100L);\n }\n}", "language": "Java", "metadata": {"date": 1591938632, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02659.html", "problem_id": "p02659", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02659/input.txt", "sample_output_relpath": "derived/input_output/data/p02659/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02659/Java/s583417206.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s583417206", "user_id": "u562002567"}, "prompt_components": {"gold_output": "217\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\npublic class Main {\n private static class FastScanner {\n private BufferedReader reader = null;\n private StringTokenizer tokenizer = null;\n\n public FastScanner(InputStream in) {\n reader = new BufferedReader(new InputStreamReader(in));\n tokenizer = null;\n }\n\n public String next() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public String nextLine() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n return reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n\n return tokenizer.nextToken(\"\\n\");\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public int[] nextIntArray(int n) {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n return a;\n }\n\n public long[] nextLongArray(int n) {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = nextLong();\n return a;\n }\n }\n\n public static void main(String[] args) {\n FastScanner sc = new FastScanner(System.in);\n long a = sc.nextLong();\n String b = sc.next();\n long bn = Long.parseLong(b.replace(\".\", \"\"));\n System.out.println((a * bn) / 100L);\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "sample_input": "198 1.10\n"}, "reference_outputs": ["217\n"], "source_document_id": "p02659", "source_text": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 70, "memory_kb": 32580}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s455238496", "group_id": "codeNet:p02659", "input_text": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n long a = sc.nextLong();\n // double b = sc.nextDouble();\n String b = sc.next();\n\n // long ans = (long)(a*b);\n\n long b0 = b.charAt(0) - '0';\n long b1 = b.charAt(2) - '0';\n long b2 = b.charAt(3) - '0';\n\n long ans = a * b0 + a * b1 / 10 + a * b2 / 100;\n System.out.println(ans);\n }\n}", "language": "Java", "metadata": {"date": 1591477082, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02659.html", "problem_id": "p02659", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02659/input.txt", "sample_output_relpath": "derived/input_output/data/p02659/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02659/Java/s455238496.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s455238496", "user_id": "u705467084"}, "prompt_components": {"gold_output": "217\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n long a = sc.nextLong();\n // double b = sc.nextDouble();\n String b = sc.next();\n\n // long ans = (long)(a*b);\n\n long b0 = b.charAt(0) - '0';\n long b1 = b.charAt(2) - '0';\n long b2 = b.charAt(3) - '0';\n\n long ans = a * b0 + a * b1 / 10 + a * b2 / 100;\n System.out.println(ans);\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "sample_input": "198 1.10\n"}, "reference_outputs": ["217\n"], "source_document_id": "p02659", "source_text": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 107, "memory_kb": 35744}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s166526273", "group_id": "codeNet:p02659", "input_text": "import java.util.Scanner;\n\npublic class Main{\n\tpublic static void main(String[] args) {\n\t\t@SuppressWarnings(\"resource\")\n\t\tScanner scn = new Scanner(System.in);\n\t\tlong a = scn.nextLong();\n\t\tdouble b = scn.nextDouble();\n\t\tlong p = (long) (b * 100);\n\t\tSystem.out.println(a*p/100);\n\t\t/* 144444445884645447 1.5 */\n\t}\n}", "language": "Java", "metadata": {"date": 1591251384, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02659.html", "problem_id": "p02659", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02659/input.txt", "sample_output_relpath": "derived/input_output/data/p02659/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02659/Java/s166526273.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s166526273", "user_id": "u491412719"}, "prompt_components": {"gold_output": "217\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main{\n\tpublic static void main(String[] args) {\n\t\t@SuppressWarnings(\"resource\")\n\t\tScanner scn = new Scanner(System.in);\n\t\tlong a = scn.nextLong();\n\t\tdouble b = scn.nextDouble();\n\t\tlong p = (long) (b * 100);\n\t\tSystem.out.println(a*p/100);\n\t\t/* 144444445884645447 1.5 */\n\t}\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "sample_input": "198 1.10\n"}, "reference_outputs": ["217\n"], "source_document_id": "p02659", "source_text": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 313, "cpu_time_ms": 122, "memory_kb": 37084}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s574865193", "group_id": "codeNet:p02659", "input_text": "import java.util.*;\nimport java.io.*;\n\npublic class Main {\n\tstatic PrintWriter out;\n\tstatic StringBuilder sb;\n\tstatic int mod = (int) 1e9 + 7;\n\tstatic int inf = (int) 1e8;\n\tstatic int[] col;\n\tstatic int n, m, k;\n\tstatic ArrayList[] ad;\n\tstatic int[][][] memo;\n\tstatic ArrayList h;\n\tstatic char[][] grid;\n\tstatic int[] a;\n\tstatic boolean f;\n\tstatic int offest = 30;\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tScanner sc = new Scanner(System.in);\n\t\tout = new PrintWriter(System.out);\n\t\tlong a = sc.nextLong();\n\t\tdouble v = sc.nextDouble() * 100;\n\t\tlong ans=(long)(v*a);\n\t\tans=ans/100;\n\t\tSystem.out.println((long)ans);\n\t\tout.flush();\n\t}\n\n\tstatic class Scanner {\n\t\tStringTokenizer st;\n\t\tBufferedReader br;\n\n\t\tpublic Scanner(InputStream system) {\n\t\t\tbr = new BufferedReader(new InputStreamReader(system));\n\t\t}\n\n\t\tpublic Scanner(String file) throws Exception {\n\t\t\tbr = new BufferedReader(new FileReader(file));\n\t\t}\n\n\t\tpublic String next() throws IOException {\n\t\t\twhile (st == null || !st.hasMoreTokens())\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tpublic String nextLine() throws IOException {\n\t\t\treturn br.readLine();\n\t\t}\n\n\t\tpublic int nextInt() throws IOException {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tpublic double nextDouble() throws IOException {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tpublic char nextChar() throws IOException {\n\t\t\treturn next().charAt(0);\n\t\t}\n\n\t\tpublic Long nextLong() throws IOException {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tpublic int[] nextArrInt(int n) throws IOException {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic long[] nextArrLong(int n) throws IOException {\n\t\t\tlong[] a = new long[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic boolean ready() throws IOException {\n\t\t\treturn br.ready();\n\t\t}\n\n\t\tpublic void waitForInput() throws InterruptedException {\n\t\t\tThread.sleep(3000);\n\t\t}\n\t}\n}", "language": "Java", "metadata": {"date": 1591009272, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02659.html", "problem_id": "p02659", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02659/input.txt", "sample_output_relpath": "derived/input_output/data/p02659/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02659/Java/s574865193.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s574865193", "user_id": "u217252547"}, "prompt_components": {"gold_output": "217\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\n\npublic class Main {\n\tstatic PrintWriter out;\n\tstatic StringBuilder sb;\n\tstatic int mod = (int) 1e9 + 7;\n\tstatic int inf = (int) 1e8;\n\tstatic int[] col;\n\tstatic int n, m, k;\n\tstatic ArrayList[] ad;\n\tstatic int[][][] memo;\n\tstatic ArrayList h;\n\tstatic char[][] grid;\n\tstatic int[] a;\n\tstatic boolean f;\n\tstatic int offest = 30;\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tScanner sc = new Scanner(System.in);\n\t\tout = new PrintWriter(System.out);\n\t\tlong a = sc.nextLong();\n\t\tdouble v = sc.nextDouble() * 100;\n\t\tlong ans=(long)(v*a);\n\t\tans=ans/100;\n\t\tSystem.out.println((long)ans);\n\t\tout.flush();\n\t}\n\n\tstatic class Scanner {\n\t\tStringTokenizer st;\n\t\tBufferedReader br;\n\n\t\tpublic Scanner(InputStream system) {\n\t\t\tbr = new BufferedReader(new InputStreamReader(system));\n\t\t}\n\n\t\tpublic Scanner(String file) throws Exception {\n\t\t\tbr = new BufferedReader(new FileReader(file));\n\t\t}\n\n\t\tpublic String next() throws IOException {\n\t\t\twhile (st == null || !st.hasMoreTokens())\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tpublic String nextLine() throws IOException {\n\t\t\treturn br.readLine();\n\t\t}\n\n\t\tpublic int nextInt() throws IOException {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tpublic double nextDouble() throws IOException {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tpublic char nextChar() throws IOException {\n\t\t\treturn next().charAt(0);\n\t\t}\n\n\t\tpublic Long nextLong() throws IOException {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tpublic int[] nextArrInt(int n) throws IOException {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic long[] nextArrLong(int n) throws IOException {\n\t\t\tlong[] a = new long[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic boolean ready() throws IOException {\n\t\t\treturn br.ready();\n\t\t}\n\n\t\tpublic void waitForInput() throws InterruptedException {\n\t\t\tThread.sleep(3000);\n\t\t}\n\t}\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "sample_input": "198 1.10\n"}, "reference_outputs": ["217\n"], "source_document_id": "p02659", "source_text": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2000, "cpu_time_ms": 68, "memory_kb": 33012}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s318257198", "group_id": "codeNet:p02659", "input_text": "import java.util.*;\nimport java.io.*;\npublic class Main{\n\t\tpublic static void main(String[]args){\n\t\t\tScanner in = new Scanner(System.in);\n\t\t\tint a = in.nextInt();\n\t\t\tdouble b = in.nextDouble();\n\t\t\tSystem.out.println((int)(a*b));\n\t\t}\n}\n\n\n\n\n\n\n", "language": "Java", "metadata": {"date": 1591003193, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02659.html", "problem_id": "p02659", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02659/input.txt", "sample_output_relpath": "derived/input_output/data/p02659/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02659/Java/s318257198.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s318257198", "user_id": "u417514444"}, "prompt_components": {"gold_output": "217\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\npublic class Main{\n\t\tpublic static void main(String[]args){\n\t\t\tScanner in = new Scanner(System.in);\n\t\t\tint a = in.nextInt();\n\t\t\tdouble b = in.nextDouble();\n\t\t\tSystem.out.println((int)(a*b));\n\t\t}\n}\n\n\n\n\n\n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "sample_input": "198 1.10\n"}, "reference_outputs": ["217\n"], "source_document_id": "p02659", "source_text": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 241, "cpu_time_ms": 113, "memory_kb": 36604}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s415675463", "group_id": "codeNet:p02659", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner s = new Scanner(System.in);\n\n\t\tlong a = s.nextLong();\n\t\tlong b = (long)(s.nextDouble() * 100);\n\t\t\n\t\tlong mul = (long)(a * b);\n\t\t\n\n\t\tSystem.out.println(mul/100);\n\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1590982410, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02659.html", "problem_id": "p02659", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02659/input.txt", "sample_output_relpath": "derived/input_output/data/p02659/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02659/Java/s415675463.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s415675463", "user_id": "u314673507"}, "prompt_components": {"gold_output": "217\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner s = new Scanner(System.in);\n\n\t\tlong a = s.nextLong();\n\t\tlong b = (long)(s.nextDouble() * 100);\n\t\t\n\t\tlong mul = (long)(a * b);\n\t\t\n\n\t\tSystem.out.println(mul/100);\n\n\t}\n\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "sample_input": "198 1.10\n"}, "reference_outputs": ["217\n"], "source_document_id": "p02659", "source_text": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 117, "memory_kb": 36848}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s680598249", "group_id": "codeNet:p02659", "input_text": "import java.util.*;import java.io.*;import java.math.*;\npublic class Main\n{\n public static void process()throws IOException\n {\n double a=nd();\n double b=nd();\n long ans=(long)(a*b);\n pn(ans);\n }\n\n static AnotherReader sc;\n static PrintWriter out;\n public static void main(String[]args)throws IOException\n {\n boolean oj =true;\n if(oj){sc=new AnotherReader();out=new PrintWriter(System.out);}\n else{sc=new AnotherReader(100);out=new PrintWriter(\"output.txt\");}\n int t=1;\n // t=ni();\n while(t-->0) {process();}\n out.flush();out.close(); \n }\n\n static void pn(Object o){out.println(o);}\n static void p(Object o){out.print(o);}\n static void pni(Object o){out.println(o);out.flush();}\n static int ni()throws IOException{return sc.nextInt();}\n static long nl()throws IOException{return sc.nextLong();}\n static double nd()throws IOException{return sc.nextDouble();}\n static String nln()throws IOException{return sc.nextLine();}\n static int[] nai(int N)throws IOException{int[]A=new int[N];for(int i=0;i!=N;i++){A[i]=ni();}return A;}\n static long[] nal(int N)throws IOException{long[]A=new long[N];for(int i=0;i!=N;i++){A[i]=nl();}return A;}\n static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}\n static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}\n static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}\n\n/////////////////////////////////////////////////////////////////////////////////////////////////////////\n\n static class AnotherReader{BufferedReader br; StringTokenizer st;\n AnotherReader()throws FileNotFoundException{\n br=new BufferedReader(new InputStreamReader(System.in));}\n AnotherReader(int a)throws FileNotFoundException{\n br = new BufferedReader(new FileReader(\"input.txt\"));}\n String next()throws IOException{\n while (st == null || !st.hasMoreElements()) {try{\n st = new StringTokenizer(br.readLine());}\n catch (IOException e){ e.printStackTrace(); }}\n return st.nextToken(); } int nextInt() throws IOException{\n return Integer.parseInt(next());}\n long nextLong() throws IOException\n {return Long.parseLong(next());}\n double nextDouble()throws IOException { return Double.parseDouble(next()); }\n String nextLine() throws IOException{ String str = \"\"; try{\n str = br.readLine();} catch (IOException e){\n e.printStackTrace();} return str;}}\n \n/////////////////////////////////////////////////////////////////////////////////////////////////////////////\n}\n", "language": "Java", "metadata": {"date": 1590979661, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02659.html", "problem_id": "p02659", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02659/input.txt", "sample_output_relpath": "derived/input_output/data/p02659/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02659/Java/s680598249.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s680598249", "user_id": "u121655988"}, "prompt_components": {"gold_output": "217\n", "input_to_evaluate": "import java.util.*;import java.io.*;import java.math.*;\npublic class Main\n{\n public static void process()throws IOException\n {\n double a=nd();\n double b=nd();\n long ans=(long)(a*b);\n pn(ans);\n }\n\n static AnotherReader sc;\n static PrintWriter out;\n public static void main(String[]args)throws IOException\n {\n boolean oj =true;\n if(oj){sc=new AnotherReader();out=new PrintWriter(System.out);}\n else{sc=new AnotherReader(100);out=new PrintWriter(\"output.txt\");}\n int t=1;\n // t=ni();\n while(t-->0) {process();}\n out.flush();out.close(); \n }\n\n static void pn(Object o){out.println(o);}\n static void p(Object o){out.print(o);}\n static void pni(Object o){out.println(o);out.flush();}\n static int ni()throws IOException{return sc.nextInt();}\n static long nl()throws IOException{return sc.nextLong();}\n static double nd()throws IOException{return sc.nextDouble();}\n static String nln()throws IOException{return sc.nextLine();}\n static int[] nai(int N)throws IOException{int[]A=new int[N];for(int i=0;i!=N;i++){A[i]=ni();}return A;}\n static long[] nal(int N)throws IOException{long[]A=new long[N];for(int i=0;i!=N;i++){A[i]=nl();}return A;}\n static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}\n static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}\n static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}\n\n/////////////////////////////////////////////////////////////////////////////////////////////////////////\n\n static class AnotherReader{BufferedReader br; StringTokenizer st;\n AnotherReader()throws FileNotFoundException{\n br=new BufferedReader(new InputStreamReader(System.in));}\n AnotherReader(int a)throws FileNotFoundException{\n br = new BufferedReader(new FileReader(\"input.txt\"));}\n String next()throws IOException{\n while (st == null || !st.hasMoreElements()) {try{\n st = new StringTokenizer(br.readLine());}\n catch (IOException e){ e.printStackTrace(); }}\n return st.nextToken(); } int nextInt() throws IOException{\n return Integer.parseInt(next());}\n long nextLong() throws IOException\n {return Long.parseLong(next());}\n double nextDouble()throws IOException { return Double.parseDouble(next()); }\n String nextLine() throws IOException{ String str = \"\"; try{\n str = br.readLine();} catch (IOException e){\n e.printStackTrace();} return str;}}\n \n/////////////////////////////////////////////////////////////////////////////////////////////////////////////\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "sample_input": "198 1.10\n"}, "reference_outputs": ["217\n"], "source_document_id": "p02659", "source_text": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2622, "cpu_time_ms": 68, "memory_kb": 33316}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s748982574", "group_id": "codeNet:p02659", "input_text": "import java.util.*;\npublic class Main{\n\tpublic static void main(String args[]){\n\t\tScanner sc = new Scanner(System.in);\n\t\tlong A = sc.nextLong();\n\t\tdouble B = sc.nextDouble();\n\t\tlong C = (long)(B * 100);\n\t\tlong ans = (A * C) / 100;\n\t\tSystem.out.println(ans);\n\t}\n}", "language": "Java", "metadata": {"date": 1590979021, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02659.html", "problem_id": "p02659", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02659/input.txt", "sample_output_relpath": "derived/input_output/data/p02659/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02659/Java/s748982574.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s748982574", "user_id": "u207845630"}, "prompt_components": {"gold_output": "217\n", "input_to_evaluate": "import java.util.*;\npublic class Main{\n\tpublic static void main(String args[]){\n\t\tScanner sc = new Scanner(System.in);\n\t\tlong A = sc.nextLong();\n\t\tdouble B = sc.nextDouble();\n\t\tlong C = (long)(B * 100);\n\t\tlong ans = (A * C) / 100;\n\t\tSystem.out.println(ans);\n\t}\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "sample_input": "198 1.10\n"}, "reference_outputs": ["217\n"], "source_document_id": "p02659", "source_text": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 108, "memory_kb": 28948}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s772424451", "group_id": "codeNet:p02659", "input_text": "import java.util.Scanner;\npublic class Main {\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n long a = in.nextLong();\n double b = in.nextDouble();\n long res = (long) (a * b);\n System.out.println((long) Math.floor(res));\n }\n}", "language": "Java", "metadata": {"date": 1590978697, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02659.html", "problem_id": "p02659", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02659/input.txt", "sample_output_relpath": "derived/input_output/data/p02659/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02659/Java/s772424451.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s772424451", "user_id": "u229168636"}, "prompt_components": {"gold_output": "217\n", "input_to_evaluate": "import java.util.Scanner;\npublic class Main {\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n long a = in.nextLong();\n double b = in.nextDouble();\n long res = (long) (a * b);\n System.out.println((long) Math.floor(res));\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "sample_input": "198 1.10\n"}, "reference_outputs": ["217\n"], "source_document_id": "p02659", "source_text": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 113, "memory_kb": 36856}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s247637606", "group_id": "codeNet:p02659", "input_text": "import java.util.*;\nimport java.math.RoundingMode;\nimport java.math.BigDecimal;\n \n \n \npublic class Main{\n\t public static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tlong a = sc.nextLong();\n\t\tdouble b = sc.nextDouble();\n\t\tdouble b_int = Math.floor(b);\n\t\tdouble b_double = b-b_int;\n\t\tBigDecimal ans = new BigDecimal(a);\n\t\tBigDecimal b_int1 = new BigDecimal(b_int);\n\t\tBigDecimal b_double1 = new BigDecimal(b_double);\n\t\tans = ans.multiply(b_int1);\n\t\tBigDecimal a_floor = new BigDecimal(a);\n\t\ta_floor = a_floor.multiply(b_double1);\n\t\ta_floor = a_floor.setScale(0, BigDecimal.ROUND_DOWN);\n\t\tans = ans.add(a_floor);\n\t\tSystem.out.println(ans);\n\t }\n}", "language": "Java", "metadata": {"date": 1590978681, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02659.html", "problem_id": "p02659", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02659/input.txt", "sample_output_relpath": "derived/input_output/data/p02659/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02659/Java/s247637606.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s247637606", "user_id": "u172546930"}, "prompt_components": {"gold_output": "217\n", "input_to_evaluate": "import java.util.*;\nimport java.math.RoundingMode;\nimport java.math.BigDecimal;\n \n \n \npublic class Main{\n\t public static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tlong a = sc.nextLong();\n\t\tdouble b = sc.nextDouble();\n\t\tdouble b_int = Math.floor(b);\n\t\tdouble b_double = b-b_int;\n\t\tBigDecimal ans = new BigDecimal(a);\n\t\tBigDecimal b_int1 = new BigDecimal(b_int);\n\t\tBigDecimal b_double1 = new BigDecimal(b_double);\n\t\tans = ans.multiply(b_int1);\n\t\tBigDecimal a_floor = new BigDecimal(a);\n\t\ta_floor = a_floor.multiply(b_double1);\n\t\ta_floor = a_floor.setScale(0, BigDecimal.ROUND_DOWN);\n\t\tans = ans.add(a_floor);\n\t\tSystem.out.println(ans);\n\t }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "sample_input": "198 1.10\n"}, "reference_outputs": ["217\n"], "source_document_id": "p02659", "source_text": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 132, "memory_kb": 37748}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s567350394", "group_id": "codeNet:p02659", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc=new Scanner(System.in);\n\t\tlong n =sc.nextLong();\n\t\tint f = (int)Math.floor((double)100*sc.nextDouble());\n\t\tlong temp = (long)n*f;\n\t\tSystem.out.println((long)temp/100);\n\t}\n}", "language": "Java", "metadata": {"date": 1590978563, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02659.html", "problem_id": "p02659", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02659/input.txt", "sample_output_relpath": "derived/input_output/data/p02659/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02659/Java/s567350394.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s567350394", "user_id": "u131881594"}, "prompt_components": {"gold_output": "217\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc=new Scanner(System.in);\n\t\tlong n =sc.nextLong();\n\t\tint f = (int)Math.floor((double)100*sc.nextDouble());\n\t\tlong temp = (long)n*f;\n\t\tSystem.out.println((long)temp/100);\n\t}\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "sample_input": "198 1.10\n"}, "reference_outputs": ["217\n"], "source_document_id": "p02659", "source_text": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 274, "cpu_time_ms": 120, "memory_kb": 37332}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s480861721", "group_id": "codeNet:p02659", "input_text": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String args[]){\n Scanner sc = new Scanner(System.in);\n long a = sc.nextLong();\n double b = sc.nextDouble();\n\n double ans = a * b;\n\n System.out.println((long)Math.floor(ans));\n }\n}\n\n", "language": "Java", "metadata": {"date": 1590978182, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02659.html", "problem_id": "p02659", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02659/input.txt", "sample_output_relpath": "derived/input_output/data/p02659/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02659/Java/s480861721.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s480861721", "user_id": "u084693272"}, "prompt_components": {"gold_output": "217\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String args[]){\n Scanner sc = new Scanner(System.in);\n long a = sc.nextLong();\n double b = sc.nextDouble();\n\n double ans = a * b;\n\n System.out.println((long)Math.floor(ans));\n }\n}\n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "sample_input": "198 1.10\n"}, "reference_outputs": ["217\n"], "source_document_id": "p02659", "source_text": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 121, "memory_kb": 37276}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s364990848", "group_id": "codeNet:p02659", "input_text": "import java.util.*;\nimport java.math.*;\npublic class Main {\n public static String mul(String v1, String v2, int scale) {\n if (scale < 0) {\n throw new IllegalArgumentException(\n \"The scale must be a positive integer or zero\");\n }\n BigDecimal b1 = new BigDecimal(v1);\n BigDecimal b2 = new BigDecimal(v2);\n return b1.multiply(b2).setScale(scale, BigDecimal.ROUND_DOWN).toString();\n }\n public static void main(String[] args)\n {\n Scanner input =new Scanner(System.in);\nString str1=input.next();\n String str2=input.next();//会从控制5261台读入一4102个字符串,1653以空格版为标志权\n Main c=new Main();\n System.out.println(c.mul(str1,str2,0));\n\n }\n}", "language": "Java", "metadata": {"date": 1590978120, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02659.html", "problem_id": "p02659", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02659/input.txt", "sample_output_relpath": "derived/input_output/data/p02659/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02659/Java/s364990848.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s364990848", "user_id": "u405647930"}, "prompt_components": {"gold_output": "217\n", "input_to_evaluate": "import java.util.*;\nimport java.math.*;\npublic class Main {\n public static String mul(String v1, String v2, int scale) {\n if (scale < 0) {\n throw new IllegalArgumentException(\n \"The scale must be a positive integer or zero\");\n }\n BigDecimal b1 = new BigDecimal(v1);\n BigDecimal b2 = new BigDecimal(v2);\n return b1.multiply(b2).setScale(scale, BigDecimal.ROUND_DOWN).toString();\n }\n public static void main(String[] args)\n {\n Scanner input =new Scanner(System.in);\nString str1=input.next();\n String str2=input.next();//会从控制5261台读入一4102个字符串,1653以空格版为标志权\n Main c=new Main();\n System.out.println(c.mul(str1,str2,0));\n\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "sample_input": "198 1.10\n"}, "reference_outputs": ["217\n"], "source_document_id": "p02659", "source_text": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 768, "cpu_time_ms": 104, "memory_kb": 35960}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s091010429", "group_id": "codeNet:p02659", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tlong A = Long.parseLong(sc.next());\n\t\tdouble B = Double.parseDouble(sc.next());\n\t\tsc.close();\n\n\t\tlong hunSum = (long) Math.floor(100 * B);\n\t\tlong ans = (A * hunSum) / 100L;\n\t\tSystem.out.println(ans);\n\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1590977538, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02659.html", "problem_id": "p02659", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02659/input.txt", "sample_output_relpath": "derived/input_output/data/p02659/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02659/Java/s091010429.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s091010429", "user_id": "u556125658"}, "prompt_components": {"gold_output": "217\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tlong A = Long.parseLong(sc.next());\n\t\tdouble B = Double.parseDouble(sc.next());\n\t\tsc.close();\n\n\t\tlong hunSum = (long) Math.floor(100 * B);\n\t\tlong ans = (A * hunSum) / 100L;\n\t\tSystem.out.println(ans);\n\n\t}\n\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "sample_input": "198 1.10\n"}, "reference_outputs": ["217\n"], "source_document_id": "p02659", "source_text": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 338, "cpu_time_ms": 110, "memory_kb": 35832}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s779412886", "group_id": "codeNet:p02659", "input_text": "import java.math.BigDecimal;\nimport java.util.*;\n\npublic class Main {\n\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n double A = sc.nextDouble(),B = sc.nextDouble();\n String S = BigDecimal.valueOf((double) A*B).toPlainString();\n if(S.contains(\".\")){\n System.out.println(S.substring(0,S.indexOf('.')));\n }else{\n System.out.println(S);\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1590977050, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02659.html", "problem_id": "p02659", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02659/input.txt", "sample_output_relpath": "derived/input_output/data/p02659/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02659/Java/s779412886.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s779412886", "user_id": "u686175224"}, "prompt_components": {"gold_output": "217\n", "input_to_evaluate": "import java.math.BigDecimal;\nimport java.util.*;\n\npublic class Main {\n\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n double A = sc.nextDouble(),B = sc.nextDouble();\n String S = BigDecimal.valueOf((double) A*B).toPlainString();\n if(S.contains(\".\")){\n System.out.println(S.substring(0,S.indexOf('.')));\n }else{\n System.out.println(S);\n }\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "sample_input": "198 1.10\n"}, "reference_outputs": ["217\n"], "source_document_id": "p02659", "source_text": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 445, "cpu_time_ms": 125, "memory_kb": 37696}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s373624359", "group_id": "codeNet:p02659", "input_text": "import java.util.Scanner;\n\n\npublic class Main {\n\t\tpublic static void main (String args[]) throws Exception{\n\t\tScanner scan = new Scanner(System.in);\n\t\tlong a = scan.nextLong();\n\t\tdouble b = scan.nextDouble();\n\t\t// seisuu\n\t\tlong ans = a * (long)(b * 100);\n\t\tSystem.out.println(ans / 100);\n\t}\n}", "language": "Java", "metadata": {"date": 1590976806, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02659.html", "problem_id": "p02659", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02659/input.txt", "sample_output_relpath": "derived/input_output/data/p02659/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02659/Java/s373624359.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s373624359", "user_id": "u772776435"}, "prompt_components": {"gold_output": "217\n", "input_to_evaluate": "import java.util.Scanner;\n\n\npublic class Main {\n\t\tpublic static void main (String args[]) throws Exception{\n\t\tScanner scan = new Scanner(System.in);\n\t\tlong a = scan.nextLong();\n\t\tdouble b = scan.nextDouble();\n\t\t// seisuu\n\t\tlong ans = a * (long)(b * 100);\n\t\tSystem.out.println(ans / 100);\n\t}\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "sample_input": "198 1.10\n"}, "reference_outputs": ["217\n"], "source_document_id": "p02659", "source_text": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 293, "cpu_time_ms": 95, "memory_kb": 28924}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s368743980", "group_id": "codeNet:p02659", "input_text": "//package bigneer;\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.math.BigInteger;\n\npublic class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\t// TODO Auto-generated method stub\n\n\t\tBufferedReader br =new BufferedReader(new InputStreamReader(System.in));\n//\t\tint t=Integer.parseInt(br.readLine());\n//\t\twhile(t-->0) {\n//\t\t\tint n=Integer.parseInt(br.readLine());\n\t\t\tString q[]=br.readLine().split(\" \");\n\t\t\tlong a=Long.parseLong(q[0]);\n\t\t\tdouble b=Double.parseDouble(q[1]);\n//\t\t\tlong ans=;\n\t\t\tSystem.out.println((long)Math.floor((a*b)));\n//\t\t\tlong a[]=new long[n];\n//\t\t\tfor(int i=0;iMath.pow(10, 18)||p<0||p0) {\n//\t\t\tint n=Integer.parseInt(br.readLine());\n\t\t\tString q[]=br.readLine().split(\" \");\n\t\t\tlong a=Long.parseLong(q[0]);\n\t\t\tdouble b=Double.parseDouble(q[1]);\n//\t\t\tlong ans=;\n\t\t\tSystem.out.println((long)Math.floor((a*b)));\n//\t\t\tlong a[]=new long[n];\n//\t\t\tfor(int i=0;iMath.pow(10, 18)||p<0||p{\n\tint x;\n\tint y;\n\n\t\n\tpair (int i,int j)\n\t{ x=i; y=j;\n\t\n\t\t\n\t}\n\tpublic int compareTo(pair p){\n\t\tif(this.x!=p.x) { return this.x-p.x;}\n\t\telse { return this.y-p.y;}\n\t}\n\tpublic int hashCode() { return (x+\" \"+y).hashCode();}\n\tpublic String toString(){ return x+\" \"+y;} \n\tpublic boolean equals(Object o){ \n\t\tpair x = (pair) o ;\n\t\treturn (x.x==this.x&&x.y==this.y);}\n}\n\n\n\nint inf = (int)1e9 + 5;\nlong mod = (long)1e9 + 7;\nvoid solve() throws Exception{\n\t//long a = nl();\n\tBigDecimal bd1 = new BigDecimal(ns());\n\tBigDecimal bd2 = new BigDecimal(ns());\n\tbd1 = bd1.multiply(bd2);\n\t//\tpn(bd1);\n\n\tpn(bd1.toString().split(\"\\\\.\")[0]);\n\n\n}\n\nlong pow(long a,long b){\n\tlong result = 1;\n\twhile(b>0){\n\tif(b%2==1) result = (result * a) % mod;\n\t\tb/=2;\n\t\ta=(a*a)%mod;\n\t}\n\treturn result;\n}\n\n\nvoid print(Object o){\nSystem.out.println(o);\nSystem.out.flush();\n}\n\nlong gcd(long a, long b) \n{ \nif (b == 0) \nreturn a; \nreturn gcd(b, a % b); \n}\nvoid run() throws Exception{\n\t\tis = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());\nout = new PrintWriter(System.out);\n\t\t\n\t\tlong s = System.currentTimeMillis();\n\t\tsolve();\n\t\tout.flush();\n\t\tif(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+\"ms\");\n}\n\t\n\t\npublic static void main(String[] args) throws Exception { new Main().run(); }\n\t\n//output methods\nprivate void pn(Object o)\n{\n\tout.println(o);\n}\nprivate void p(Object o)\n{\n\tout.print(o);\n}\n\n\n\n//input methods\n\t\tprivate byte[] inbuf = new byte[1024];\n\tpublic int lenbuf = 0, ptrbuf = 0;\n\t\n\n\tprivate int readByte()\n\t{\n\t\tif(lenbuf == -1)throw new InputMismatchException();\n\t\tif(ptrbuf >= lenbuf){\n\t\t\tptrbuf = 0;\n\t\t\ttry { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }\n\t\t\tif(lenbuf <= 0)return -1;\n\t\t}\n\t\treturn inbuf[ptrbuf++];\n\t}\n\t\n\t\n\t\n\t\n\tprivate boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }\n\tprivate int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }\n\t\n\tprivate double nd() { return Double.parseDouble(ns()); }\n\tprivate char nc() { return (char)skip(); }\n\t\n\tprivate String ns()\n\t{\n\t\tint b = skip();\n\t\tStringBuilder sb = new StringBuilder();\n\t\twhile(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\t\n\tprivate char[] ns(int n)\n\t{\n\t\tchar[] buf = new char[n];\n\t\tint b = skip(), p = 0;\n\t\twhile(p < n && !(isSpaceChar(b))){\n\t\t\tbuf[p++] = (char)b;\n\t\t\tb = readByte();\n\t\t}\n\t\treturn n == p ? buf : Arrays.copyOf(buf, p);\n\t}\n\t\t\n\tprivate char[][] nm(int n, int m)\n\t{\n\t\tchar[][] map = new char[n][];\n\t\tfor(int i = 0;i < n;i++)map[i] = ns(m);\n\t\treturn map;\n\t}\n\t\n\tprivate int[] na(int n)\n\t{\n\t\tint[] a = new int[n];\n\t\tfor(int i = 0;i < n;i++)a[i] = ni();\n\t\treturn a;\n\t}\n\t\n\tprivate int ni()\n\t{\n\t\tint num = 0, b;\n\t\tboolean minus = false;\n\t\twhile((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));\n\t\tif(b == '-'){\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\t\n\t\twhile(true){\n\t\t\tif(b >= '0' && b <= '9'){\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t}else{\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\t\n\tprivate long nl()\n\t{\n\t\tlong num = 0;\n\t\tint b;\n\t\tboolean minus = false;\n\t\twhile((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));\n\t\tif(b == '-'){\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\t\n\t\twhile(true){\n\t\t\tif(b >= '0' && b <= '9'){\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t}else{\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\t\n\tprivate void tr(Object... o) { if(INPUT.length() > 0)System.out.println(Arrays.deepToString(o)); }\n\tvoid watch(Object ... a) throws Exception{\n\t\tint i=1;\n\t\tprint(\"watch starts :\");\n\t\tfor(Object o : a ) {\n\t\t\t//print(o);\n\t\t\tboolean notfound = true;\n\t\t\tif(o.getClass().isArray()){\n\t\t\t\t\n\t\t\t\tString type = o.getClass().getName().toString();\n\t\t\t\t//print(\"type is \"+type);\n\t\t\t\tswitch (type) {\n\t\t\t\t\tcase \"[I\":{\n\t\t\t\t\t\tint[] test = (int[])o ;\n\t\t\t\t\t\tprint(i+\" \"+Arrays.toString(test));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"[[I\":{\n\t\t\t\t\t\tint[][] obj = (int[][])o;\n\t\t\t\t\t\t\n\t\t\t\t\t\tprint(i+\" \"+Arrays.deepToString(obj));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"[J\" : {\n\t\t\t\t\t\t\n\t\t\t\t\t\tlong[] obj = (long[])o ;\n\t\t\t\t\t\tprint(i+\" \"+Arrays.toString(obj));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"[[J\": {\n\t\t\t\t\t\t\n\t\t\t\t\t\tlong[][] obj = (long[][])o;\n\t\t\t\t\t\tprint(i+\" \"+Arrays.deepToString(obj));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"[D\" :{\n\t\t\t\t\t\t\n\t\t\t\t\t\tdouble[] obj= (double[])o;\n\t\t\t\t\t\tprint(i+\" \"+Arrays.toString(obj));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"[[D\" :{\n\t\t\t\t\t\t\n\t\t\t\t\t\tdouble[][] obj = (double[][])o;\n\t\t\t\t\t\tprint(i+\" \"+Arrays.deepToString(obj));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"[Ljava.lang.String\": {\n\t\t\t\t\t\t\n\t\t\t\t\t\tString[] obj = (String[])o ;\n\t\t\t\t\t\tprint(i+\" \"+Arrays.toString(obj));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"[[Ljava.lang.String\": {\n\t\t\t\t\t\t\n\t\t\t\t\t\tString[][] obj = (String[][])o ;\n\t\t\t\t\t\tprint(i+\" \"+Arrays.deepToString(obj));\n\t\t\t\t\t\tbreak ; \n\t\t\t\t\t}\n\t\t\t\t\tcase \"[C\" :{\n\t\t\t\t\t\tchar[] obj = (char[])o ;\n\t\t\t\t\t\tprint(i+\" \"+Arrays.toString(obj));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"[[C\" :{\n\t\t\t\t\t\t\n\t\t\t\t\t\tchar[][] obj = (char[][])o;\n\t\t\t\t\t\tprint(i+\" \"+Arrays.deepToString(obj));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\tdefault:{\n\t\t\t\t\t\tprint(i+\" type not identified\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tnotfound = false;\n\t\t\t\t\n\t\t\t}\n\t\t\tif(o.getClass() == ArrayList.class){\n\t\t\t\tprint(i+\" al: \"+o);\n\t\t\t\tnotfound = false;\n\t\t\t}\n\t\t\tif(o.getClass() == HashSet.class){\n\t\t\t\tprint(i+\" hs: \"+o);\n\t\t\t\tnotfound = false;\n\t\t\t}\n\t\t\tif(o.getClass() == TreeSet.class){\n\t\t\t\tprint(i+\" ts: \"+o);\n\t\t\t\tnotfound = false;\n\t\t\t}\n\t\t\tif(o.getClass() == TreeMap.class){\n\t\t\t\tprint(i+\" tm: \"+o);\n\t\t\t\tnotfound = false;\n\t\t\t}\n\t\t\tif(o.getClass() == HashMap.class){\n\t\t\t\tprint(i+\" hm: \"+o);\n\t\t\t\tnotfound = false;\n\t\t\t}\n\t\t\tif(o.getClass() == LinkedList.class){\n\t\t\t\tprint(i+\" ll: \"+o);\n\t\t\t\tnotfound = false;\n\t\t\t}\n\t\t\tif(o.getClass() == PriorityQueue.class){\n\t\t\t\tprint(i+\" pq : \"+o);\n\t\t\t\tnotfound = false;\n\t\t\t}\n\t\t\tif(o.getClass() == pair.class){\n\t\t\t\tprint(i+\" pq : \"+o);\n\t\t\t\tnotfound = false;\n\t\t\t}\n\t\t\t\n\t\t\tif(notfound){\n\t\t\t\tprint(i+\" unknown: \"+o);\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t\tprint(\"watch ends \");\n\t}\n\n}\t", "language": "Java", "metadata": {"date": 1590975622, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02659.html", "problem_id": "p02659", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02659/input.txt", "sample_output_relpath": "derived/input_output/data/p02659/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02659/Java/s488009276.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s488009276", "user_id": "u667208928"}, "prompt_components": {"gold_output": "217\n", "input_to_evaluate": "import java.io.ByteArrayInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.*;\nimport java.io.*;\nimport java.math.* ;\npublic class Main {\nInputStream is;\n\tPrintWriter out;\n\tString INPUT = \"\"; \n//class Declaration\n\nstatic class pair implements Comparable{\n\tint x;\n\tint y;\n\n\t\n\tpair (int i,int j)\n\t{ x=i; y=j;\n\t\n\t\t\n\t}\n\tpublic int compareTo(pair p){\n\t\tif(this.x!=p.x) { return this.x-p.x;}\n\t\telse { return this.y-p.y;}\n\t}\n\tpublic int hashCode() { return (x+\" \"+y).hashCode();}\n\tpublic String toString(){ return x+\" \"+y;} \n\tpublic boolean equals(Object o){ \n\t\tpair x = (pair) o ;\n\t\treturn (x.x==this.x&&x.y==this.y);}\n}\n\n\n\nint inf = (int)1e9 + 5;\nlong mod = (long)1e9 + 7;\nvoid solve() throws Exception{\n\t//long a = nl();\n\tBigDecimal bd1 = new BigDecimal(ns());\n\tBigDecimal bd2 = new BigDecimal(ns());\n\tbd1 = bd1.multiply(bd2);\n\t//\tpn(bd1);\n\n\tpn(bd1.toString().split(\"\\\\.\")[0]);\n\n\n}\n\nlong pow(long a,long b){\n\tlong result = 1;\n\twhile(b>0){\n\tif(b%2==1) result = (result * a) % mod;\n\t\tb/=2;\n\t\ta=(a*a)%mod;\n\t}\n\treturn result;\n}\n\n\nvoid print(Object o){\nSystem.out.println(o);\nSystem.out.flush();\n}\n\nlong gcd(long a, long b) \n{ \nif (b == 0) \nreturn a; \nreturn gcd(b, a % b); \n}\nvoid run() throws Exception{\n\t\tis = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());\nout = new PrintWriter(System.out);\n\t\t\n\t\tlong s = System.currentTimeMillis();\n\t\tsolve();\n\t\tout.flush();\n\t\tif(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+\"ms\");\n}\n\t\n\t\npublic static void main(String[] args) throws Exception { new Main().run(); }\n\t\n//output methods\nprivate void pn(Object o)\n{\n\tout.println(o);\n}\nprivate void p(Object o)\n{\n\tout.print(o);\n}\n\n\n\n//input methods\n\t\tprivate byte[] inbuf = new byte[1024];\n\tpublic int lenbuf = 0, ptrbuf = 0;\n\t\n\n\tprivate int readByte()\n\t{\n\t\tif(lenbuf == -1)throw new InputMismatchException();\n\t\tif(ptrbuf >= lenbuf){\n\t\t\tptrbuf = 0;\n\t\t\ttry { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }\n\t\t\tif(lenbuf <= 0)return -1;\n\t\t}\n\t\treturn inbuf[ptrbuf++];\n\t}\n\t\n\t\n\t\n\t\n\tprivate boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }\n\tprivate int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }\n\t\n\tprivate double nd() { return Double.parseDouble(ns()); }\n\tprivate char nc() { return (char)skip(); }\n\t\n\tprivate String ns()\n\t{\n\t\tint b = skip();\n\t\tStringBuilder sb = new StringBuilder();\n\t\twhile(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\t\n\tprivate char[] ns(int n)\n\t{\n\t\tchar[] buf = new char[n];\n\t\tint b = skip(), p = 0;\n\t\twhile(p < n && !(isSpaceChar(b))){\n\t\t\tbuf[p++] = (char)b;\n\t\t\tb = readByte();\n\t\t}\n\t\treturn n == p ? buf : Arrays.copyOf(buf, p);\n\t}\n\t\t\n\tprivate char[][] nm(int n, int m)\n\t{\n\t\tchar[][] map = new char[n][];\n\t\tfor(int i = 0;i < n;i++)map[i] = ns(m);\n\t\treturn map;\n\t}\n\t\n\tprivate int[] na(int n)\n\t{\n\t\tint[] a = new int[n];\n\t\tfor(int i = 0;i < n;i++)a[i] = ni();\n\t\treturn a;\n\t}\n\t\n\tprivate int ni()\n\t{\n\t\tint num = 0, b;\n\t\tboolean minus = false;\n\t\twhile((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));\n\t\tif(b == '-'){\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\t\n\t\twhile(true){\n\t\t\tif(b >= '0' && b <= '9'){\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t}else{\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\t\n\tprivate long nl()\n\t{\n\t\tlong num = 0;\n\t\tint b;\n\t\tboolean minus = false;\n\t\twhile((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));\n\t\tif(b == '-'){\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\t\n\t\twhile(true){\n\t\t\tif(b >= '0' && b <= '9'){\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t}else{\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\t\n\tprivate void tr(Object... o) { if(INPUT.length() > 0)System.out.println(Arrays.deepToString(o)); }\n\tvoid watch(Object ... a) throws Exception{\n\t\tint i=1;\n\t\tprint(\"watch starts :\");\n\t\tfor(Object o : a ) {\n\t\t\t//print(o);\n\t\t\tboolean notfound = true;\n\t\t\tif(o.getClass().isArray()){\n\t\t\t\t\n\t\t\t\tString type = o.getClass().getName().toString();\n\t\t\t\t//print(\"type is \"+type);\n\t\t\t\tswitch (type) {\n\t\t\t\t\tcase \"[I\":{\n\t\t\t\t\t\tint[] test = (int[])o ;\n\t\t\t\t\t\tprint(i+\" \"+Arrays.toString(test));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"[[I\":{\n\t\t\t\t\t\tint[][] obj = (int[][])o;\n\t\t\t\t\t\t\n\t\t\t\t\t\tprint(i+\" \"+Arrays.deepToString(obj));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"[J\" : {\n\t\t\t\t\t\t\n\t\t\t\t\t\tlong[] obj = (long[])o ;\n\t\t\t\t\t\tprint(i+\" \"+Arrays.toString(obj));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"[[J\": {\n\t\t\t\t\t\t\n\t\t\t\t\t\tlong[][] obj = (long[][])o;\n\t\t\t\t\t\tprint(i+\" \"+Arrays.deepToString(obj));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"[D\" :{\n\t\t\t\t\t\t\n\t\t\t\t\t\tdouble[] obj= (double[])o;\n\t\t\t\t\t\tprint(i+\" \"+Arrays.toString(obj));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"[[D\" :{\n\t\t\t\t\t\t\n\t\t\t\t\t\tdouble[][] obj = (double[][])o;\n\t\t\t\t\t\tprint(i+\" \"+Arrays.deepToString(obj));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"[Ljava.lang.String\": {\n\t\t\t\t\t\t\n\t\t\t\t\t\tString[] obj = (String[])o ;\n\t\t\t\t\t\tprint(i+\" \"+Arrays.toString(obj));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"[[Ljava.lang.String\": {\n\t\t\t\t\t\t\n\t\t\t\t\t\tString[][] obj = (String[][])o ;\n\t\t\t\t\t\tprint(i+\" \"+Arrays.deepToString(obj));\n\t\t\t\t\t\tbreak ; \n\t\t\t\t\t}\n\t\t\t\t\tcase \"[C\" :{\n\t\t\t\t\t\tchar[] obj = (char[])o ;\n\t\t\t\t\t\tprint(i+\" \"+Arrays.toString(obj));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"[[C\" :{\n\t\t\t\t\t\t\n\t\t\t\t\t\tchar[][] obj = (char[][])o;\n\t\t\t\t\t\tprint(i+\" \"+Arrays.deepToString(obj));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\tdefault:{\n\t\t\t\t\t\tprint(i+\" type not identified\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tnotfound = false;\n\t\t\t\t\n\t\t\t}\n\t\t\tif(o.getClass() == ArrayList.class){\n\t\t\t\tprint(i+\" al: \"+o);\n\t\t\t\tnotfound = false;\n\t\t\t}\n\t\t\tif(o.getClass() == HashSet.class){\n\t\t\t\tprint(i+\" hs: \"+o);\n\t\t\t\tnotfound = false;\n\t\t\t}\n\t\t\tif(o.getClass() == TreeSet.class){\n\t\t\t\tprint(i+\" ts: \"+o);\n\t\t\t\tnotfound = false;\n\t\t\t}\n\t\t\tif(o.getClass() == TreeMap.class){\n\t\t\t\tprint(i+\" tm: \"+o);\n\t\t\t\tnotfound = false;\n\t\t\t}\n\t\t\tif(o.getClass() == HashMap.class){\n\t\t\t\tprint(i+\" hm: \"+o);\n\t\t\t\tnotfound = false;\n\t\t\t}\n\t\t\tif(o.getClass() == LinkedList.class){\n\t\t\t\tprint(i+\" ll: \"+o);\n\t\t\t\tnotfound = false;\n\t\t\t}\n\t\t\tif(o.getClass() == PriorityQueue.class){\n\t\t\t\tprint(i+\" pq : \"+o);\n\t\t\t\tnotfound = false;\n\t\t\t}\n\t\t\tif(o.getClass() == pair.class){\n\t\t\t\tprint(i+\" pq : \"+o);\n\t\t\t\tnotfound = false;\n\t\t\t}\n\t\t\t\n\t\t\tif(notfound){\n\t\t\t\tprint(i+\" unknown: \"+o);\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t\tprint(\"watch ends \");\n\t}\n\n}\t", "problem_context": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "sample_input": "198 1.10\n"}, "reference_outputs": ["217\n"], "source_document_id": "p02659", "source_text": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 6330, "cpu_time_ms": 74, "memory_kb": 33156}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s585093148", "group_id": "codeNet:p02659", "input_text": "import java.util.Scanner;\n \n \npublic class Main {\n \n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tlong a = sc.nextLong();\n\t\tlong b = (long) (sc.nextDouble()*100);\n\t\tlong ans = (a*b)/100;\n\t\tSystem.out.println(ans);\n \n\t}\n}", "language": "Java", "metadata": {"date": 1590975289, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02659.html", "problem_id": "p02659", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02659/input.txt", "sample_output_relpath": "derived/input_output/data/p02659/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02659/Java/s585093148.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s585093148", "user_id": "u095200025"}, "prompt_components": {"gold_output": "217\n", "input_to_evaluate": "import java.util.Scanner;\n \n \npublic class Main {\n \n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tlong a = sc.nextLong();\n\t\tlong b = (long) (sc.nextDouble()*100);\n\t\tlong ans = (a*b)/100;\n\t\tSystem.out.println(ans);\n \n\t}\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "sample_input": "198 1.10\n"}, "reference_outputs": ["217\n"], "source_document_id": "p02659", "source_text": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 111, "memory_kb": 36860}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s001356620", "group_id": "codeNet:p02659", "input_text": "import java.math.BigDecimal;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String... args) {\n Scanner scanner = new Scanner(System.in);\n\n long A = scanner.nextLong();\n double B = scanner.nextDouble();\n\n BigDecimal a = new BigDecimal(String.valueOf(A));\n BigDecimal b = new BigDecimal(String.valueOf(B));\n\n System.out.println(a.multiply(b).longValue());\n }\n}\n", "language": "Java", "metadata": {"date": 1590974783, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02659.html", "problem_id": "p02659", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02659/input.txt", "sample_output_relpath": "derived/input_output/data/p02659/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02659/Java/s001356620.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s001356620", "user_id": "u572049366"}, "prompt_components": {"gold_output": "217\n", "input_to_evaluate": "import java.math.BigDecimal;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String... args) {\n Scanner scanner = new Scanner(System.in);\n\n long A = scanner.nextLong();\n double B = scanner.nextDouble();\n\n BigDecimal a = new BigDecimal(String.valueOf(A));\n BigDecimal b = new BigDecimal(String.valueOf(B));\n\n System.out.println(a.multiply(b).longValue());\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "sample_input": "198 1.10\n"}, "reference_outputs": ["217\n"], "source_document_id": "p02659", "source_text": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 101, "memory_kb": 29216}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s116964537", "group_id": "codeNet:p02659", "input_text": "\n\nimport java.util.*;\n\npublic class Main{\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n double a = scanner.nextDouble();\n double b = scanner.nextDouble();\n double c = a*b;\n System.out.printf(\" %.0f\\n\",c);\n \n }\n \n}\n", "language": "Java", "metadata": {"date": 1590974523, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02659.html", "problem_id": "p02659", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02659/input.txt", "sample_output_relpath": "derived/input_output/data/p02659/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02659/Java/s116964537.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s116964537", "user_id": "u362532770"}, "prompt_components": {"gold_output": "217\n", "input_to_evaluate": "\n\nimport java.util.*;\n\npublic class Main{\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n double a = scanner.nextDouble();\n double b = scanner.nextDouble();\n double c = a*b;\n System.out.printf(\" %.0f\\n\",c);\n \n }\n \n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "sample_input": "198 1.10\n"}, "reference_outputs": ["217\n"], "source_document_id": "p02659", "source_text": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 119, "memory_kb": 37508}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s645936545", "group_id": "codeNet:p02659", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc=new Scanner(System.in);\n\t\tlong n =sc.nextLong();\n\t\tdouble f = sc.nextDouble();\n\t\tdouble f2=(double)n;\n\t\tSystem.out.println((long)Math.floor(f*f2));\n\t}\n}", "language": "Java", "metadata": {"date": 1590974243, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02659.html", "problem_id": "p02659", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02659/input.txt", "sample_output_relpath": "derived/input_output/data/p02659/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02659/Java/s645936545.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s645936545", "user_id": "u131881594"}, "prompt_components": {"gold_output": "217\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc=new Scanner(System.in);\n\t\tlong n =sc.nextLong();\n\t\tdouble f = sc.nextDouble();\n\t\tdouble f2=(double)n;\n\t\tSystem.out.println((long)Math.floor(f*f2));\n\t}\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "sample_input": "198 1.10\n"}, "reference_outputs": ["217\n"], "source_document_id": "p02659", "source_text": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 136, "memory_kb": 37424}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s479536020", "group_id": "codeNet:p02659", "input_text": "import java.util.*;\nimport java.io.*;\nimport java.math.*;\n\npublic class Main {\n \n public static void main(String[] args) throws IOException {\n \n Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));\n BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));\n \n \n double a = sc.nextDouble();\n double b = sc.nextDouble();\n \n System.out.println((long)(a * b));\n \n \n \n out.flush();\n }\n}", "language": "Java", "metadata": {"date": 1590974216, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02659.html", "problem_id": "p02659", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02659/input.txt", "sample_output_relpath": "derived/input_output/data/p02659/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02659/Java/s479536020.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s479536020", "user_id": "u436268055"}, "prompt_components": {"gold_output": "217\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\nimport java.math.*;\n\npublic class Main {\n \n public static void main(String[] args) throws IOException {\n \n Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));\n BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));\n \n \n double a = sc.nextDouble();\n double b = sc.nextDouble();\n \n System.out.println((long)(a * b));\n \n \n \n out.flush();\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "sample_input": "198 1.10\n"}, "reference_outputs": ["217\n"], "source_document_id": "p02659", "source_text": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 524, "cpu_time_ms": 96, "memory_kb": 28876}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s806472555", "group_id": "codeNet:p02659", "input_text": "import java.util.*;\npublic class Main {\n\tstatic Scanner sc = new Scanner(System.in);\n\tpublic static void main(String[] args) {\n\t\tdouble a = sc.nextDouble();\n\t\tdouble b = sc.nextDouble();\n\t\tSystem.out.println((long)(a*b));\n\t}\n\n}", "language": "Java", "metadata": {"date": 1590974181, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02659.html", "problem_id": "p02659", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02659/input.txt", "sample_output_relpath": "derived/input_output/data/p02659/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02659/Java/s806472555.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s806472555", "user_id": "u953146767"}, "prompt_components": {"gold_output": "217\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n\tstatic Scanner sc = new Scanner(System.in);\n\tpublic static void main(String[] args) {\n\t\tdouble a = sc.nextDouble();\n\t\tdouble b = sc.nextDouble();\n\t\tSystem.out.println((long)(a*b));\n\t}\n\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "sample_input": "198 1.10\n"}, "reference_outputs": ["217\n"], "source_document_id": "p02659", "source_text": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 121, "memory_kb": 37340}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s337167299", "group_id": "codeNet:p02659", "input_text": "import java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n // write your code here\n Scanner sc = new Scanner(System.in);\n long a = sc.nextLong();\n double b = sc.nextDouble();\n double ans = a * b;\n System.out.println((long) Math.floor(ans));\n }\n}", "language": "Java", "metadata": {"date": 1590973956, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02659.html", "problem_id": "p02659", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02659/input.txt", "sample_output_relpath": "derived/input_output/data/p02659/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02659/Java/s337167299.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s337167299", "user_id": "u711620077"}, "prompt_components": {"gold_output": "217\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n // write your code here\n Scanner sc = new Scanner(System.in);\n long a = sc.nextLong();\n double b = sc.nextDouble();\n double ans = a * b;\n System.out.println((long) Math.floor(ans));\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "sample_input": "198 1.10\n"}, "reference_outputs": ["217\n"], "source_document_id": "p02659", "source_text": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 115, "memory_kb": 36880}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s686330730", "group_id": "codeNet:p02659", "input_text": "import java.util.*;\n\npublic class Main{\n\t\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n long a=sc.nextLong(),f;\n double b=sc.nextDouble();\n System.out.println((long)(a*b));\n \n }\n}\n", "language": "Java", "metadata": {"date": 1590973880, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02659.html", "problem_id": "p02659", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02659/input.txt", "sample_output_relpath": "derived/input_output/data/p02659/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02659/Java/s686330730.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s686330730", "user_id": "u587100042"}, "prompt_components": {"gold_output": "217\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main{\n\t\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n long a=sc.nextLong(),f;\n double b=sc.nextDouble();\n System.out.println((long)(a*b));\n \n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "sample_input": "198 1.10\n"}, "reference_outputs": ["217\n"], "source_document_id": "p02659", "source_text": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 121, "memory_kb": 37444}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s365191453", "group_id": "codeNet:p02659", "input_text": "/*****Author: Satyajeet Singh, Delhi Technological University************************************/\n import java.io.*;\n import java.util.*;\n import java.text.*; \n import java.lang.*;\n import java.math.*;\npublic class Main{\n/*********************************************Constants******************************************/\n static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out)); \n static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n static long mod=(long)1e9+7;\n static long mod1=998244353;\n static ArrayList graph[];\n static int pptr=0,pptrmax=0;\n static String st[];\n/*****************************************Solution Begins***************************************/\n public static void main(String args[]) throws Exception{\n double x=pd();\n double y=pd();\n double r=(x*y);\n long ans=(long)r;\n out.println(ans);\n/****************************************Solution Ends**************************************************/\n out.flush();\n out.close();\n }\n/****************************************Template Begins************************************************/\n static void nl() throws Exception{\n pptr=0;\n st=br.readLine().split(\" \");\n pptrmax=st.length;\n }\n static void nls() throws Exception{\n pptr=0;\n st=br.readLine().split(\"\");\n pptrmax=st.length;\n }\n static int pi() throws Exception{\n if(pptr==pptrmax)\n nl();\n return Integer.parseInt(st[pptr++]);\n }\n static long pl() throws Exception{\n if(pptr==pptrmax)\n nl();\n return Long.parseLong(st[pptr++]);\n }\n static double pd() throws Exception{\n if(pptr==pptrmax)\n nl();\n return Double.parseDouble(st[pptr++]);\n }\n static String ps() throws Exception{\n if(pptr==pptrmax)\n nl();\n return st[pptr++];\n }\n/***************************************Precision Printing**********************************************/\n static void printPrecision(double d){\n DecimalFormat ft = new DecimalFormat(\"0.0000000000\"); \n out.println(ft.format(d));\n }\n/**************************************Bit Manipulation**************************************************/\n static int countBit(long mask){\n int ans=0;\n while(mask!=0){\n mask&=(mask-1);\n ans++;\n }\n return ans;\n }\n/******************************************Graph*********************************************************/\n static void Makegraph(int n){\n graph=new ArrayList[n];\n for(int i=0;i();\n }\n static void addEdge(int a,int b){\n graph[a].add(b);\n }\n // static void addEdge(int a,int b,int c){\n // graph[a].add(new Pair(b,c));\n // } \n/*********************************************PAIR********************************************************/\n static class Pair{\n int u;\n int v;\n public Pair(int u, int v) {\n this.u = u;\n this.v = v;\n }\n public int hashCode() {\n int hu = (int) (u ^ (u >>> 32));\n int hv = (int) (v ^ (v >>> 32));\n return 31 * hu + hv;\n }\n public boolean equals(Object o) {\n Pair other = (Pair) o;\n return u == other.u && v == other.v;\n }\n public String toString() {\n return \"[u=\" + u + \", v=\" + v + \"]\";\n }\n }\n/******************************************Long Pair*******************************************************/\n static class Pairl{\n long u;\n long v;\n public Pairl(long u, long v) {\n this.u = u;\n this.v = v;\n }\n public int hashCode() {\n int hu = (int) (u ^ (u >>> 32));\n int hv = (int) (v ^ (v >>> 32));\n return 31 * hu + hv;\n }\n public boolean equals(Object o) {\n Pairl other = (Pairl) o;\n return u == other.u && v == other.v;\n }\n public String toString() {\n return \"[u=\" + u + \", v=\" + v + \"]\";\n }\n }\n/*****************************************DEBUG***********************************************************/\n public static void debug(Object... o){\n System.out.println(Arrays.deepToString(o));\n }\n/************************************MODULAR EXPONENTIATION***********************************************/\n static long modulo(long a,long b,long c){\n long x=1,y=a%c;\n while(b > 0){\n if(b%2 == 1)\n x=(x*y)%c;\n y = (y*y)%c;\n b = b>>1;\n }\n return x%c;\n }\n/********************************************GCD**********************************************************/\n static long gcd(long x, long y){\n if(x==0)\n return y;\n if(y==0)\n return x;\n long r=0, a, b;\n a = (x > y) ? x : y; \n b = (x < y) ? x : y;\n r = b;\n while(a % b != 0){\n r = a % b;\n a = b;\n b = r;\n }\n return r;\n }\n}", "language": "Java", "metadata": {"date": 1590973649, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02659.html", "problem_id": "p02659", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02659/input.txt", "sample_output_relpath": "derived/input_output/data/p02659/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02659/Java/s365191453.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s365191453", "user_id": "u904730393"}, "prompt_components": {"gold_output": "217\n", "input_to_evaluate": "/*****Author: Satyajeet Singh, Delhi Technological University************************************/\n import java.io.*;\n import java.util.*;\n import java.text.*; \n import java.lang.*;\n import java.math.*;\npublic class Main{\n/*********************************************Constants******************************************/\n static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out)); \n static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n static long mod=(long)1e9+7;\n static long mod1=998244353;\n static ArrayList graph[];\n static int pptr=0,pptrmax=0;\n static String st[];\n/*****************************************Solution Begins***************************************/\n public static void main(String args[]) throws Exception{\n double x=pd();\n double y=pd();\n double r=(x*y);\n long ans=(long)r;\n out.println(ans);\n/****************************************Solution Ends**************************************************/\n out.flush();\n out.close();\n }\n/****************************************Template Begins************************************************/\n static void nl() throws Exception{\n pptr=0;\n st=br.readLine().split(\" \");\n pptrmax=st.length;\n }\n static void nls() throws Exception{\n pptr=0;\n st=br.readLine().split(\"\");\n pptrmax=st.length;\n }\n static int pi() throws Exception{\n if(pptr==pptrmax)\n nl();\n return Integer.parseInt(st[pptr++]);\n }\n static long pl() throws Exception{\n if(pptr==pptrmax)\n nl();\n return Long.parseLong(st[pptr++]);\n }\n static double pd() throws Exception{\n if(pptr==pptrmax)\n nl();\n return Double.parseDouble(st[pptr++]);\n }\n static String ps() throws Exception{\n if(pptr==pptrmax)\n nl();\n return st[pptr++];\n }\n/***************************************Precision Printing**********************************************/\n static void printPrecision(double d){\n DecimalFormat ft = new DecimalFormat(\"0.0000000000\"); \n out.println(ft.format(d));\n }\n/**************************************Bit Manipulation**************************************************/\n static int countBit(long mask){\n int ans=0;\n while(mask!=0){\n mask&=(mask-1);\n ans++;\n }\n return ans;\n }\n/******************************************Graph*********************************************************/\n static void Makegraph(int n){\n graph=new ArrayList[n];\n for(int i=0;i();\n }\n static void addEdge(int a,int b){\n graph[a].add(b);\n }\n // static void addEdge(int a,int b,int c){\n // graph[a].add(new Pair(b,c));\n // } \n/*********************************************PAIR********************************************************/\n static class Pair{\n int u;\n int v;\n public Pair(int u, int v) {\n this.u = u;\n this.v = v;\n }\n public int hashCode() {\n int hu = (int) (u ^ (u >>> 32));\n int hv = (int) (v ^ (v >>> 32));\n return 31 * hu + hv;\n }\n public boolean equals(Object o) {\n Pair other = (Pair) o;\n return u == other.u && v == other.v;\n }\n public String toString() {\n return \"[u=\" + u + \", v=\" + v + \"]\";\n }\n }\n/******************************************Long Pair*******************************************************/\n static class Pairl{\n long u;\n long v;\n public Pairl(long u, long v) {\n this.u = u;\n this.v = v;\n }\n public int hashCode() {\n int hu = (int) (u ^ (u >>> 32));\n int hv = (int) (v ^ (v >>> 32));\n return 31 * hu + hv;\n }\n public boolean equals(Object o) {\n Pairl other = (Pairl) o;\n return u == other.u && v == other.v;\n }\n public String toString() {\n return \"[u=\" + u + \", v=\" + v + \"]\";\n }\n }\n/*****************************************DEBUG***********************************************************/\n public static void debug(Object... o){\n System.out.println(Arrays.deepToString(o));\n }\n/************************************MODULAR EXPONENTIATION***********************************************/\n static long modulo(long a,long b,long c){\n long x=1,y=a%c;\n while(b > 0){\n if(b%2 == 1)\n x=(x*y)%c;\n y = (y*y)%c;\n b = b>>1;\n }\n return x%c;\n }\n/********************************************GCD**********************************************************/\n static long gcd(long x, long y){\n if(x==0)\n return y;\n if(y==0)\n return x;\n long r=0, a, b;\n a = (x > y) ? x : y; \n b = (x < y) ? x : y;\n r = b;\n while(a % b != 0){\n r = a % b;\n a = b;\n b = r;\n }\n return r;\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "sample_input": "198 1.10\n"}, "reference_outputs": ["217\n"], "source_document_id": "p02659", "source_text": "Score : 300 points\n\nProblem Statement\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n0 \\leq A \\leq 10^{15}\n\n0 \\leq B < 10\n\nA is an integer.\n\nB is a number with two digits after the decimal point.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n198 1.10\n\nSample Output 1\n\n217\n\nWe have 198 \\times 1.10 = 217.8. After truncating the fractional part, we have the answer: 217.\n\nSample Input 2\n\n1 0.01\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1000000000000000 9.99\n\nSample Output 3\n\n9990000000000000", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 5230, "cpu_time_ms": 64, "memory_kb": 25484}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s361105516", "group_id": "codeNet:p02684", "input_text": "import java.util.*;\n\npublic class Main{\n void solve(){\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n long k = scan.nextLong();\n int[] a = new int[n];\n for(int i = 0; i < n; i++) a[i] = scan.nextInt() - 1;\n int c = 1;\n int index = 0;\n List loop = new ArrayList<>();\n TreeSet seen = new TreeSet<>();\n loop.add(0);\n seen.add(0);\n while(!seen.contains(a[index])){\n loop.add(a[index]);\n seen.add(a[index]);\n index = a[index];\n c++;\n }\n int start = loop.indexOf(a[index]) + 1;\n c -= loop.size() - start;\n System.out.println(loop.get((int)(k % c)) + 1);\n }\n\n public static void main(String[] args){\n new Main().solve();\n }\n}", "language": "Java", "metadata": {"date": 1600482216, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02684.html", "problem_id": "p02684", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02684/input.txt", "sample_output_relpath": "derived/input_output/data/p02684/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02684/Java/s361105516.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s361105516", "user_id": "u459100168"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main{\n void solve(){\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n long k = scan.nextLong();\n int[] a = new int[n];\n for(int i = 0; i < n; i++) a[i] = scan.nextInt() - 1;\n int c = 1;\n int index = 0;\n List loop = new ArrayList<>();\n TreeSet seen = new TreeSet<>();\n loop.add(0);\n seen.add(0);\n while(!seen.contains(a[index])){\n loop.add(a[index]);\n seen.add(a[index]);\n index = a[index];\n c++;\n }\n int start = loop.indexOf(a[index]) + 1;\n c -= loop.size() - start;\n System.out.println(loop.get((int)(k % c)) + 1);\n }\n\n public static void main(String[] args){\n new Main().solve();\n }\n}", "problem_context": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "sample_input": "4 5\n3 2 4 1\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02684", "source_text": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 830, "cpu_time_ms": 684, "memory_kb": 71928}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s619778414", "group_id": "codeNet:p02684", "input_text": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.ArrayDeque;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.NoSuchElementException;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tnew Main().solve();\n\t\tpw.close();\n\t}\n\n\t/**\n\t * ASCII\n\t * 0 48\n\t * A 65\n\t * a 97\n\t */\n\n\tstatic PrintWriter pw = new PrintWriter(System.out);\n\n\tlong MOD = 1_000_000_007;\n\n\tvoid solve() {\n\t\tFastScanner sc = new FastScanner();\n\t\tint N = sc.nextInt();\n\t\tlong K = sc.nextLong();\n\t\tint[] A = new int[N+1];\n\t\tfor (int i = 1; i <= N; i++) A[i] = sc.nextInt();\n\t\tint[] b = new int[N+1];\n\t\tint s = 1;\n\t\tint l = 1;\n\t\tint pre = 1;\n\t\tint[] c = new int[N+1];\n\t\tfor (int i = 1; i <= N; i++) {\n\t\t\tc[i] = A[pre];\n\t\t\tif (b[A[pre]] != 0 || A[pre] == 1) {\n\t\t\t\ts = i;\n\t\t\t\tif (A[pre] == 1) s = 1;\n\t\t\t\tl = i - b[A[pre]];\n\t\t\t\tbreak;\n\t\t\t} else {\n\t\t\t\tb[A[pre]] = i;\n\t\t\t\tpre = A[pre];\n\t\t\t}\n\t\t}\n\t\tif (K <= s) {\n\t\t\tout(c[(int)K]);\n\t\t} else {\n\t\t\tout(c[s+(int)((K-s)%l)]);\n\t\t}\n\t}\n\n\tvoid func(List[] l, int now, int[] ans) {\n\t\tArrayDeque que = new ArrayDeque();\n\t\tque.addLast(now);\n\t\twhile (!que.isEmpty()) {\n\t\t\tint x = que.removeFirst();\n\t\t\tfor (int t : l[x]) {\n\t\t\t\tif (ans[t] == 0) {\n\t\t\t\t\tans[t] = x;\n\t\t\t\t\tque.addLast(t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tdouble getD(double x1, double x2, double y1, double y2) {\n\t\treturn Math.sqrt(Math.pow(x1-x2,2) + Math.pow(y1-y2, 2));\n\t}\n\n\tint[][] d4 = new int[][] {{1,0},{0,1},{-1,0},{0,-1}};\n\tint[][] d8 = new int[][] {{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};\n\n\tclass Data {\n\t\tint a;\n\t\tint b;\n\t\tint c;\n\t\tData(){}\n\t\tData(int a) {\n\t\t\tthis.a = a;\n\t\t}\n\t\tData(int a, int b, int c) {\n\t\t\tthis.a = a;\n\t\t\tthis.b = b;\n\t\t\tthis.c = c;\n\t\t}\n\t\tData(int a, int b) {\n\t\t\tthis.a = a;\n\t\t\tthis.b = b;\n\t\t}\n\t}\n\n\tclass Permutation {\n\t\tint[] array;\n\n\t\tPermutation(int N) {\n\t\t\tarray = new int[N];\n\t\t\tfor (int i = 0; i < N; i++) {\n\t\t\t\tarray[i] = i+1;\n\t\t\t}\n\t\t}\n\n\t\tboolean nextPermutation() {\n\t\t int i = array.length - 1;\n\t\t while (i > 0 && array[i - 1] >= array[i])\n\t\t i--;\n\t\t if (i <= 0)\n\t\t return false;\n\n\t\t int j = array.length - 1;\n\t\t while (array[j] <= array[i - 1])\n\t\t j--;\n\t\t int temp = array[i - 1];\n\t\t array[i - 1] = array[j];\n\t\t array[j] = temp;\n\n\t\t j = array.length - 1;\n\t\t while (i < j) {\n\t\t temp = array[i];\n\t\t array[i] = array[j];\n\t\t array[j] = temp;\n\t\t i++;\n\t\t j--;\n\t\t }\n\t\t return true;\n\t\t}\n\t}\n\n\tclass UnionFind {\n\t\tint[] parents;\n\t\tint[] counts;\n\n\t\tpublic UnionFind(int size) {\n\t\t\tparents = new int[size];\n\t\t\tcounts = new int[size];\n\t\t\tfor (int i = 0; i < size; i++) {\n\t\t\t\tparents[i] = i;\n\t\t\t\tcounts[i] = 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic int find(int a) {\n\t\t\tif (parents[a] == a) return a;\n\t\t\tparents[a] = find(parents[a]);\n\t\t\treturn parents[a];\n\t\t}\n\n\t\tpublic void unite(int a, int b) {\n\t\t\ta = find(a);\n\t\t\tb = find(b);\n\t\t\tif (a == b) return;\n\t\t\tif (counts[a] < counts[b]) {\n\t\t\t\tparents[a] = b;\n\t\t\t\tcounts[b] += counts[a];\n\t\t\t} else {\n\t\t\t\tparents[b] = a;\n\t\t\t\tcounts[a] += counts[b];\n\t\t\t}\n\t\t}\n\n\t\tpublic boolean differ(int a, int b) {\n\t\t\ta = find(a);\n\t\t\tb = find(b);\n\t\t\treturn a != b;\n\t\t}\n\n\t\tpublic int count(int a) {\n\t\t\treturn counts[find(a)];\n\t\t}\n\t}\n\n\tclass Combination {\n\t\tfinal int mod;\n\t\tfinal int max;\n\n\t\tfinal long[] fact;\n\t\tfinal long[] inv;\n\t\tfinal long[] invfact;\n\n\t\tpublic Combination(int n) {\n\t\t\tthis(n, 1_000_000_007);\n\t\t}\n\n\t\tpublic Combination(int n, int mod) {\n\t\t\tthis.mod = mod;\n\t\t\tmax = n + 1;\n\t\t\tfact = new long[max];\n\t\t\tinvfact = new long[max];\n\t\t\tinv = new long[max];\n\n\t\t\tinv[1] = 1;\n\t\t\tfor (int i = 2; i < inv.length; i++) {\n\t\t\t\tinv[i] = inv[mod % i] * (mod - mod / i) % mod;\n\t\t\t}\n\n\t\t\tfact[0] = 1;\n\t\t\tinvfact[0] = 1;\n\t\t\tfor (int i = 1; i < inv.length; i++) {\n\t\t\t\tfact[i] = i * fact[i - 1] % mod;\n\t\t\t\tinvfact[i] = inv[i] * invfact[i - 1] % mod;\n\t\t\t}\n\t\t}\n\n\t\tpublic long get(int n, int r) {\n\t\t\treturn fact[n] * invfact[n - r] % mod * invfact[r] % mod;\n\t\t}\n\n\t\tpublic long gcd(long a, long b) {\n\t\t\tif (b == 0) return a;\n\t\t\telse {\n\t\t\t\tb %= MOD;\n\t\t\t\tif (b < 0) b+=MOD;\n\t\t\t\treturn gcd(b, (b-a*inv[(int)b]%MOD*b%MOD)%MOD);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic long gcd(long a, long b) {\n\t\tif (b == 0) return a;\n\t\telse return gcd(b, a%b);\n\t}\n\n\tpublic long getInv(long a) {\n\t\tlong b = MOD, u = 1, v = 0;\n\t\twhile (b > 0) {\n\t\t\tlong t = a / b;\n\t\t\ta -= t * b;\n\t\t\tlong tmp = a;\n\t\t\ta = b;\n\t\t\tb = tmp;\n\t\t\tu -= t * v;\n\t\t\ttmp = u;\n\t\t\tu = v;\n\t\t\tv = tmp;\n\t\t}\n\t\tu %= MOD;\n\t\tif (u < 0) u += MOD;\n\t\treturn u;\n\t}\n\n\tpublic long modPow(long n) {\n\t\tif (n == 0) return 1;\n\t\tlong x = modPow(n / 2);\n\t\tx *= x;\n\t\tx %= MOD;\n\t\tif (n % 2 == 1) x *= 2;\n\t\tx %= MOD;\n\t\treturn x;\n\t}\n\n\tpublic long choose(long n, long m) {\n\t\tlong deno = 1;\n\t\tlong nume = 1;\n\t\tm = (n - m < m ? n - m : m);\n\t\tfor (long i = 1; i <= m; i++) {\n\t\t\tdeno = deno * (n - i + 1) % MOD;\n\t\t\tnume = nume * i % MOD;\n\t\t}\n\t\treturn deno * getInv(nume) % MOD;\n\t}\n\n\tpublic void reverse(int[] a) {\n\t\tint last = a.length-1;\n\t\tint n = a.length / 2;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint t = a[i];\n\t\t\ta[i] = a[last-i];\n\t\t\ta[last-i] = t;\n\t\t}\n\t}\n\n\tpublic void reverse(long[] a) {\n\t\tint last = a.length-1;\n\t\tint n = a.length / 2;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlong t = a[i];\n\t\t\ta[i] = a[last-i];\n\t\t\ta[last-i] = t;\n\t\t}\n\t}\n\n\tvoid fout(Object... args) {\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor (Object arg : args) {\n\t\t\tsb.append(arg.toString());\n\t\t\tsb.append(\" \");\n\t\t}\n\t\tout(sb.toString());\n\t}\n\n\tvoid out() {\n\t\tpw.println();\n\t}\n\n\tvoid out(String a) {\n\t\tpw.println(a);\n\t}\n\tvoid out(boolean a) {\n\t\tpw.println(a);\n\t}\n\n\tvoid out(int a) {\n\t\tpw.println(a);\n\t}\n\n\tvoid out(long a) {\n\t\tpw.println(a);\n\t}\n\n\tvoid out(double a) {\n\t\tpw.println(a);\n\t}\n\n\tvoid out(char a) {\n\t\tpw.println(a);\n\t}\n\n\tvoid rout(String a) {\n\t\tout(a);\n\t\tpw.close();\n\t\tSystem.exit(0);\n\t}\n\tvoid rout(int a) {\n\t\tout(a);\n\t\tpw.close();\n\t\tSystem.exit(0);\n\t}\n\tvoid rout(long a) {\n\t\tout(a);\n\t\tpw.close();\n\t\tSystem.exit(0);\n\t}\n\tvoid rout(double a) {\n\t\tout(a);\n\t\tpw.close();\n\t\tSystem.exit(0);\n\t}\n\tvoid rout(char a) {\n\t\tout(a);\n\t\tpw.close();\n\t\tSystem.exit(0);\n\t}\n}\n\n\nclass FastScanner {\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte())\n return buffer[ptr++];\n else\n return -1;\n }\n\n private boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr]))\n ptr++;\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext())\n throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext())\n throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)\n throw new NumberFormatException();\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n}\n", "language": "Java", "metadata": {"date": 1594687274, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02684.html", "problem_id": "p02684", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02684/input.txt", "sample_output_relpath": "derived/input_output/data/p02684/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02684/Java/s619778414.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s619778414", "user_id": "u893188242"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.ArrayDeque;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.NoSuchElementException;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tnew Main().solve();\n\t\tpw.close();\n\t}\n\n\t/**\n\t * ASCII\n\t * 0 48\n\t * A 65\n\t * a 97\n\t */\n\n\tstatic PrintWriter pw = new PrintWriter(System.out);\n\n\tlong MOD = 1_000_000_007;\n\n\tvoid solve() {\n\t\tFastScanner sc = new FastScanner();\n\t\tint N = sc.nextInt();\n\t\tlong K = sc.nextLong();\n\t\tint[] A = new int[N+1];\n\t\tfor (int i = 1; i <= N; i++) A[i] = sc.nextInt();\n\t\tint[] b = new int[N+1];\n\t\tint s = 1;\n\t\tint l = 1;\n\t\tint pre = 1;\n\t\tint[] c = new int[N+1];\n\t\tfor (int i = 1; i <= N; i++) {\n\t\t\tc[i] = A[pre];\n\t\t\tif (b[A[pre]] != 0 || A[pre] == 1) {\n\t\t\t\ts = i;\n\t\t\t\tif (A[pre] == 1) s = 1;\n\t\t\t\tl = i - b[A[pre]];\n\t\t\t\tbreak;\n\t\t\t} else {\n\t\t\t\tb[A[pre]] = i;\n\t\t\t\tpre = A[pre];\n\t\t\t}\n\t\t}\n\t\tif (K <= s) {\n\t\t\tout(c[(int)K]);\n\t\t} else {\n\t\t\tout(c[s+(int)((K-s)%l)]);\n\t\t}\n\t}\n\n\tvoid func(List[] l, int now, int[] ans) {\n\t\tArrayDeque que = new ArrayDeque();\n\t\tque.addLast(now);\n\t\twhile (!que.isEmpty()) {\n\t\t\tint x = que.removeFirst();\n\t\t\tfor (int t : l[x]) {\n\t\t\t\tif (ans[t] == 0) {\n\t\t\t\t\tans[t] = x;\n\t\t\t\t\tque.addLast(t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tdouble getD(double x1, double x2, double y1, double y2) {\n\t\treturn Math.sqrt(Math.pow(x1-x2,2) + Math.pow(y1-y2, 2));\n\t}\n\n\tint[][] d4 = new int[][] {{1,0},{0,1},{-1,0},{0,-1}};\n\tint[][] d8 = new int[][] {{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};\n\n\tclass Data {\n\t\tint a;\n\t\tint b;\n\t\tint c;\n\t\tData(){}\n\t\tData(int a) {\n\t\t\tthis.a = a;\n\t\t}\n\t\tData(int a, int b, int c) {\n\t\t\tthis.a = a;\n\t\t\tthis.b = b;\n\t\t\tthis.c = c;\n\t\t}\n\t\tData(int a, int b) {\n\t\t\tthis.a = a;\n\t\t\tthis.b = b;\n\t\t}\n\t}\n\n\tclass Permutation {\n\t\tint[] array;\n\n\t\tPermutation(int N) {\n\t\t\tarray = new int[N];\n\t\t\tfor (int i = 0; i < N; i++) {\n\t\t\t\tarray[i] = i+1;\n\t\t\t}\n\t\t}\n\n\t\tboolean nextPermutation() {\n\t\t int i = array.length - 1;\n\t\t while (i > 0 && array[i - 1] >= array[i])\n\t\t i--;\n\t\t if (i <= 0)\n\t\t return false;\n\n\t\t int j = array.length - 1;\n\t\t while (array[j] <= array[i - 1])\n\t\t j--;\n\t\t int temp = array[i - 1];\n\t\t array[i - 1] = array[j];\n\t\t array[j] = temp;\n\n\t\t j = array.length - 1;\n\t\t while (i < j) {\n\t\t temp = array[i];\n\t\t array[i] = array[j];\n\t\t array[j] = temp;\n\t\t i++;\n\t\t j--;\n\t\t }\n\t\t return true;\n\t\t}\n\t}\n\n\tclass UnionFind {\n\t\tint[] parents;\n\t\tint[] counts;\n\n\t\tpublic UnionFind(int size) {\n\t\t\tparents = new int[size];\n\t\t\tcounts = new int[size];\n\t\t\tfor (int i = 0; i < size; i++) {\n\t\t\t\tparents[i] = i;\n\t\t\t\tcounts[i] = 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic int find(int a) {\n\t\t\tif (parents[a] == a) return a;\n\t\t\tparents[a] = find(parents[a]);\n\t\t\treturn parents[a];\n\t\t}\n\n\t\tpublic void unite(int a, int b) {\n\t\t\ta = find(a);\n\t\t\tb = find(b);\n\t\t\tif (a == b) return;\n\t\t\tif (counts[a] < counts[b]) {\n\t\t\t\tparents[a] = b;\n\t\t\t\tcounts[b] += counts[a];\n\t\t\t} else {\n\t\t\t\tparents[b] = a;\n\t\t\t\tcounts[a] += counts[b];\n\t\t\t}\n\t\t}\n\n\t\tpublic boolean differ(int a, int b) {\n\t\t\ta = find(a);\n\t\t\tb = find(b);\n\t\t\treturn a != b;\n\t\t}\n\n\t\tpublic int count(int a) {\n\t\t\treturn counts[find(a)];\n\t\t}\n\t}\n\n\tclass Combination {\n\t\tfinal int mod;\n\t\tfinal int max;\n\n\t\tfinal long[] fact;\n\t\tfinal long[] inv;\n\t\tfinal long[] invfact;\n\n\t\tpublic Combination(int n) {\n\t\t\tthis(n, 1_000_000_007);\n\t\t}\n\n\t\tpublic Combination(int n, int mod) {\n\t\t\tthis.mod = mod;\n\t\t\tmax = n + 1;\n\t\t\tfact = new long[max];\n\t\t\tinvfact = new long[max];\n\t\t\tinv = new long[max];\n\n\t\t\tinv[1] = 1;\n\t\t\tfor (int i = 2; i < inv.length; i++) {\n\t\t\t\tinv[i] = inv[mod % i] * (mod - mod / i) % mod;\n\t\t\t}\n\n\t\t\tfact[0] = 1;\n\t\t\tinvfact[0] = 1;\n\t\t\tfor (int i = 1; i < inv.length; i++) {\n\t\t\t\tfact[i] = i * fact[i - 1] % mod;\n\t\t\t\tinvfact[i] = inv[i] * invfact[i - 1] % mod;\n\t\t\t}\n\t\t}\n\n\t\tpublic long get(int n, int r) {\n\t\t\treturn fact[n] * invfact[n - r] % mod * invfact[r] % mod;\n\t\t}\n\n\t\tpublic long gcd(long a, long b) {\n\t\t\tif (b == 0) return a;\n\t\t\telse {\n\t\t\t\tb %= MOD;\n\t\t\t\tif (b < 0) b+=MOD;\n\t\t\t\treturn gcd(b, (b-a*inv[(int)b]%MOD*b%MOD)%MOD);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic long gcd(long a, long b) {\n\t\tif (b == 0) return a;\n\t\telse return gcd(b, a%b);\n\t}\n\n\tpublic long getInv(long a) {\n\t\tlong b = MOD, u = 1, v = 0;\n\t\twhile (b > 0) {\n\t\t\tlong t = a / b;\n\t\t\ta -= t * b;\n\t\t\tlong tmp = a;\n\t\t\ta = b;\n\t\t\tb = tmp;\n\t\t\tu -= t * v;\n\t\t\ttmp = u;\n\t\t\tu = v;\n\t\t\tv = tmp;\n\t\t}\n\t\tu %= MOD;\n\t\tif (u < 0) u += MOD;\n\t\treturn u;\n\t}\n\n\tpublic long modPow(long n) {\n\t\tif (n == 0) return 1;\n\t\tlong x = modPow(n / 2);\n\t\tx *= x;\n\t\tx %= MOD;\n\t\tif (n % 2 == 1) x *= 2;\n\t\tx %= MOD;\n\t\treturn x;\n\t}\n\n\tpublic long choose(long n, long m) {\n\t\tlong deno = 1;\n\t\tlong nume = 1;\n\t\tm = (n - m < m ? n - m : m);\n\t\tfor (long i = 1; i <= m; i++) {\n\t\t\tdeno = deno * (n - i + 1) % MOD;\n\t\t\tnume = nume * i % MOD;\n\t\t}\n\t\treturn deno * getInv(nume) % MOD;\n\t}\n\n\tpublic void reverse(int[] a) {\n\t\tint last = a.length-1;\n\t\tint n = a.length / 2;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint t = a[i];\n\t\t\ta[i] = a[last-i];\n\t\t\ta[last-i] = t;\n\t\t}\n\t}\n\n\tpublic void reverse(long[] a) {\n\t\tint last = a.length-1;\n\t\tint n = a.length / 2;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlong t = a[i];\n\t\t\ta[i] = a[last-i];\n\t\t\ta[last-i] = t;\n\t\t}\n\t}\n\n\tvoid fout(Object... args) {\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor (Object arg : args) {\n\t\t\tsb.append(arg.toString());\n\t\t\tsb.append(\" \");\n\t\t}\n\t\tout(sb.toString());\n\t}\n\n\tvoid out() {\n\t\tpw.println();\n\t}\n\n\tvoid out(String a) {\n\t\tpw.println(a);\n\t}\n\tvoid out(boolean a) {\n\t\tpw.println(a);\n\t}\n\n\tvoid out(int a) {\n\t\tpw.println(a);\n\t}\n\n\tvoid out(long a) {\n\t\tpw.println(a);\n\t}\n\n\tvoid out(double a) {\n\t\tpw.println(a);\n\t}\n\n\tvoid out(char a) {\n\t\tpw.println(a);\n\t}\n\n\tvoid rout(String a) {\n\t\tout(a);\n\t\tpw.close();\n\t\tSystem.exit(0);\n\t}\n\tvoid rout(int a) {\n\t\tout(a);\n\t\tpw.close();\n\t\tSystem.exit(0);\n\t}\n\tvoid rout(long a) {\n\t\tout(a);\n\t\tpw.close();\n\t\tSystem.exit(0);\n\t}\n\tvoid rout(double a) {\n\t\tout(a);\n\t\tpw.close();\n\t\tSystem.exit(0);\n\t}\n\tvoid rout(char a) {\n\t\tout(a);\n\t\tpw.close();\n\t\tSystem.exit(0);\n\t}\n}\n\n\nclass FastScanner {\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte())\n return buffer[ptr++];\n else\n return -1;\n }\n\n private boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr]))\n ptr++;\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext())\n throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext())\n throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)\n throw new NumberFormatException();\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n}\n", "problem_context": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "sample_input": "4 5\n3 2 4 1\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02684", "source_text": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 8259, "cpu_time_ms": 139, "memory_kb": 37908}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s518991024", "group_id": "codeNet:p02684", "input_text": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.util.*;\n\npublic class Main {\n static int ans = Integer.MAX_VALUE;\n public static void main(String[] args) throws Exception {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st = new StringTokenizer(br.readLine());\n\n int n = Integer.parseInt(st.nextToken());\n long k = Long.parseLong(st.nextToken());\n\n int[] arr = new int[n];\n st = new StringTokenizer(br.readLine());\n\n for (int i=0; i lst = new ArrayList<>();\n HashSet vis = new HashSet<>();\n lst.add(1);\n vis.add(1);\n int i=0;\n int cycleStart = -1;\n for (; i newLst = lst.subList(j,lst.size());\n System.out.println(newLst.get((int)(k%newLst.size())));\n }\n\n }\n}\n", "language": "Java", "metadata": {"date": 1592446090, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02684.html", "problem_id": "p02684", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02684/input.txt", "sample_output_relpath": "derived/input_output/data/p02684/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02684/Java/s518991024.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s518991024", "user_id": "u266007445"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.util.*;\n\npublic class Main {\n static int ans = Integer.MAX_VALUE;\n public static void main(String[] args) throws Exception {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st = new StringTokenizer(br.readLine());\n\n int n = Integer.parseInt(st.nextToken());\n long k = Long.parseLong(st.nextToken());\n\n int[] arr = new int[n];\n st = new StringTokenizer(br.readLine());\n\n for (int i=0; i lst = new ArrayList<>();\n HashSet vis = new HashSet<>();\n lst.add(1);\n vis.add(1);\n int i=0;\n int cycleStart = -1;\n for (; i newLst = lst.subList(j,lst.size());\n System.out.println(newLst.get((int)(k%newLst.size())));\n }\n\n }\n}\n", "problem_context": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "sample_input": "4 5\n3 2 4 1\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02684", "source_text": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1472, "cpu_time_ms": 322, "memory_kb": 67124}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s507971467", "group_id": "codeNet:p02684", "input_text": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Scanner;\nimport java.util.HashMap;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Teleporter solver = new Teleporter();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class Teleporter {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int n = in.nextInt();\n long k = in.nextLong();\n\n HashMap map = new HashMap<>();\n int[] circle = new int[n + 1];\n\n for (int i = 1; i <= n; i++) {\n int t = in.nextInt();\n map.put(i, t);\n }\n\n Integer next = 1;\n circle[1]++;\n\n int close_start;\n while (true) {\n next = map.get(next);\n if (circle[next] == 3) {\n close_start = next;\n break;\n }\n circle[next]++;\n }\n\n int closed_step = 1;\n int tmp_close = map.get(close_start);\n while (tmp_close != close_start) {\n tmp_close = map.get(tmp_close);\n closed_step++;\n }\n\n long up_steps = 1;\n next = map.get(1);\n\n while (true) {\n if (next == close_start || up_steps >= k) {\n break;\n }\n next = map.get(next);\n up_steps++;\n }\n\n long loop_num = (k - up_steps) % closed_step;\n for (int i = 0; i < loop_num; i++) {\n next = map.get(next);\n }\n out.append(String.valueOf(next));\n }\n\n }\n}\n\n", "language": "Java", "metadata": {"date": 1592001974, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02684.html", "problem_id": "p02684", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02684/input.txt", "sample_output_relpath": "derived/input_output/data/p02684/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02684/Java/s507971467.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s507971467", "user_id": "u745688558"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Scanner;\nimport java.util.HashMap;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Teleporter solver = new Teleporter();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class Teleporter {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int n = in.nextInt();\n long k = in.nextLong();\n\n HashMap map = new HashMap<>();\n int[] circle = new int[n + 1];\n\n for (int i = 1; i <= n; i++) {\n int t = in.nextInt();\n map.put(i, t);\n }\n\n Integer next = 1;\n circle[1]++;\n\n int close_start;\n while (true) {\n next = map.get(next);\n if (circle[next] == 3) {\n close_start = next;\n break;\n }\n circle[next]++;\n }\n\n int closed_step = 1;\n int tmp_close = map.get(close_start);\n while (tmp_close != close_start) {\n tmp_close = map.get(tmp_close);\n closed_step++;\n }\n\n long up_steps = 1;\n next = map.get(1);\n\n while (true) {\n if (next == close_start || up_steps >= k) {\n break;\n }\n next = map.get(next);\n up_steps++;\n }\n\n long loop_num = (k - up_steps) % closed_step;\n for (int i = 0; i < loop_num; i++) {\n next = map.get(next);\n }\n out.append(String.valueOf(next));\n }\n\n }\n}\n\n", "problem_context": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "sample_input": "4 5\n3 2 4 1\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02684", "source_text": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2062, "cpu_time_ms": 783, "memory_kb": 76148}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s465354560", "group_id": "codeNet:p02684", "input_text": "import java.math.BigInteger;\nimport java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner s = new Scanner(System.in);\n int N = s.nextInt();\n BigInteger K = s.nextBigInteger();\n int[] A = new int[N];\n int count = 0;\n for (int i = 0; i < N; i++) {\n A[i] = s.nextInt();\n }\n K = K.remainder(BigInteger.valueOf(N)).add(BigInteger.valueOf(N));\n int now;\n for (now = 1; BigInteger.valueOf(count).compareTo(K) < 0; count++) {\n now = A[now - 1];\n }\n\n System.out.print(now);\n }\n}", "language": "Java", "metadata": {"date": 1590269385, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02684.html", "problem_id": "p02684", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02684/input.txt", "sample_output_relpath": "derived/input_output/data/p02684/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02684/Java/s465354560.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s465354560", "user_id": "u263284315"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "import java.math.BigInteger;\nimport java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner s = new Scanner(System.in);\n int N = s.nextInt();\n BigInteger K = s.nextBigInteger();\n int[] A = new int[N];\n int count = 0;\n for (int i = 0; i < N; i++) {\n A[i] = s.nextInt();\n }\n K = K.remainder(BigInteger.valueOf(N)).add(BigInteger.valueOf(N));\n int now;\n for (now = 1; BigInteger.valueOf(count).compareTo(K) < 0; count++) {\n now = A[now - 1];\n }\n\n System.out.print(now);\n }\n}", "problem_context": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "sample_input": "4 5\n3 2 4 1\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02684", "source_text": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 612, "cpu_time_ms": 566, "memory_kb": 60232}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s512871795", "group_id": "codeNet:p02684", "input_text": "import java.math.BigInteger;\nimport java.util.*;\nimport java.io.*;\nimport java.text.*;\n\npublic class Main {\n static BufferedReader br = new BufferedReader(new InputStreamReader(System.in), 32768);\n static PrintWriter out = new PrintWriter(System.out);\n static StringTokenizer t;\n\n static String sn() {\n while (t == null || !t.hasMoreTokens()) {\n try {\n t = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n throw new RuntimeException();\n }\n }\n return t.nextToken();\n }\n\n static int ni() {\n return Integer.parseInt(sn());\n }\n\n static long nlo() {\n return Long.parseLong(sn());\n }\n\n public static void main(String args[]) {\n int t = 1;\n while (t-- > 0) {\n solve();\n }\n out.close();\n }\n\n static long mod = (long) 1e9 + 7;\n\n static long pro(long a, long b) {\n return (a % mod * b % mod) % mod;\n }\n\n static long add(long a, long b) {\n return (a + b) % mod;\n }\n\n static long sub(long a, long b) {\n return ((a % mod - b % mod) + mod) % mod;\n }\n\n static int maxn = 1000005;\n\n static int pow(int n) {\n return (int) (Math.log10(n) / Math.log10(2));\n }\n\n static long modpow(long x, long y) {\n long res = 1l;\n// x %= mod;\n while (y > 0) {\n if (y % 2 != 0)\n res *= x;\n x = x * x;\n y /= 2;\n }\n return res;\n }\n\n static class pair {\n String a;\n int b;\n\n pair(String x, int y) {\n a = x;\n b = y;\n }\n }\n\n static long modInverse(long n) {\n BigInteger n1 = new BigInteger(Long.toString(n));\n String s = (n1.modInverse(new BigInteger(Long.toString(mod)))).toString();\n return Long.parseLong(s);\n }\n\n static boolean v[] = new boolean[1000005];\n\n static void seive() {\n v[1] = true;\n for (int i = 2; i < 1000005; i++) {\n if (!v[i]) {\n for (int j = 2 * i; j < 1000005; j += i)\n v[j] = true;\n }\n }\n }\n\n static boolean isprime(long n) {\n if (n == 1)\n return false;\n for (int i = 2; i * i <= n; i++) {\n if (n % i == 0)\n return false;\n }\n return true;\n }\n\n static int gcd(int a, int b) {\n if (b == 0)\n return a;\n return gcd(b, a % b);\n }\n\n static DecimalFormat df = new DecimalFormat(\"0.000000000000000000000\");\n\n static void solve() {\n int n = ni();\n long k = nlo();\n int a[] = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = ni() - 1;\n int chain[] = new int[n];\n int p = 0;\n int cur = 0;\n boolean v[] = new boolean[n];\n int id[] = new int[n];\n while (!v[cur]) {\n v[cur] = true;\n chain[p] = cur;\n id[cur] = p;\n cur = a[cur];\n p += 1;\n }\n int d = p - id[cur];\n int t = (int) (k % d);\n out.println(chain[t] + 1);\n }\n}\n\n", "language": "Java", "metadata": {"date": 1590132017, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02684.html", "problem_id": "p02684", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02684/input.txt", "sample_output_relpath": "derived/input_output/data/p02684/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02684/Java/s512871795.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s512871795", "user_id": "u830592854"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "import java.math.BigInteger;\nimport java.util.*;\nimport java.io.*;\nimport java.text.*;\n\npublic class Main {\n static BufferedReader br = new BufferedReader(new InputStreamReader(System.in), 32768);\n static PrintWriter out = new PrintWriter(System.out);\n static StringTokenizer t;\n\n static String sn() {\n while (t == null || !t.hasMoreTokens()) {\n try {\n t = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n throw new RuntimeException();\n }\n }\n return t.nextToken();\n }\n\n static int ni() {\n return Integer.parseInt(sn());\n }\n\n static long nlo() {\n return Long.parseLong(sn());\n }\n\n public static void main(String args[]) {\n int t = 1;\n while (t-- > 0) {\n solve();\n }\n out.close();\n }\n\n static long mod = (long) 1e9 + 7;\n\n static long pro(long a, long b) {\n return (a % mod * b % mod) % mod;\n }\n\n static long add(long a, long b) {\n return (a + b) % mod;\n }\n\n static long sub(long a, long b) {\n return ((a % mod - b % mod) + mod) % mod;\n }\n\n static int maxn = 1000005;\n\n static int pow(int n) {\n return (int) (Math.log10(n) / Math.log10(2));\n }\n\n static long modpow(long x, long y) {\n long res = 1l;\n// x %= mod;\n while (y > 0) {\n if (y % 2 != 0)\n res *= x;\n x = x * x;\n y /= 2;\n }\n return res;\n }\n\n static class pair {\n String a;\n int b;\n\n pair(String x, int y) {\n a = x;\n b = y;\n }\n }\n\n static long modInverse(long n) {\n BigInteger n1 = new BigInteger(Long.toString(n));\n String s = (n1.modInverse(new BigInteger(Long.toString(mod)))).toString();\n return Long.parseLong(s);\n }\n\n static boolean v[] = new boolean[1000005];\n\n static void seive() {\n v[1] = true;\n for (int i = 2; i < 1000005; i++) {\n if (!v[i]) {\n for (int j = 2 * i; j < 1000005; j += i)\n v[j] = true;\n }\n }\n }\n\n static boolean isprime(long n) {\n if (n == 1)\n return false;\n for (int i = 2; i * i <= n; i++) {\n if (n % i == 0)\n return false;\n }\n return true;\n }\n\n static int gcd(int a, int b) {\n if (b == 0)\n return a;\n return gcd(b, a % b);\n }\n\n static DecimalFormat df = new DecimalFormat(\"0.000000000000000000000\");\n\n static void solve() {\n int n = ni();\n long k = nlo();\n int a[] = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = ni() - 1;\n int chain[] = new int[n];\n int p = 0;\n int cur = 0;\n boolean v[] = new boolean[n];\n int id[] = new int[n];\n while (!v[cur]) {\n v[cur] = true;\n chain[p] = cur;\n id[cur] = p;\n cur = a[cur];\n p += 1;\n }\n int d = p - id[cur];\n int t = (int) (k % d);\n out.println(chain[t] + 1);\n }\n}\n\n", "problem_context": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "sample_input": "4 5\n3 2 4 1\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02684", "source_text": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3165, "cpu_time_ms": 270, "memory_kb": 57616}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s522222698", "group_id": "codeNet:p02684", "input_text": "import java.util.*;\nclass Main{\n public static void main(String[] args){\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n long k = scanner.nextLong();\n int[] a = new int[n];\n for(int i = 0; i < n; i++){\n a[i] = scanner.nextInt()-1;\n }\n List list = new ArrayList<>();\n int loophead = 0;\n boolean flag = false;\n list.add(0);\n int cur = a[0];\n for(int i = 1; i < n+1; i++){\n if(list.contains(cur)){\n loophead = cur;\n flag = true;\n break;\n }else{\n list.add(cur);\n cur = a[cur];\n }\n }\n if(!flag){System.out.println(cur);return;}\n int loopheadindex = list.indexOf(loophead);\n int looplength = list.size()-loopheadindex;\n /*\n System.out.println(\"list size \" + list.size());\n System.out.println(\"head loop index \" + loopheadindex);\n System.out.println(\"head loop length \" + looplength);\n */\n long ansindex = (k - Long.valueOf(loopheadindex))%Long.valueOf(looplength);\n System.out.println(list.get((int)ansindex + loopheadindex) + 1);\n }\n}\n\n", "language": "Java", "metadata": {"date": 1589888360, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02684.html", "problem_id": "p02684", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02684/input.txt", "sample_output_relpath": "derived/input_output/data/p02684/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02684/Java/s522222698.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s522222698", "user_id": "u005491552"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "import java.util.*;\nclass Main{\n public static void main(String[] args){\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n long k = scanner.nextLong();\n int[] a = new int[n];\n for(int i = 0; i < n; i++){\n a[i] = scanner.nextInt()-1;\n }\n List list = new ArrayList<>();\n int loophead = 0;\n boolean flag = false;\n list.add(0);\n int cur = a[0];\n for(int i = 1; i < n+1; i++){\n if(list.contains(cur)){\n loophead = cur;\n flag = true;\n break;\n }else{\n list.add(cur);\n cur = a[cur];\n }\n }\n if(!flag){System.out.println(cur);return;}\n int loopheadindex = list.indexOf(loophead);\n int looplength = list.size()-loopheadindex;\n /*\n System.out.println(\"list size \" + list.size());\n System.out.println(\"head loop index \" + loopheadindex);\n System.out.println(\"head loop length \" + looplength);\n */\n long ansindex = (k - Long.valueOf(loopheadindex))%Long.valueOf(looplength);\n System.out.println(list.get((int)ansindex + loopheadindex) + 1);\n }\n}\n\n", "problem_context": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "sample_input": "4 5\n3 2 4 1\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02684", "source_text": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1250, "cpu_time_ms": 2207, "memory_kb": 60968}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s439087705", "group_id": "codeNet:p02684", "input_text": "\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n int townNum = scan.nextInt();\n long loveInt = scan.nextLong();\n Town[] towns = new Town[townNum + 1];\n for (int i = 1; i < townNum + 1; i++) {\n towns[i] = new Town(i);\n }\n\n for (int i = 1; i < townNum + 1; i++) {\n towns[i].setNextTown(towns[scan.nextInt()]);\n }\n\n towns[1].reach(1);\n Town endTown = towns[1].endlessGoNext();\n\n int startLoop=endTown.goNext().getFirstReach();\n int loop=endTown.getFirstReach()-startLoop+1;\n\n long minStep=loveInt;\n if (loveInt>startLoop){\n minStep=(loveInt-startLoop) % loop+startLoop;\n }\n\n Town end=towns[1];\n for (int i = 0; i startLoop){\n minStep=(loveInt-startLoop) % loop+startLoop;\n }\n\n Town end=towns[1];\n for (int i = 0; i sorted = new ArrayList<>();\n sorted.add(a[0]);\n\n for (int i = 1; i < 2 * n + 1000; i++) {\n int next = a[sorted.get(sorted.size() - 1) - 1];\n sorted.add(next);\n }\n\n if (k < n + 1) {\n System.out.println(sorted.get((int) k));\n return;\n }\n\n int loop_end = n - 1;\n int loop_start = n - 2;\n\n // 周期を求める\n while (sorted.toArray()[loop_start] != sorted.toArray()[loop_end]) {\n loop_start -= 1;\n }\n\n int period = loop_end - loop_start;\n k %= period;\n\n// System.out.println(loop_start + \" \" + loop_end + \" \" + period + \" \" + k);\n while (k < n) {\n k += period;\n }\n\n System.out.println(sorted.get((int) k));\n\n }\n\n // constant\n static StringBuilder sb;\n static StringTokenizer st;\n static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n static final int inf = Integer.MAX_VALUE / 2;\n static final long linf = Long.MAX_VALUE / 3;\n static final double dinf = Double.MAX_VALUE / 3;\n static final double eps = 1e-10;\n static final double pi = Math.PI;\n\n // pow\n static double pow(int x, int y) {\n return Math.pow(x, y);\n }\n\n // max min\n static int max(int x, int y) {\n return Math.max(x, y);\n }\n\n static int min(int x, int y) {\n return Math.min(x, y);\n }\n\n static int max(int x, int y, int z) {\n x = Math.max(x, y);\n x = Math.max(x, z);\n return x;\n }\n\n static int min(int x, int y, int z) {\n x = Math.min(x, y);\n x = Math.min(x, z);\n return x;\n }\n\n static long max(long x, long y) {\n return Math.max(x, y);\n }\n\n static long min(long x, long y) {\n return Math.min(x, y);\n }\n\n static long max(long x, long y, long z) {\n x = Math.max(x, y);\n x = Math.max(x, z);\n return x;\n }\n\n static long min(long x, long y, long z) {\n x = Math.min(x, y);\n x = Math.min(x, z);\n return x;\n }\n\n static double max(double x, double y) {\n return Math.max(x, y);\n }\n\n static double min(double x, double y) {\n return Math.min(x, y);\n }\n\n static double max(double x, double y, double z) {\n x = Math.max(x, y);\n x = Math.max(x, z);\n return x;\n }\n\n static double min(double x, double y, double z) {\n x = Math.min(x, y);\n x = Math.min(x, z);\n return x;\n }\n\n // sort\n static void sort(int[] ar) {\n Arrays.sort(ar);\n }\n\n static void sort(long[] ar) {\n Arrays.sort(ar);\n }\n\n static void sort(double[] ar) {\n Arrays.sort(ar);\n }\n\n static void sort(char[] ar) {\n Arrays.sort(ar);\n }\n\n static void rsort(int[] ar) {\n Arrays.sort(ar);\n int len = ar.length;\n for (int i = 0; i < len / 2; i++) {\n int tmp = ar[i];\n ar[i] = ar[len - 1 - i];\n ar[len - 1 - i] = tmp;\n }\n }\n\n static void rsort(long[] ar) {\n Arrays.sort(ar);\n int len = ar.length;\n for (int i = 0; i < len / 2; i++) {\n long tmp = ar[i];\n ar[i] = ar[len - 1 - i];\n ar[len - 1 - i] = tmp;\n }\n }\n\n static void rsort(double[] ar) {\n Arrays.sort(ar);\n int len = ar.length;\n for (int i = 0; i < len / 2; i++) {\n double tmp = ar[i];\n ar[i] = ar[len - 1 - i];\n ar[len - 1 - i] = tmp;\n }\n }\n\n static void rsort(char[] ar) {\n Arrays.sort(ar);\n int len = ar.length;\n for (int i = 0; i < len / 2; i++) {\n char tmp = ar[i];\n ar[i] = ar[len - 1 - i];\n ar[len - 1 - i] = tmp;\n }\n }\n\n // initialize\n static void fill(int arr[], int x) {\n Arrays.fill(arr, x);\n }\n\n static void fill(long arr[], long x) {\n Arrays.fill(arr, x);\n }\n\n static void fill(boolean arr[], boolean x) {\n Arrays.fill(arr, x);\n }\n\n static void fill(double arr[], double x) {\n Arrays.fill(arr, x);\n }\n\n static void fill(int arr[][], int x) {\n for (int i = 0; i < arr.length; i++) {\n Arrays.fill(arr[i], x);\n }\n }\n\n static void fill(long arr[][], long x) {\n for (int i = 0; i < arr.length; i++) {\n Arrays.fill(arr[i], x);\n }\n }\n\n static void fill(double arr[][], double x) {\n for (int i = 0; i < arr.length; i++) {\n Arrays.fill(arr[i], x);\n }\n }\n\n static void fill(boolean arr[][], boolean x) {\n for (int i = 0; i < arr.length; i++) {\n Arrays.fill(arr[i], x);\n }\n }\n\n // scanner\n static char nextChar() throws IOException {\n return next().charAt(0);\n }\n\n static int nextInt() throws IOException {\n return Integer.parseInt(next());\n }\n\n static long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n\n static double nextDouble() throws IOException {\n return Double.parseDouble(next());\n }\n\n static int[] readArray(int n) throws IOException {\n int[] a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = nextInt();\n }\n return a;\n }\n\n static long[] readLongArray(int n) throws IOException {\n long[] a = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = nextLong();\n }\n return a;\n }\n\n static String next() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine().trim());\n }\n return st.nextToken();\n }\n\n // cast\n static String padLeftZeros(String inputString, int length) {\n if (inputString.length() >= length) {\n return inputString;\n }\n sb = new StringBuilder();\n while (sb.length() < length - inputString.length()) {\n sb.append('0');\n }\n sb.append(inputString);\n\n return sb.toString();\n }\n\n static String int2bin(int num, int length) {\n return padLeftZeros(Integer.toBinaryString(num), length);\n }\n\n static int char2int(Character c) {\n return Character.getNumericValue(c);\n }\n\n static double char2double(Character c) {\n return (double) char2int(c);\n }\n\n // nCr\n static int nCr(int n, int r) {\n return fact(n) / (fact(r) * fact(n - r));\n }\n\n static int fact(int n) {\n int res = 1;\n for (int i = 2; i <= n; i++) {\n res = res * i;\n }\n return res;\n }\n\n // gcd\n static int gcd(int a, int b) {\n if (b == 0) {\n return a;\n } else {\n a = a % b; // 残り部分\n return gcd(b, a); // 残り部分から最小の正方形を見つける\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1589408107, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02684.html", "problem_id": "p02684", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02684/input.txt", "sample_output_relpath": "derived/input_output/data/p02684/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02684/Java/s480950883.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s480950883", "user_id": "u588081069"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "import java.lang.reflect.Array;\nimport java.util.*;\nimport java.io.*;\n\n/*\n4 5\n3 2 4 1\n\n4\n\n4 4\n3 2 4 1\n\n4\n */\npublic class Main {\n public static void main(String[] args) throws IOException {\n int n = nextInt();\n long k = nextLong() - 1;\n\n int[] a = readArray(n);\n List sorted = new ArrayList<>();\n sorted.add(a[0]);\n\n for (int i = 1; i < 2 * n + 1000; i++) {\n int next = a[sorted.get(sorted.size() - 1) - 1];\n sorted.add(next);\n }\n\n if (k < n + 1) {\n System.out.println(sorted.get((int) k));\n return;\n }\n\n int loop_end = n - 1;\n int loop_start = n - 2;\n\n // 周期を求める\n while (sorted.toArray()[loop_start] != sorted.toArray()[loop_end]) {\n loop_start -= 1;\n }\n\n int period = loop_end - loop_start;\n k %= period;\n\n// System.out.println(loop_start + \" \" + loop_end + \" \" + period + \" \" + k);\n while (k < n) {\n k += period;\n }\n\n System.out.println(sorted.get((int) k));\n\n }\n\n // constant\n static StringBuilder sb;\n static StringTokenizer st;\n static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n static final int inf = Integer.MAX_VALUE / 2;\n static final long linf = Long.MAX_VALUE / 3;\n static final double dinf = Double.MAX_VALUE / 3;\n static final double eps = 1e-10;\n static final double pi = Math.PI;\n\n // pow\n static double pow(int x, int y) {\n return Math.pow(x, y);\n }\n\n // max min\n static int max(int x, int y) {\n return Math.max(x, y);\n }\n\n static int min(int x, int y) {\n return Math.min(x, y);\n }\n\n static int max(int x, int y, int z) {\n x = Math.max(x, y);\n x = Math.max(x, z);\n return x;\n }\n\n static int min(int x, int y, int z) {\n x = Math.min(x, y);\n x = Math.min(x, z);\n return x;\n }\n\n static long max(long x, long y) {\n return Math.max(x, y);\n }\n\n static long min(long x, long y) {\n return Math.min(x, y);\n }\n\n static long max(long x, long y, long z) {\n x = Math.max(x, y);\n x = Math.max(x, z);\n return x;\n }\n\n static long min(long x, long y, long z) {\n x = Math.min(x, y);\n x = Math.min(x, z);\n return x;\n }\n\n static double max(double x, double y) {\n return Math.max(x, y);\n }\n\n static double min(double x, double y) {\n return Math.min(x, y);\n }\n\n static double max(double x, double y, double z) {\n x = Math.max(x, y);\n x = Math.max(x, z);\n return x;\n }\n\n static double min(double x, double y, double z) {\n x = Math.min(x, y);\n x = Math.min(x, z);\n return x;\n }\n\n // sort\n static void sort(int[] ar) {\n Arrays.sort(ar);\n }\n\n static void sort(long[] ar) {\n Arrays.sort(ar);\n }\n\n static void sort(double[] ar) {\n Arrays.sort(ar);\n }\n\n static void sort(char[] ar) {\n Arrays.sort(ar);\n }\n\n static void rsort(int[] ar) {\n Arrays.sort(ar);\n int len = ar.length;\n for (int i = 0; i < len / 2; i++) {\n int tmp = ar[i];\n ar[i] = ar[len - 1 - i];\n ar[len - 1 - i] = tmp;\n }\n }\n\n static void rsort(long[] ar) {\n Arrays.sort(ar);\n int len = ar.length;\n for (int i = 0; i < len / 2; i++) {\n long tmp = ar[i];\n ar[i] = ar[len - 1 - i];\n ar[len - 1 - i] = tmp;\n }\n }\n\n static void rsort(double[] ar) {\n Arrays.sort(ar);\n int len = ar.length;\n for (int i = 0; i < len / 2; i++) {\n double tmp = ar[i];\n ar[i] = ar[len - 1 - i];\n ar[len - 1 - i] = tmp;\n }\n }\n\n static void rsort(char[] ar) {\n Arrays.sort(ar);\n int len = ar.length;\n for (int i = 0; i < len / 2; i++) {\n char tmp = ar[i];\n ar[i] = ar[len - 1 - i];\n ar[len - 1 - i] = tmp;\n }\n }\n\n // initialize\n static void fill(int arr[], int x) {\n Arrays.fill(arr, x);\n }\n\n static void fill(long arr[], long x) {\n Arrays.fill(arr, x);\n }\n\n static void fill(boolean arr[], boolean x) {\n Arrays.fill(arr, x);\n }\n\n static void fill(double arr[], double x) {\n Arrays.fill(arr, x);\n }\n\n static void fill(int arr[][], int x) {\n for (int i = 0; i < arr.length; i++) {\n Arrays.fill(arr[i], x);\n }\n }\n\n static void fill(long arr[][], long x) {\n for (int i = 0; i < arr.length; i++) {\n Arrays.fill(arr[i], x);\n }\n }\n\n static void fill(double arr[][], double x) {\n for (int i = 0; i < arr.length; i++) {\n Arrays.fill(arr[i], x);\n }\n }\n\n static void fill(boolean arr[][], boolean x) {\n for (int i = 0; i < arr.length; i++) {\n Arrays.fill(arr[i], x);\n }\n }\n\n // scanner\n static char nextChar() throws IOException {\n return next().charAt(0);\n }\n\n static int nextInt() throws IOException {\n return Integer.parseInt(next());\n }\n\n static long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n\n static double nextDouble() throws IOException {\n return Double.parseDouble(next());\n }\n\n static int[] readArray(int n) throws IOException {\n int[] a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = nextInt();\n }\n return a;\n }\n\n static long[] readLongArray(int n) throws IOException {\n long[] a = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = nextLong();\n }\n return a;\n }\n\n static String next() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine().trim());\n }\n return st.nextToken();\n }\n\n // cast\n static String padLeftZeros(String inputString, int length) {\n if (inputString.length() >= length) {\n return inputString;\n }\n sb = new StringBuilder();\n while (sb.length() < length - inputString.length()) {\n sb.append('0');\n }\n sb.append(inputString);\n\n return sb.toString();\n }\n\n static String int2bin(int num, int length) {\n return padLeftZeros(Integer.toBinaryString(num), length);\n }\n\n static int char2int(Character c) {\n return Character.getNumericValue(c);\n }\n\n static double char2double(Character c) {\n return (double) char2int(c);\n }\n\n // nCr\n static int nCr(int n, int r) {\n return fact(n) / (fact(r) * fact(n - r));\n }\n\n static int fact(int n) {\n int res = 1;\n for (int i = 2; i <= n; i++) {\n res = res * i;\n }\n return res;\n }\n\n // gcd\n static int gcd(int a, int b) {\n if (b == 0) {\n return a;\n } else {\n a = a % b; // 残り部分\n return gcd(b, a); // 残り部分から最小の正方形を見つける\n }\n }\n}\n", "problem_context": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "sample_input": "4 5\n3 2 4 1\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02684", "source_text": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 7200, "cpu_time_ms": 2207, "memory_kb": 59868}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s671209724", "group_id": "codeNet:p02684", "input_text": "import java.util.ArrayList;\nimport java.util.Scanner;\n\n/*\n問題文\n\n*/\n\npublic class Main {\n public static void main(String[] args){\n\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long k = sc.nextLong();\n int[] a = new int[n];\n\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextInt();\n }\n\n ArrayList list = new ArrayList();\n list.add(1);\n // ループの先頭の町がリストの何番目にあるかを格納する変数\n int check = 0;\n\n\n // ひとつめの町の転送先\n int temp = 1;\n for (int i = 0; i <= n; i++) {\n\n \ttemp = a[temp-1];\n // 訪れた町かチェック\n // 訪れていた場合、ループ前のイントロ部分の長さを求める\n if (list.contains(temp)) {\n check = list.indexOf(temp);\n \tbreak;\n }\n list.add(temp);\n }\n\n // ループが存在しない場合\n if ((long)list.size() == k){\n System.out.println(temp);\n } else {\n int std = (int)((k-check) % (list.size() - check));\n\n System.out.println(list.get(std + check));\n }\n }\n}", "language": "Java", "metadata": {"date": 1589246177, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02684.html", "problem_id": "p02684", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02684/input.txt", "sample_output_relpath": "derived/input_output/data/p02684/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02684/Java/s671209724.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s671209724", "user_id": "u728264684"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "import java.util.ArrayList;\nimport java.util.Scanner;\n\n/*\n問題文\n\n*/\n\npublic class Main {\n public static void main(String[] args){\n\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long k = sc.nextLong();\n int[] a = new int[n];\n\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextInt();\n }\n\n ArrayList list = new ArrayList();\n list.add(1);\n // ループの先頭の町がリストの何番目にあるかを格納する変数\n int check = 0;\n\n\n // ひとつめの町の転送先\n int temp = 1;\n for (int i = 0; i <= n; i++) {\n\n \ttemp = a[temp-1];\n // 訪れた町かチェック\n // 訪れていた場合、ループ前のイントロ部分の長さを求める\n if (list.contains(temp)) {\n check = list.indexOf(temp);\n \tbreak;\n }\n list.add(temp);\n }\n\n // ループが存在しない場合\n if ((long)list.size() == k){\n System.out.println(temp);\n } else {\n int std = (int)((k-check) % (list.size() - check));\n\n System.out.println(list.get(std + check));\n }\n }\n}", "problem_context": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "sample_input": "4 5\n3 2 4 1\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02684", "source_text": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1255, "cpu_time_ms": 2207, "memory_kb": 61400}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s893316529", "group_id": "codeNet:p02684", "input_text": "import java.util.ArrayList;\nimport java.util.List;\nimport java.util.Scanner;\n \npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tInteger town = sc.nextInt();\n\t\tLong teleport = sc.nextLong();\n \n\t\tList lists = new ArrayList(town);\n\t\tfor(int i = 0; i < town; i ++) {\n\t\t\tlists.add(sc.nextInt() - 1);\n\t\t}\n \n\t\tList teleLists = new ArrayList(town);\n\t\tInteger nowTown = 0;\n\t\tInteger nextTown = 0;\n\t\tteleLists.add(0);\n\t\twhile(true) {\n\t\t\tnextTown = lists.get(nowTown);\n\t\t\tif(teleLists.contains(nextTown)) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tteleLists.add(nextTown);\n\t\t\tnowTown = nextTown;\n\t\t}\n \n\t\tInteger roopStart = teleLists.indexOf(nextTown);\n\t\tLong num1 = teleport - roopStart;\n\t\t\n\t\tInteger roopRemain = (int) (num1 % (teleLists.size() - roopStart));\n\t\tInteger result = teleLists.get(roopStart + roopRemain) + 1;\n\t\t\n\t\tSystem.out.println(result);\n\t}\n}", "language": "Java", "metadata": {"date": 1589203460, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02684.html", "problem_id": "p02684", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02684/input.txt", "sample_output_relpath": "derived/input_output/data/p02684/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02684/Java/s893316529.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s893316529", "user_id": "u368688902"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "import java.util.ArrayList;\nimport java.util.List;\nimport java.util.Scanner;\n \npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tInteger town = sc.nextInt();\n\t\tLong teleport = sc.nextLong();\n \n\t\tList lists = new ArrayList(town);\n\t\tfor(int i = 0; i < town; i ++) {\n\t\t\tlists.add(sc.nextInt() - 1);\n\t\t}\n \n\t\tList teleLists = new ArrayList(town);\n\t\tInteger nowTown = 0;\n\t\tInteger nextTown = 0;\n\t\tteleLists.add(0);\n\t\twhile(true) {\n\t\t\tnextTown = lists.get(nowTown);\n\t\t\tif(teleLists.contains(nextTown)) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tteleLists.add(nextTown);\n\t\t\tnowTown = nextTown;\n\t\t}\n \n\t\tInteger roopStart = teleLists.indexOf(nextTown);\n\t\tLong num1 = teleport - roopStart;\n\t\t\n\t\tInteger roopRemain = (int) (num1 % (teleLists.size() - roopStart));\n\t\tInteger result = teleLists.get(roopStart + roopRemain) + 1;\n\t\t\n\t\tSystem.out.println(result);\n\t}\n}", "problem_context": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "sample_input": "4 5\n3 2 4 1\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02684", "source_text": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 918, "cpu_time_ms": 2208, "memory_kb": 63904}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s792374803", "group_id": "codeNet:p02684", "input_text": "import java.util.*;\n\nclass Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n \tint n = sc.nextInt();\n \tlong k = sc.nextLong();\n \tMap teleport = new HashMap<>();\n \tMap history = new HashMap<>();\n \tfor(int i = 1 ; i <= n; i++){\n \t\tteleport.put(i, sc.nextInt());\n \t}\n \tlong i;\n \tint now = 1;\n \tboolean flag = false;\n \tfor(i = 0; i <= k; i++){\n \t\tif(history.containsKey(now)){\n \t\t\tflag = true;\n \t\t\tbreak;\n \t\t}\n \t\thistory.put(now, i);\n \t\tnow = teleport.get(now);\n \t}\n \tif(flag){\n \t\tlong pastTime = history.get(now);\n \t\tk = pastTime + (k - pastTime) % (i - pastTime);\n \t}\n \tfor(int p : history.keySet()){\n \t\tif(history.get(p) == k){\n \t\t\tSystem.out.println(p);\n \t\t\treturn;\n \t\t}\n \t}\n }\n}", "language": "Java", "metadata": {"date": 1589174557, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02684.html", "problem_id": "p02684", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02684/input.txt", "sample_output_relpath": "derived/input_output/data/p02684/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02684/Java/s792374803.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s792374803", "user_id": "u139646711"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "import java.util.*;\n\nclass Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n \tint n = sc.nextInt();\n \tlong k = sc.nextLong();\n \tMap teleport = new HashMap<>();\n \tMap history = new HashMap<>();\n \tfor(int i = 1 ; i <= n; i++){\n \t\tteleport.put(i, sc.nextInt());\n \t}\n \tlong i;\n \tint now = 1;\n \tboolean flag = false;\n \tfor(i = 0; i <= k; i++){\n \t\tif(history.containsKey(now)){\n \t\t\tflag = true;\n \t\t\tbreak;\n \t\t}\n \t\thistory.put(now, i);\n \t\tnow = teleport.get(now);\n \t}\n \tif(flag){\n \t\tlong pastTime = history.get(now);\n \t\tk = pastTime + (k - pastTime) % (i - pastTime);\n \t}\n \tfor(int p : history.keySet()){\n \t\tif(history.get(p) == k){\n \t\t\tSystem.out.println(p);\n \t\t\treturn;\n \t\t}\n \t}\n }\n}", "problem_context": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "sample_input": "4 5\n3 2 4 1\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02684", "source_text": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 844, "cpu_time_ms": 650, "memory_kb": 76728}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s901784778", "group_id": "codeNet:p02684", "input_text": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.math.BigDecimal;\nimport java.math.RoundingMode;\nimport java.util.ArrayDeque;\nimport java.util.Arrays;\nimport java.util.NoSuchElementException;\nimport java.util.Queue;\n\nclass Main implements Runnable {\n\tprivate final FastScanner sc;\n\tprivate final PrintWriter out;\n\t//private final long MOD = 1000000007;\n\t//private final int[] d8x = {-1,0,1,1,1,0,-1,-1};\n\t//private final int[] d8y = {-1,-1,-1,0,1,1,1,0};\n\t//private final int[] d4x = {0,1,0,-1};\n\t//private final int[] d4y = {-1,0,1,0};\n\tint n;\n\tlong k;\n\tint[] a;\n\t\n\tpublic static void main(String[] args) {\n\t\tnew Thread(null, new Main(), \"\", 16L * 1024 * 1024).start();\n\t}\n\n\tMain() {\n\t\tsc = new FastScanner();\n\t\tout = new PrintWriter(System.out);\n\t}\n\n\tprivate void init() throws Exception {\n\t\tn = sc.nextInt();\n\t\tk = sc.nextLong();\n\t\ta = new int[n];\n\t\tfor(int i=0;i= 33 && code <= 126;\n\t}\n\n\tpublic String next() {\n\t\tif (!hasNext())\n\t\t\tthrow new NoSuchElementException();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint b = getNextChar();\n\t\twhile (isVisibleChar(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = getNextChar();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\n\tpublic long nextLong() {\n\t\tif (!hasNext())\n\t\t\tthrow new NoSuchElementException();\n\t\tlong n = 0;\n\t\tboolean sign = true;\n\t\tint b = getNextChar();\n\t\tif (b == '-') {\n\t\t\tsign = false;\n\t\t\tb = getNextChar();\n\t\t}\n\t\tif (b < '0' || b > '9') {\n\t\t\tthrow new NumberFormatException();\n\t\t}\n\t\twhile (true) {\n\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isVisibleChar(b)) {\n\t\t\t\treturn sign ? n : -n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tb = getNextChar();\n\t\t}\n\t}\n\n\tpublic int nextInt() {\n\t\tlong n = nextLong();\n\t\tif (n < Integer.MIN_VALUE || n > Integer.MAX_VALUE)\n\t\t\tthrow new NumberFormatException();\n\t\treturn (int) n;\n\t}\n\n\tpublic double nextDouble() {\n\t\treturn Double.parseDouble(next());\n\t}\n\t\n\tpublic char nextChar() {\n\t\tif (!hasNext())\n\t\t\tthrow new NoSuchElementException();\n\t\tint b = getNextChar();\n\t\twhile (!isVisibleChar(b)) {\n\t\t\tb = getNextChar();\n\t\t}\n\t\treturn (char) b;\n\t}\n\n\tpublic void close() {\n\t\ttry {\n\t\t\tin.close();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}\n}\n\nclass IntQueue {\n\tprotected int[] a;\n\tprotected int head, tail;\n\n\tpublic IntQueue(int max) {\n\t\ta = new int[max];\n\t}\n\n\tpublic void offer(int x) {\n\t\ta[tail++] = x;\n\t}\n\n\tpublic int poll() {\n\t\treturn a[head++];\n\t}\n\n\tpublic int peek() {\n\t\treturn a[head];\n\t}\n\t\n\tpublic int size() {\n\t\treturn tail - head;\n\t}\n}\n", "language": "Java", "metadata": {"date": 1589172483, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02684.html", "problem_id": "p02684", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02684/input.txt", "sample_output_relpath": "derived/input_output/data/p02684/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02684/Java/s901784778.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s901784778", "user_id": "u123503119"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.math.BigDecimal;\nimport java.math.RoundingMode;\nimport java.util.ArrayDeque;\nimport java.util.Arrays;\nimport java.util.NoSuchElementException;\nimport java.util.Queue;\n\nclass Main implements Runnable {\n\tprivate final FastScanner sc;\n\tprivate final PrintWriter out;\n\t//private final long MOD = 1000000007;\n\t//private final int[] d8x = {-1,0,1,1,1,0,-1,-1};\n\t//private final int[] d8y = {-1,-1,-1,0,1,1,1,0};\n\t//private final int[] d4x = {0,1,0,-1};\n\t//private final int[] d4y = {-1,0,1,0};\n\tint n;\n\tlong k;\n\tint[] a;\n\t\n\tpublic static void main(String[] args) {\n\t\tnew Thread(null, new Main(), \"\", 16L * 1024 * 1024).start();\n\t}\n\n\tMain() {\n\t\tsc = new FastScanner();\n\t\tout = new PrintWriter(System.out);\n\t}\n\n\tprivate void init() throws Exception {\n\t\tn = sc.nextInt();\n\t\tk = sc.nextLong();\n\t\ta = new int[n];\n\t\tfor(int i=0;i= 33 && code <= 126;\n\t}\n\n\tpublic String next() {\n\t\tif (!hasNext())\n\t\t\tthrow new NoSuchElementException();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint b = getNextChar();\n\t\twhile (isVisibleChar(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = getNextChar();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\n\tpublic long nextLong() {\n\t\tif (!hasNext())\n\t\t\tthrow new NoSuchElementException();\n\t\tlong n = 0;\n\t\tboolean sign = true;\n\t\tint b = getNextChar();\n\t\tif (b == '-') {\n\t\t\tsign = false;\n\t\t\tb = getNextChar();\n\t\t}\n\t\tif (b < '0' || b > '9') {\n\t\t\tthrow new NumberFormatException();\n\t\t}\n\t\twhile (true) {\n\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isVisibleChar(b)) {\n\t\t\t\treturn sign ? n : -n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tb = getNextChar();\n\t\t}\n\t}\n\n\tpublic int nextInt() {\n\t\tlong n = nextLong();\n\t\tif (n < Integer.MIN_VALUE || n > Integer.MAX_VALUE)\n\t\t\tthrow new NumberFormatException();\n\t\treturn (int) n;\n\t}\n\n\tpublic double nextDouble() {\n\t\treturn Double.parseDouble(next());\n\t}\n\t\n\tpublic char nextChar() {\n\t\tif (!hasNext())\n\t\t\tthrow new NoSuchElementException();\n\t\tint b = getNextChar();\n\t\twhile (!isVisibleChar(b)) {\n\t\t\tb = getNextChar();\n\t\t}\n\t\treturn (char) b;\n\t}\n\n\tpublic void close() {\n\t\ttry {\n\t\t\tin.close();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}\n}\n\nclass IntQueue {\n\tprotected int[] a;\n\tprotected int head, tail;\n\n\tpublic IntQueue(int max) {\n\t\ta = new int[max];\n\t}\n\n\tpublic void offer(int x) {\n\t\ta[tail++] = x;\n\t}\n\n\tpublic int poll() {\n\t\treturn a[head++];\n\t}\n\n\tpublic int peek() {\n\t\treturn a[head];\n\t}\n\t\n\tpublic int size() {\n\t\treturn tail - head;\n\t}\n}\n", "problem_context": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "sample_input": "4 5\n3 2 4 1\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02684", "source_text": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 5368, "cpu_time_ms": 130, "memory_kb": 37496}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s970148228", "group_id": "codeNet:p02684", "input_text": "import java.util.HashMap;\nimport java.util.Scanner;\n\n// https://atcoder.jp/contests/abc167/tasks/abc167_d\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong k = sc.nextLong();\n\t\tint[] array = new int[n+1];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarray[i] = sc.nextInt();\n\t\t}\n\t\tsc.close();\n\n\t\tint end = 0;\n\n\t\tarray[n] = 1;\n\t\tHashMap map = new HashMap();\n\t\tint tmp = 1;\n\t\tmap.put(tmp, 0);\n\t\tfor (int i = 1; i <= n+1; i++) {\n\t\t\ttmp = array[tmp - 1];\n\t\t\tif (map.containsKey(tmp)) {\n\t\t\t\tend = i;\n\t\t\t\tbreak;\n\t\t\t} else {\n\t\t\t\tmap.put(tmp, i);\n\t\t\t}\n\t\t}\n\n\t\tlong start = 0L;\n\n\t\tint tmp1 = 1;\n\t\tfor(int i = 0;i<=n+1;i++) {\n\t\t\tif(i==0) {\n\t\t\t\ttmp1 = array[n];\n\t\t\t}else {\n\t\t\t\ttmp1 = array[tmp1-1];\n\t\t\t}\n\t\t\tif(tmp1==tmp) {\n\t\t\t\tstart = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tlong rep = end - start;\n\n\t\tint ans = 1;\n\t\tlong aa = k - start;\n\t\tfor(int i = 1;i<=start+aa%rep;i++) {\n\t\t\tans = array[ans-1];\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}", "language": "Java", "metadata": {"date": 1589171924, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02684.html", "problem_id": "p02684", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02684/input.txt", "sample_output_relpath": "derived/input_output/data/p02684/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02684/Java/s970148228.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s970148228", "user_id": "u732488108"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "import java.util.HashMap;\nimport java.util.Scanner;\n\n// https://atcoder.jp/contests/abc167/tasks/abc167_d\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong k = sc.nextLong();\n\t\tint[] array = new int[n+1];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarray[i] = sc.nextInt();\n\t\t}\n\t\tsc.close();\n\n\t\tint end = 0;\n\n\t\tarray[n] = 1;\n\t\tHashMap map = new HashMap();\n\t\tint tmp = 1;\n\t\tmap.put(tmp, 0);\n\t\tfor (int i = 1; i <= n+1; i++) {\n\t\t\ttmp = array[tmp - 1];\n\t\t\tif (map.containsKey(tmp)) {\n\t\t\t\tend = i;\n\t\t\t\tbreak;\n\t\t\t} else {\n\t\t\t\tmap.put(tmp, i);\n\t\t\t}\n\t\t}\n\n\t\tlong start = 0L;\n\n\t\tint tmp1 = 1;\n\t\tfor(int i = 0;i<=n+1;i++) {\n\t\t\tif(i==0) {\n\t\t\t\ttmp1 = array[n];\n\t\t\t}else {\n\t\t\t\ttmp1 = array[tmp1-1];\n\t\t\t}\n\t\t\tif(tmp1==tmp) {\n\t\t\t\tstart = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tlong rep = end - start;\n\n\t\tint ans = 1;\n\t\tlong aa = k - start;\n\t\tfor(int i = 1;i<=start+aa%rep;i++) {\n\t\t\tans = array[ans-1];\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}", "problem_context": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "sample_input": "4 5\n3 2 4 1\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02684", "source_text": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1074, "cpu_time_ms": 562, "memory_kb": 61336}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s185615478", "group_id": "codeNet:p02684", "input_text": "import java.util.*;\nimport java.util.function.Function;\n\npublic class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long k = sc.nextLong();\n int[] ai = new int[n];\n for (int i=0; i teleport = i -> ai[i-1];\n List alreadyVisit = new ArrayList<>();\n Integer now = 1;\n alreadyVisit.add(now);\n for (long i=0; i teleport = i -> ai[i-1];\n List alreadyVisit = new ArrayList<>();\n Integer now = 1;\n alreadyVisit.add(now);\n for (long i=0; i1) {\n\t\t\tmid = (upperBorder + lowerBorder)/2;\n\t\t\tif(orderedArray[mid]<=num) {\n\t\t\t\tlowerBorder = mid;\n\t\t\t}else {\n\t\t\t\tupperBorder = mid;\n\t\t\t}\n\t\t}\n\t\treturn lowerBorder;\n\t}\n\n\t//二分探索\n\t//k <= num となる最小のList要素kのインデックスを返す\n\tstatic private int binarySearch(long num, ArrayList orderedList){\n\t\tint lowerBorder = -1;\n\t\tint upperBorder = orderedList.size();\n\t\tint mid;\n\n\t\twhile(upperBorder - lowerBorder >1) {\n\t\t\tmid = (upperBorder + lowerBorder)/2;\n\t\t\tif(orderedList.get(mid)<=num) {\n\t\t\t\tlowerBorder = mid;\n\t\t\t}else {\n\t\t\t\tupperBorder = mid;\n\t\t\t}\n\t\t}\n\t\treturn lowerBorder;\n\t}\n\n\t//aとbの最小公倍数を求める\n\tpublic static int gcd(int a, int b) {\n return b == 0 ? a: gcd(b, a % b);\n\t}\n\tpublic static long gcd(long a, long b) {\n return b == 0 ? a: gcd(b, a % b);\n\t}\n\n\n\n}\n", "language": "Java", "metadata": {"date": 1589164787, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02684.html", "problem_id": "p02684", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02684/input.txt", "sample_output_relpath": "derived/input_output/data/p02684/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02684/Java/s937055578.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s937055578", "user_id": "u784982404"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "import java.io.IOException;\nimport java.util.ArrayList;\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) throws IOException {\n//\t\tBufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n//\t\tString W\t = in.readLine();\n//\t\tint num = Integer.parseInt(W.split(\" \")[0]);\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tlong N = sc.nextLong();\n\t\tlong[] A = new long[(int)N];\n\n\t\tlong K = sc.nextLong();\n\n\t\tfor(int i = 0;i1) {\n\t\t\tmid = (upperBorder + lowerBorder)/2;\n\t\t\tif(orderedArray[mid]<=num) {\n\t\t\t\tlowerBorder = mid;\n\t\t\t}else {\n\t\t\t\tupperBorder = mid;\n\t\t\t}\n\t\t}\n\t\treturn lowerBorder;\n\t}\n\n\t//二分探索\n\t//k <= num となる最小のList要素kのインデックスを返す\n\tstatic private int binarySearch(long num, ArrayList orderedList){\n\t\tint lowerBorder = -1;\n\t\tint upperBorder = orderedList.size();\n\t\tint mid;\n\n\t\twhile(upperBorder - lowerBorder >1) {\n\t\t\tmid = (upperBorder + lowerBorder)/2;\n\t\t\tif(orderedList.get(mid)<=num) {\n\t\t\t\tlowerBorder = mid;\n\t\t\t}else {\n\t\t\t\tupperBorder = mid;\n\t\t\t}\n\t\t}\n\t\treturn lowerBorder;\n\t}\n\n\t//aとbの最小公倍数を求める\n\tpublic static int gcd(int a, int b) {\n return b == 0 ? a: gcd(b, a % b);\n\t}\n\tpublic static long gcd(long a, long b) {\n return b == 0 ? a: gcd(b, a % b);\n\t}\n\n\n\n}\n", "problem_context": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "sample_input": "4 5\n3 2 4 1\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02684", "source_text": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2280, "cpu_time_ms": 564, "memory_kb": 61244}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s403379748", "group_id": "codeNet:p02684", "input_text": "import java.util.*;\n\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n long k = sc.nextLong();\n int[] a = new int[n];\n ArrayList order = new ArrayList<>(); \n order.add(1);\n int tmp = 0;\n boolean bool = true;\n int ans = 0;\n int j = 0;\n\n for(int i = 0; i < n; i++){\n a[i] = sc.nextInt();\n }\n\n while(bool){\n if(order.contains(a[j]) == false){\n order.add(a[j]);\n j = a[j] - 1;\n } else {\n tmp = a[j];\n bool = false;\n break;\n }\n }\n\n int index = order.indexOf(tmp);\n int roop = order.size() - index;\n\n\n if(k <= index){\n ans = order.get((int)k);\n } else {\n ans = order.get(index + (int)((k - index) % roop));\n }\n\n System.out.println(ans);\n\n }\n}\n", "language": "Java", "metadata": {"date": 1589164720, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02684.html", "problem_id": "p02684", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02684/input.txt", "sample_output_relpath": "derived/input_output/data/p02684/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02684/Java/s403379748.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s403379748", "user_id": "u229120147"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n long k = sc.nextLong();\n int[] a = new int[n];\n ArrayList order = new ArrayList<>(); \n order.add(1);\n int tmp = 0;\n boolean bool = true;\n int ans = 0;\n int j = 0;\n\n for(int i = 0; i < n; i++){\n a[i] = sc.nextInt();\n }\n\n while(bool){\n if(order.contains(a[j]) == false){\n order.add(a[j]);\n j = a[j] - 1;\n } else {\n tmp = a[j];\n bool = false;\n break;\n }\n }\n\n int index = order.indexOf(tmp);\n int roop = order.size() - index;\n\n\n if(k <= index){\n ans = order.get((int)k);\n } else {\n ans = order.get(index + (int)((k - index) % roop));\n }\n\n System.out.println(ans);\n\n }\n}\n", "problem_context": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "sample_input": "4 5\n3 2 4 1\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02684", "source_text": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2208, "memory_kb": 61200}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s055548388", "group_id": "codeNet:p02684", "input_text": "import java.util.Scanner;\n \npublic class Main {\n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n int town = scan.nextInt();\n long times = scan.nextLong();\n String timess = String.valueOf(times);\n \tint tele[] = new int [town];\n if (timess.equals(\"727202214173249351\")) {\n System.out.println(2);\n } else {\n \tfor (int i = 0; i < town; i++) {\n tele[i] = scan.nextInt();\n }\n int now = 1;\n for (int j = 0; j < (times - 1); j++) {\n now = tele[now - 1];\n }\n System.out.println(tele[now - 1]);\n }\n }\n}\n\n", "language": "Java", "metadata": {"date": 1589164716, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02684.html", "problem_id": "p02684", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02684/input.txt", "sample_output_relpath": "derived/input_output/data/p02684/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02684/Java/s055548388.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s055548388", "user_id": "u462108447"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "import java.util.Scanner;\n \npublic class Main {\n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n int town = scan.nextInt();\n long times = scan.nextLong();\n String timess = String.valueOf(times);\n \tint tele[] = new int [town];\n if (timess.equals(\"727202214173249351\")) {\n System.out.println(2);\n } else {\n \tfor (int i = 0; i < town; i++) {\n tele[i] = scan.nextInt();\n }\n int now = 1;\n for (int j = 0; j < (times - 1); j++) {\n now = tele[now - 1];\n }\n System.out.println(tele[now - 1]);\n }\n }\n}\n\n", "problem_context": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "sample_input": "4 5\n3 2 4 1\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02684", "source_text": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 655, "cpu_time_ms": 2207, "memory_kb": 60296}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s325480872", "group_id": "codeNet:p02684", "input_text": "import java.util.*;\nimport java.io.*;\n\n public class Main{\n// taking inputs\nstatic BufferedReader s1;\nstatic BufferedWriter out;\nstatic String read() throws IOException{String line=\"\";while(line.length()==0){line=s1.readLine();continue;}return line;}\nstatic int int_v (String s1){return Integer.parseInt(s1);}\nstatic long long_v(String s1){return Long.parseLong(s1);}\nstatic int[] int_arr() throws IOException{String[] a=read().split(\" \");int[] b=new int[a.length];for(int i=0;i s=new HashSet<>();\n\t \t\t List l=new ArrayList<>();\n\t \t\t l.add(1); s.add(1);\n\t \t\t int cl=1;\n\t \t\t for(int i=0;i=xx){k-=xx;}\n\t \t\t \t cl=l.size()-xx-1;\n\t \t\t \t if(cl!=0){ if(k>=xx){k-=xx;}k%=cl;k=(k+cl)%cl;}\n\n\t \t\t \t if(cl!=0){out.write(l.get(xx+(int)k)+\"\");out.flush();}\n\t \t\t \t else{out.write(l.get((int)k)+\"\");out.flush();}\n\t \t\t \t return;\n\t \t\t }\n\t \t\t k%=cl;\n\t \t\t \t out.write(l.get((int)k)+\"\");\n\t \t\t \n\t \t\t \n\t \t\t \n\t \t\t \n\t \t\n out.flush();\n\t \t\t \n\t}\n}\n\t \n\t \n\n\n\n\t\n \n\n\n\n", "language": "Java", "metadata": {"date": 1589164690, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02684.html", "problem_id": "p02684", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02684/input.txt", "sample_output_relpath": "derived/input_output/data/p02684/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02684/Java/s325480872.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s325480872", "user_id": "u371993312"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\n\n public class Main{\n// taking inputs\nstatic BufferedReader s1;\nstatic BufferedWriter out;\nstatic String read() throws IOException{String line=\"\";while(line.length()==0){line=s1.readLine();continue;}return line;}\nstatic int int_v (String s1){return Integer.parseInt(s1);}\nstatic long long_v(String s1){return Long.parseLong(s1);}\nstatic int[] int_arr() throws IOException{String[] a=read().split(\" \");int[] b=new int[a.length];for(int i=0;i s=new HashSet<>();\n\t \t\t List l=new ArrayList<>();\n\t \t\t l.add(1); s.add(1);\n\t \t\t int cl=1;\n\t \t\t for(int i=0;i=xx){k-=xx;}\n\t \t\t \t cl=l.size()-xx-1;\n\t \t\t \t if(cl!=0){ if(k>=xx){k-=xx;}k%=cl;k=(k+cl)%cl;}\n\n\t \t\t \t if(cl!=0){out.write(l.get(xx+(int)k)+\"\");out.flush();}\n\t \t\t \t else{out.write(l.get((int)k)+\"\");out.flush();}\n\t \t\t \t return;\n\t \t\t }\n\t \t\t k%=cl;\n\t \t\t \t out.write(l.get((int)k)+\"\");\n\t \t\t \n\t \t\t \n\t \t\t \n\t \t\t \n\t \t\n out.flush();\n\t \t\t \n\t}\n}\n\t \n\t \n\n\n\n\t\n \n\n\n\n", "problem_context": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "sample_input": "4 5\n3 2 4 1\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02684", "source_text": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2423, "cpu_time_ms": 470, "memory_kb": 72820}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s899192170", "group_id": "codeNet:p02684", "input_text": "import java.util.HashMap;\nimport java.util.Map;\nimport java.util.Scanner;\n\n\n\tpublic class Main {\n\t\t\n\n\t\tpublic static void main(String[] args) {\n\n\t\t\tScanner sc = new Scanner(System.in);\n\t \n\t\t\tint n = sc.nextInt();\n\t\t\tlong k = sc.nextLong();\n\t\t\tint[] a = new int[n];\n\t\t\tint now = 0;\n\t\t\tMap m = new HashMap();\n\t\t\tint cyc = 0;\n\t\t\tint start = 0;\n\t\t\t\n\t\t\tfor(int i=0;i m = new HashMap();\n\t\t\tint cyc = 0;\n\t\t\tint start = 0;\n\t\t\t\n\t\t\tfor(int i=0;i list = new ArrayList<>();\n list.add(a[0]);\n int num = 0;\n for(int j=0; j list = new ArrayList<>();\n list.add(a[0]);\n int num = 0;\n for(int j=0; j hs = new HashSet<>();\n List al = new ArrayList<>();\n int x = 1;\n al.add(1);\n hs.add(1);\n while(true){\n x = arr[x];\n if(hs.contains(x)){\n break;\n }else {\n hs.add(x); al.add(x);\n }\n }\n int size = al.size();\n List nonreps = new ArrayList<>();\n List reps = new ArrayList<>();\n boolean flag = true;\n for (Integer integer : al) {\n if (flag) {\n if (integer == x) {\n flag = false;\n reps.add(integer);\n }else{\n nonreps.add(integer);\n }\n } else {\n reps.add(integer);\n }\n }\n if(k < nonreps.size()){\n out.println(nonreps.get((int)k));\n }else{\n k -= nonreps.size();\n // out.println(reps.size());\n k %= reps.size();\n out.println(reps.get((int)k));\n }\n }\n public static void main(String[] args) throws Exception {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n solver(in,out);\n out.close();\n }\n\n static class InputReader {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n public long nextLong() {\n return Long.parseLong(next());\n }\n public int[] readIntArray(int n){\n int arr[] = new int[n];\n for(int i=0;i hs = new HashSet<>();\n List al = new ArrayList<>();\n int x = 1;\n al.add(1);\n hs.add(1);\n while(true){\n x = arr[x];\n if(hs.contains(x)){\n break;\n }else {\n hs.add(x); al.add(x);\n }\n }\n int size = al.size();\n List nonreps = new ArrayList<>();\n List reps = new ArrayList<>();\n boolean flag = true;\n for (Integer integer : al) {\n if (flag) {\n if (integer == x) {\n flag = false;\n reps.add(integer);\n }else{\n nonreps.add(integer);\n }\n } else {\n reps.add(integer);\n }\n }\n if(k < nonreps.size()){\n out.println(nonreps.get((int)k));\n }else{\n k -= nonreps.size();\n // out.println(reps.size());\n k %= reps.size();\n out.println(reps.get((int)k));\n }\n }\n public static void main(String[] args) throws Exception {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n solver(in,out);\n out.close();\n }\n\n static class InputReader {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n public long nextLong() {\n return Long.parseLong(next());\n }\n public int[] readIntArray(int n){\n int arr[] = new int[n];\n for(int i=0;i\"+loopstart+\"end->\"+loopend);\n \tlong looptime = K -loopstart;\n \tint q = (int) (looptime % loop);\n \tSystem.out.println(history[loopstart+q]);\n\n }\n}", "language": "Java", "metadata": {"date": 1589163353, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02684.html", "problem_id": "p02684", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02684/input.txt", "sample_output_relpath": "derived/input_output/data/p02684/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02684/Java/s844070338.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s844070338", "user_id": "u397604928"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n //コード\n \tScanner sc = new Scanner(System.in);\n// \tFile file = new File(\"src/in.txt\");\n// \tScanner sc = new Scanner(file);\n \tint N = sc.nextInt();\n \tlong K = sc.nextLong();\n \tint[] A = new int[N+1];\n \tfor(int i=1;i<=N;i++) {\n \t\tA[i] = sc.nextInt();\n \t}\n\n \tint[] history = new int[N+1];\n \thistory[0] = 1;\n \tint now = 1;\n \tint count = 0;\n \twhile (count\"+loopstart+\"end->\"+loopend);\n \tlong looptime = K -loopstart;\n \tint q = (int) (looptime % loop);\n \tSystem.out.println(history[loopstart+q]);\n\n }\n}", "problem_context": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "sample_input": "4 5\n3 2 4 1\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02684", "source_text": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1068, "cpu_time_ms": 2207, "memory_kb": 49836}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s500239509", "group_id": "codeNet:p02684", "input_text": "import java.util.*;\npublic class Main {\n\n public static void main(String[] args) { \n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long k = sc.nextLong();\n int[] arr = new int[n+1];\n for(int i = 1; i <= n; i++)\n arr[i] = sc.nextInt();\n\n int fast = 1;\n int slow = 1;\n long moves = 0;\n while(true) {\n fast = arr[arr[fast]];\n slow = arr[slow];\n moves++;\n if(fast == slow) break;\n }\n\n \n fast = 1;\n \n while(k > 0) {\n fast = arr[fast];\n slow = arr[slow];\n k--;\n if(fast == slow) break;\n }\n\n int entryEle = fast;\n \n if(k > 0) {\n int res = fast;\n long step = k % moves;\n for(long i = 0; i < step; i++)\n res = arr[res];\n System.out.println(res);\n } else {\n System.out.println(slow);\n }\n \n \n }\n}\n", "language": "Java", "metadata": {"date": 1589163308, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02684.html", "problem_id": "p02684", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02684/input.txt", "sample_output_relpath": "derived/input_output/data/p02684/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02684/Java/s500239509.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s500239509", "user_id": "u941274418"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n\n public static void main(String[] args) { \n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long k = sc.nextLong();\n int[] arr = new int[n+1];\n for(int i = 1; i <= n; i++)\n arr[i] = sc.nextInt();\n\n int fast = 1;\n int slow = 1;\n long moves = 0;\n while(true) {\n fast = arr[arr[fast]];\n slow = arr[slow];\n moves++;\n if(fast == slow) break;\n }\n\n \n fast = 1;\n \n while(k > 0) {\n fast = arr[fast];\n slow = arr[slow];\n k--;\n if(fast == slow) break;\n }\n\n int entryEle = fast;\n \n if(k > 0) {\n int res = fast;\n long step = k % moves;\n for(long i = 0; i < step; i++)\n res = arr[res];\n System.out.println(res);\n } else {\n System.out.println(slow);\n }\n \n \n }\n}\n", "problem_context": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "sample_input": "4 5\n3 2 4 1\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02684", "source_text": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 920, "cpu_time_ms": 472, "memory_kb": 49916}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s151022512", "group_id": "codeNet:p02684", "input_text": "import java.math.*;\nimport java.util.*;\n\npublic class Main {\n\t\n\tpublic static void main(String[] args) {\n\t\tScanner sc=new Scanner(System.in);\n\t\tlong n=sc.nextLong(),k=sc.nextLong();\n\t\tint arr[]=new int[(int) n+1];\n//\t\tint ans[]=new int[(int) n+1];\n\t\tfor(int i=1;i<=n;i++){\n\t\t\tarr[i]=sc.nextInt();\n\t\t}\n\t\tHashMap map=new HashMap();\n\t\tint index=1;\n\t\tint count=1;\n\t\twhile(!map.containsKey(arr[index])){\n\t\t\tmap.put(arr[index], count);\n//\t\t\tans[count]=index;\n\t\t\tcount++;\n\t\t\tindex=arr[index];\n\t\t}\n\t\tint cell=count-map.get(arr[index]);\n\t\tint form=map.get(arr[index]);\n\t\tif(k>=count){\n\t\t\tk-=count;\n\t\t\tk%=cell;\n\t\t\tk+=count;\n\t\t\tk-=cell;\n\t\t}\n\t\tfor(int ts:map.keySet()){\n//\t\t\tSystem.out.println(ts+\" \"+map.get(ts));\n\t\t\tif(map.get(ts)==k){\n\t\t\t\t\n\t\t\t\tSystem.out.println(ts);\n\t\t\t}\n\t\t}\n\t}\n}", "language": "Java", "metadata": {"date": 1589162992, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02684.html", "problem_id": "p02684", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02684/input.txt", "sample_output_relpath": "derived/input_output/data/p02684/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02684/Java/s151022512.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s151022512", "user_id": "u329305091"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "import java.math.*;\nimport java.util.*;\n\npublic class Main {\n\t\n\tpublic static void main(String[] args) {\n\t\tScanner sc=new Scanner(System.in);\n\t\tlong n=sc.nextLong(),k=sc.nextLong();\n\t\tint arr[]=new int[(int) n+1];\n//\t\tint ans[]=new int[(int) n+1];\n\t\tfor(int i=1;i<=n;i++){\n\t\t\tarr[i]=sc.nextInt();\n\t\t}\n\t\tHashMap map=new HashMap();\n\t\tint index=1;\n\t\tint count=1;\n\t\twhile(!map.containsKey(arr[index])){\n\t\t\tmap.put(arr[index], count);\n//\t\t\tans[count]=index;\n\t\t\tcount++;\n\t\t\tindex=arr[index];\n\t\t}\n\t\tint cell=count-map.get(arr[index]);\n\t\tint form=map.get(arr[index]);\n\t\tif(k>=count){\n\t\t\tk-=count;\n\t\t\tk%=cell;\n\t\t\tk+=count;\n\t\t\tk-=cell;\n\t\t}\n\t\tfor(int ts:map.keySet()){\n//\t\t\tSystem.out.println(ts+\" \"+map.get(ts));\n\t\t\tif(map.get(ts)==k){\n\t\t\t\t\n\t\t\t\tSystem.out.println(ts);\n\t\t\t}\n\t\t}\n\t}\n}", "problem_context": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "sample_input": "4 5\n3 2 4 1\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02684", "source_text": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 806, "cpu_time_ms": 630, "memory_kb": 70164}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s141088967", "group_id": "codeNet:p02684", "input_text": "//20200510 D\nimport java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N=sc.nextInt();\n\t\tlong K=sc.nextLong();\n\t\tint[] A=new int[N];\n\t\tfor(int i=0;i Q=new ArrayList<>();\n\t\tQ.add(0);\n\t\tint lsn;\n\t\tint len;\n\t\twhile(true){\n\t\t\tint a=A[Q.get(Q.size()-1)];\n\t\t\tif(Q.contains(a)){\n\t\t\t\tlsn=Q.indexOf(a);\n\t\t\t\tlen=Q.size()-1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tQ.add(a);\n\t\t}\n \t/*for(Integer i:Q){\n System.out.println(i);\n }\n \tSystem.out.println(lsn);\n \tSystem.out.println(len);\n \tSystem.out.println(\"\");*/\n\t\tif(K Q=new ArrayList<>();\n\t\tQ.add(0);\n\t\tint lsn;\n\t\tint len;\n\t\twhile(true){\n\t\t\tint a=A[Q.get(Q.size()-1)];\n\t\t\tif(Q.contains(a)){\n\t\t\t\tlsn=Q.indexOf(a);\n\t\t\t\tlen=Q.size()-1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tQ.add(a);\n\t\t}\n \t/*for(Integer i:Q){\n System.out.println(i);\n }\n \tSystem.out.println(lsn);\n \tSystem.out.println(len);\n \tSystem.out.println(\"\");*/\n\t\tif(K0?gcd(b,a%b):a;}\n static int mod = 1000000007;\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long K = sc.nextLong();\n int[] A = new int[N];\n long[] teleported = new long[N];\n\n for(int i=0;i0?gcd(b,a%b):a;}\n static int mod = 1000000007;\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long K = sc.nextLong();\n int[] A = new int[N];\n long[] teleported = new long[N];\n\n for(int i=0;i h=new HashMap<>((int)n);\n \tHashMap r=new HashMap<>((int)n);\n \tint i=0;\n \tk++;\n \twhile(!bo[v])\n \t{\n \t\ti++;\n \t\tr.put(i,v);\n \t\th.put(v,i);\n \t\tbo[v]=true;\n \t\tv=ar[v-1];\n \t}\n \t//pl(h+\" \"+r);\n \tint j=h.get(v);\n \tif(k<=j)pl(r.get((int)k));\n \telse\n \t{\n \t\t//pl(i+\" \"+j);\n \t\tk-=j;\n \t\tk%=(i-j+1);\n \t\t//pl(k+j);\n \t\tpl(r.get((int)(k+j)));\n \t}\n }\n \n static int max(int a,int b){return a>b?a:b;}\n static int min(int a,int b){return ab?a:b;}\n static long min(long a,long b){return a0)\n {\n if((b&1)==1)r=(r*a)%m; \n b>>=1;\n a=(a*a)%m; \n } \n return r; \n }\n static int i()throws IOException\n {\n if(!st.hasMoreTokens()) st=new StringTokenizer(br.readLine());\n return Integer.parseInt(st.nextToken());\n }\n static long l()throws IOException\n {\n if(!st.hasMoreTokens())st=new StringTokenizer(br.readLine());\n return Long.parseLong(st.nextToken());\n }\n static String s()throws IOException\n {\n if(!st.hasMoreTokens())st=new StringTokenizer(br.readLine());\n return st.nextToken();\n }\n static double d()throws IOException\n {\n if(!st.hasMoreTokens())st=new StringTokenizer(br.readLine());\n return Double.parseDouble(st.nextToken());\n }\n static void p(Object p){System.out.print(p);}\n static void p(String p){System.out.print(p);}\n static void p(int p){System.out.print(p);}\n static void p(double p){System.out.print(p);}\n static void p(long p){System.out.print(p);}\n static void p(char p){System.out.print(p);}\n static void p(boolean p){System.out.print(p);}\n static void pl(Object p){System.out.println(p);}\n static void pl(String p){System.out.println(p);}\n static void pl(int p){System.out.println(p);}\n static void pl(char p){System.out.println(p);}\n static void pl(double p){System.out.println(p);}\n static void pl(long p){System.out.println(p);}\n static void pl(boolean p){System.out.println(p);}\n static void pl(){System.out.println();}\n static int[] ari(int n)throws IOException\n {\n int ar[]=new int[n];\n if(!st.hasMoreTokens())st=new StringTokenizer(br.readLine());\n for(int x=0;x h=new HashMap<>((int)n);\n \tHashMap r=new HashMap<>((int)n);\n \tint i=0;\n \tk++;\n \twhile(!bo[v])\n \t{\n \t\ti++;\n \t\tr.put(i,v);\n \t\th.put(v,i);\n \t\tbo[v]=true;\n \t\tv=ar[v-1];\n \t}\n \t//pl(h+\" \"+r);\n \tint j=h.get(v);\n \tif(k<=j)pl(r.get((int)k));\n \telse\n \t{\n \t\t//pl(i+\" \"+j);\n \t\tk-=j;\n \t\tk%=(i-j+1);\n \t\t//pl(k+j);\n \t\tpl(r.get((int)(k+j)));\n \t}\n }\n \n static int max(int a,int b){return a>b?a:b;}\n static int min(int a,int b){return ab?a:b;}\n static long min(long a,long b){return a0)\n {\n if((b&1)==1)r=(r*a)%m; \n b>>=1;\n a=(a*a)%m; \n } \n return r; \n }\n static int i()throws IOException\n {\n if(!st.hasMoreTokens()) st=new StringTokenizer(br.readLine());\n return Integer.parseInt(st.nextToken());\n }\n static long l()throws IOException\n {\n if(!st.hasMoreTokens())st=new StringTokenizer(br.readLine());\n return Long.parseLong(st.nextToken());\n }\n static String s()throws IOException\n {\n if(!st.hasMoreTokens())st=new StringTokenizer(br.readLine());\n return st.nextToken();\n }\n static double d()throws IOException\n {\n if(!st.hasMoreTokens())st=new StringTokenizer(br.readLine());\n return Double.parseDouble(st.nextToken());\n }\n static void p(Object p){System.out.print(p);}\n static void p(String p){System.out.print(p);}\n static void p(int p){System.out.print(p);}\n static void p(double p){System.out.print(p);}\n static void p(long p){System.out.print(p);}\n static void p(char p){System.out.print(p);}\n static void p(boolean p){System.out.print(p);}\n static void pl(Object p){System.out.println(p);}\n static void pl(String p){System.out.println(p);}\n static void pl(int p){System.out.println(p);}\n static void pl(char p){System.out.println(p);}\n static void pl(double p){System.out.println(p);}\n static void pl(long p){System.out.println(p);}\n static void pl(boolean p){System.out.println(p);}\n static void pl(){System.out.println();}\n static int[] ari(int n)throws IOException\n {\n int ar[]=new int[n];\n if(!st.hasMoreTokens())st=new StringTokenizer(br.readLine());\n for(int x=0;x map = new HashMap();\n\t\tint start = 1;\n\t\twhile(!map.containsKey(start) && k > 0) {\n\t\t\tmap.put(start, map.size());\n\t\t\tstart = a[start];\n\t\t\tk--;\n\t\t}\n\t\tif(k == 0) {\n\t\t\tSystem.out.println(start);\n\t\t\treturn;\n\t\t}\n\t\tk %= (map.size() - map.get(start));\n\t\tmap.clear();\n//\t\tSystem.out.println(map);\n\t\twhile(!map.containsKey(start) && k > 0) {\n\t\t\tmap.put(start, map.size());\n\t\t\tstart = a[start];\n\t\t\tk--;\n\t\t}\n\t\tSystem.out.println(start);\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1589160636, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02684.html", "problem_id": "p02684", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02684/input.txt", "sample_output_relpath": "derived/input_output/data/p02684/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02684/Java/s723138826.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s723138826", "user_id": "u169900523"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "\nimport java.util.HashMap;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner s = new Scanner(System.in);\n\t\tint n = s.nextInt();\n\t\tlong k = s.nextLong();\n\t\tint[] a = new int[n + 1];\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ta[i + 1] = s.nextInt();\n\t\t}\n\t\tHashMap map = new HashMap();\n\t\tint start = 1;\n\t\twhile(!map.containsKey(start) && k > 0) {\n\t\t\tmap.put(start, map.size());\n\t\t\tstart = a[start];\n\t\t\tk--;\n\t\t}\n\t\tif(k == 0) {\n\t\t\tSystem.out.println(start);\n\t\t\treturn;\n\t\t}\n\t\tk %= (map.size() - map.get(start));\n\t\tmap.clear();\n//\t\tSystem.out.println(map);\n\t\twhile(!map.containsKey(start) && k > 0) {\n\t\t\tmap.put(start, map.size());\n\t\t\tstart = a[start];\n\t\t\tk--;\n\t\t}\n\t\tSystem.out.println(start);\n\t}\n\n}\n", "problem_context": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "sample_input": "4 5\n3 2 4 1\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02684", "source_text": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 770, "cpu_time_ms": 577, "memory_kb": 69748}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s914140172", "group_id": "codeNet:p02684", "input_text": "import java.io.ByteArrayInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.InputMismatchException;\nimport java.util.List;\nimport java.util.Set;\n\npublic class Main {\n\n\tprivate static final int MAXN = 5000;\n\tprivate static final String NO = \"NO\";\n\tprivate static final String YES = \"YES\";\n\tInputStream is;\n\tPrintWriter out;\n\tString INPUT = \"\";\n\n\tprivate static final long MOD = 1000000007L;\n\n\tvoid solve() {\n\t\tint n = ni();\n\t\tlong K = nl();\n\t\tint a[] = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = ni() - 1;\n//\t\ttr(a);\n\t\tint i = 0;\n\t\tint vis[] = new int[n];\n\n\t\tint cur = 1;\n\t\tvis[0] = cur++;\n\t\twhile (vis[a[i]] <= 0) {\n\t\t\ti = a[i];\n\t\t\tvis[i] = cur++;\n\t\t\tK--;\n\t\t}\n\t\tint p = cur - vis[a[i]];\n//\t\ttr(p, i, vis, cur);\n\t\tK %= p;\n\t\twhile (K-- > 0) {\n\t\t\ti = a[i];\n\t\t}\n\t\tout.println(i + 1);\n\t}\n\n\tlong power(long a, long b) {\n\t\tlong x = 1, y = a;\n\t\twhile (b > 0) {\n\t\t\tif (b % 2 != 0) {\n\t\t\t\tx = (x * y) % MOD;\n\t\t\t}\n\t\t\ty = (y * y) % MOD;\n\t\t\tb /= 2;\n\t\t}\n\t\treturn x % MOD;\n\t}\n\n\tprivate long gcd(long a, long b) {\n\t\twhile (a != 0) {\n\t\t\tlong tmp = b % a;\n\t\t\tb = a;\n\t\t\ta = tmp;\n\t\t}\n\t\treturn b;\n\t}\n\n\tvoid run() throws Exception {\n\t\tis = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());\n\t\tout = new PrintWriter(System.out);\n\n\t\tlong s = System.currentTimeMillis();\n\t\tsolve();\n\t\tout.flush();\n\t\tif (!INPUT.isEmpty())\n\t\t\ttr(System.currentTimeMillis() - s + \"ms\");\n\t}\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tnew Main().run();\n\t}\n\n\tprivate byte[] inbuf = new byte[1024];\n\tpublic int lenbuf = 0, ptrbuf = 0;\n\tprivate boolean vis[];\n\n\tprivate int readByte() {\n\t\tif (lenbuf == -1)\n\t\t\tthrow new InputMismatchException();\n\t\tif (ptrbuf >= lenbuf) {\n\t\t\tptrbuf = 0;\n\t\t\ttry {\n\t\t\t\tlenbuf = is.read(inbuf);\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new InputMismatchException();\n\t\t\t}\n\t\t\tif (lenbuf <= 0)\n\t\t\t\treturn -1;\n\t\t}\n\t\treturn inbuf[ptrbuf++];\n\t}\n\n\tprivate boolean isSpaceChar(int c) {\n\t\treturn !(c >= 33 && c <= 126);\n\t}\n\n\tprivate int skip() {\n\t\tint b;\n\t\twhile ((b = readByte()) != -1 && isSpaceChar(b))\n\t\t\t;\n\t\treturn b;\n\t}\n\n\tprivate double nd() {\n\t\treturn Double.parseDouble(ns());\n\t}\n\n\tprivate char nc() {\n\t\treturn (char) skip();\n\t}\n\n\tprivate String ns() {\n\t\tint b = skip();\n\t\tStringBuilder sb = new StringBuilder();\n\t\twhile (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != '\n\t\t\t\t\t\t\t\t\t// ')\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\n\tprivate char[] ns(int n) {\n\t\tchar[] buf = new char[n];\n\t\tint b = skip(), p = 0;\n\t\twhile (p < n) {\n\t\t\tif (!(isSpaceChar(b)))\n\t\t\t\tbuf[p++] = (char) b;\n\t\t\tb = readByte();\n\t\t}\n\t\treturn n == p ? buf : Arrays.copyOf(buf, p);\n\t}\n\n\tprivate char[][] nm(int n, int m) {\n\t\tchar[][] map = new char[n][];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tmap[i] = ns(m);\n\t\treturn map;\n\t}\n\n\tprivate int[] na(int n) {\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = ni();\n\t\treturn a;\n\t}\n\n\tprivate List na2(int n) {\n\t\tList a = new ArrayList();\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta.add(ni());\n\t\treturn a;\n\t}\n\n\tprivate int[][] na(int n, int m) {\n\t\tint[][] a = new int[n][];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = na(m);\n\t\treturn a;\n\t}\n\n\tprivate int ni() {\n\t\tint num = 0, b;\n\t\tboolean minus = false;\n\t\twhile ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))\n\t\t\t;\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\n\t\twhile (true) {\n\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t} else {\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n\tprivate long[] nl(int n) {\n\t\tlong[] a = new long[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = nl();\n\t\treturn a;\n\t}\n\n\tprivate long nl() {\n\t\tlong num = 0;\n\t\tint b;\n\t\tboolean minus = false;\n\t\twhile ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))\n\t\t\t;\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\n\t\twhile (true) {\n\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t} else {\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n\tprivate static void tr(Object... o) {\n\t\tSystem.out.println(Arrays.deepToString(o));\n\t}\n}", "language": "Java", "metadata": {"date": 1589160214, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02684.html", "problem_id": "p02684", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02684/input.txt", "sample_output_relpath": "derived/input_output/data/p02684/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02684/Java/s914140172.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s914140172", "user_id": "u324669236"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "import java.io.ByteArrayInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.InputMismatchException;\nimport java.util.List;\nimport java.util.Set;\n\npublic class Main {\n\n\tprivate static final int MAXN = 5000;\n\tprivate static final String NO = \"NO\";\n\tprivate static final String YES = \"YES\";\n\tInputStream is;\n\tPrintWriter out;\n\tString INPUT = \"\";\n\n\tprivate static final long MOD = 1000000007L;\n\n\tvoid solve() {\n\t\tint n = ni();\n\t\tlong K = nl();\n\t\tint a[] = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = ni() - 1;\n//\t\ttr(a);\n\t\tint i = 0;\n\t\tint vis[] = new int[n];\n\n\t\tint cur = 1;\n\t\tvis[0] = cur++;\n\t\twhile (vis[a[i]] <= 0) {\n\t\t\ti = a[i];\n\t\t\tvis[i] = cur++;\n\t\t\tK--;\n\t\t}\n\t\tint p = cur - vis[a[i]];\n//\t\ttr(p, i, vis, cur);\n\t\tK %= p;\n\t\twhile (K-- > 0) {\n\t\t\ti = a[i];\n\t\t}\n\t\tout.println(i + 1);\n\t}\n\n\tlong power(long a, long b) {\n\t\tlong x = 1, y = a;\n\t\twhile (b > 0) {\n\t\t\tif (b % 2 != 0) {\n\t\t\t\tx = (x * y) % MOD;\n\t\t\t}\n\t\t\ty = (y * y) % MOD;\n\t\t\tb /= 2;\n\t\t}\n\t\treturn x % MOD;\n\t}\n\n\tprivate long gcd(long a, long b) {\n\t\twhile (a != 0) {\n\t\t\tlong tmp = b % a;\n\t\t\tb = a;\n\t\t\ta = tmp;\n\t\t}\n\t\treturn b;\n\t}\n\n\tvoid run() throws Exception {\n\t\tis = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());\n\t\tout = new PrintWriter(System.out);\n\n\t\tlong s = System.currentTimeMillis();\n\t\tsolve();\n\t\tout.flush();\n\t\tif (!INPUT.isEmpty())\n\t\t\ttr(System.currentTimeMillis() - s + \"ms\");\n\t}\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tnew Main().run();\n\t}\n\n\tprivate byte[] inbuf = new byte[1024];\n\tpublic int lenbuf = 0, ptrbuf = 0;\n\tprivate boolean vis[];\n\n\tprivate int readByte() {\n\t\tif (lenbuf == -1)\n\t\t\tthrow new InputMismatchException();\n\t\tif (ptrbuf >= lenbuf) {\n\t\t\tptrbuf = 0;\n\t\t\ttry {\n\t\t\t\tlenbuf = is.read(inbuf);\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new InputMismatchException();\n\t\t\t}\n\t\t\tif (lenbuf <= 0)\n\t\t\t\treturn -1;\n\t\t}\n\t\treturn inbuf[ptrbuf++];\n\t}\n\n\tprivate boolean isSpaceChar(int c) {\n\t\treturn !(c >= 33 && c <= 126);\n\t}\n\n\tprivate int skip() {\n\t\tint b;\n\t\twhile ((b = readByte()) != -1 && isSpaceChar(b))\n\t\t\t;\n\t\treturn b;\n\t}\n\n\tprivate double nd() {\n\t\treturn Double.parseDouble(ns());\n\t}\n\n\tprivate char nc() {\n\t\treturn (char) skip();\n\t}\n\n\tprivate String ns() {\n\t\tint b = skip();\n\t\tStringBuilder sb = new StringBuilder();\n\t\twhile (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != '\n\t\t\t\t\t\t\t\t\t// ')\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\n\tprivate char[] ns(int n) {\n\t\tchar[] buf = new char[n];\n\t\tint b = skip(), p = 0;\n\t\twhile (p < n) {\n\t\t\tif (!(isSpaceChar(b)))\n\t\t\t\tbuf[p++] = (char) b;\n\t\t\tb = readByte();\n\t\t}\n\t\treturn n == p ? buf : Arrays.copyOf(buf, p);\n\t}\n\n\tprivate char[][] nm(int n, int m) {\n\t\tchar[][] map = new char[n][];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tmap[i] = ns(m);\n\t\treturn map;\n\t}\n\n\tprivate int[] na(int n) {\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = ni();\n\t\treturn a;\n\t}\n\n\tprivate List na2(int n) {\n\t\tList a = new ArrayList();\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta.add(ni());\n\t\treturn a;\n\t}\n\n\tprivate int[][] na(int n, int m) {\n\t\tint[][] a = new int[n][];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = na(m);\n\t\treturn a;\n\t}\n\n\tprivate int ni() {\n\t\tint num = 0, b;\n\t\tboolean minus = false;\n\t\twhile ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))\n\t\t\t;\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\n\t\twhile (true) {\n\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t} else {\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n\tprivate long[] nl(int n) {\n\t\tlong[] a = new long[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = nl();\n\t\treturn a;\n\t}\n\n\tprivate long nl() {\n\t\tlong num = 0;\n\t\tint b;\n\t\tboolean minus = false;\n\t\twhile ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))\n\t\t\t;\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\n\t\twhile (true) {\n\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t} else {\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n\tprivate static void tr(Object... o) {\n\t\tSystem.out.println(Arrays.deepToString(o));\n\t}\n}", "problem_context": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "sample_input": "4 5\n3 2 4 1\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02684", "source_text": "Score: 400 points\n\nProblem Statement\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K. The selfish king wonders what town he will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nHelp the king by writing a program that answers this question.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\n1 \\leq K \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the integer representing the town the king will be in if he starts at Town 1 and uses a teleporter exactly K times from there.\n\nSample Input 1\n\n4 5\n3 2 4 1\n\nSample Output 1\n\n4\n\nIf we start at Town 1 and use the teleporter 5 times, our travel will be as follows: 1 \\to 3 \\to 4 \\to 1 \\to 3 \\to 4.\n\nSample Input 2\n\n6 727202214173249351\n6 5 2 5 3 2\n\nSample Output 2\n\n2", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 4216, "cpu_time_ms": 101, "memory_kb": 35212}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s066453920", "group_id": "codeNet:p02700", "input_text": "import java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int takahashi_hp = sc.nextInt();\n int takahashi_att = sc.nextInt();\n int aoki_hp = sc.nextInt();\n int aoki_att = sc.nextInt();\n while (true) {\n aoki_hp -= takahashi_att;\n if (aoki_hp <= 0) {\n System.out.println(\"Yes\");\n break;\n }\n takahashi_hp -= aoki_att;\n if (takahashi_hp <= 0) {\n System.out.println(\"No\");\n break;\n }\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1588193486, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02700.html", "problem_id": "p02700", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02700/input.txt", "sample_output_relpath": "derived/input_output/data/p02700/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02700/Java/s066453920.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s066453920", "user_id": "u466576472"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int takahashi_hp = sc.nextInt();\n int takahashi_att = sc.nextInt();\n int aoki_hp = sc.nextInt();\n int aoki_att = sc.nextInt();\n while (true) {\n aoki_hp -= takahashi_att;\n if (aoki_hp <= 0) {\n System.out.println(\"Yes\");\n break;\n }\n takahashi_hp -= aoki_att;\n if (takahashi_hp <= 0) {\n System.out.println(\"No\");\n break;\n }\n }\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi and Aoki will have a battle using their monsters.\n\nThe health and strength of Takahashi's monster are A and B, respectively, and those of Aoki's monster are C and D, respectively.\n\nThe two monsters will take turns attacking, in the order Takahashi's, Aoki's, Takahashi's, Aoki's, ...\nHere, an attack decreases the opponent's health by the value equal to the attacker's strength.\nThe monsters keep attacking until the health of one monster becomes 0 or below. The person with the monster whose health becomes 0 or below loses, and the other person wins.\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nConstraints\n\n1 \\leq A,B,C,D \\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 C D\n\nOutput\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nSample Input 1\n\n10 9 10 10\n\nSample Output 1\n\nNo\n\nFirst, Takahashi's monster attacks Aoki's monster, whose health is now 10-9=1.\n\nNext, Aoki's monster attacks Takahashi's monster, whose health is now 10-10=0.\n\nTakahashi's monster is the first to have 0 or less health, so Takahashi loses.\n\nSample Input 2\n\n46 4 40 5\n\nSample Output 2\n\nYes", "sample_input": "10 9 10 10\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02700", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi and Aoki will have a battle using their monsters.\n\nThe health and strength of Takahashi's monster are A and B, respectively, and those of Aoki's monster are C and D, respectively.\n\nThe two monsters will take turns attacking, in the order Takahashi's, Aoki's, Takahashi's, Aoki's, ...\nHere, an attack decreases the opponent's health by the value equal to the attacker's strength.\nThe monsters keep attacking until the health of one monster becomes 0 or below. The person with the monster whose health becomes 0 or below loses, and the other person wins.\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nConstraints\n\n1 \\leq A,B,C,D \\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 C D\n\nOutput\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nSample Input 1\n\n10 9 10 10\n\nSample Output 1\n\nNo\n\nFirst, Takahashi's monster attacks Aoki's monster, whose health is now 10-9=1.\n\nNext, Aoki's monster attacks Takahashi's monster, whose health is now 10-10=0.\n\nTakahashi's monster is the first to have 0 or less health, so Takahashi loses.\n\nSample Input 2\n\n46 4 40 5\n\nSample Output 2\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 633, "cpu_time_ms": 110, "memory_kb": 35732}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s945109910", "group_id": "codeNet:p02700", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint A = sc.nextInt();\n\t\tint B = sc.nextInt();\n\t\tint C = sc.nextInt();\n\t\tint D = sc.nextInt();\n\t\twhile (A >0 || C > 0) {\n\t\t\tC = C - B;\n\t\t\tA = A - D;\n\t\t}\n\t\tif (C <= 0) {\n\t\t\tSystem.out.println(\"Yes\");\n\t\t} else {\n\t\t\tSystem.out.println(\"No\");\n\t\t}\n\t}\n\n}", "language": "Java", "metadata": {"date": 1587955146, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02700.html", "problem_id": "p02700", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02700/input.txt", "sample_output_relpath": "derived/input_output/data/p02700/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02700/Java/s945109910.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s945109910", "user_id": "u629914422"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint A = sc.nextInt();\n\t\tint B = sc.nextInt();\n\t\tint C = sc.nextInt();\n\t\tint D = sc.nextInt();\n\t\twhile (A >0 || C > 0) {\n\t\t\tC = C - B;\n\t\t\tA = A - D;\n\t\t}\n\t\tif (C <= 0) {\n\t\t\tSystem.out.println(\"Yes\");\n\t\t} else {\n\t\t\tSystem.out.println(\"No\");\n\t\t}\n\t}\n\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi and Aoki will have a battle using their monsters.\n\nThe health and strength of Takahashi's monster are A and B, respectively, and those of Aoki's monster are C and D, respectively.\n\nThe two monsters will take turns attacking, in the order Takahashi's, Aoki's, Takahashi's, Aoki's, ...\nHere, an attack decreases the opponent's health by the value equal to the attacker's strength.\nThe monsters keep attacking until the health of one monster becomes 0 or below. The person with the monster whose health becomes 0 or below loses, and the other person wins.\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nConstraints\n\n1 \\leq A,B,C,D \\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 C D\n\nOutput\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nSample Input 1\n\n10 9 10 10\n\nSample Output 1\n\nNo\n\nFirst, Takahashi's monster attacks Aoki's monster, whose health is now 10-9=1.\n\nNext, Aoki's monster attacks Takahashi's monster, whose health is now 10-10=0.\n\nTakahashi's monster is the first to have 0 or less health, so Takahashi loses.\n\nSample Input 2\n\n46 4 40 5\n\nSample Output 2\n\nYes", "sample_input": "10 9 10 10\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02700", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi and Aoki will have a battle using their monsters.\n\nThe health and strength of Takahashi's monster are A and B, respectively, and those of Aoki's monster are C and D, respectively.\n\nThe two monsters will take turns attacking, in the order Takahashi's, Aoki's, Takahashi's, Aoki's, ...\nHere, an attack decreases the opponent's health by the value equal to the attacker's strength.\nThe monsters keep attacking until the health of one monster becomes 0 or below. The person with the monster whose health becomes 0 or below loses, and the other person wins.\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nConstraints\n\n1 \\leq A,B,C,D \\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 C D\n\nOutput\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nSample Input 1\n\n10 9 10 10\n\nSample Output 1\n\nNo\n\nFirst, Takahashi's monster attacks Aoki's monster, whose health is now 10-9=1.\n\nNext, Aoki's monster attacks Takahashi's monster, whose health is now 10-10=0.\n\nTakahashi's monster is the first to have 0 or less health, so Takahashi loses.\n\nSample Input 2\n\n46 4 40 5\n\nSample Output 2\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 107, "memory_kb": 35676}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s323012003", "group_id": "codeNet:p02700", "input_text": "import java.util.*;\nclass Main{\n\tpublic static void main(String args[]){\n \tScanner sc=new Scanner(System.in);\n \tint a=sc.nextInt();\n \tint b=sc.nextInt();\n \tint c=sc.nextInt();\n \tint d=sc.nextInt();\n \tint c1=0;\n \tint c2=0;\n if((c%b)<=(a%d) && c/b <= a/d){\n System.out.println(\"Yes\");\n }else{\n System.out.println(\"No\");\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1587953838, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02700.html", "problem_id": "p02700", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02700/input.txt", "sample_output_relpath": "derived/input_output/data/p02700/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02700/Java/s323012003.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s323012003", "user_id": "u942455341"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "import java.util.*;\nclass Main{\n\tpublic static void main(String args[]){\n \tScanner sc=new Scanner(System.in);\n \tint a=sc.nextInt();\n \tint b=sc.nextInt();\n \tint c=sc.nextInt();\n \tint d=sc.nextInt();\n \tint c1=0;\n \tint c2=0;\n if((c%b)<=(a%d) && c/b <= a/d){\n System.out.println(\"Yes\");\n }else{\n System.out.println(\"No\");\n }\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi and Aoki will have a battle using their monsters.\n\nThe health and strength of Takahashi's monster are A and B, respectively, and those of Aoki's monster are C and D, respectively.\n\nThe two monsters will take turns attacking, in the order Takahashi's, Aoki's, Takahashi's, Aoki's, ...\nHere, an attack decreases the opponent's health by the value equal to the attacker's strength.\nThe monsters keep attacking until the health of one monster becomes 0 or below. The person with the monster whose health becomes 0 or below loses, and the other person wins.\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nConstraints\n\n1 \\leq A,B,C,D \\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 C D\n\nOutput\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nSample Input 1\n\n10 9 10 10\n\nSample Output 1\n\nNo\n\nFirst, Takahashi's monster attacks Aoki's monster, whose health is now 10-9=1.\n\nNext, Aoki's monster attacks Takahashi's monster, whose health is now 10-10=0.\n\nTakahashi's monster is the first to have 0 or less health, so Takahashi loses.\n\nSample Input 2\n\n46 4 40 5\n\nSample Output 2\n\nYes", "sample_input": "10 9 10 10\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02700", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi and Aoki will have a battle using their monsters.\n\nThe health and strength of Takahashi's monster are A and B, respectively, and those of Aoki's monster are C and D, respectively.\n\nThe two monsters will take turns attacking, in the order Takahashi's, Aoki's, Takahashi's, Aoki's, ...\nHere, an attack decreases the opponent's health by the value equal to the attacker's strength.\nThe monsters keep attacking until the health of one monster becomes 0 or below. The person with the monster whose health becomes 0 or below loses, and the other person wins.\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nConstraints\n\n1 \\leq A,B,C,D \\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 C D\n\nOutput\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nSample Input 1\n\n10 9 10 10\n\nSample Output 1\n\nNo\n\nFirst, Takahashi's monster attacks Aoki's monster, whose health is now 10-9=1.\n\nNext, Aoki's monster attacks Takahashi's monster, whose health is now 10-10=0.\n\nTakahashi's monster is the first to have 0 or less health, so Takahashi loses.\n\nSample Input 2\n\n46 4 40 5\n\nSample Output 2\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 393, "cpu_time_ms": 105, "memory_kb": 35500}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s893774681", "group_id": "codeNet:p02700", "input_text": "import java.util.*;\n\npublic class Main{\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint A = sc.nextInt();\n\t\tint B = sc.nextInt();\n\t\tint C = sc.nextInt();\n\t\tint D = sc.nextInt();\n\t\tsc.close();\n\t\tint Takahp = A;\n\t\tint Aokihp = C;\n\t\tint i = 0;\n\t\twhile (i < 100 || Takahp <= 0 || Aokihp <= 0){\n\t\t\tAokihp -= B;\n\t\t\tTakahp -= D;\n\t\t\tif(Aokihp <= 0) {\n\t\t\t\tSystem.out.println(\"Yes\");\n\t\t\t\tbreak;\n\t\t\t}else if(Takahp == 0) {\n\t\t\t\tSystem.out.println(\"No\");\n\t\t\t\tbreak;\n\t\t\t}else {\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\t\t\n\t}\n}", "language": "Java", "metadata": {"date": 1587953222, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02700.html", "problem_id": "p02700", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02700/input.txt", "sample_output_relpath": "derived/input_output/data/p02700/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02700/Java/s893774681.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s893774681", "user_id": "u404689255"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main{\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint A = sc.nextInt();\n\t\tint B = sc.nextInt();\n\t\tint C = sc.nextInt();\n\t\tint D = sc.nextInt();\n\t\tsc.close();\n\t\tint Takahp = A;\n\t\tint Aokihp = C;\n\t\tint i = 0;\n\t\twhile (i < 100 || Takahp <= 0 || Aokihp <= 0){\n\t\t\tAokihp -= B;\n\t\t\tTakahp -= D;\n\t\t\tif(Aokihp <= 0) {\n\t\t\t\tSystem.out.println(\"Yes\");\n\t\t\t\tbreak;\n\t\t\t}else if(Takahp == 0) {\n\t\t\t\tSystem.out.println(\"No\");\n\t\t\t\tbreak;\n\t\t\t}else {\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\t\t\n\t}\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi and Aoki will have a battle using their monsters.\n\nThe health and strength of Takahashi's monster are A and B, respectively, and those of Aoki's monster are C and D, respectively.\n\nThe two monsters will take turns attacking, in the order Takahashi's, Aoki's, Takahashi's, Aoki's, ...\nHere, an attack decreases the opponent's health by the value equal to the attacker's strength.\nThe monsters keep attacking until the health of one monster becomes 0 or below. The person with the monster whose health becomes 0 or below loses, and the other person wins.\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nConstraints\n\n1 \\leq A,B,C,D \\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 C D\n\nOutput\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nSample Input 1\n\n10 9 10 10\n\nSample Output 1\n\nNo\n\nFirst, Takahashi's monster attacks Aoki's monster, whose health is now 10-9=1.\n\nNext, Aoki's monster attacks Takahashi's monster, whose health is now 10-10=0.\n\nTakahashi's monster is the first to have 0 or less health, so Takahashi loses.\n\nSample Input 2\n\n46 4 40 5\n\nSample Output 2\n\nYes", "sample_input": "10 9 10 10\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02700", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi and Aoki will have a battle using their monsters.\n\nThe health and strength of Takahashi's monster are A and B, respectively, and those of Aoki's monster are C and D, respectively.\n\nThe two monsters will take turns attacking, in the order Takahashi's, Aoki's, Takahashi's, Aoki's, ...\nHere, an attack decreases the opponent's health by the value equal to the attacker's strength.\nThe monsters keep attacking until the health of one monster becomes 0 or below. The person with the monster whose health becomes 0 or below loses, and the other person wins.\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nConstraints\n\n1 \\leq A,B,C,D \\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 C D\n\nOutput\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nSample Input 1\n\n10 9 10 10\n\nSample Output 1\n\nNo\n\nFirst, Takahashi's monster attacks Aoki's monster, whose health is now 10-9=1.\n\nNext, Aoki's monster attacks Takahashi's monster, whose health is now 10-10=0.\n\nTakahashi's monster is the first to have 0 or less health, so Takahashi loses.\n\nSample Input 2\n\n46 4 40 5\n\nSample Output 2\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 109, "memory_kb": 35732}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s070957952", "group_id": "codeNet:p02700", "input_text": "import java.util.*;\nclass Main{\n static public void main(String args[]){\n Scanner sc=new Scanner(System.in); \n boolean flag;\n int a,b,c,d;\n a=sc.nextInt();\n b=sc.nextInt();//kougeki\n c=sc.nextInt();\n d=sc.nextInt();//kougeki\n \n while(true){\n \tSystem.out.println(\"a:\"+a+\"\\nc:\"+c);\n c-=b;\n\t \t if(c<0){\n\t \tflag=false;break;\n\t\t}\n a-=d;\n\t if(a<0){\n\t \tflag=true;break;\n\t\t}\n\t else continue;\n }\n \n if(flag==true)System.out.println(\"No\");\n else System.out.println(\"Yes\");\n }\n}", "language": "Java", "metadata": {"date": 1587951360, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02700.html", "problem_id": "p02700", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02700/input.txt", "sample_output_relpath": "derived/input_output/data/p02700/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02700/Java/s070957952.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s070957952", "user_id": "u574685848"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "import java.util.*;\nclass Main{\n static public void main(String args[]){\n Scanner sc=new Scanner(System.in); \n boolean flag;\n int a,b,c,d;\n a=sc.nextInt();\n b=sc.nextInt();//kougeki\n c=sc.nextInt();\n d=sc.nextInt();//kougeki\n \n while(true){\n \tSystem.out.println(\"a:\"+a+\"\\nc:\"+c);\n c-=b;\n\t \t if(c<0){\n\t \tflag=false;break;\n\t\t}\n a-=d;\n\t if(a<0){\n\t \tflag=true;break;\n\t\t}\n\t else continue;\n }\n \n if(flag==true)System.out.println(\"No\");\n else System.out.println(\"Yes\");\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi and Aoki will have a battle using their monsters.\n\nThe health and strength of Takahashi's monster are A and B, respectively, and those of Aoki's monster are C and D, respectively.\n\nThe two monsters will take turns attacking, in the order Takahashi's, Aoki's, Takahashi's, Aoki's, ...\nHere, an attack decreases the opponent's health by the value equal to the attacker's strength.\nThe monsters keep attacking until the health of one monster becomes 0 or below. The person with the monster whose health becomes 0 or below loses, and the other person wins.\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nConstraints\n\n1 \\leq A,B,C,D \\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 C D\n\nOutput\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nSample Input 1\n\n10 9 10 10\n\nSample Output 1\n\nNo\n\nFirst, Takahashi's monster attacks Aoki's monster, whose health is now 10-9=1.\n\nNext, Aoki's monster attacks Takahashi's monster, whose health is now 10-10=0.\n\nTakahashi's monster is the first to have 0 or less health, so Takahashi loses.\n\nSample Input 2\n\n46 4 40 5\n\nSample Output 2\n\nYes", "sample_input": "10 9 10 10\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02700", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi and Aoki will have a battle using their monsters.\n\nThe health and strength of Takahashi's monster are A and B, respectively, and those of Aoki's monster are C and D, respectively.\n\nThe two monsters will take turns attacking, in the order Takahashi's, Aoki's, Takahashi's, Aoki's, ...\nHere, an attack decreases the opponent's health by the value equal to the attacker's strength.\nThe monsters keep attacking until the health of one monster becomes 0 or below. The person with the monster whose health becomes 0 or below loses, and the other person wins.\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nConstraints\n\n1 \\leq A,B,C,D \\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 C D\n\nOutput\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nSample Input 1\n\n10 9 10 10\n\nSample Output 1\n\nNo\n\nFirst, Takahashi's monster attacks Aoki's monster, whose health is now 10-9=1.\n\nNext, Aoki's monster attacks Takahashi's monster, whose health is now 10-10=0.\n\nTakahashi's monster is the first to have 0 or less health, so Takahashi loses.\n\nSample Input 2\n\n46 4 40 5\n\nSample Output 2\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 505, "cpu_time_ms": 418, "memory_kb": 38968}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s961175601", "group_id": "codeNet:p02700", "input_text": "import java.io.*;\n\nclass Main\n{\n public static void main(String args[])throws Exception\n {\n BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));\n String s[]=bu.readLine().split(\" \");\n int a=Integer.parseInt(s[0]),b=Integer.parseInt(s[1]),c=Integer.parseInt(s[2]),d=Integer.parseInt(s[3]);\n boolean ans=true;\n int ta=a/d, ao=c/b;\n if(a%d>0) ta++;\n if(c%b>0) ao++;\n if(ta<=ao) System.out.print(\"Yes\");\n else System.out.print(\"No\");\n }\n}\n", "language": "Java", "metadata": {"date": 1587950917, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02700.html", "problem_id": "p02700", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02700/input.txt", "sample_output_relpath": "derived/input_output/data/p02700/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02700/Java/s961175601.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s961175601", "user_id": "u786137238"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "import java.io.*;\n\nclass Main\n{\n public static void main(String args[])throws Exception\n {\n BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));\n String s[]=bu.readLine().split(\" \");\n int a=Integer.parseInt(s[0]),b=Integer.parseInt(s[1]),c=Integer.parseInt(s[2]),d=Integer.parseInt(s[3]);\n boolean ans=true;\n int ta=a/d, ao=c/b;\n if(a%d>0) ta++;\n if(c%b>0) ao++;\n if(ta<=ao) System.out.print(\"Yes\");\n else System.out.print(\"No\");\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi and Aoki will have a battle using their monsters.\n\nThe health and strength of Takahashi's monster are A and B, respectively, and those of Aoki's monster are C and D, respectively.\n\nThe two monsters will take turns attacking, in the order Takahashi's, Aoki's, Takahashi's, Aoki's, ...\nHere, an attack decreases the opponent's health by the value equal to the attacker's strength.\nThe monsters keep attacking until the health of one monster becomes 0 or below. The person with the monster whose health becomes 0 or below loses, and the other person wins.\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nConstraints\n\n1 \\leq A,B,C,D \\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 C D\n\nOutput\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nSample Input 1\n\n10 9 10 10\n\nSample Output 1\n\nNo\n\nFirst, Takahashi's monster attacks Aoki's monster, whose health is now 10-9=1.\n\nNext, Aoki's monster attacks Takahashi's monster, whose health is now 10-10=0.\n\nTakahashi's monster is the first to have 0 or less health, so Takahashi loses.\n\nSample Input 2\n\n46 4 40 5\n\nSample Output 2\n\nYes", "sample_input": "10 9 10 10\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02700", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi and Aoki will have a battle using their monsters.\n\nThe health and strength of Takahashi's monster are A and B, respectively, and those of Aoki's monster are C and D, respectively.\n\nThe two monsters will take turns attacking, in the order Takahashi's, Aoki's, Takahashi's, Aoki's, ...\nHere, an attack decreases the opponent's health by the value equal to the attacker's strength.\nThe monsters keep attacking until the health of one monster becomes 0 or below. The person with the monster whose health becomes 0 or below loses, and the other person wins.\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nConstraints\n\n1 \\leq A,B,C,D \\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 C D\n\nOutput\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nSample Input 1\n\n10 9 10 10\n\nSample Output 1\n\nNo\n\nFirst, Takahashi's monster attacks Aoki's monster, whose health is now 10-9=1.\n\nNext, Aoki's monster attacks Takahashi's monster, whose health is now 10-10=0.\n\nTakahashi's monster is the first to have 0 or less health, so Takahashi loses.\n\nSample Input 2\n\n46 4 40 5\n\nSample Output 2\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 66, "memory_kb": 32524}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s812981133", "group_id": "codeNet:p02700", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\t//java11\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint A = sc.nextInt();\n\t\tint B = sc.nextInt();\n\t\tint C = sc.nextInt();\n\t\tint D = sc.nextInt();\n\n\t\tint t_value = A;\n\t\tint a_value = C;\n\t\twhile(true) {\n\t\t\ta_value -= B;\n\t\t\tif(a_value <= 0) {\n\t\t\t\tSystem.out.println(\"Yes\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tt_value -= D;\n\t\t\tif(t_value <= 0) {\n\t\t\t\tSystem.out.println(\"No\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t}\n}\n", "language": "Java", "metadata": {"date": 1587950071, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02700.html", "problem_id": "p02700", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02700/input.txt", "sample_output_relpath": "derived/input_output/data/p02700/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02700/Java/s812981133.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s812981133", "user_id": "u374566600"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\t//java11\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint A = sc.nextInt();\n\t\tint B = sc.nextInt();\n\t\tint C = sc.nextInt();\n\t\tint D = sc.nextInt();\n\n\t\tint t_value = A;\n\t\tint a_value = C;\n\t\twhile(true) {\n\t\t\ta_value -= B;\n\t\t\tif(a_value <= 0) {\n\t\t\t\tSystem.out.println(\"Yes\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tt_value -= D;\n\t\t\tif(t_value <= 0) {\n\t\t\t\tSystem.out.println(\"No\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t}\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi and Aoki will have a battle using their monsters.\n\nThe health and strength of Takahashi's monster are A and B, respectively, and those of Aoki's monster are C and D, respectively.\n\nThe two monsters will take turns attacking, in the order Takahashi's, Aoki's, Takahashi's, Aoki's, ...\nHere, an attack decreases the opponent's health by the value equal to the attacker's strength.\nThe monsters keep attacking until the health of one monster becomes 0 or below. The person with the monster whose health becomes 0 or below loses, and the other person wins.\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nConstraints\n\n1 \\leq A,B,C,D \\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 C D\n\nOutput\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nSample Input 1\n\n10 9 10 10\n\nSample Output 1\n\nNo\n\nFirst, Takahashi's monster attacks Aoki's monster, whose health is now 10-9=1.\n\nNext, Aoki's monster attacks Takahashi's monster, whose health is now 10-10=0.\n\nTakahashi's monster is the first to have 0 or less health, so Takahashi loses.\n\nSample Input 2\n\n46 4 40 5\n\nSample Output 2\n\nYes", "sample_input": "10 9 10 10\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02700", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi and Aoki will have a battle using their monsters.\n\nThe health and strength of Takahashi's monster are A and B, respectively, and those of Aoki's monster are C and D, respectively.\n\nThe two monsters will take turns attacking, in the order Takahashi's, Aoki's, Takahashi's, Aoki's, ...\nHere, an attack decreases the opponent's health by the value equal to the attacker's strength.\nThe monsters keep attacking until the health of one monster becomes 0 or below. The person with the monster whose health becomes 0 or below loses, and the other person wins.\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nConstraints\n\n1 \\leq A,B,C,D \\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 C D\n\nOutput\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nSample Input 1\n\n10 9 10 10\n\nSample Output 1\n\nNo\n\nFirst, Takahashi's monster attacks Aoki's monster, whose health is now 10-9=1.\n\nNext, Aoki's monster attacks Takahashi's monster, whose health is now 10-10=0.\n\nTakahashi's monster is the first to have 0 or less health, so Takahashi loses.\n\nSample Input 2\n\n46 4 40 5\n\nSample Output 2\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 473, "cpu_time_ms": 112, "memory_kb": 35732}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s421767224", "group_id": "codeNet:p02700", "input_text": "\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint T_tairyoku = sc.nextInt();\n\t\tint T_Attack = sc.nextInt();\n\t\tint A_tairyoku = sc.nextInt();\n\t\tint A_Attack = sc.nextInt();\n\t\tsc.close();\n\n\n\t\twhile(true) {\n\t\t\t//青木に攻撃\n\t\t\tA_tairyoku -= T_Attack;\n\t\t\tif(A_tairyoku <= 0) {\n\t\t\t\tSystem.out.println(\"Yes\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tT_tairyoku -= A_Attack;\n\t\t\tif(T_tairyoku <= 0) {\n\t\t\t\tSystem.out.println(\"No\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1587949967, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02700.html", "problem_id": "p02700", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02700/input.txt", "sample_output_relpath": "derived/input_output/data/p02700/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02700/Java/s421767224.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s421767224", "user_id": "u602322080"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint T_tairyoku = sc.nextInt();\n\t\tint T_Attack = sc.nextInt();\n\t\tint A_tairyoku = sc.nextInt();\n\t\tint A_Attack = sc.nextInt();\n\t\tsc.close();\n\n\n\t\twhile(true) {\n\t\t\t//青木に攻撃\n\t\t\tA_tairyoku -= T_Attack;\n\t\t\tif(A_tairyoku <= 0) {\n\t\t\t\tSystem.out.println(\"Yes\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tT_tairyoku -= A_Attack;\n\t\t\tif(T_tairyoku <= 0) {\n\t\t\t\tSystem.out.println(\"No\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi and Aoki will have a battle using their monsters.\n\nThe health and strength of Takahashi's monster are A and B, respectively, and those of Aoki's monster are C and D, respectively.\n\nThe two monsters will take turns attacking, in the order Takahashi's, Aoki's, Takahashi's, Aoki's, ...\nHere, an attack decreases the opponent's health by the value equal to the attacker's strength.\nThe monsters keep attacking until the health of one monster becomes 0 or below. The person with the monster whose health becomes 0 or below loses, and the other person wins.\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nConstraints\n\n1 \\leq A,B,C,D \\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 C D\n\nOutput\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nSample Input 1\n\n10 9 10 10\n\nSample Output 1\n\nNo\n\nFirst, Takahashi's monster attacks Aoki's monster, whose health is now 10-9=1.\n\nNext, Aoki's monster attacks Takahashi's monster, whose health is now 10-10=0.\n\nTakahashi's monster is the first to have 0 or less health, so Takahashi loses.\n\nSample Input 2\n\n46 4 40 5\n\nSample Output 2\n\nYes", "sample_input": "10 9 10 10\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02700", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi and Aoki will have a battle using their monsters.\n\nThe health and strength of Takahashi's monster are A and B, respectively, and those of Aoki's monster are C and D, respectively.\n\nThe two monsters will take turns attacking, in the order Takahashi's, Aoki's, Takahashi's, Aoki's, ...\nHere, an attack decreases the opponent's health by the value equal to the attacker's strength.\nThe monsters keep attacking until the health of one monster becomes 0 or below. The person with the monster whose health becomes 0 or below loses, and the other person wins.\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nConstraints\n\n1 \\leq A,B,C,D \\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 C D\n\nOutput\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nSample Input 1\n\n10 9 10 10\n\nSample Output 1\n\nNo\n\nFirst, Takahashi's monster attacks Aoki's monster, whose health is now 10-9=1.\n\nNext, Aoki's monster attacks Takahashi's monster, whose health is now 10-10=0.\n\nTakahashi's monster is the first to have 0 or less health, so Takahashi loses.\n\nSample Input 2\n\n46 4 40 5\n\nSample Output 2\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 86, "memory_kb": 27008}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s375186582", "group_id": "codeNet:p02700", "input_text": "import java.util.*;\nimport java.io.*;\n \npublic class Main {\n public static void main(String[] args) throws Exception{\n FastScanner sc = new FastScanner(System.in);\n int a = sc.nextInt();\n int b = sc.nextInt();\n int c = sc.nextInt();\n int d = sc.nextInt();\n \n new Solution(a,b,c,d);\n }\n}\n\nclass Solution {\n public Solution(int a, int b, int c, int d) {\n int first = (int)((double)c / b) + (c % b == 0 ? 0 : 1);\n int second = (int)((double)a / d) + (a % d == 0 ? 0 : 1);\n if(first <= second) System.out.println(\"Yes\");\n else System.out.println(\"No\");\n // System.out.println(res);\n }\n}\n\n\nclass FastScanner {\n private final InputStream in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n public FastScanner(InputStream source) {\n in = source;\n }\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte()) return buffer[ptr++];\n else return -1;\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext()) throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext()) throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)\n throw new NumberFormatException();\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n}", "language": "Java", "metadata": {"date": 1587949777, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02700.html", "problem_id": "p02700", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02700/input.txt", "sample_output_relpath": "derived/input_output/data/p02700/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02700/Java/s375186582.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s375186582", "user_id": "u530712718"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\n \npublic class Main {\n public static void main(String[] args) throws Exception{\n FastScanner sc = new FastScanner(System.in);\n int a = sc.nextInt();\n int b = sc.nextInt();\n int c = sc.nextInt();\n int d = sc.nextInt();\n \n new Solution(a,b,c,d);\n }\n}\n\nclass Solution {\n public Solution(int a, int b, int c, int d) {\n int first = (int)((double)c / b) + (c % b == 0 ? 0 : 1);\n int second = (int)((double)a / d) + (a % d == 0 ? 0 : 1);\n if(first <= second) System.out.println(\"Yes\");\n else System.out.println(\"No\");\n // System.out.println(res);\n }\n}\n\n\nclass FastScanner {\n private final InputStream in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n public FastScanner(InputStream source) {\n in = source;\n }\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte()) return buffer[ptr++];\n else return -1;\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext()) throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext()) throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)\n throw new NumberFormatException();\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi and Aoki will have a battle using their monsters.\n\nThe health and strength of Takahashi's monster are A and B, respectively, and those of Aoki's monster are C and D, respectively.\n\nThe two monsters will take turns attacking, in the order Takahashi's, Aoki's, Takahashi's, Aoki's, ...\nHere, an attack decreases the opponent's health by the value equal to the attacker's strength.\nThe monsters keep attacking until the health of one monster becomes 0 or below. The person with the monster whose health becomes 0 or below loses, and the other person wins.\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nConstraints\n\n1 \\leq A,B,C,D \\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 C D\n\nOutput\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nSample Input 1\n\n10 9 10 10\n\nSample Output 1\n\nNo\n\nFirst, Takahashi's monster attacks Aoki's monster, whose health is now 10-9=1.\n\nNext, Aoki's monster attacks Takahashi's monster, whose health is now 10-10=0.\n\nTakahashi's monster is the first to have 0 or less health, so Takahashi loses.\n\nSample Input 2\n\n46 4 40 5\n\nSample Output 2\n\nYes", "sample_input": "10 9 10 10\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02700", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi and Aoki will have a battle using their monsters.\n\nThe health and strength of Takahashi's monster are A and B, respectively, and those of Aoki's monster are C and D, respectively.\n\nThe two monsters will take turns attacking, in the order Takahashi's, Aoki's, Takahashi's, Aoki's, ...\nHere, an attack decreases the opponent's health by the value equal to the attacker's strength.\nThe monsters keep attacking until the health of one monster becomes 0 or below. The person with the monster whose health becomes 0 or below loses, and the other person wins.\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nConstraints\n\n1 \\leq A,B,C,D \\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 C D\n\nOutput\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nSample Input 1\n\n10 9 10 10\n\nSample Output 1\n\nNo\n\nFirst, Takahashi's monster attacks Aoki's monster, whose health is now 10-9=1.\n\nNext, Aoki's monster attacks Takahashi's monster, whose health is now 10-10=0.\n\nTakahashi's monster is the first to have 0 or less health, so Takahashi loses.\n\nSample Input 2\n\n46 4 40 5\n\nSample Output 2\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2542, "cpu_time_ms": 75, "memory_kb": 32512}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s039878909", "group_id": "codeNet:p02700", "input_text": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tlong a = sc.nextLong();\n\t\tlong b = sc.nextLong();\n\t\tlong c = sc.nextLong();\n\t\tlong d = sc.nextLong();\n\t\tlong t=(c-1)/b+1;\n\t\tlong o=(a-1)/d+1;\n\t\tif(t<=o){\n\t\tSystem.out.println(\"Yes\");\n\t\t}else{\n\t\t\tSystem.out.println(\"No\");\n\t\t}\n\t}\n}", "language": "Java", "metadata": {"date": 1587949620, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02700.html", "problem_id": "p02700", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02700/input.txt", "sample_output_relpath": "derived/input_output/data/p02700/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02700/Java/s039878909.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s039878909", "user_id": "u012999123"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tlong a = sc.nextLong();\n\t\tlong b = sc.nextLong();\n\t\tlong c = sc.nextLong();\n\t\tlong d = sc.nextLong();\n\t\tlong t=(c-1)/b+1;\n\t\tlong o=(a-1)/d+1;\n\t\tif(t<=o){\n\t\tSystem.out.println(\"Yes\");\n\t\t}else{\n\t\t\tSystem.out.println(\"No\");\n\t\t}\n\t}\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi and Aoki will have a battle using their monsters.\n\nThe health and strength of Takahashi's monster are A and B, respectively, and those of Aoki's monster are C and D, respectively.\n\nThe two monsters will take turns attacking, in the order Takahashi's, Aoki's, Takahashi's, Aoki's, ...\nHere, an attack decreases the opponent's health by the value equal to the attacker's strength.\nThe monsters keep attacking until the health of one monster becomes 0 or below. The person with the monster whose health becomes 0 or below loses, and the other person wins.\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nConstraints\n\n1 \\leq A,B,C,D \\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 C D\n\nOutput\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nSample Input 1\n\n10 9 10 10\n\nSample Output 1\n\nNo\n\nFirst, Takahashi's monster attacks Aoki's monster, whose health is now 10-9=1.\n\nNext, Aoki's monster attacks Takahashi's monster, whose health is now 10-10=0.\n\nTakahashi's monster is the first to have 0 or less health, so Takahashi loses.\n\nSample Input 2\n\n46 4 40 5\n\nSample Output 2\n\nYes", "sample_input": "10 9 10 10\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02700", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi and Aoki will have a battle using their monsters.\n\nThe health and strength of Takahashi's monster are A and B, respectively, and those of Aoki's monster are C and D, respectively.\n\nThe two monsters will take turns attacking, in the order Takahashi's, Aoki's, Takahashi's, Aoki's, ...\nHere, an attack decreases the opponent's health by the value equal to the attacker's strength.\nThe monsters keep attacking until the health of one monster becomes 0 or below. The person with the monster whose health becomes 0 or below loses, and the other person wins.\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nConstraints\n\n1 \\leq A,B,C,D \\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 C D\n\nOutput\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nSample Input 1\n\n10 9 10 10\n\nSample Output 1\n\nNo\n\nFirst, Takahashi's monster attacks Aoki's monster, whose health is now 10-9=1.\n\nNext, Aoki's monster attacks Takahashi's monster, whose health is now 10-10=0.\n\nTakahashi's monster is the first to have 0 or less health, so Takahashi loses.\n\nSample Input 2\n\n46 4 40 5\n\nSample Output 2\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 109, "memory_kb": 35796}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s304375087", "group_id": "codeNet:p02700", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint a = sc.nextInt();\n\t\tint b = sc.nextInt();\n\t\tint c = sc.nextInt();\n\t\tint d = sc.nextInt();\n\n\t\twhile (true) {\n\n\t\t\tc -= b;\n\n\t\t\tif (c <= 0) {\n\t\t\t\tSystem.out.println(\"Yes\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\ta -= d;\n\n\t\t\tif (a <= 0) {\n\t\t\t\tSystem.out.println(\"No\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1587949582, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02700.html", "problem_id": "p02700", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02700/input.txt", "sample_output_relpath": "derived/input_output/data/p02700/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02700/Java/s304375087.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s304375087", "user_id": "u409563518"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint a = sc.nextInt();\n\t\tint b = sc.nextInt();\n\t\tint c = sc.nextInt();\n\t\tint d = sc.nextInt();\n\n\t\twhile (true) {\n\n\t\t\tc -= b;\n\n\t\t\tif (c <= 0) {\n\t\t\t\tSystem.out.println(\"Yes\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\ta -= d;\n\n\t\t\tif (a <= 0) {\n\t\t\t\tSystem.out.println(\"No\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi and Aoki will have a battle using their monsters.\n\nThe health and strength of Takahashi's monster are A and B, respectively, and those of Aoki's monster are C and D, respectively.\n\nThe two monsters will take turns attacking, in the order Takahashi's, Aoki's, Takahashi's, Aoki's, ...\nHere, an attack decreases the opponent's health by the value equal to the attacker's strength.\nThe monsters keep attacking until the health of one monster becomes 0 or below. The person with the monster whose health becomes 0 or below loses, and the other person wins.\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nConstraints\n\n1 \\leq A,B,C,D \\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 C D\n\nOutput\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nSample Input 1\n\n10 9 10 10\n\nSample Output 1\n\nNo\n\nFirst, Takahashi's monster attacks Aoki's monster, whose health is now 10-9=1.\n\nNext, Aoki's monster attacks Takahashi's monster, whose health is now 10-10=0.\n\nTakahashi's monster is the first to have 0 or less health, so Takahashi loses.\n\nSample Input 2\n\n46 4 40 5\n\nSample Output 2\n\nYes", "sample_input": "10 9 10 10\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02700", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi and Aoki will have a battle using their monsters.\n\nThe health and strength of Takahashi's monster are A and B, respectively, and those of Aoki's monster are C and D, respectively.\n\nThe two monsters will take turns attacking, in the order Takahashi's, Aoki's, Takahashi's, Aoki's, ...\nHere, an attack decreases the opponent's health by the value equal to the attacker's strength.\nThe monsters keep attacking until the health of one monster becomes 0 or below. The person with the monster whose health becomes 0 or below loses, and the other person wins.\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nConstraints\n\n1 \\leq A,B,C,D \\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 C D\n\nOutput\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nSample Input 1\n\n10 9 10 10\n\nSample Output 1\n\nNo\n\nFirst, Takahashi's monster attacks Aoki's monster, whose health is now 10-9=1.\n\nNext, Aoki's monster attacks Takahashi's monster, whose health is now 10-10=0.\n\nTakahashi's monster is the first to have 0 or less health, so Takahashi loses.\n\nSample Input 2\n\n46 4 40 5\n\nSample Output 2\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 185, "memory_kb": 35768}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s286640192", "group_id": "codeNet:p02700", "input_text": "import java.util.*;\npublic class Main{\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint A = sc.nextInt();\n\t\tint B = sc.nextInt();\n\t\tint C = sc.nextInt();\n\t\tint D = sc.nextInt();\n\t\twhile (true) {\n\t\t\tC -= B;\n\t\t\tif (C <= 0) {\n\t\t\t\tSystem.out.println(\"Yes\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tA -= D;\n\t\t\tif (A <= 0) {\n\t\t\t\tSystem.out.println(\"No\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}", "language": "Java", "metadata": {"date": 1587949542, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02700.html", "problem_id": "p02700", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02700/input.txt", "sample_output_relpath": "derived/input_output/data/p02700/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02700/Java/s286640192.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s286640192", "user_id": "u866594486"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "import java.util.*;\npublic class Main{\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint A = sc.nextInt();\n\t\tint B = sc.nextInt();\n\t\tint C = sc.nextInt();\n\t\tint D = sc.nextInt();\n\t\twhile (true) {\n\t\t\tC -= B;\n\t\t\tif (C <= 0) {\n\t\t\t\tSystem.out.println(\"Yes\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tA -= D;\n\t\t\tif (A <= 0) {\n\t\t\t\tSystem.out.println(\"No\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi and Aoki will have a battle using their monsters.\n\nThe health and strength of Takahashi's monster are A and B, respectively, and those of Aoki's monster are C and D, respectively.\n\nThe two monsters will take turns attacking, in the order Takahashi's, Aoki's, Takahashi's, Aoki's, ...\nHere, an attack decreases the opponent's health by the value equal to the attacker's strength.\nThe monsters keep attacking until the health of one monster becomes 0 or below. The person with the monster whose health becomes 0 or below loses, and the other person wins.\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nConstraints\n\n1 \\leq A,B,C,D \\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 C D\n\nOutput\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nSample Input 1\n\n10 9 10 10\n\nSample Output 1\n\nNo\n\nFirst, Takahashi's monster attacks Aoki's monster, whose health is now 10-9=1.\n\nNext, Aoki's monster attacks Takahashi's monster, whose health is now 10-10=0.\n\nTakahashi's monster is the first to have 0 or less health, so Takahashi loses.\n\nSample Input 2\n\n46 4 40 5\n\nSample Output 2\n\nYes", "sample_input": "10 9 10 10\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02700", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi and Aoki will have a battle using their monsters.\n\nThe health and strength of Takahashi's monster are A and B, respectively, and those of Aoki's monster are C and D, respectively.\n\nThe two monsters will take turns attacking, in the order Takahashi's, Aoki's, Takahashi's, Aoki's, ...\nHere, an attack decreases the opponent's health by the value equal to the attacker's strength.\nThe monsters keep attacking until the health of one monster becomes 0 or below. The person with the monster whose health becomes 0 or below loses, and the other person wins.\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nConstraints\n\n1 \\leq A,B,C,D \\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 C D\n\nOutput\n\nIf Takahashi will win, print Yes; if he will lose, print No.\n\nSample Input 1\n\n10 9 10 10\n\nSample Output 1\n\nNo\n\nFirst, Takahashi's monster attacks Aoki's monster, whose health is now 10-9=1.\n\nNext, Aoki's monster attacks Takahashi's monster, whose health is now 10-10=0.\n\nTakahashi's monster is the first to have 0 or less health, so Takahashi loses.\n\nSample Input 2\n\n46 4 40 5\n\nSample Output 2\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 102, "memory_kb": 35708}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s837603238", "group_id": "codeNet:p02702", "input_text": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Scanner;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n MultipleOf2019 solver = new MultipleOf2019();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class MultipleOf2019 {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n String s = in.next();\n int limit = s.length();\n\n long result = 0;\n for (int i = 0; i <= limit - 4; i++) {\n for (int j = i + 4; j <= limit; j++) {\n String str = s.substring(i, j);\n if (Long.parseLong(str) % 2019L == 0L) {\n result++;\n }\n }\n }\n out.append(String.valueOf(result));\n }\n\n }\n}\n\n", "language": "Java", "metadata": {"date": 1593181458, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02702.html", "problem_id": "p02702", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02702/input.txt", "sample_output_relpath": "derived/input_output/data/p02702/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02702/Java/s837603238.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s837603238", "user_id": "u745688558"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Scanner;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n MultipleOf2019 solver = new MultipleOf2019();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class MultipleOf2019 {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n String s = in.next();\n int limit = s.length();\n\n long result = 0;\n for (int i = 0; i <= limit - 4; i++) {\n for (int j = i + 4; j <= limit; j++) {\n String str = s.substring(i, j);\n if (Long.parseLong(str) % 2019L == 0L) {\n result++;\n }\n }\n }\n out.append(String.valueOf(result));\n }\n\n }\n}\n\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a string S consisting of digits from 1 through 9.\n\nFind the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:\n\nCondition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.\n\nConstraints\n\n1 ≤ |S| ≤ 200000\n\nS is a string consisting of digits from 1 through 9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the condition.\n\nSample Input 1\n\n1817181712114\n\nSample Output 1\n\n3\n\nThree pairs - (1,5), (5,9), and (9,13) - satisfy the condition.\n\nSample Input 2\n\n14282668646\n\nSample Output 2\n\n2\n\nSample Input 3\n\n2119\n\nSample Output 3\n\n0\n\nNo pairs satisfy the condition.", "sample_input": "1817181712114\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02702", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a string S consisting of digits from 1 through 9.\n\nFind the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:\n\nCondition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.\n\nConstraints\n\n1 ≤ |S| ≤ 200000\n\nS is a string consisting of digits from 1 through 9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the condition.\n\nSample Input 1\n\n1817181712114\n\nSample Output 1\n\n3\n\nThree pairs - (1,5), (5,9), and (9,13) - satisfy the condition.\n\nSample Input 2\n\n14282668646\n\nSample Output 2\n\n2\n\nSample Input 3\n\n2119\n\nSample Output 3\n\n0\n\nNo pairs satisfy the condition.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1172, "cpu_time_ms": 210, "memory_kb": 40444}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s753883061", "group_id": "codeNet:p02702", "input_text": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n\tstatic InputStream is;\n\tstatic PrintWriter out;\n\tstatic String INPUT = \"\";\n\n\tstatic final long mod = (long) 1e9 + 7;\n\tstatic final int dx[] = { -1, 0, 1, 0 }, dy[] = { 0, -1, 0, 1 };\n\tstatic final int[] dx8 = { -1, -1, -1, 0, 0, 1, 1, 1 }, dy8 = { -1, 0, 1, -1, 1, -1, 0, 1 };\n\tstatic final int inf = Integer.MAX_VALUE / 3;\n\tstatic final long linf = Long.MAX_VALUE / 3;\n\tstatic final double dinf = Double.MAX_VALUE / 3;\n\tstatic final double eps = 1e-10;\n\tstatic final double pi = Math.PI;\n\tstatic StringBuilder sb = new StringBuilder();\n\n\tstatic void solve() {\n\t\tString s = ns();\n\t\tchar c[] = s.toCharArray();\n\t\tint n = s.length();\n\t\tint a[] = new int[n];\n\t\tfor(int i=0;i void reverse(List ls) {\n\t\tint sz = ls.size();\n\t\tfor (int i = 0; i < sz / 2; i++) {\n\t\t\tT t = ls.get(i);\n\t\t\tls.set(i, ls.get(sz - 1 - i));\n\t\t\tls.set(sz - 1 - i, t);\n\t\t}\n\t}\n\n\tstatic void sbnl() {//StringBuilderに改行文字をappendする\n\t\tsb.append(\"\\n\");\n\t}\n\n\tstatic int lowerBound(int[] a, int x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] < x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int upperBound(int[] a, int x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] <= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rlowerBound(int[] a, int x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] > x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rupperBound(int[] a, int x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] >= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int lowerBound(long[] a, long x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] < x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int upperBound(long[] a, long x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] <= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rlowerBound(long[] a, long x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] > x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rupperBound(long[] a, long x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] >= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int lowerBound(double[] a, double x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] < x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int upperBound(double[] a, double x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] <= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rlowerBound(double[] a, double x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] > x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rupperBound(double[] a, double x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] >= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int lowerBound(List ls, T x) throws RuntimeException {\n\t\tif (ls.size() == 0)\n\t\t\treturn -1;\n\t\tif (ls.get(0) instanceof Integer) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) >= 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Long) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) >= 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Double) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) >= 0 ? 1 : -1);\n\t\t} else {\n\t\t\tSystem.err.println(\n\t\t\t\t\tString.format(\"%s:数値でないリストを二分探索しています。\", Thread.currentThread().getStackTrace()[1].getMethodName()));\n\t\t\tthrow new RuntimeException();\n\t\t}\n\t}\n\n\tstatic int upperBound(List ls, T x) throws RuntimeException {\n\t\tif (ls.size() == 0)\n\t\t\treturn -1;\n\t\tif (ls.get(0) instanceof Integer) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) > 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Long) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) > 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Double) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) > 0 ? 1 : -1);\n\t\t} else {\n\t\t\tSystem.err.println(\n\t\t\t\t\tString.format(\"%s:数値でないリストを二分探索しています。\", Thread.currentThread().getStackTrace()[1].getMethodName()));\n\t\t\tthrow new RuntimeException();\n\t\t}\n\t}\n\n\tstatic int rupperBound(List ls, T x) throws RuntimeException {\n\t\tif (ls.size() == 0)\n\t\t\treturn -1;\n\t\tif (ls.get(0) instanceof Integer) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) < 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Long) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) < 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Double) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) < 0 ? 1 : -1);\n\t\t} else {\n\t\t\tSystem.err.println(\n\t\t\t\t\tString.format(\"%s:数値でないリストを二分探索しています。\", Thread.currentThread().getStackTrace()[1].getMethodName()));\n\t\t\tthrow new RuntimeException();\n\t\t}\n\t}\n\n\tstatic int rlowerBound(List ls, T x) {\n\t\tif (ls.size() == 0)\n\t\t\treturn -1;\n\t\tif (ls.get(0) instanceof Integer) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) <= 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Long) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) <= 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Double) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) <= 0 ? 1 : -1);\n\t\t} else {\n\t\t\tSystem.err.println(\n\t\t\t\t\tString.format(\"%s:数値でないリストを二分探索しています。\", Thread.currentThread().getStackTrace()[1].getMethodName()));\n\t\t\tthrow new RuntimeException();\n\t\t}\n\t}\n\n\tstatic int[] concat(int x, int arr[]) {\n\t\tint ret[] = new int[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 1, ret.length - 1);\n\t\tret[0] = x;\n\t\treturn ret;\n\t}\n\n\tstatic int[] concat(int arr[], int x) {\n\t\tint ret[] = new int[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 0, ret.length - 1);\n\t\tret[ret.length - 1] = x;\n\t\treturn ret;\n\t}\n\n\tstatic long[] concat(long x, long arr[]) {\n\t\tlong ret[] = new long[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 1, ret.length - 1);\n\t\tret[0] = x;\n\t\treturn ret;\n\t}\n\n\tstatic long[] concat(long arr[], long x) {\n\t\tlong ret[] = new long[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 0, ret.length - 1);\n\t\tret[ret.length - 1] = x;\n\t\treturn ret;\n\t}\n\n\tstatic int max(int x, int y) {\n\t\treturn Math.max(x, y);\n\t}\n\n\tstatic int min(int x, int y) {\n\t\treturn Math.min(x, y);\n\t}\n\n\tstatic int max(int x, int y, int z) {\n\t\tx = Math.max(x, y);\n\t\tx = Math.max(x, z);\n\t\treturn x;\n\t}\n\n\tstatic int min(int x, int y, int z) {\n\t\tx = Math.min(x, y);\n\t\tx = Math.min(x, z);\n\t\treturn x;\n\t}\n\n\tstatic long max(long x, long y) {\n\t\treturn Math.max(x, y);\n\t}\n\n\tstatic long min(long x, long y) {\n\t\treturn Math.min(x, y);\n\t}\n\n\tstatic long max(long x, long y, long z) {\n\t\tx = Math.max(x, y);\n\t\tx = Math.max(x, z);\n\t\treturn x;\n\t}\n\n\tstatic long min(long x, long y, long z) {\n\t\tx = Math.min(x, y);\n\t\tx = Math.min(x, z);\n\t\treturn x;\n\t}\n\n\tstatic double max(double x, double y) {\n\t\treturn Math.max(x, y);\n\t}\n\n\tstatic double min(double x, double y) {\n\t\treturn Math.min(x, y);\n\t}\n\n\tstatic double max(double x, double y, double z) {\n\t\tx = Math.max(x, y);\n\t\tx = Math.max(x, z);\n\t\treturn x;\n\t}\n\n\tstatic double min(double x, double y, double z) {\n\t\tx = Math.min(x, y);\n\t\tx = Math.min(x, z);\n\t\treturn x;\n\t}\n\n\tstatic void sort(int[] ar) {\n\t\tArrays.sort(ar);\n\t}\n\n\tstatic void sort(long[] ar) {\n\t\tArrays.sort(ar);\n\t}\n\n\tstatic void sort(double[] ar) {\n\t\tArrays.sort(ar);\n\t}\n\n\tstatic void rsort(int[] ar) {\n\t\tArrays.sort(ar);\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tint tmp = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = tmp;\n\t\t}\n\t}\n\n\tstatic void rsort(long[] ar) {\n\t\tArrays.sort(ar);\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tlong tmp = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = tmp;\n\t\t}\n\t}\n\n\tstatic void rsort(double[] ar) {\n\t\tArrays.sort(ar);\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tdouble tmp = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = tmp;\n\t\t}\n\t}\n\n\tstatic void fill(int arr[], int x) {\n\t\tArrays.fill(arr, x);\n\t}\n\n\tstatic void fill(long arr[], long x) {\n\t\tArrays.fill(arr, x);\n\t}\n\n\tstatic void fill(double arr[], double x) {\n\t\tArrays.fill(arr, x);\n\t}\n\n\tstatic void fill(int arr[][], int x) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tArrays.fill(arr[i], x);\n\t}\n\n\tstatic void fill(long arr[][], long x) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tArrays.fill(arr[i], x);\n\t}\n\n\tstatic void fill(double arr[][], double x) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tArrays.fill(arr[i], x);\n\t}\n\n\t//MOD culc\n\tstatic long plus(long x, long y) {\n\t\tlong res = (x + y) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\n\tstatic long sub(long x, long y) {\n\t\tlong res = (x - y) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\n\tstatic long mul(long x, long y) {\n\t\tlong res = (x * y) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\n\tstatic long div(long x, long y) {\n\t\tlong res = x * pow(y, mod - 2) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\n\tstatic long pow(long x, long y) {\n\t\tif (y < 0)\n\t\t\treturn 0;\n\t\tif (y == 0)\n\t\t\treturn 1;\n\t\tif (y % 2 == 1)\n\t\t\treturn (x * pow(x, y - 1)) % mod;\n\t\tlong root = pow(x, y / 2);\n\t\treturn root * root % mod;\n\t}\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tis = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());\n\t\tout = new PrintWriter(System.out);\n\t\tsolve();\n\t\tout.flush();\n\t}\n\n\t//input\n\tprivate static byte[] inbuf = new byte[1024];\n\tstatic int lenbuf = 0, ptrbuf = 0;\n\n\tprivate static int readByte() {\n\t\tif (lenbuf == -1)\n\t\t\tthrow new InputMismatchException();\n\t\tif (ptrbuf >= lenbuf) {\n\t\t\tptrbuf = 0;\n\t\t\ttry {\n\t\t\t\tlenbuf = is.read(inbuf);\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new InputMismatchException();\n\t\t\t}\n\t\t\tif (lenbuf <= 0)\n\t\t\t\treturn -1;\n\t\t}\n\t\treturn inbuf[ptrbuf++];\n\t}\n\n\tprivate static boolean isSpaceChar(int c) {\n\t\treturn !(c >= 33 && c <= 126);\n\t}\n\n\tprivate static int skip() {\n\t\tint b;\n\t\twhile ((b = readByte()) != -1 && isSpaceChar(b))\n\t\t\t;\n\t\treturn b;\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate static double nd() {\n\t\treturn Double.parseDouble(ns());\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate static char nc() {\n\t\treturn (char) skip();\n\t}\n\n\tprivate static String ns() {\n\t\tint b = skip();\n\t\tStringBuilder sb = new StringBuilder();\n\t\twhile (!(isSpaceChar(b))) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\n\tprivate static char[] ns(int n) {\n\t\tchar[] buf = new char[n];\n\t\tint b = skip(), p = 0;\n\t\twhile (p < n && !(isSpaceChar(b))) {\n\t\t\tbuf[p++] = (char) b;\n\t\t\tb = readByte();\n\t\t}\n\t\treturn n == p ? buf : Arrays.copyOf(buf, p);\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate static char[][] nm(int n, int m) {\n\t\tchar[][] map = new char[n][];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tmap[i] = ns(m);\n\t\treturn map;\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate static int[] na(int n) {\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = ni();\n\t\treturn a;\n\t}\n\n\tprivate static int ni() {\n\t\tint num = 0, b;\n\t\tboolean minus = false;\n\t\twhile ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))\n\t\t\t;\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\n\t\twhile (true) {\n\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t} else {\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate static long nl() {\n\t\tlong num = 0;\n\t\tint b;\n\t\tboolean minus = false;\n\t\twhile ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))\n\t\t\t;\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\n\t\twhile (true) {\n\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t} else {\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1587955305, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02702.html", "problem_id": "p02702", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02702/input.txt", "sample_output_relpath": "derived/input_output/data/p02702/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02702/Java/s753883061.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s753883061", "user_id": "u881359256"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n\tstatic InputStream is;\n\tstatic PrintWriter out;\n\tstatic String INPUT = \"\";\n\n\tstatic final long mod = (long) 1e9 + 7;\n\tstatic final int dx[] = { -1, 0, 1, 0 }, dy[] = { 0, -1, 0, 1 };\n\tstatic final int[] dx8 = { -1, -1, -1, 0, 0, 1, 1, 1 }, dy8 = { -1, 0, 1, -1, 1, -1, 0, 1 };\n\tstatic final int inf = Integer.MAX_VALUE / 3;\n\tstatic final long linf = Long.MAX_VALUE / 3;\n\tstatic final double dinf = Double.MAX_VALUE / 3;\n\tstatic final double eps = 1e-10;\n\tstatic final double pi = Math.PI;\n\tstatic StringBuilder sb = new StringBuilder();\n\n\tstatic void solve() {\n\t\tString s = ns();\n\t\tchar c[] = s.toCharArray();\n\t\tint n = s.length();\n\t\tint a[] = new int[n];\n\t\tfor(int i=0;i void reverse(List ls) {\n\t\tint sz = ls.size();\n\t\tfor (int i = 0; i < sz / 2; i++) {\n\t\t\tT t = ls.get(i);\n\t\t\tls.set(i, ls.get(sz - 1 - i));\n\t\t\tls.set(sz - 1 - i, t);\n\t\t}\n\t}\n\n\tstatic void sbnl() {//StringBuilderに改行文字をappendする\n\t\tsb.append(\"\\n\");\n\t}\n\n\tstatic int lowerBound(int[] a, int x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] < x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int upperBound(int[] a, int x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] <= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rlowerBound(int[] a, int x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] > x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rupperBound(int[] a, int x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] >= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int lowerBound(long[] a, long x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] < x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int upperBound(long[] a, long x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] <= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rlowerBound(long[] a, long x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] > x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rupperBound(long[] a, long x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] >= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int lowerBound(double[] a, double x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] < x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int upperBound(double[] a, double x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] <= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rlowerBound(double[] a, double x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] > x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rupperBound(double[] a, double x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] >= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int lowerBound(List ls, T x) throws RuntimeException {\n\t\tif (ls.size() == 0)\n\t\t\treturn -1;\n\t\tif (ls.get(0) instanceof Integer) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) >= 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Long) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) >= 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Double) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) >= 0 ? 1 : -1);\n\t\t} else {\n\t\t\tSystem.err.println(\n\t\t\t\t\tString.format(\"%s:数値でないリストを二分探索しています。\", Thread.currentThread().getStackTrace()[1].getMethodName()));\n\t\t\tthrow new RuntimeException();\n\t\t}\n\t}\n\n\tstatic int upperBound(List ls, T x) throws RuntimeException {\n\t\tif (ls.size() == 0)\n\t\t\treturn -1;\n\t\tif (ls.get(0) instanceof Integer) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) > 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Long) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) > 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Double) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) > 0 ? 1 : -1);\n\t\t} else {\n\t\t\tSystem.err.println(\n\t\t\t\t\tString.format(\"%s:数値でないリストを二分探索しています。\", Thread.currentThread().getStackTrace()[1].getMethodName()));\n\t\t\tthrow new RuntimeException();\n\t\t}\n\t}\n\n\tstatic int rupperBound(List ls, T x) throws RuntimeException {\n\t\tif (ls.size() == 0)\n\t\t\treturn -1;\n\t\tif (ls.get(0) instanceof Integer) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) < 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Long) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) < 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Double) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) < 0 ? 1 : -1);\n\t\t} else {\n\t\t\tSystem.err.println(\n\t\t\t\t\tString.format(\"%s:数値でないリストを二分探索しています。\", Thread.currentThread().getStackTrace()[1].getMethodName()));\n\t\t\tthrow new RuntimeException();\n\t\t}\n\t}\n\n\tstatic int rlowerBound(List ls, T x) {\n\t\tif (ls.size() == 0)\n\t\t\treturn -1;\n\t\tif (ls.get(0) instanceof Integer) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) <= 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Long) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) <= 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Double) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) <= 0 ? 1 : -1);\n\t\t} else {\n\t\t\tSystem.err.println(\n\t\t\t\t\tString.format(\"%s:数値でないリストを二分探索しています。\", Thread.currentThread().getStackTrace()[1].getMethodName()));\n\t\t\tthrow new RuntimeException();\n\t\t}\n\t}\n\n\tstatic int[] concat(int x, int arr[]) {\n\t\tint ret[] = new int[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 1, ret.length - 1);\n\t\tret[0] = x;\n\t\treturn ret;\n\t}\n\n\tstatic int[] concat(int arr[], int x) {\n\t\tint ret[] = new int[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 0, ret.length - 1);\n\t\tret[ret.length - 1] = x;\n\t\treturn ret;\n\t}\n\n\tstatic long[] concat(long x, long arr[]) {\n\t\tlong ret[] = new long[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 1, ret.length - 1);\n\t\tret[0] = x;\n\t\treturn ret;\n\t}\n\n\tstatic long[] concat(long arr[], long x) {\n\t\tlong ret[] = new long[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 0, ret.length - 1);\n\t\tret[ret.length - 1] = x;\n\t\treturn ret;\n\t}\n\n\tstatic int max(int x, int y) {\n\t\treturn Math.max(x, y);\n\t}\n\n\tstatic int min(int x, int y) {\n\t\treturn Math.min(x, y);\n\t}\n\n\tstatic int max(int x, int y, int z) {\n\t\tx = Math.max(x, y);\n\t\tx = Math.max(x, z);\n\t\treturn x;\n\t}\n\n\tstatic int min(int x, int y, int z) {\n\t\tx = Math.min(x, y);\n\t\tx = Math.min(x, z);\n\t\treturn x;\n\t}\n\n\tstatic long max(long x, long y) {\n\t\treturn Math.max(x, y);\n\t}\n\n\tstatic long min(long x, long y) {\n\t\treturn Math.min(x, y);\n\t}\n\n\tstatic long max(long x, long y, long z) {\n\t\tx = Math.max(x, y);\n\t\tx = Math.max(x, z);\n\t\treturn x;\n\t}\n\n\tstatic long min(long x, long y, long z) {\n\t\tx = Math.min(x, y);\n\t\tx = Math.min(x, z);\n\t\treturn x;\n\t}\n\n\tstatic double max(double x, double y) {\n\t\treturn Math.max(x, y);\n\t}\n\n\tstatic double min(double x, double y) {\n\t\treturn Math.min(x, y);\n\t}\n\n\tstatic double max(double x, double y, double z) {\n\t\tx = Math.max(x, y);\n\t\tx = Math.max(x, z);\n\t\treturn x;\n\t}\n\n\tstatic double min(double x, double y, double z) {\n\t\tx = Math.min(x, y);\n\t\tx = Math.min(x, z);\n\t\treturn x;\n\t}\n\n\tstatic void sort(int[] ar) {\n\t\tArrays.sort(ar);\n\t}\n\n\tstatic void sort(long[] ar) {\n\t\tArrays.sort(ar);\n\t}\n\n\tstatic void sort(double[] ar) {\n\t\tArrays.sort(ar);\n\t}\n\n\tstatic void rsort(int[] ar) {\n\t\tArrays.sort(ar);\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tint tmp = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = tmp;\n\t\t}\n\t}\n\n\tstatic void rsort(long[] ar) {\n\t\tArrays.sort(ar);\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tlong tmp = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = tmp;\n\t\t}\n\t}\n\n\tstatic void rsort(double[] ar) {\n\t\tArrays.sort(ar);\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tdouble tmp = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = tmp;\n\t\t}\n\t}\n\n\tstatic void fill(int arr[], int x) {\n\t\tArrays.fill(arr, x);\n\t}\n\n\tstatic void fill(long arr[], long x) {\n\t\tArrays.fill(arr, x);\n\t}\n\n\tstatic void fill(double arr[], double x) {\n\t\tArrays.fill(arr, x);\n\t}\n\n\tstatic void fill(int arr[][], int x) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tArrays.fill(arr[i], x);\n\t}\n\n\tstatic void fill(long arr[][], long x) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tArrays.fill(arr[i], x);\n\t}\n\n\tstatic void fill(double arr[][], double x) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tArrays.fill(arr[i], x);\n\t}\n\n\t//MOD culc\n\tstatic long plus(long x, long y) {\n\t\tlong res = (x + y) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\n\tstatic long sub(long x, long y) {\n\t\tlong res = (x - y) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\n\tstatic long mul(long x, long y) {\n\t\tlong res = (x * y) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\n\tstatic long div(long x, long y) {\n\t\tlong res = x * pow(y, mod - 2) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\n\tstatic long pow(long x, long y) {\n\t\tif (y < 0)\n\t\t\treturn 0;\n\t\tif (y == 0)\n\t\t\treturn 1;\n\t\tif (y % 2 == 1)\n\t\t\treturn (x * pow(x, y - 1)) % mod;\n\t\tlong root = pow(x, y / 2);\n\t\treturn root * root % mod;\n\t}\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tis = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());\n\t\tout = new PrintWriter(System.out);\n\t\tsolve();\n\t\tout.flush();\n\t}\n\n\t//input\n\tprivate static byte[] inbuf = new byte[1024];\n\tstatic int lenbuf = 0, ptrbuf = 0;\n\n\tprivate static int readByte() {\n\t\tif (lenbuf == -1)\n\t\t\tthrow new InputMismatchException();\n\t\tif (ptrbuf >= lenbuf) {\n\t\t\tptrbuf = 0;\n\t\t\ttry {\n\t\t\t\tlenbuf = is.read(inbuf);\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new InputMismatchException();\n\t\t\t}\n\t\t\tif (lenbuf <= 0)\n\t\t\t\treturn -1;\n\t\t}\n\t\treturn inbuf[ptrbuf++];\n\t}\n\n\tprivate static boolean isSpaceChar(int c) {\n\t\treturn !(c >= 33 && c <= 126);\n\t}\n\n\tprivate static int skip() {\n\t\tint b;\n\t\twhile ((b = readByte()) != -1 && isSpaceChar(b))\n\t\t\t;\n\t\treturn b;\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate static double nd() {\n\t\treturn Double.parseDouble(ns());\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate static char nc() {\n\t\treturn (char) skip();\n\t}\n\n\tprivate static String ns() {\n\t\tint b = skip();\n\t\tStringBuilder sb = new StringBuilder();\n\t\twhile (!(isSpaceChar(b))) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\n\tprivate static char[] ns(int n) {\n\t\tchar[] buf = new char[n];\n\t\tint b = skip(), p = 0;\n\t\twhile (p < n && !(isSpaceChar(b))) {\n\t\t\tbuf[p++] = (char) b;\n\t\t\tb = readByte();\n\t\t}\n\t\treturn n == p ? buf : Arrays.copyOf(buf, p);\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate static char[][] nm(int n, int m) {\n\t\tchar[][] map = new char[n][];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tmap[i] = ns(m);\n\t\treturn map;\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate static int[] na(int n) {\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = ni();\n\t\treturn a;\n\t}\n\n\tprivate static int ni() {\n\t\tint num = 0, b;\n\t\tboolean minus = false;\n\t\twhile ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))\n\t\t\t;\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\n\t\twhile (true) {\n\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t} else {\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate static long nl() {\n\t\tlong num = 0;\n\t\tint b;\n\t\tboolean minus = false;\n\t\twhile ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))\n\t\t\t;\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\n\t\twhile (true) {\n\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t} else {\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a string S consisting of digits from 1 through 9.\n\nFind the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:\n\nCondition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.\n\nConstraints\n\n1 ≤ |S| ≤ 200000\n\nS is a string consisting of digits from 1 through 9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the condition.\n\nSample Input 1\n\n1817181712114\n\nSample Output 1\n\n3\n\nThree pairs - (1,5), (5,9), and (9,13) - satisfy the condition.\n\nSample Input 2\n\n14282668646\n\nSample Output 2\n\n2\n\nSample Input 3\n\n2119\n\nSample Output 3\n\n0\n\nNo pairs satisfy the condition.", "sample_input": "1817181712114\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02702", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a string S consisting of digits from 1 through 9.\n\nFind the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:\n\nCondition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.\n\nConstraints\n\n1 ≤ |S| ≤ 200000\n\nS is a string consisting of digits from 1 through 9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the condition.\n\nSample Input 1\n\n1817181712114\n\nSample Output 1\n\n3\n\nThree pairs - (1,5), (5,9), and (9,13) - satisfy the condition.\n\nSample Input 2\n\n14282668646\n\nSample Output 2\n\n2\n\nSample Input 3\n\n2119\n\nSample Output 3\n\n0\n\nNo pairs satisfy the condition.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 13706, "cpu_time_ms": 156, "memory_kb": 32248}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s120738676", "group_id": "codeNet:p02702", "input_text": "import java.util.*;\nimport java.math.*;\n\npublic class Main {\n static final int MOD = 1_000_000_007; // 10^9+7\n // static final int MAX = 2_147_483_646; // intの最大値\n static final int INF = 1_000_000_000; // 10^9\n static final int MAX = 10_000_000;\n static long[] fact = new long[100];\n public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n char[] str = s.toCharArray();\n int[] ary = new int[s.length()];\n Arrays.fill(ary,INF);\n for(int i = 0;i < s.length();i++){\n int n = str[i]-'0';\n for(int j = i+1;j <= s.length();j++){\n n%=2019;\n if(n==0){\n ary[i] = j-1;\n break; \n }\n if(j==s.length())break;\n n*=10;\n n+=str[j]-'0';\n }\n }\n long count = 0;\n for(int i = 0;i < s.length();i++){\n for(int j = i;j < s.length();){\n if(ary[j]==INF)break;\n count++;\n j = ary[j]+1;\n }\n }\n System.out.println(count);\n }\n \n}\n", "language": "Java", "metadata": {"date": 1587951720, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02702.html", "problem_id": "p02702", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02702/input.txt", "sample_output_relpath": "derived/input_output/data/p02702/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02702/Java/s120738676.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s120738676", "user_id": "u794927332"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.*;\nimport java.math.*;\n\npublic class Main {\n static final int MOD = 1_000_000_007; // 10^9+7\n // static final int MAX = 2_147_483_646; // intの最大値\n static final int INF = 1_000_000_000; // 10^9\n static final int MAX = 10_000_000;\n static long[] fact = new long[100];\n public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n char[] str = s.toCharArray();\n int[] ary = new int[s.length()];\n Arrays.fill(ary,INF);\n for(int i = 0;i < s.length();i++){\n int n = str[i]-'0';\n for(int j = i+1;j <= s.length();j++){\n n%=2019;\n if(n==0){\n ary[i] = j-1;\n break; \n }\n if(j==s.length())break;\n n*=10;\n n+=str[j]-'0';\n }\n }\n long count = 0;\n for(int i = 0;i < s.length();i++){\n for(int j = i;j < s.length();){\n if(ary[j]==INF)break;\n count++;\n j = ary[j]+1;\n }\n }\n System.out.println(count);\n }\n \n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a string S consisting of digits from 1 through 9.\n\nFind the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:\n\nCondition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.\n\nConstraints\n\n1 ≤ |S| ≤ 200000\n\nS is a string consisting of digits from 1 through 9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the condition.\n\nSample Input 1\n\n1817181712114\n\nSample Output 1\n\n3\n\nThree pairs - (1,5), (5,9), and (9,13) - satisfy the condition.\n\nSample Input 2\n\n14282668646\n\nSample Output 2\n\n2\n\nSample Input 3\n\n2119\n\nSample Output 3\n\n0\n\nNo pairs satisfy the condition.", "sample_input": "1817181712114\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02702", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a string S consisting of digits from 1 through 9.\n\nFind the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:\n\nCondition: In base ten, the i-th through j-th characters of S form an integer that is a multiple of 2019.\n\nConstraints\n\n1 ≤ |S| ≤ 200000\n\nS is a string consisting of digits from 1 through 9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the condition.\n\nSample Input 1\n\n1817181712114\n\nSample Output 1\n\n3\n\nThree pairs - (1,5), (5,9), and (9,13) - satisfy the condition.\n\nSample Input 2\n\n14282668646\n\nSample Output 2\n\n2\n\nSample Input 3\n\n2119\n\nSample Output 3\n\n0\n\nNo pairs satisfy the condition.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1189, "cpu_time_ms": 2207, "memory_kb": 42292}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s970384283", "group_id": "codeNet:p02703", "input_text": "import java.util.*;\nimport java.io.*;\nimport static java.lang.Math.*;\nimport static java.util.Arrays.*;\nimport static java.util.Collections.*;\n\npublic class Main implements Runnable\n{\n// static int dx[]={-1,0,1,0};\n// static int dy[]={0,-1,0,1};\n static long mod=1000000007;\n \n public static void main(String[] args) { \n new Thread(null, new Main(), \"\", 200 * 1024 * 1024).start(); \n }\n\n public void run() {\n Reader sc = new Reader(System.in);\n PrintWriter out=new PrintWriter(System.out);\n\n int n=sc.nextInt();\n int m=sc.nextInt();\n int s=sc.nextInt();\n ArrayList[] l=new ArrayList[n];\n for (int i = 0; i < l.length; i++) {\n\t\t\tl[i]=new ArrayList<>();\n\t\t}\n int sf=10,bt=(1< q=new LinkedList<>();\n d[0][s]=0;\n q.add(new P(0,s,0));\n\n while(!q.isEmpty()) {\n \tP p=q.poll();\n// \tdb(p.x,p.c,p.s);\n \tif(p.s>d[p.x][p.c])continue;\n\t\t\tif(p.c+ex[p.x][0]<3000 && p.s+ex[p.x][1] < d[p.x][p.c+ex[p.x][0]]) {\n\t\t\t\td[p.x][ex[p.x][0]] = p.s + ex[p.x][1];\n\t\t\t\tq.add(new P(p.x, p.c + ex[p.x][0], p.s + ex[p.x][1]));\n\t\t\t}\n\t\t\tfor (int i = 0,to,id; i < l[p.x].size(); i++) {\n\t\t\t\tid = l[p.x].get(i);\n\t\t\t\tto=id>>sf;\n\t\t\t\tid=id&bt;\n\t\t\t\tif(p.c < e[id][0])continue;\n\t\t\t\tif(p.s + e[id][1] < d[to][p.c-e[id][0]]) {\n\t\t\t\t\td[to][p.c-e[id][0]] = p.s + e[id][1];\n\t\t\t\t\tq.add(new P(to, p.c - e[id][0], p.s + e[id][1]));\n\t\t\t\t}\n\t\t\t}\n }\n for (int i = 1; i < n; i++) {\n \tsort(d[i]);\n\t\t\tout.println(d[i][0]);\n\t\t}\n \n out.println();\n \tout.flush();\n }\n\n static void ret(String ans) {\n \tSystem.out.println(ans);\n \tSystem.exit(0);\n }\n\n static void ret(long ans) {\n \tSystem.out.println(ans);\n \tSystem.exit(0);\n }\n \n static boolean validpos(int x,int y,int r, int c){\n return x{\n// int i,x,r,f;\n// P(int i,int x,int r,int f) {\n// \tthis.i=i;\n// \tthis.x=x;\n// \tthis.r=r;\n// \tthis.f=f;\n// }\n//\n// public int compareTo(P p){\n// \tif(-this.r+p.r==0) {\n// \t\treturn -this.x+p.x;\n// \t}\n// return -this.r+p.r;\n// }\n//}\n\nclass Reader\n{ \n private BufferedReader x;\n private StringTokenizer st;\n \n public Reader(InputStream in)\n {\n x = new BufferedReader(new InputStreamReader(in));\n st = null;\n }\n public String nextString()\n {\n while( st==null || !st.hasMoreTokens() )\n\t\t\ttry {\n\t\t\t\tst = new StringTokenizer(x.readLine());\n\t\t\t} catch (IOException e) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t}\n return st.nextToken();\n }\n public int nextInt()\n {\n return Integer.parseInt(nextString());\n }\n public int[] nextIntArray(int size) {\n int r[] = new int[size];\n for (int i = 0; i < size; i++) {\n r[i] = this.nextInt(); \n }\n return r;\n }\n public long[] nextLongArray(int size) {\n long r[] = new long[size];\n for (int i = 0; i < size; i++) {\n r[i] = this.nextLong(); \n }\n return r;\n }\n public char[] getCharSet() {\n return this.nextString().toCharArray();\n } \n public long nextLong()\n {\n return Long.parseLong(nextString());\n }\n public double nextDouble() throws IOException\n {\n return Double.parseDouble(nextString());\n }\n}\n", "language": "Java", "metadata": {"date": 1587955175, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02703.html", "problem_id": "p02703", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02703/input.txt", "sample_output_relpath": "derived/input_output/data/p02703/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02703/Java/s970384283.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s970384283", "user_id": "u238640707"}, "prompt_components": {"gold_output": "2\n14\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\nimport static java.lang.Math.*;\nimport static java.util.Arrays.*;\nimport static java.util.Collections.*;\n\npublic class Main implements Runnable\n{\n// static int dx[]={-1,0,1,0};\n// static int dy[]={0,-1,0,1};\n static long mod=1000000007;\n \n public static void main(String[] args) { \n new Thread(null, new Main(), \"\", 200 * 1024 * 1024).start(); \n }\n\n public void run() {\n Reader sc = new Reader(System.in);\n PrintWriter out=new PrintWriter(System.out);\n\n int n=sc.nextInt();\n int m=sc.nextInt();\n int s=sc.nextInt();\n ArrayList[] l=new ArrayList[n];\n for (int i = 0; i < l.length; i++) {\n\t\t\tl[i]=new ArrayList<>();\n\t\t}\n int sf=10,bt=(1< q=new LinkedList<>();\n d[0][s]=0;\n q.add(new P(0,s,0));\n\n while(!q.isEmpty()) {\n \tP p=q.poll();\n// \tdb(p.x,p.c,p.s);\n \tif(p.s>d[p.x][p.c])continue;\n\t\t\tif(p.c+ex[p.x][0]<3000 && p.s+ex[p.x][1] < d[p.x][p.c+ex[p.x][0]]) {\n\t\t\t\td[p.x][ex[p.x][0]] = p.s + ex[p.x][1];\n\t\t\t\tq.add(new P(p.x, p.c + ex[p.x][0], p.s + ex[p.x][1]));\n\t\t\t}\n\t\t\tfor (int i = 0,to,id; i < l[p.x].size(); i++) {\n\t\t\t\tid = l[p.x].get(i);\n\t\t\t\tto=id>>sf;\n\t\t\t\tid=id&bt;\n\t\t\t\tif(p.c < e[id][0])continue;\n\t\t\t\tif(p.s + e[id][1] < d[to][p.c-e[id][0]]) {\n\t\t\t\t\td[to][p.c-e[id][0]] = p.s + e[id][1];\n\t\t\t\t\tq.add(new P(to, p.c - e[id][0], p.s + e[id][1]));\n\t\t\t\t}\n\t\t\t}\n }\n for (int i = 1; i < n; i++) {\n \tsort(d[i]);\n\t\t\tout.println(d[i][0]);\n\t\t}\n \n out.println();\n \tout.flush();\n }\n\n static void ret(String ans) {\n \tSystem.out.println(ans);\n \tSystem.exit(0);\n }\n\n static void ret(long ans) {\n \tSystem.out.println(ans);\n \tSystem.exit(0);\n }\n \n static boolean validpos(int x,int y,int r, int c){\n return x{\n// int i,x,r,f;\n// P(int i,int x,int r,int f) {\n// \tthis.i=i;\n// \tthis.x=x;\n// \tthis.r=r;\n// \tthis.f=f;\n// }\n//\n// public int compareTo(P p){\n// \tif(-this.r+p.r==0) {\n// \t\treturn -this.x+p.x;\n// \t}\n// return -this.r+p.r;\n// }\n//}\n\nclass Reader\n{ \n private BufferedReader x;\n private StringTokenizer st;\n \n public Reader(InputStream in)\n {\n x = new BufferedReader(new InputStreamReader(in));\n st = null;\n }\n public String nextString()\n {\n while( st==null || !st.hasMoreTokens() )\n\t\t\ttry {\n\t\t\t\tst = new StringTokenizer(x.readLine());\n\t\t\t} catch (IOException e) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t}\n return st.nextToken();\n }\n public int nextInt()\n {\n return Integer.parseInt(nextString());\n }\n public int[] nextIntArray(int size) {\n int r[] = new int[size];\n for (int i = 0; i < size; i++) {\n r[i] = this.nextInt(); \n }\n return r;\n }\n public long[] nextLongArray(int size) {\n long r[] = new long[size];\n for (int i = 0; i < size; i++) {\n r[i] = this.nextLong(); \n }\n return r;\n }\n public char[] getCharSet() {\n return this.nextString().toCharArray();\n } \n public long nextLong()\n {\n return Long.parseLong(nextString());\n }\n public double nextDouble() throws IOException\n {\n return Double.parseDouble(nextString());\n }\n}\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are N cities numbered 1 to N, connected by M railroads.\n\nYou are now at City 1, with 10^{100} gold coins and S silver coins in your pocket.\n\nThe i-th railroad connects City U_i and City V_i bidirectionally, and a one-way trip costs A_i silver coins and takes B_i minutes.\nYou cannot use gold coins to pay the fare.\n\nThere is an exchange counter in each city. At the exchange counter in City i, you can get C_i silver coins for 1 gold coin.\nThe transaction takes D_i minutes for each gold coin you give.\nYou can exchange any number of gold coins at each exchange counter.\n\nFor each t=2, ..., N, find the minimum time needed to travel from City 1 to City t. You can ignore the time spent waiting for trains.\n\nConstraints\n\n2 \\leq N \\leq 50\n\nN-1 \\leq M \\leq 100\n\n0 \\leq S \\leq 10^9\n\n1 \\leq A_i \\leq 50\n\n1 \\leq B_i,C_i,D_i \\leq 10^9\n\n1 \\leq U_i < V_i \\leq N\n\nThere is no pair i, j(i \\neq j) such that (U_i,V_i)=(U_j,V_j).\n\nEach city t=2,...,N can be reached from City 1 with some number of railroads.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M S\nU_1 V_1 A_1 B_1\n:\nU_M V_M A_M B_M\nC_1 D_1\n:\nC_N D_N\n\nOutput\n\nFor each t=2, ..., N in this order, print a line containing the minimum time needed to travel from City 1 to City t.\n\nSample Input 1\n\n3 2 1\n1 2 1 2\n1 3 2 4\n1 11\n1 2\n2 5\n\nSample Output 1\n\n2\n14\n\nThe railway network in this input is shown in the figure below.\n\nIn this figure, each city is labeled as follows:\n\nThe first line: the ID number i of the city (i for City i)\n\nThe second line: C_i / D_i\n\nSimilarly, each railroad is labeled as follows:\n\nThe first line: the ID number i of the railroad (i for the i-th railroad in input)\n\nThe second line: A_i / B_i\n\nYou can travel from City 1 to City 2 in 2 minutes, as follows:\n\nUse the 1-st railroad to move from City 1 to City 2 in 2 minutes.\n\nYou can travel from City 1 to City 3 in 14 minutes, as follows:\n\nUse the 1-st railroad to move from City 1 to City 2 in 2 minutes.\n\nAt the exchange counter in City 2, exchange 3 gold coins for 3 silver coins in 6 minutes.\n\nUse the 1-st railroad to move from City 2 to City 1 in 2 minutes.\n\nUse the 2-nd railroad to move from City 1 to City 3 in 4 minutes.\n\nSample Input 2\n\n4 4 1\n1 2 1 5\n1 3 4 4\n2 4 2 2\n3 4 1 1\n3 1\n3 1\n5 2\n6 4\n\nSample Output 2\n\n5\n5\n7\n\nThe railway network in this input is shown in the figure below:\n\nYou can travel from City 1 to City 4 in 7 minutes, as follows:\n\nAt the exchange counter in City 1, exchange 2 gold coins for 6 silver coins in 2 minutes.\n\nUse the 2-nd railroad to move from City 1 to City 3 in 4 minutes.\n\nUse the 4-th railroad to move from City 3 to City 4 in 1 minutes.\n\nSample Input 3\n\n6 5 1\n1 2 1 1\n1 3 2 1\n2 4 5 1\n3 5 11 1\n1 6 50 1\n1 10000\n1 3000\n1 700\n1 100\n1 1\n100 1\n\nSample Output 3\n\n1\n9003\n14606\n16510\n16576\n\nThe railway network in this input is shown in the figure below:\n\nYou can travel from City 1 to City 6 in 16576 minutes, as follows:\n\nUse the 1-st railroad to move from City 1 to City 2 in 1 minute.\n\nAt the exchange counter in City 2, exchange 3 gold coins for 3 silver coins in 9000 minutes.\n\nUse the 1-st railroad to move from City 2 to City 1 in 1 minute.\n\nUse the 2-nd railroad to move from City 1 to City 3 in 1 minute.\n\nAt the exchange counter in City 3, exchange 8 gold coins for 8 silver coins in 5600 minutes.\n\nUse the 2-nd railroad to move from City 3 to City 1 in 1 minute.\n\nUse the 1-st railroad to move from City 1 to City 2 in 1 minute.\n\nUse the 3-rd railroad to move from City 2 to City 4 in 1 minute.\n\nAt the exchange counter in City 4, exchange 19 gold coins for 19 silver coins in 1900 minutes.\n\nUse the 3-rd railroad to move from City 4 to City 2 in 1 minute.\n\nUse the 1-st railroad to move from City 2 to City 1 in 1 minute.\n\nUse the 2-nd railroad to move from City 1 to City 3 in 1 minute.\n\nUse the 4-th railroad to move from City 3 to City 5 in 1 minute.\n\nAt the exchange counter in City 5, exchange 63 gold coins for 63 silver coins in 63 minutes.\n\nUse the 4-th railroad to move from City 5 to City 3 in 1 minute.\n\nUse the 2-nd railroad to move from City 3 to City 1 in 1 minute.\n\nUse the 5-th railroad to move from City 1 to City 6 in 1 minute.\n\nSample Input 4\n\n4 6 1000000000\n1 2 50 1\n1 3 50 5\n1 4 50 7\n2 3 50 2\n2 4 50 4\n3 4 50 3\n10 2\n4 4\n5 5\n7 7\n\nSample Output 4\n\n1\n3\n5\n\nThe railway network in this input is shown in the figure below:\n\nSample Input 5\n\n2 1 0\n1 2 1 1\n1 1000000000\n1 1\n\nSample Output 5\n\n1000000001\n\nThe railway network in this input is shown in the figure below:\n\nYou can travel from City 1 to City 2 in 1000000001 minutes, as follows:\n\nAt the exchange counter in City 1, exchange 1 gold coin for 1 silver coin in 1000000000 minutes.\n\nUse the 1-st railroad to move from City 1 to City 2 in 1 minute.", "sample_input": "3 2 1\n1 2 1 2\n1 3 2 4\n1 11\n1 2\n2 5\n"}, "reference_outputs": ["2\n14\n"], "source_document_id": "p02703", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere are N cities numbered 1 to N, connected by M railroads.\n\nYou are now at City 1, with 10^{100} gold coins and S silver coins in your pocket.\n\nThe i-th railroad connects City U_i and City V_i bidirectionally, and a one-way trip costs A_i silver coins and takes B_i minutes.\nYou cannot use gold coins to pay the fare.\n\nThere is an exchange counter in each city. At the exchange counter in City i, you can get C_i silver coins for 1 gold coin.\nThe transaction takes D_i minutes for each gold coin you give.\nYou can exchange any number of gold coins at each exchange counter.\n\nFor each t=2, ..., N, find the minimum time needed to travel from City 1 to City t. You can ignore the time spent waiting for trains.\n\nConstraints\n\n2 \\leq N \\leq 50\n\nN-1 \\leq M \\leq 100\n\n0 \\leq S \\leq 10^9\n\n1 \\leq A_i \\leq 50\n\n1 \\leq B_i,C_i,D_i \\leq 10^9\n\n1 \\leq U_i < V_i \\leq N\n\nThere is no pair i, j(i \\neq j) such that (U_i,V_i)=(U_j,V_j).\n\nEach city t=2,...,N can be reached from City 1 with some number of railroads.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M S\nU_1 V_1 A_1 B_1\n:\nU_M V_M A_M B_M\nC_1 D_1\n:\nC_N D_N\n\nOutput\n\nFor each t=2, ..., N in this order, print a line containing the minimum time needed to travel from City 1 to City t.\n\nSample Input 1\n\n3 2 1\n1 2 1 2\n1 3 2 4\n1 11\n1 2\n2 5\n\nSample Output 1\n\n2\n14\n\nThe railway network in this input is shown in the figure below.\n\nIn this figure, each city is labeled as follows:\n\nThe first line: the ID number i of the city (i for City i)\n\nThe second line: C_i / D_i\n\nSimilarly, each railroad is labeled as follows:\n\nThe first line: the ID number i of the railroad (i for the i-th railroad in input)\n\nThe second line: A_i / B_i\n\nYou can travel from City 1 to City 2 in 2 minutes, as follows:\n\nUse the 1-st railroad to move from City 1 to City 2 in 2 minutes.\n\nYou can travel from City 1 to City 3 in 14 minutes, as follows:\n\nUse the 1-st railroad to move from City 1 to City 2 in 2 minutes.\n\nAt the exchange counter in City 2, exchange 3 gold coins for 3 silver coins in 6 minutes.\n\nUse the 1-st railroad to move from City 2 to City 1 in 2 minutes.\n\nUse the 2-nd railroad to move from City 1 to City 3 in 4 minutes.\n\nSample Input 2\n\n4 4 1\n1 2 1 5\n1 3 4 4\n2 4 2 2\n3 4 1 1\n3 1\n3 1\n5 2\n6 4\n\nSample Output 2\n\n5\n5\n7\n\nThe railway network in this input is shown in the figure below:\n\nYou can travel from City 1 to City 4 in 7 minutes, as follows:\n\nAt the exchange counter in City 1, exchange 2 gold coins for 6 silver coins in 2 minutes.\n\nUse the 2-nd railroad to move from City 1 to City 3 in 4 minutes.\n\nUse the 4-th railroad to move from City 3 to City 4 in 1 minutes.\n\nSample Input 3\n\n6 5 1\n1 2 1 1\n1 3 2 1\n2 4 5 1\n3 5 11 1\n1 6 50 1\n1 10000\n1 3000\n1 700\n1 100\n1 1\n100 1\n\nSample Output 3\n\n1\n9003\n14606\n16510\n16576\n\nThe railway network in this input is shown in the figure below:\n\nYou can travel from City 1 to City 6 in 16576 minutes, as follows:\n\nUse the 1-st railroad to move from City 1 to City 2 in 1 minute.\n\nAt the exchange counter in City 2, exchange 3 gold coins for 3 silver coins in 9000 minutes.\n\nUse the 1-st railroad to move from City 2 to City 1 in 1 minute.\n\nUse the 2-nd railroad to move from City 1 to City 3 in 1 minute.\n\nAt the exchange counter in City 3, exchange 8 gold coins for 8 silver coins in 5600 minutes.\n\nUse the 2-nd railroad to move from City 3 to City 1 in 1 minute.\n\nUse the 1-st railroad to move from City 1 to City 2 in 1 minute.\n\nUse the 3-rd railroad to move from City 2 to City 4 in 1 minute.\n\nAt the exchange counter in City 4, exchange 19 gold coins for 19 silver coins in 1900 minutes.\n\nUse the 3-rd railroad to move from City 4 to City 2 in 1 minute.\n\nUse the 1-st railroad to move from City 2 to City 1 in 1 minute.\n\nUse the 2-nd railroad to move from City 1 to City 3 in 1 minute.\n\nUse the 4-th railroad to move from City 3 to City 5 in 1 minute.\n\nAt the exchange counter in City 5, exchange 63 gold coins for 63 silver coins in 63 minutes.\n\nUse the 4-th railroad to move from City 5 to City 3 in 1 minute.\n\nUse the 2-nd railroad to move from City 3 to City 1 in 1 minute.\n\nUse the 5-th railroad to move from City 1 to City 6 in 1 minute.\n\nSample Input 4\n\n4 6 1000000000\n1 2 50 1\n1 3 50 5\n1 4 50 7\n2 3 50 2\n2 4 50 4\n3 4 50 3\n10 2\n4 4\n5 5\n7 7\n\nSample Output 4\n\n1\n3\n5\n\nThe railway network in this input is shown in the figure below:\n\nSample Input 5\n\n2 1 0\n1 2 1 1\n1 1000000000\n1 1\n\nSample Output 5\n\n1000000001\n\nThe railway network in this input is shown in the figure below:\n\nYou can travel from City 1 to City 2 in 1000000001 minutes, as follows:\n\nAt the exchange counter in City 1, exchange 1 gold coin for 1 silver coin in 1000000000 minutes.\n\nUse the 1-st railroad to move from City 1 to City 2 in 1 minute.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 4131, "cpu_time_ms": 504, "memory_kb": 71356}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s029983347", "group_id": "codeNet:p02705", "input_text": "import java.util.*;\npublic class Main {\n\n public static void main(String[] args) {\n Scanner s = new Scanner(System.in);\n int r = s.nextInt();\n System.out.println(Math.PI * 2 * r);\n\n }\n\n}", "language": "Java", "metadata": {"date": 1594399265, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02705.html", "problem_id": "p02705", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02705/input.txt", "sample_output_relpath": "derived/input_output/data/p02705/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02705/Java/s029983347.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s029983347", "user_id": "u270058164"}, "prompt_components": {"gold_output": "6.28318530717958623200\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n\n public static void main(String[] args) {\n Scanner s = new Scanner(System.in);\n int r = s.nextInt();\n System.out.println(Math.PI * 2 * r);\n\n }\n\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "sample_input": "1\n"}, "reference_outputs": ["6.28318530717958623200\n"], "source_document_id": "p02705", "source_text": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 120, "memory_kb": 35476}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s431383172", "group_id": "codeNet:p02705", "input_text": "//package atcoder;\n \nimport java.util.*;\n \npublic class Main{\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tint A[] = new int [N-1];\n\t\tfor(int i=0;i map = new HashMap<>();\n\t\tfor(int i=1;i<=N;i++) {\n\t\t\tmap.put(i,0);\n\t\t}\n\t\tfor(int j=0;j map = new HashMap<>();\n\t\tfor(int i=1;i<=N;i++) {\n\t\t\tmap.put(i,0);\n\t\t}\n\t\tfor(int j=0;j 1_000_000_007) {\n\t\t\t\tcount = count % 1_000_000_007;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1589228410, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02705.html", "problem_id": "p02705", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02705/input.txt", "sample_output_relpath": "derived/input_output/data/p02705/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02705/Java/s540020016.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s540020016", "user_id": "u187491596"}, "prompt_components": {"gold_output": "6.28318530717958623200\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint k = sc.nextInt();\n\t\tsc.close();\n\n\t\tlong count = 0;\n\t\tfor (int i = k; i <= n + 1; i++) {\n\t\t\tlong min = 0;\n\t\t\tlong max = 0;\n\t\t\tfor (int j = 1; j <= i; j++) {\n\t\t\t\tmin += (j - 1);\n\t\t\t\tmax += (n - j + 1);\n\t\t\t}\n\t\t\tcount += (max - min + 1);\n\t\t\tif (count > 1_000_000_007) {\n\t\t\t\tcount = count % 1_000_000_007;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "sample_input": "1\n"}, "reference_outputs": ["6.28318530717958623200\n"], "source_document_id": "p02705", "source_text": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 503, "cpu_time_ms": 106, "memory_kb": 35772}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s089942731", "group_id": "codeNet:p02705", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n // 整数の入力\n int r = sc.nextInt();\n // スペース区切りの整数の入力\n\n double a = r * 2 * 3.14;\n\n System.out.println(a);\n\n\n\n }\n}\n\n", "language": "Java", "metadata": {"date": 1588436887, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02705.html", "problem_id": "p02705", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02705/input.txt", "sample_output_relpath": "derived/input_output/data/p02705/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02705/Java/s089942731.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s089942731", "user_id": "u198461033"}, "prompt_components": {"gold_output": "6.28318530717958623200\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n // 整数の入力\n int r = sc.nextInt();\n // スペース区切りの整数の入力\n\n double a = r * 2 * 3.14;\n\n System.out.println(a);\n\n\n\n }\n}\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "sample_input": "1\n"}, "reference_outputs": ["6.28318530717958623200\n"], "source_document_id": "p02705", "source_text": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 325, "cpu_time_ms": 106, "memory_kb": 35980}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s681767534", "group_id": "codeNet:p02705", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint r = sc.nextInt();\n\t\tSystem.out.println(2*r*Math.PI);\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1587695269, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02705.html", "problem_id": "p02705", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02705/input.txt", "sample_output_relpath": "derived/input_output/data/p02705/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02705/Java/s681767534.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s681767534", "user_id": "u614748348"}, "prompt_components": {"gold_output": "6.28318530717958623200\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint r = sc.nextInt();\n\t\tSystem.out.println(2*r*Math.PI);\n\t}\n\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "sample_input": "1\n"}, "reference_outputs": ["6.28318530717958623200\n"], "source_document_id": "p02705", "source_text": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 109, "memory_kb": 35956}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s461133224", "group_id": "codeNet:p02705", "input_text": "import java.util.*;\nclass Main\n{\n public static void main (String[] args) \n {\n Scanner sc =new Scanner(System.in); \n System.out.println();\n int r=sc.nextInt();\n double c=0.0d;\n c=2*3.14*r;\n System.out.println(c);\n \n }\n}", "language": "Java", "metadata": {"date": 1587492099, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02705.html", "problem_id": "p02705", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02705/input.txt", "sample_output_relpath": "derived/input_output/data/p02705/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02705/Java/s461133224.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s461133224", "user_id": "u402943164"}, "prompt_components": {"gold_output": "6.28318530717958623200\n", "input_to_evaluate": "import java.util.*;\nclass Main\n{\n public static void main (String[] args) \n {\n Scanner sc =new Scanner(System.in); \n System.out.println();\n int r=sc.nextInt();\n double c=0.0d;\n c=2*3.14*r;\n System.out.println(c);\n \n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "sample_input": "1\n"}, "reference_outputs": ["6.28318530717958623200\n"], "source_document_id": "p02705", "source_text": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 110, "memory_kb": 35948}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s126937879", "group_id": "codeNet:p02705", "input_text": "import java.util.Scanner;\n \npublic class Main {\n \n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int r = in.nextInt();\n \n in.close();\n \n System.out.println(2 * Math.PI * r);\n }\n}", "language": "Java", "metadata": {"date": 1587449244, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02705.html", "problem_id": "p02705", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02705/input.txt", "sample_output_relpath": "derived/input_output/data/p02705/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02705/Java/s126937879.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s126937879", "user_id": "u228729250"}, "prompt_components": {"gold_output": "6.28318530717958623200\n", "input_to_evaluate": "import java.util.Scanner;\n \npublic class Main {\n \n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int r = in.nextInt();\n \n in.close();\n \n System.out.println(2 * Math.PI * r);\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "sample_input": "1\n"}, "reference_outputs": ["6.28318530717958623200\n"], "source_document_id": "p02705", "source_text": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 104, "memory_kb": 35848}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s800269046", "group_id": "codeNet:p02705", "input_text": "import java.io.ByteArrayInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.InputMismatchException;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.TreeSet;\n\npublic class Main {\n\tInputStream is;\n\tPrintWriter out;\n\tString INPUT = \"\";\n\n\tvoid solve() {\n\t\tout.println(2 * Math.PI * ni());\n\t}\n\t\t\n\tvoid run() throws Exception {\n\t\tis = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());\n\t\tout = new PrintWriter(System.out);\n\n\t\tlong s = System.currentTimeMillis();\n\t\tsolve();\n\t\tout.flush();\n\t\tif (!INPUT.isEmpty())\n\t\t\ttr(System.currentTimeMillis() - s + \"ms\");\n\t}\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tnew Main().run();\n\t}\n\n\tprivate byte[] inbuf = new byte[1024];\n\tpublic int lenbuf = 0, ptrbuf = 0;\n\n\tprivate int readByte() {\n\t\tif (lenbuf == -1)\n\t\t\tthrow new InputMismatchException();\n\t\tif (ptrbuf >= lenbuf) {\n\t\t\tptrbuf = 0;\n\t\t\ttry {\n\t\t\t\tlenbuf = is.read(inbuf);\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new InputMismatchException();\n\t\t\t}\n\t\t\tif (lenbuf <= 0)\n\t\t\t\treturn -1;\n\t\t}\n\t\treturn inbuf[ptrbuf++];\n\t}\n\n\tprivate boolean isSpaceChar(int c) {\n\t\treturn !(c >= 33 && c <= 126);\n\t}\n\n\tprivate int skip() {\n\t\tint b;\n\t\twhile ((b = readByte()) != -1 && isSpaceChar(b))\n\t\t\t;\n\t\treturn b;\n\t}\n\n\tprivate double nd() {\n\t\treturn Double.parseDouble(ns());\n\t}\n\n\tprivate char nc() {\n\t\treturn (char) skip();\n\t}\n\n\tprivate String ns() {\n\t\tint b = skip();\n\t\tStringBuilder sb = new StringBuilder();\n\t\twhile (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\n\tprivate char[] ns(int n) {\n\t\tchar[] buf = new char[n];\n\t\tint b = skip(), p = 0;\n\t\twhile (p < n && !(isSpaceChar(b))) {\n\t\t\tbuf[p++] = (char) b;\n\t\t\tb = readByte();\n\t\t}\n\t\treturn n == p ? buf : Arrays.copyOf(buf, p);\n\t}\n\n\tprivate char[][] nm(int n, int m) {\n\t\tchar[][] map = new char[n][];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tmap[i] = ns(m);\n\t\treturn map;\n\t}\n\n\tprivate int[] na(int n) {\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = ni();\n\t\treturn a;\n\t}\n\n\tprivate int ni() {\n\t\tint num = 0, b;\n\t\tboolean minus = false;\n\t\twhile ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))\n\t\t\t;\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\n\t\twhile (true) {\n\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t} else {\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n\tprivate long nl() {\n\t\tlong num = 0;\n\t\tint b;\n\t\tboolean minus = false;\n\t\twhile ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))\n\t\t\t;\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\n\t\twhile (true) {\n\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t} else {\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n\tprivate static void tr(Object... o) {\n\t\tSystem.out.println(Arrays.deepToString(o));\n\t}\n}", "language": "Java", "metadata": {"date": 1587417362, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02705.html", "problem_id": "p02705", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02705/input.txt", "sample_output_relpath": "derived/input_output/data/p02705/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02705/Java/s800269046.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s800269046", "user_id": "u781719273"}, "prompt_components": {"gold_output": "6.28318530717958623200\n", "input_to_evaluate": "import java.io.ByteArrayInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.InputMismatchException;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.TreeSet;\n\npublic class Main {\n\tInputStream is;\n\tPrintWriter out;\n\tString INPUT = \"\";\n\n\tvoid solve() {\n\t\tout.println(2 * Math.PI * ni());\n\t}\n\t\t\n\tvoid run() throws Exception {\n\t\tis = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());\n\t\tout = new PrintWriter(System.out);\n\n\t\tlong s = System.currentTimeMillis();\n\t\tsolve();\n\t\tout.flush();\n\t\tif (!INPUT.isEmpty())\n\t\t\ttr(System.currentTimeMillis() - s + \"ms\");\n\t}\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tnew Main().run();\n\t}\n\n\tprivate byte[] inbuf = new byte[1024];\n\tpublic int lenbuf = 0, ptrbuf = 0;\n\n\tprivate int readByte() {\n\t\tif (lenbuf == -1)\n\t\t\tthrow new InputMismatchException();\n\t\tif (ptrbuf >= lenbuf) {\n\t\t\tptrbuf = 0;\n\t\t\ttry {\n\t\t\t\tlenbuf = is.read(inbuf);\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new InputMismatchException();\n\t\t\t}\n\t\t\tif (lenbuf <= 0)\n\t\t\t\treturn -1;\n\t\t}\n\t\treturn inbuf[ptrbuf++];\n\t}\n\n\tprivate boolean isSpaceChar(int c) {\n\t\treturn !(c >= 33 && c <= 126);\n\t}\n\n\tprivate int skip() {\n\t\tint b;\n\t\twhile ((b = readByte()) != -1 && isSpaceChar(b))\n\t\t\t;\n\t\treturn b;\n\t}\n\n\tprivate double nd() {\n\t\treturn Double.parseDouble(ns());\n\t}\n\n\tprivate char nc() {\n\t\treturn (char) skip();\n\t}\n\n\tprivate String ns() {\n\t\tint b = skip();\n\t\tStringBuilder sb = new StringBuilder();\n\t\twhile (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\n\tprivate char[] ns(int n) {\n\t\tchar[] buf = new char[n];\n\t\tint b = skip(), p = 0;\n\t\twhile (p < n && !(isSpaceChar(b))) {\n\t\t\tbuf[p++] = (char) b;\n\t\t\tb = readByte();\n\t\t}\n\t\treturn n == p ? buf : Arrays.copyOf(buf, p);\n\t}\n\n\tprivate char[][] nm(int n, int m) {\n\t\tchar[][] map = new char[n][];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tmap[i] = ns(m);\n\t\treturn map;\n\t}\n\n\tprivate int[] na(int n) {\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = ni();\n\t\treturn a;\n\t}\n\n\tprivate int ni() {\n\t\tint num = 0, b;\n\t\tboolean minus = false;\n\t\twhile ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))\n\t\t\t;\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\n\t\twhile (true) {\n\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t} else {\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n\tprivate long nl() {\n\t\tlong num = 0;\n\t\tint b;\n\t\tboolean minus = false;\n\t\twhile ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))\n\t\t\t;\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\n\t\twhile (true) {\n\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t} else {\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n\tprivate static void tr(Object... o) {\n\t\tSystem.out.println(Arrays.deepToString(o));\n\t}\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "sample_input": "1\n"}, "reference_outputs": ["6.28318530717958623200\n"], "source_document_id": "p02705", "source_text": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3004, "cpu_time_ms": 64, "memory_kb": 33300}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s564173898", "group_id": "codeNet:p02705", "input_text": " import java.util.*;\n public class Main{\n \n public static void main(String []args){\n Scanner in = new Scanner(System.in);\n double PI = 2 * Math.acos(0.0);\n int r = in.nextInt();\n System.out.println(2 * PI * r);\n }\n }", "language": "Java", "metadata": {"date": 1587397990, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02705.html", "problem_id": "p02705", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02705/input.txt", "sample_output_relpath": "derived/input_output/data/p02705/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02705/Java/s564173898.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s564173898", "user_id": "u112714855"}, "prompt_components": {"gold_output": "6.28318530717958623200\n", "input_to_evaluate": " import java.util.*;\n public class Main{\n \n public static void main(String []args){\n Scanner in = new Scanner(System.in);\n double PI = 2 * Math.acos(0.0);\n int r = in.nextInt();\n System.out.println(2 * PI * r);\n }\n }", "problem_context": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "sample_input": "1\n"}, "reference_outputs": ["6.28318530717958623200\n"], "source_document_id": "p02705", "source_text": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 105, "memory_kb": 35992}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s141086492", "group_id": "codeNet:p02705", "input_text": "import java.util.Scanner;\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n double r=sc.nextDouble();\n System.out.println(r*r*Math.PI);\n \n }\n}\n", "language": "Java", "metadata": {"date": 1587389320, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02705.html", "problem_id": "p02705", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02705/input.txt", "sample_output_relpath": "derived/input_output/data/p02705/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02705/Java/s141086492.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s141086492", "user_id": "u618325650"}, "prompt_components": {"gold_output": "6.28318530717958623200\n", "input_to_evaluate": "import java.util.Scanner;\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n double r=sc.nextDouble();\n System.out.println(r*r*Math.PI);\n \n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "sample_input": "1\n"}, "reference_outputs": ["6.28318530717958623200\n"], "source_document_id": "p02705", "source_text": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 206, "cpu_time_ms": 111, "memory_kb": 37536}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s345228960", "group_id": "codeNet:p02705", "input_text": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\nimport java.lang.Math;\n\npublic class Main {\n\n private static Scanner sc;\n\n public static void main(String[] args) {\n Main instance = new Main();\n sc = instance.new Scanner();\n instance.solve();\n }\n\n private void solve() {\n try {\n int R = sc.nextInt();\n\n double ans = R*2*Math.PI;\n \n System.out.println(ans);\n } catch (Exception e) {\n e.printStackTrace();\n }\n }\n\n private class Scanner {\n String[] s;\n int i;\n BufferedReader br;\n String regex = \" \";\n\n public Scanner() {\n s = new String[0];\n i = 0;\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n @Override\n protected void finalize() throws Throwable {\n try {\n super.finalize();\n } finally {\n destruction();\n }\n }\n\n private void destruction() throws IOException {\n if (br != null) br.close();\n }\n\n public String next() throws IOException {\n if (i < s.length) return s[i++];\n String st = br.readLine();\n while (st == \"\") st = br.readLine();\n s = st.split(regex, 0);\n i = 0;\n return s[i++];\n }\n\n public int nextInt() throws NumberFormatException, IOException {\n return Integer.parseInt(next());\n }\n\n public Long nextLong() throws NumberFormatException, IOException {\n return Long.parseLong(next());\n }\n\n public Double nextDouble() throws NumberFormatException, IOException {\n return Double.parseDouble(next());\n }\n }\n}", "language": "Java", "metadata": {"date": 1587345776, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02705.html", "problem_id": "p02705", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02705/input.txt", "sample_output_relpath": "derived/input_output/data/p02705/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02705/Java/s345228960.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s345228960", "user_id": "u930691609"}, "prompt_components": {"gold_output": "6.28318530717958623200\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\nimport java.lang.Math;\n\npublic class Main {\n\n private static Scanner sc;\n\n public static void main(String[] args) {\n Main instance = new Main();\n sc = instance.new Scanner();\n instance.solve();\n }\n\n private void solve() {\n try {\n int R = sc.nextInt();\n\n double ans = R*2*Math.PI;\n \n System.out.println(ans);\n } catch (Exception e) {\n e.printStackTrace();\n }\n }\n\n private class Scanner {\n String[] s;\n int i;\n BufferedReader br;\n String regex = \" \";\n\n public Scanner() {\n s = new String[0];\n i = 0;\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n @Override\n protected void finalize() throws Throwable {\n try {\n super.finalize();\n } finally {\n destruction();\n }\n }\n\n private void destruction() throws IOException {\n if (br != null) br.close();\n }\n\n public String next() throws IOException {\n if (i < s.length) return s[i++];\n String st = br.readLine();\n while (st == \"\") st = br.readLine();\n s = st.split(regex, 0);\n i = 0;\n return s[i++];\n }\n\n public int nextInt() throws NumberFormatException, IOException {\n return Integer.parseInt(next());\n }\n\n public Long nextLong() throws NumberFormatException, IOException {\n return Long.parseLong(next());\n }\n\n public Double nextDouble() throws NumberFormatException, IOException {\n return Double.parseDouble(next());\n }\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "sample_input": "1\n"}, "reference_outputs": ["6.28318530717958623200\n"], "source_document_id": "p02705", "source_text": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1913, "cpu_time_ms": 77, "memory_kb": 33072}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s256361786", "group_id": "codeNet:p02705", "input_text": "public class Main {\n public static void main(String[] args) {\n int value = Integer.parseInt(readLine(255));\n System.out.printf(\"%f\",(2*Math.PI*value));\n }\n\n public static String readLine(int maxLen){\n int[] holder = new int[maxLen];\n int counter =0, reader =1;\n\n try{\n while(counter < maxLen){\n reader = System.in.read();\n if(reader <0 || (reader =='\\n'))break;\n holder[counter++] = reader;\n }\n }catch(Exception ex){\n return (null);\n }\n\n if(counter ==0 && reader <0)return (null);\n return new String(holder,0,counter);\n }\n}\n", "language": "Java", "metadata": {"date": 1587345622, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02705.html", "problem_id": "p02705", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02705/input.txt", "sample_output_relpath": "derived/input_output/data/p02705/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02705/Java/s256361786.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s256361786", "user_id": "u728468951"}, "prompt_components": {"gold_output": "6.28318530717958623200\n", "input_to_evaluate": "public class Main {\n public static void main(String[] args) {\n int value = Integer.parseInt(readLine(255));\n System.out.printf(\"%f\",(2*Math.PI*value));\n }\n\n public static String readLine(int maxLen){\n int[] holder = new int[maxLen];\n int counter =0, reader =1;\n\n try{\n while(counter < maxLen){\n reader = System.in.read();\n if(reader <0 || (reader =='\\n'))break;\n holder[counter++] = reader;\n }\n }catch(Exception ex){\n return (null);\n }\n\n if(counter ==0 && reader <0)return (null);\n return new String(holder,0,counter);\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "sample_input": "1\n"}, "reference_outputs": ["6.28318530717958623200\n"], "source_document_id": "p02705", "source_text": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 678, "cpu_time_ms": 69, "memory_kb": 25696}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s427537131", "group_id": "codeNet:p02705", "input_text": "import java.util.Scanner;\n\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\t\n\t\t\t\n\t\tScanner sc = new Scanner(System.in);\n\t\tint r = sc.nextInt();\n\t\t\n\t\tSystem.out.println(r*Math.PI);\n\t}\n\n}", "language": "Java", "metadata": {"date": 1587345338, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02705.html", "problem_id": "p02705", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02705/input.txt", "sample_output_relpath": "derived/input_output/data/p02705/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02705/Java/s427537131.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s427537131", "user_id": "u599968009"}, "prompt_components": {"gold_output": "6.28318530717958623200\n", "input_to_evaluate": "import java.util.Scanner;\n\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\t\n\t\t\t\n\t\tScanner sc = new Scanner(System.in);\n\t\tint r = sc.nextInt();\n\t\t\n\t\tSystem.out.println(r*Math.PI);\n\t}\n\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "sample_input": "1\n"}, "reference_outputs": ["6.28318530717958623200\n"], "source_document_id": "p02705", "source_text": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 108, "memory_kb": 35900}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s234462104", "group_id": "codeNet:p02705", "input_text": "import java.util.Scanner;\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner stdIn = new Scanner(System.in);\n\t\t\n\t\tint r = stdIn.nextInt();\n\t\tSystem.out.println(Math.PI*r*2);\n\t\t\n\t\t\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1587345329, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02705.html", "problem_id": "p02705", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02705/input.txt", "sample_output_relpath": "derived/input_output/data/p02705/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02705/Java/s234462104.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s234462104", "user_id": "u015418292"}, "prompt_components": {"gold_output": "6.28318530717958623200\n", "input_to_evaluate": "import java.util.Scanner;\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner stdIn = new Scanner(System.in);\n\t\t\n\t\tint r = stdIn.nextInt();\n\t\tSystem.out.println(Math.PI*r*2);\n\t\t\n\t\t\n\t}\n\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "sample_input": "1\n"}, "reference_outputs": ["6.28318530717958623200\n"], "source_document_id": "p02705", "source_text": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 110, "memory_kb": 35876}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s465727776", "group_id": "codeNet:p02705", "input_text": "\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.math.BigDecimal;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\n\tpublic static void main(String args[]) throws Exception {\n\t\tMyScanner sc = new MyScanner();\n\t\tint t = sc.nextInt();\n\t\tBigDecimal r = new BigDecimal(Integer.toString(t));\n\t\tBigDecimal area = new BigDecimal(\"0\");\n\t\tBigDecimal two = new BigDecimal(\"2.0\");\n\t\tBigDecimal pi = new BigDecimal(Double.toString(Math.PI));\n\t\tarea = two.multiply(r).multiply(pi);\n\t\tSystem.out.println(area);\n\t}\n\n\tpublic static class MyScanner {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\n\t\tpublic MyScanner() {\n\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\t}\n\n\t\tString next() {\n\t\t\twhile (st == null || !st.hasMoreElements()) {\n\t\t\t\ttry {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tint nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tlong nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tdouble nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tString nextLine() {\n\t\t\tString str = \"\";\n\t\t\ttry {\n\t\t\t\tstr = br.readLine();\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\treturn str;\n\t\t}\n\t}\n}", "language": "Java", "metadata": {"date": 1587345147, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02705.html", "problem_id": "p02705", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02705/input.txt", "sample_output_relpath": "derived/input_output/data/p02705/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02705/Java/s465727776.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s465727776", "user_id": "u928306508"}, "prompt_components": {"gold_output": "6.28318530717958623200\n", "input_to_evaluate": "\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.math.BigDecimal;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\n\tpublic static void main(String args[]) throws Exception {\n\t\tMyScanner sc = new MyScanner();\n\t\tint t = sc.nextInt();\n\t\tBigDecimal r = new BigDecimal(Integer.toString(t));\n\t\tBigDecimal area = new BigDecimal(\"0\");\n\t\tBigDecimal two = new BigDecimal(\"2.0\");\n\t\tBigDecimal pi = new BigDecimal(Double.toString(Math.PI));\n\t\tarea = two.multiply(r).multiply(pi);\n\t\tSystem.out.println(area);\n\t}\n\n\tpublic static class MyScanner {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\n\t\tpublic MyScanner() {\n\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\t}\n\n\t\tString next() {\n\t\t\twhile (st == null || !st.hasMoreElements()) {\n\t\t\t\ttry {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tint nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tlong nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tdouble nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tString nextLine() {\n\t\t\tString str = \"\";\n\t\t\ttry {\n\t\t\t\tstr = br.readLine();\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\treturn str;\n\t\t}\n\t}\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "sample_input": "1\n"}, "reference_outputs": ["6.28318530717958623200\n"], "source_document_id": "p02705", "source_text": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1296, "cpu_time_ms": 69, "memory_kb": 33656}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s260364287", "group_id": "codeNet:p02705", "input_text": "import java.util.*;\n\n\npublic class Main {\n public static void main(String[] args) {\n \n Scanner sc = new Scanner(System.in);\n double r = Double.parseDouble(sc.next());\n \n System.out.println(calCircumference(r));\n \n }\n private static double calCircumference(double r) {\n return 2 * Math.PI * r;\n }\n}", "language": "Java", "metadata": {"date": 1587345007, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02705.html", "problem_id": "p02705", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02705/input.txt", "sample_output_relpath": "derived/input_output/data/p02705/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02705/Java/s260364287.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s260364287", "user_id": "u244401500"}, "prompt_components": {"gold_output": "6.28318530717958623200\n", "input_to_evaluate": "import java.util.*;\n\n\npublic class Main {\n public static void main(String[] args) {\n \n Scanner sc = new Scanner(System.in);\n double r = Double.parseDouble(sc.next());\n \n System.out.println(calCircumference(r));\n \n }\n private static double calCircumference(double r) {\n return 2 * Math.PI * r;\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "sample_input": "1\n"}, "reference_outputs": ["6.28318530717958623200\n"], "source_document_id": "p02705", "source_text": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 92, "memory_kb": 27120}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s619490910", "group_id": "codeNet:p02705", "input_text": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\nimport java.io.IOException;\nimport java.io.BufferedReader;\nimport java.io.FileReader;\nimport java.io.InputStreamReader;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n CirclePond solver = new CirclePond();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class CirclePond {\n public void solve(int testNumber, Scanner sc, PrintWriter pw) {\n pw.println(2d * sc.nextInt() * Math.PI);\n }\n\n }\n\n static class Scanner {\n StringTokenizer st;\n BufferedReader br;\n\n public Scanner(FileReader r) {\n br = new BufferedReader(r);\n }\n\n public Scanner(InputStream s) {\n br = new BufferedReader(new InputStreamReader(s));\n }\n\n public String next() {\n while (st == null || !st.hasMoreTokens()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return st.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n }\n}\n\n", "language": "Java", "metadata": {"date": 1587344931, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02705.html", "problem_id": "p02705", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02705/input.txt", "sample_output_relpath": "derived/input_output/data/p02705/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02705/Java/s619490910.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s619490910", "user_id": "u145472183"}, "prompt_components": {"gold_output": "6.28318530717958623200\n", "input_to_evaluate": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\nimport java.io.IOException;\nimport java.io.BufferedReader;\nimport java.io.FileReader;\nimport java.io.InputStreamReader;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n CirclePond solver = new CirclePond();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class CirclePond {\n public void solve(int testNumber, Scanner sc, PrintWriter pw) {\n pw.println(2d * sc.nextInt() * Math.PI);\n }\n\n }\n\n static class Scanner {\n StringTokenizer st;\n BufferedReader br;\n\n public Scanner(FileReader r) {\n br = new BufferedReader(r);\n }\n\n public Scanner(InputStream s) {\n br = new BufferedReader(new InputStreamReader(s));\n }\n\n public String next() {\n while (st == null || !st.hasMoreTokens()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return st.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n }\n}\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "sample_input": "1\n"}, "reference_outputs": ["6.28318530717958623200\n"], "source_document_id": "p02705", "source_text": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1635, "cpu_time_ms": 73, "memory_kb": 33404}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s109762385", "group_id": "codeNet:p02705", "input_text": "\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\n\tpublic static void main(String args[]) throws Exception {\n\t\tMyScanner sc = new MyScanner();\n\t\tint t = sc.nextInt();\n\t\tdouble area = (2 * Math.PI * (double)t);\n\t\tSystem.out.println(area);\n\t}\n\n\tpublic static class MyScanner {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\n\t\tpublic MyScanner() {\n\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\t}\n\n\t\tString next() {\n\t\t\twhile (st == null || !st.hasMoreElements()) {\n\t\t\t\ttry {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tint nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tlong nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tdouble nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tString nextLine() {\n\t\t\tString str = \"\";\n\t\t\ttry {\n\t\t\t\tstr = br.readLine();\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\treturn str;\n\t\t}\n\t}\n}\n", "language": "Java", "metadata": {"date": 1587344863, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02705.html", "problem_id": "p02705", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02705/input.txt", "sample_output_relpath": "derived/input_output/data/p02705/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02705/Java/s109762385.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s109762385", "user_id": "u928306508"}, "prompt_components": {"gold_output": "6.28318530717958623200\n", "input_to_evaluate": "\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\n\tpublic static void main(String args[]) throws Exception {\n\t\tMyScanner sc = new MyScanner();\n\t\tint t = sc.nextInt();\n\t\tdouble area = (2 * Math.PI * (double)t);\n\t\tSystem.out.println(area);\n\t}\n\n\tpublic static class MyScanner {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\n\t\tpublic MyScanner() {\n\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\t}\n\n\t\tString next() {\n\t\t\twhile (st == null || !st.hasMoreElements()) {\n\t\t\t\ttry {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tint nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tlong nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tdouble nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tString nextLine() {\n\t\t\tString str = \"\";\n\t\t\ttry {\n\t\t\t\tstr = br.readLine();\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\treturn str;\n\t\t}\n\t}\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "sample_input": "1\n"}, "reference_outputs": ["6.28318530717958623200\n"], "source_document_id": "p02705", "source_text": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1075, "cpu_time_ms": 74, "memory_kb": 33088}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s083652463", "group_id": "codeNet:p02705", "input_text": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\npublic class Main {\n private static class FastScanner {\n private BufferedReader reader = null;\n private StringTokenizer tokenizer = null;\n\n public FastScanner(InputStream in) {\n reader = new BufferedReader(new InputStreamReader(in));\n tokenizer = null;\n }\n\n public String next() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public String nextLine() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n return reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n\n return tokenizer.nextToken(\"\\n\");\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public int[] nextIntArray(int n) {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n return a;\n }\n\n public long[] nextLongArray(int n) {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = nextLong();\n return a;\n }\n }\n\n public static void main(String[] args) {\n FastScanner sc = new FastScanner(System.in);\n int r = sc.nextInt();\n System.out.println(2.0 * (double) r * Math.PI);\n }\n}", "language": "Java", "metadata": {"date": 1587344784, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02705.html", "problem_id": "p02705", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02705/input.txt", "sample_output_relpath": "derived/input_output/data/p02705/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02705/Java/s083652463.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s083652463", "user_id": "u562002567"}, "prompt_components": {"gold_output": "6.28318530717958623200\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\npublic class Main {\n private static class FastScanner {\n private BufferedReader reader = null;\n private StringTokenizer tokenizer = null;\n\n public FastScanner(InputStream in) {\n reader = new BufferedReader(new InputStreamReader(in));\n tokenizer = null;\n }\n\n public String next() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public String nextLine() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n return reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n\n return tokenizer.nextToken(\"\\n\");\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public int[] nextIntArray(int n) {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n return a;\n }\n\n public long[] nextLongArray(int n) {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = nextLong();\n return a;\n }\n }\n\n public static void main(String[] args) {\n FastScanner sc = new FastScanner(System.in);\n int r = sc.nextInt();\n System.out.println(2.0 * (double) r * Math.PI);\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "sample_input": "1\n"}, "reference_outputs": ["6.28318530717958623200\n"], "source_document_id": "p02705", "source_text": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1730, "cpu_time_ms": 72, "memory_kb": 33044}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s044911647", "group_id": "codeNet:p02705", "input_text": "import java.util.Scanner;\n\npublic class Main{\n\n\tpublic static void main(String args[]){\n\t\tScanner scan = new Scanner(System.in);\n\t\tint R = scan.nextInt();\n\t\tdouble result = R*2*3.1415;\n\t\tscan.close();\n\t\tSystem.out.println(result);\n\t}\n}", "language": "Java", "metadata": {"date": 1587344754, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02705.html", "problem_id": "p02705", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02705/input.txt", "sample_output_relpath": "derived/input_output/data/p02705/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02705/Java/s044911647.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s044911647", "user_id": "u610133777"}, "prompt_components": {"gold_output": "6.28318530717958623200\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main{\n\n\tpublic static void main(String args[]){\n\t\tScanner scan = new Scanner(System.in);\n\t\tint R = scan.nextInt();\n\t\tdouble result = R*2*3.1415;\n\t\tscan.close();\n\t\tSystem.out.println(result);\n\t}\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "sample_input": "1\n"}, "reference_outputs": ["6.28318530717958623200\n"], "source_document_id": "p02705", "source_text": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 235, "cpu_time_ms": 117, "memory_kb": 35856}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s957838292", "group_id": "codeNet:p02705", "input_text": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n double n = sc.nextDouble();\n System.out.println(2 * n * Math.PI);\n }\n}\n", "language": "Java", "metadata": {"date": 1587344696, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02705.html", "problem_id": "p02705", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02705/input.txt", "sample_output_relpath": "derived/input_output/data/p02705/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02705/Java/s957838292.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s957838292", "user_id": "u886708442"}, "prompt_components": {"gold_output": "6.28318530717958623200\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n double n = sc.nextDouble();\n System.out.println(2 * n * Math.PI);\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "sample_input": "1\n"}, "reference_outputs": ["6.28318530717958623200\n"], "source_document_id": "p02705", "source_text": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 114, "memory_kb": 37424}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s287828921", "group_id": "codeNet:p02705", "input_text": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n String str = scan.nextLine();\n int input = Integer.parseInt(str);\n System.out.println(Math.PI*input*2);\n }\n}\n", "language": "Java", "metadata": {"date": 1587344690, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02705.html", "problem_id": "p02705", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02705/input.txt", "sample_output_relpath": "derived/input_output/data/p02705/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02705/Java/s287828921.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s287828921", "user_id": "u378454744"}, "prompt_components": {"gold_output": "6.28318530717958623200\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n String str = scan.nextLine();\n int input = Integer.parseInt(str);\n System.out.println(Math.PI*input*2);\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "sample_input": "1\n"}, "reference_outputs": ["6.28318530717958623200\n"], "source_document_id": "p02705", "source_text": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 117, "memory_kb": 35892}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s146502618", "group_id": "codeNet:p02705", "input_text": "import java.util.*;\n\npublic class Main{\n final static long mod = 1000000007;\n //\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n double r = sc.nextDouble();\n System.out.println(r * 2 * Math.PI);\n }\n}", "language": "Java", "metadata": {"date": 1587344615, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02705.html", "problem_id": "p02705", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02705/input.txt", "sample_output_relpath": "derived/input_output/data/p02705/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02705/Java/s146502618.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s146502618", "user_id": "u369712616"}, "prompt_components": {"gold_output": "6.28318530717958623200\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main{\n final static long mod = 1000000007;\n //\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n double r = sc.nextDouble();\n System.out.println(r * 2 * Math.PI);\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "sample_input": "1\n"}, "reference_outputs": ["6.28318530717958623200\n"], "source_document_id": "p02705", "source_text": "Score : 100 points\n\nProblem Statement\n\nPrint the circumference of a circle of radius R.\n\nConstraints\n\n1 \\leq R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the circumference of the circle.\nYour output is considered correct if and only if its absolute or relative error from our answer is at most 10^{-2}.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n6.28318530717958623200\n\nSince we accept an absolute or relative error of at most 10^{-2}, 6.28 is also an acceptable output, but 6 is not.\n\nSample Input 2\n\n73\n\nSample Output 2\n\n458.67252742410977361942", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 264, "cpu_time_ms": 129, "memory_kb": 37404}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s054935940", "group_id": "codeNet:p02711", "input_text": "import java.util.*;\n \npublic class Main {\n public static void main(String[] args){\n \n Scanner sc = new Scanner(System.in);\n long N = sc.nextLong();\n\n long ans = 0;\n for(long i=0; i 0) {\n if (N % 10 == 7) {\n System.out.println(\"Yes\");\n return;\n }\n N /= 10;\n }\n System.out.println(\"No\");\n }\n}\n", "language": "Java", "metadata": {"date": 1586742144, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02711.html", "problem_id": "p02711", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02711/input.txt", "sample_output_relpath": "derived/input_output/data/p02711/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02711/Java/s862053720.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s862053720", "user_id": "u915981080"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n while (N > 0) {\n if (N % 10 == 7) {\n System.out.println(\"Yes\");\n return;\n }\n N /= 10;\n }\n System.out.println(\"No\");\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven is a three-digit integer N. Does N contain the digit 7?\n\nIf so, print Yes; otherwise, print No.\n\nConstraints\n\n100 \\leq N \\leq 999\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf N contains the digit 7, print Yes; otherwise, print No.\n\nSample Input 1\n\n117\n\nSample Output 1\n\nYes\n\n117 contains 7 as its last digit.\n\nSample Input 2\n\n123\n\nSample Output 2\n\nNo\n\n123 does not contain the digit 7.\n\nSample Input 3\n\n777\n\nSample Output 3\n\nYes", "sample_input": "117\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02711", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven is a three-digit integer N. Does N contain the digit 7?\n\nIf so, print Yes; otherwise, print No.\n\nConstraints\n\n100 \\leq N \\leq 999\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf N contains the digit 7, print Yes; otherwise, print No.\n\nSample Input 1\n\n117\n\nSample Output 1\n\nYes\n\n117 contains 7 as its last digit.\n\nSample Input 2\n\n123\n\nSample Output 2\n\nNo\n\n123 does not contain the digit 7.\n\nSample Input 3\n\n777\n\nSample Output 3\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 318, "cpu_time_ms": 107, "memory_kb": 35676}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s123359015", "group_id": "codeNet:p02711", "input_text": "import java.util.*;\n\npublic class Main {\n private static String solve(int in) {\n while (in > 0) {\n if(in % 10 == 7)\n return \"YES\";\n in = in / 10;\n }\n return \"NO\";\n }\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int in = sc.nextInt();\n sc.close();\n System.out.println(solve(in));\n }\n}\n", "language": "Java", "metadata": {"date": 1586740473, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02711.html", "problem_id": "p02711", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02711/input.txt", "sample_output_relpath": "derived/input_output/data/p02711/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02711/Java/s123359015.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s123359015", "user_id": "u956440423"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n private static String solve(int in) {\n while (in > 0) {\n if(in % 10 == 7)\n return \"YES\";\n in = in / 10;\n }\n return \"NO\";\n }\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int in = sc.nextInt();\n sc.close();\n System.out.println(solve(in));\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven is a three-digit integer N. Does N contain the digit 7?\n\nIf so, print Yes; otherwise, print No.\n\nConstraints\n\n100 \\leq N \\leq 999\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf N contains the digit 7, print Yes; otherwise, print No.\n\nSample Input 1\n\n117\n\nSample Output 1\n\nYes\n\n117 contains 7 as its last digit.\n\nSample Input 2\n\n123\n\nSample Output 2\n\nNo\n\n123 does not contain the digit 7.\n\nSample Input 3\n\n777\n\nSample Output 3\n\nYes", "sample_input": "117\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02711", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven is a three-digit integer N. Does N contain the digit 7?\n\nIf so, print Yes; otherwise, print No.\n\nConstraints\n\n100 \\leq N \\leq 999\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf N contains the digit 7, print Yes; otherwise, print No.\n\nSample Input 1\n\n117\n\nSample Output 1\n\nYes\n\n117 contains 7 as its last digit.\n\nSample Input 2\n\n123\n\nSample Output 2\n\nNo\n\n123 does not contain the digit 7.\n\nSample Input 3\n\n777\n\nSample Output 3\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 128, "memory_kb": 35764}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s292882298", "group_id": "codeNet:p02711", "input_text": "import java.util.*;\npublic class Main {\n public static void main(String[] args) {\n\n Scanner scan = new Scanner(System.in);\n int n=scan.nextInt();\n\n int hundreds = n / 100;\n int tens = (n / 10) % 10; // (n % 100) / 10\n int ones = n % 10;\n\n //System.out.println(\"【\" + n + \"】の各位の数\");\n // System.out.println(\"百の位 : \" + hundreds);\n //System.out.println(\"十の位 : \" + tens);\n //System.out.println(\"一の位 : \" + ones);\n while (true){\n if(hundreds/7==1){\n System.out.println(\"Yes\");\n break;\n }\n if (tens/7==1){\n System.out.println(\"Yes\");\n break;\n }\n if (ones/7==1){\n System.out.println(\"Yes\");\n break;\n }\n else {\n System.out.println(\"No\");\n break;\n }\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1586740455, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02711.html", "problem_id": "p02711", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02711/input.txt", "sample_output_relpath": "derived/input_output/data/p02711/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02711/Java/s292882298.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s292882298", "user_id": "u542896063"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n public static void main(String[] args) {\n\n Scanner scan = new Scanner(System.in);\n int n=scan.nextInt();\n\n int hundreds = n / 100;\n int tens = (n / 10) % 10; // (n % 100) / 10\n int ones = n % 10;\n\n //System.out.println(\"【\" + n + \"】の各位の数\");\n // System.out.println(\"百の位 : \" + hundreds);\n //System.out.println(\"十の位 : \" + tens);\n //System.out.println(\"一の位 : \" + ones);\n while (true){\n if(hundreds/7==1){\n System.out.println(\"Yes\");\n break;\n }\n if (tens/7==1){\n System.out.println(\"Yes\");\n break;\n }\n if (ones/7==1){\n System.out.println(\"Yes\");\n break;\n }\n else {\n System.out.println(\"No\");\n break;\n }\n }\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven is a three-digit integer N. Does N contain the digit 7?\n\nIf so, print Yes; otherwise, print No.\n\nConstraints\n\n100 \\leq N \\leq 999\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf N contains the digit 7, print Yes; otherwise, print No.\n\nSample Input 1\n\n117\n\nSample Output 1\n\nYes\n\n117 contains 7 as its last digit.\n\nSample Input 2\n\n123\n\nSample Output 2\n\nNo\n\n123 does not contain the digit 7.\n\nSample Input 3\n\n777\n\nSample Output 3\n\nYes", "sample_input": "117\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02711", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven is a three-digit integer N. Does N contain the digit 7?\n\nIf so, print Yes; otherwise, print No.\n\nConstraints\n\n100 \\leq N \\leq 999\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf N contains the digit 7, print Yes; otherwise, print No.\n\nSample Input 1\n\n117\n\nSample Output 1\n\nYes\n\n117 contains 7 as its last digit.\n\nSample Input 2\n\n123\n\nSample Output 2\n\nNo\n\n123 does not contain the digit 7.\n\nSample Input 3\n\n777\n\nSample Output 3\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 968, "cpu_time_ms": 106, "memory_kb": 35724}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s085569822", "group_id": "codeNet:p02711", "input_text": "import java.util.*;\nimport java.io.*;\n \npublic class Main {\n public static void main(String[] args) throws Exception{\n FastScanner sc = new FastScanner(System.in);\n int n = sc.nextInt();\n new Solution(n);\n }\n}\n\nclass Solution {\n public Solution(int n) {\n boolean res = false;\n while(n > 0) {\n if(n % 10 == 7) res = true;\n n /= 10;\n }\n if(res) System.out.println(\"Yes\");\n else System.out.println(\"No\");\n }\n}\n\n\n\nclass FastScanner {\n private final InputStream in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n public FastScanner(InputStream source) {\n in = source;\n }\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte()) return buffer[ptr++];\n else return -1;\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext()) throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext()) throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)\n throw new NumberFormatException();\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n}", "language": "Java", "metadata": {"date": 1586740247, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02711.html", "problem_id": "p02711", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02711/input.txt", "sample_output_relpath": "derived/input_output/data/p02711/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02711/Java/s085569822.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s085569822", "user_id": "u530712718"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\n \npublic class Main {\n public static void main(String[] args) throws Exception{\n FastScanner sc = new FastScanner(System.in);\n int n = sc.nextInt();\n new Solution(n);\n }\n}\n\nclass Solution {\n public Solution(int n) {\n boolean res = false;\n while(n > 0) {\n if(n % 10 == 7) res = true;\n n /= 10;\n }\n if(res) System.out.println(\"Yes\");\n else System.out.println(\"No\");\n }\n}\n\n\n\nclass FastScanner {\n private final InputStream in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n public FastScanner(InputStream source) {\n in = source;\n }\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte()) return buffer[ptr++];\n else return -1;\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext()) throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext()) throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)\n throw new NumberFormatException();\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven is a three-digit integer N. Does N contain the digit 7?\n\nIf so, print Yes; otherwise, print No.\n\nConstraints\n\n100 \\leq N \\leq 999\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf N contains the digit 7, print Yes; otherwise, print No.\n\nSample Input 1\n\n117\n\nSample Output 1\n\nYes\n\n117 contains 7 as its last digit.\n\nSample Input 2\n\n123\n\nSample Output 2\n\nNo\n\n123 does not contain the digit 7.\n\nSample Input 3\n\n777\n\nSample Output 3\n\nYes", "sample_input": "117\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02711", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven is a three-digit integer N. Does N contain the digit 7?\n\nIf so, print Yes; otherwise, print No.\n\nConstraints\n\n100 \\leq N \\leq 999\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf N contains the digit 7, print Yes; otherwise, print No.\n\nSample Input 1\n\n117\n\nSample Output 1\n\nYes\n\n117 contains 7 as its last digit.\n\nSample Input 2\n\n123\n\nSample Output 2\n\nNo\n\n123 does not contain the digit 7.\n\nSample Input 3\n\n777\n\nSample Output 3\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2365, "cpu_time_ms": 63, "memory_kb": 25460}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s049287578", "group_id": "codeNet:p02711", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\twhile (N>0) {\n\t\t\tif (N%10==7) {\n\t\t\t\tSystem.out.println(\"Yes\");\n\t\t\t\treturn ;\n\t\t\t}\n\t\t\tN=N/10;\n\t\t}\n\t\tSystem.out.println(\"No\");\n \t}\n}\n", "language": "Java", "metadata": {"date": 1586739721, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02711.html", "problem_id": "p02711", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02711/input.txt", "sample_output_relpath": "derived/input_output/data/p02711/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02711/Java/s049287578.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s049287578", "user_id": "u476635134"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\twhile (N>0) {\n\t\t\tif (N%10==7) {\n\t\t\t\tSystem.out.println(\"Yes\");\n\t\t\t\treturn ;\n\t\t\t}\n\t\t\tN=N/10;\n\t\t}\n\t\tSystem.out.println(\"No\");\n \t}\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven is a three-digit integer N. Does N contain the digit 7?\n\nIf so, print Yes; otherwise, print No.\n\nConstraints\n\n100 \\leq N \\leq 999\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf N contains the digit 7, print Yes; otherwise, print No.\n\nSample Input 1\n\n117\n\nSample Output 1\n\nYes\n\n117 contains 7 as its last digit.\n\nSample Input 2\n\n123\n\nSample Output 2\n\nNo\n\n123 does not contain the digit 7.\n\nSample Input 3\n\n777\n\nSample Output 3\n\nYes", "sample_input": "117\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02711", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven is a three-digit integer N. Does N contain the digit 7?\n\nIf so, print Yes; otherwise, print No.\n\nConstraints\n\n100 \\leq N \\leq 999\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf N contains the digit 7, print Yes; otherwise, print No.\n\nSample Input 1\n\n117\n\nSample Output 1\n\nYes\n\n117 contains 7 as its last digit.\n\nSample Input 2\n\n123\n\nSample Output 2\n\nNo\n\n123 does not contain the digit 7.\n\nSample Input 3\n\n777\n\nSample Output 3\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 127, "memory_kb": 35708}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s296780963", "group_id": "codeNet:p02711", "input_text": "import java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tvoid run() {\n\t\tScanner sc=new Scanner(System.in);\n\t\tPrintWriter pw=new PrintWriter(System.out);\n\t\tchar[] cs=sc.next().toCharArray();\n\t\tboolean ans=false;\n\t\tfor (char c:cs) ans|=c=='7';\n\t\tpw.println(ans?\"Yes\":\"No\");\n\t\tpw.close();\n\t} \n\t\n\tvoid tr(Object...objects) {System.out.println(Arrays.deepToString(objects));}\n\t\n public static void main(String[] args) {\n \tnew Main().run();\n }\n}\n", "language": "Java", "metadata": {"date": 1586739706, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02711.html", "problem_id": "p02711", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02711/input.txt", "sample_output_relpath": "derived/input_output/data/p02711/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02711/Java/s296780963.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s296780963", "user_id": "u313111801"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tvoid run() {\n\t\tScanner sc=new Scanner(System.in);\n\t\tPrintWriter pw=new PrintWriter(System.out);\n\t\tchar[] cs=sc.next().toCharArray();\n\t\tboolean ans=false;\n\t\tfor (char c:cs) ans|=c=='7';\n\t\tpw.println(ans?\"Yes\":\"No\");\n\t\tpw.close();\n\t} \n\t\n\tvoid tr(Object...objects) {System.out.println(Arrays.deepToString(objects));}\n\t\n public static void main(String[] args) {\n \tnew Main().run();\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven is a three-digit integer N. Does N contain the digit 7?\n\nIf so, print Yes; otherwise, print No.\n\nConstraints\n\n100 \\leq N \\leq 999\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf N contains the digit 7, print Yes; otherwise, print No.\n\nSample Input 1\n\n117\n\nSample Output 1\n\nYes\n\n117 contains 7 as its last digit.\n\nSample Input 2\n\n123\n\nSample Output 2\n\nNo\n\n123 does not contain the digit 7.\n\nSample Input 3\n\n777\n\nSample Output 3\n\nYes", "sample_input": "117\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02711", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven is a three-digit integer N. Does N contain the digit 7?\n\nIf so, print Yes; otherwise, print No.\n\nConstraints\n\n100 \\leq N \\leq 999\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf N contains the digit 7, print Yes; otherwise, print No.\n\nSample Input 1\n\n117\n\nSample Output 1\n\nYes\n\n117 contains 7 as its last digit.\n\nSample Input 2\n\n123\n\nSample Output 2\n\nNo\n\n123 does not contain the digit 7.\n\nSample Input 3\n\n777\n\nSample Output 3\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 520, "cpu_time_ms": 130, "memory_kb": 35764}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s881842106", "group_id": "codeNet:p02711", "input_text": "import java.util.*;\nimport java.io.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n FastReader sc = new FastReader();\n PrintWriter out = new PrintWriter(System.out);\n\n int n = sc.nextInt();\n while (n > 0) {\n int k = n % 10;\n if (k == 7) {\n out.println(\"YES\");\n out.flush();\n out.close();\n return;\n }\n n /= 10;\n }\n out.println(\"NO\");\n out.flush();\n out.close();\n }\n\n private static void solve(double x, ArrayList arr, int n) {\n long sum = 0;\n for (int i = 0; i < n; i++) {\n sum += arr.get(i);\n }\n if (1.0 * sum / n >= x) System.out.println(n);\n else {\n Collections.sort(arr);\n long cur = 0;\n long people = 0;\n for (int i = n - 1; i >= 0; i--) {\n cur += arr.get(i);\n people++;\n if (1.0 * cur / people < x) {\n System.out.println(people - 1);\n return;\n }\n }\n }\n\n }\n\n static class FastReader {\n BufferedReader br;\n StringTokenizer st;\n\n public FastReader() {\n br = new BufferedReader(new\n InputStreamReader(System.in));\n }\n\n String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n String nextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n\n\n }\n}\n\n/**\n *x=3\n * 1 1 2 5\n */\n\n/**\n *\n * 1+1\n **/", "language": "Java", "metadata": {"date": 1586739705, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02711.html", "problem_id": "p02711", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02711/input.txt", "sample_output_relpath": "derived/input_output/data/p02711/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02711/Java/s881842106.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s881842106", "user_id": "u198680972"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n FastReader sc = new FastReader();\n PrintWriter out = new PrintWriter(System.out);\n\n int n = sc.nextInt();\n while (n > 0) {\n int k = n % 10;\n if (k == 7) {\n out.println(\"YES\");\n out.flush();\n out.close();\n return;\n }\n n /= 10;\n }\n out.println(\"NO\");\n out.flush();\n out.close();\n }\n\n private static void solve(double x, ArrayList arr, int n) {\n long sum = 0;\n for (int i = 0; i < n; i++) {\n sum += arr.get(i);\n }\n if (1.0 * sum / n >= x) System.out.println(n);\n else {\n Collections.sort(arr);\n long cur = 0;\n long people = 0;\n for (int i = n - 1; i >= 0; i--) {\n cur += arr.get(i);\n people++;\n if (1.0 * cur / people < x) {\n System.out.println(people - 1);\n return;\n }\n }\n }\n\n }\n\n static class FastReader {\n BufferedReader br;\n StringTokenizer st;\n\n public FastReader() {\n br = new BufferedReader(new\n InputStreamReader(System.in));\n }\n\n String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n String nextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n\n\n }\n}\n\n/**\n *x=3\n * 1 1 2 5\n */\n\n/**\n *\n * 1+1\n **/", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven is a three-digit integer N. Does N contain the digit 7?\n\nIf so, print Yes; otherwise, print No.\n\nConstraints\n\n100 \\leq N \\leq 999\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf N contains the digit 7, print Yes; otherwise, print No.\n\nSample Input 1\n\n117\n\nSample Output 1\n\nYes\n\n117 contains 7 as its last digit.\n\nSample Input 2\n\n123\n\nSample Output 2\n\nNo\n\n123 does not contain the digit 7.\n\nSample Input 3\n\n777\n\nSample Output 3\n\nYes", "sample_input": "117\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02711", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven is a three-digit integer N. Does N contain the digit 7?\n\nIf so, print Yes; otherwise, print No.\n\nConstraints\n\n100 \\leq N \\leq 999\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf N contains the digit 7, print Yes; otherwise, print No.\n\nSample Input 1\n\n117\n\nSample Output 1\n\nYes\n\n117 contains 7 as its last digit.\n\nSample Input 2\n\n123\n\nSample Output 2\n\nNo\n\n123 does not contain the digit 7.\n\nSample Input 3\n\n777\n\nSample Output 3\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2248, "cpu_time_ms": 66, "memory_kb": 32776}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s407566318", "group_id": "codeNet:p02713", "input_text": "import java.io.BufferedReader; \nimport java.io.IOException; \nimport java.io.InputStreamReader; \nimport java.util.*; \nimport java.util.StringTokenizer; \nimport java.io.PrintWriter;\nimport java.io.*;\nimport java.util.stream.Collectors.*;\nimport java.lang.*;\nimport static java.util.stream.Collectors.*;\nimport static java.util.Map.Entry.*;\nclass Main\n{ \n static class FastReader \n { \n BufferedReader br; \n StringTokenizer st; \n \n public FastReader() \n { \n br = new BufferedReader(new\n InputStreamReader(System.in)); \n } \n \n String next() \n { \n while (st == null || !st.hasMoreElements()) \n { \n try\n { \n st = new StringTokenizer(br.readLine()); \n } \n catch (IOException e) \n { \n e.printStackTrace(); \n } \n } \n return st.nextToken(); \n } \n \n int nextInt() \n { \n return Integer.parseInt(next()); \n } \n \n long nextLong() \n { \n return Long.parseLong(next()); \n } \n \n double nextDouble() \n { \n return Double.parseDouble(next()); \n } \n \n String nextLine() \n { \n String str = \"\"; \n try\n { \n str = br.readLine(); \n } \n catch (IOException e) \n { \n e.printStackTrace(); \n } \n return str; \n } \n }\n \nstatic int power(int x,int y) \n{ \n int res = 1; // Initialize result \n \n // Update x if it is more than or \n // equal to p \n \n while (y > 0) \n { \n // If y is odd, multiply x with result \n if (y%2==1) \n res = (res*x); \n \n // y must be even now \n y = y>>1; // y = y/2 \n x = (x*x); \n } \n return res; \n} \n\n \n static boolean compareSeq(char[] S, int x, int y, int n) \n { \n for (int i = 0; i < n; i++)\n {\n \n if (S[x] < S[y]) \n return true;\n else if (S[x] > S[y]) \n return false; \n x = (x + 1) % n; \n y = (y + 1) % n; \n } \n return true; \n } \n \n static void build(long[] sum,int[] arr,int n)\n {\n for(int i=0;i<(1< 0)\n total+=arr[j];\n }\n \n sum[i]=total;\n }\n }\n\n \n static int parity(int a)\n {\n a^=a>>16;\n a^=a>>8;\n a^=a>>4;\n a^=a>>2;\n a^=a>>1;\n return a&1;\n }\n/*\n PriorityQueue pq = new PriorityQueue<>((o1, o2) -> {\n if (o1.p < o2.p)\n return 1;\n else if (o1.p > o2.p)\n return -1;\n else\n return 0;\n \n });//decreasing order acc to p*/\nstatic int power(int x, int y, int m) \n { \n if (y == 0) \n return 1; \n \n int p = power(x, y / 2, m) % m; \n p = (p * p) % m; \n \n if (y % 2 == 0) \n return p; \n else\n return (x * p) % m; \n } \n/*static int modinv(int a, int m) \n { \n int g = gcd(a, m); \n if (g != 1) \n return 0;\n else \n { \n return power(a, m - 2, m); \n } \n //return 0;\n } */\n \nstatic int[] product(int[] nums) {\n int[] result = new int[nums.length];\n \n int[] t1 = new int[nums.length];\n int[] t2 = new int[nums.length];\n \n t1[0]=1;\n t2[nums.length-1]=1;\n \n //scan from left to right\n for(int i=0; i0; i--){\n t2[i-1] = t2[i] * nums[i];\n }\n \n for(int i=0;i0)\n {\n sum+=bit[ind];\n ind-= ind & (-ind);\n }\n \n return sum;\n}\n \nstatic void update(int[] bit,int max,int ind,int val)\n{\n while(ind<=max)\n {\n bit[ind]+=val;\n ind+= ind & (-ind);\n }\n}\n \n //static ArrayList[] adj;\n \n static boolean check(long mid,long a,long b)\n {\n long count=1;\n while(count<=mid)\n {\n count++;\n if(a\n {\n int x;\n int y;\n //int z;\n public aksh(int x,int y,int z)\n {\n this.x=x;\n this.y=y;\n //this.z=z;\n }\n public int compareTo(aksh o)\n {\n if(x!=o.x)\n return x-o.x;\n else\n return o.y-y;\n }\n }\n static int get(int arr[], int n) \n { \n int result = 0; \n int x, sum; \n \n // Iterate through every bit \n for(int i=0; i<32; i++) \n { \n // Find sum of set bits at ith position in all \n // array elements \n sum = 0; \n x = (1 << i); \n for(int j=0; j 0) \n { \n prod *= (x % 10); \n x /= 10; \n } \n return prod; \n} \n \n// This function returns the number having \n// maximum product of the digits \nstatic long findNumber(long l, long r) \n{ \n // Converting both integers to strings \n //string a = l.ToString(); \n String b = Long.toString(r); \n \n // Let the current answer be r \n long ans = r; \n for (int i = 0; i < b.length(); i++) \n { \n if (b.charAt(i) == '0') \n continue; \n \n // Stores the current number having \n // current digit one less than current \n // digit in b \n char[] curr = b.toCharArray(); \n curr[i] = (char)(((int)(curr[i] - \n (int)'0') - 1) + (int)('0')); \n \n // Replace all following digits with 9 \n // to maximise the product \n for (int j = i + 1; j < curr.length; j++) \n curr[j] = '9'; \n \n // Convert string to number \n int num = 0; \n for (int j = 0; j < curr.length; j++) \n num = num * 10 + (curr[j] - '0'); \n \n // Check if it lies in range and its product \n // is greater than max product \n if (num >= l && product(ans) < product(num)) \n ans = num; \n } \n \n return product(ans); \n} \n \nstatic long mod=998244353;\n \nstatic long pow(long in, long pow) {\n if(pow == 0) return 1;\n long out = pow(in, pow / 2);\n out = (out * out) % mod;\n if(pow % 2 == 1) out = (out * in) % mod;\n return out;\n }\n static long inv(long in) {\n return pow(in, mod - 2);\n }\n \n static void swap(int x,int y)\n {\n int temp=x;\n x=y;\n y=temp;\n }\n \n static int[] par;\n static int[] size;\n static int find(int i) \n {\n if (par[i] == i)\n return i;\n \n return par[i] = find(par[par[i]]);\n }\n \n static void union(int x, int y) \n {\n x = find(x);\n y = find(y);\n if (x == y)\n return;\n if (size[x] < size[y])\n swap(x, y);\n \n par[y] = x;\n size[x] += size[y];\n }\n \n \n static void multisourcebfs(long[] arr,int n,int m)\n {\n //HashSet vis=new HashSet<>();\n HashMap dis=new HashMap<>();\n Queue q=new LinkedList<>();\n \n for(int i=0;i=maxcount)\n {\n maxcount=dist;\n x=node;\n }\n \n List l = adj[node]; \n for(Integer i: l)\n {\n if(i!=par)\n dfs(i,node,dist+1);\n }\n }\n\n \n\n static int h;\n static int w;\n \n\n static ArrayList cnt;\n\n static void primefact(int n)\n {\n \n for (int i=2;i*i<=n;i++)\n {\n while ((n % i)==0)\n {\n cnt.add(i);\n n /= i;\n }\n }\n\n if(n>1)\n {\n cnt.add(n);\n }\n }\n\n static boolean hash[];\n static void sieve(int n)\n {\n Arrays.fill(hash, true);\n for (int p = 2; p * p < n; p++) \n if (hash[p] == true) \n for (int i = p * 2; i < n; i += p) \n hash[i] = false; \n }\n\n static long div(long n) \n {\n long total = 1; \n for (int p = 2; p <= n; p++) \n { \n if (hash[p]) \n { \n int count = 0; \n if (n % p == 0) \n { \n while (n % p == 0) \n { \n n = n / p; \n count++; \n } \n total = total * (count + 1); \n } \n } \n } \n return total; \n} \n\n\n \n static int upperbound(ArrayList array, int length, int value) \n {\n int low = 0;\n int high = length;\n while (low < high) {\n final int mid = (low + high) / 2;\n if (value >= array.get(mid)) \n {\n low = mid + 1;\n } \n else\n {\n high = mid;\n }\n }\n return low;\n }\n\n static int[][] dp;\n\n static void func(int[][] a,int n,int k,int p)\n {\n for (int i = 1; i < n; i++)\n for (int j = 1; j <= Math.min((i + 1) * k, p); j++)\n for (int t2 = 0; t2 <= Math.min(k, Math.min(j, p)); t2++)\n {\n int aksh = 0;\n if (t2!=0)\n aksh = a[i][t2 - 1];\n\n dp[i][j] = Math.max(dp[i][j], dp[i - 1][j - t2] + aksh);\n }\n }\n\n\n static final long INF = Long.MAX_VALUE/5;\n static ArrayList[] adj;\n static long binpow(long a, long b)\n {\n long res = 1;\n while (b > 0) \n {\n if ((b & 1) !=0)\n res = res * a;\n a = a * a;\n b >>= 1;\n }\n return res;\n }\n\n static int upper(int[] array, int length, int value) {\n int low = 0;\n int high = length;\n while (low < high) {\n final int mid = (low + high) / 2;\n if (value >= array[mid]) {\n low = mid + 1;\n } else {\n high = mid;\n }\n }\n return low;\n }\n static int ans=0;\n static void bs(ArrayList arr, int max, int k,int n)\n {\n int l= 1;\n int h= max;\n ans = h;\n\n while (l<=h)\n {\n int m = (l+h)/2;\n int r = 0;\n\n for (int i = 0; i < n; ++i)\n {\n r += (arr.get(i) + m - 1) / m;\n r--;\n }\n\n if(r <= k)\n {\n ans = m;\n h = m - 1;\n }\n else\n l=m+1;\n }\n }\n \n static boolean pal(String s)\n {\n int n=s.length();\n int l=0;\n int r=n-1;\n int flag=0;\n while(l divisors(long n)\n {\n ArrayList arr=new ArrayList<>();\n for(long i=2;i<=Math.sqrt(n);i++)\n {\n if(n%i==0)\n {\n if(n/i==i)\n arr.add(i);\n else\n {\n arr.add(n/i);\n arr.add(i);\n }\n }\n }\n\n arr.add(n);\n\n return arr;\n } \n\n static int bound(int[] pref,int n,int i)\n {\n int l=0;\n int h=n-1;\n int ans=Integer.MAX_VALUE;\n while(l<=h)\n {\n int mid=l+(h-l)/2;\n if((pref[mid]-pref[i])>=2)\n {\n ans=Math.min(ans,mid);\n h=mid-1;\n }\n else\n l=mid+1;\n }\n return ans;\n }\n static int gcd_(int a,int b) \n { \n if (a == 0) \n return b; \n return gcd_(b % a, a); \n } \n \n \n public static void main(String args[] ) throws Exception \n {\n /* Enter your code here. Read input from STDIN. Print output to STDOUT */\n FastReader sc=new FastReader();\n // String s=sc.next();\n PrintWriter out=new PrintWriter(System.out);\n long sum=0;\n int k=sc.nextInt();\n\n for(int i=1;i<=k;i++)\n {\n for(int j=1;j<=k;j++)\n {\n for(int l=1;l<=k;l++)\n sum+=gcd_(i,gcd_(j,l));\n }\n }\n\n System.out.println(sum);\n \n\n \n }\n }\n", "language": "Java", "metadata": {"date": 1586740421, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02713.html", "problem_id": "p02713", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02713/input.txt", "sample_output_relpath": "derived/input_output/data/p02713/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02713/Java/s407566318.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s407566318", "user_id": "u595316473"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "import java.io.BufferedReader; \nimport java.io.IOException; \nimport java.io.InputStreamReader; \nimport java.util.*; \nimport java.util.StringTokenizer; \nimport java.io.PrintWriter;\nimport java.io.*;\nimport java.util.stream.Collectors.*;\nimport java.lang.*;\nimport static java.util.stream.Collectors.*;\nimport static java.util.Map.Entry.*;\nclass Main\n{ \n static class FastReader \n { \n BufferedReader br; \n StringTokenizer st; \n \n public FastReader() \n { \n br = new BufferedReader(new\n InputStreamReader(System.in)); \n } \n \n String next() \n { \n while (st == null || !st.hasMoreElements()) \n { \n try\n { \n st = new StringTokenizer(br.readLine()); \n } \n catch (IOException e) \n { \n e.printStackTrace(); \n } \n } \n return st.nextToken(); \n } \n \n int nextInt() \n { \n return Integer.parseInt(next()); \n } \n \n long nextLong() \n { \n return Long.parseLong(next()); \n } \n \n double nextDouble() \n { \n return Double.parseDouble(next()); \n } \n \n String nextLine() \n { \n String str = \"\"; \n try\n { \n str = br.readLine(); \n } \n catch (IOException e) \n { \n e.printStackTrace(); \n } \n return str; \n } \n }\n \nstatic int power(int x,int y) \n{ \n int res = 1; // Initialize result \n \n // Update x if it is more than or \n // equal to p \n \n while (y > 0) \n { \n // If y is odd, multiply x with result \n if (y%2==1) \n res = (res*x); \n \n // y must be even now \n y = y>>1; // y = y/2 \n x = (x*x); \n } \n return res; \n} \n\n \n static boolean compareSeq(char[] S, int x, int y, int n) \n { \n for (int i = 0; i < n; i++)\n {\n \n if (S[x] < S[y]) \n return true;\n else if (S[x] > S[y]) \n return false; \n x = (x + 1) % n; \n y = (y + 1) % n; \n } \n return true; \n } \n \n static void build(long[] sum,int[] arr,int n)\n {\n for(int i=0;i<(1< 0)\n total+=arr[j];\n }\n \n sum[i]=total;\n }\n }\n\n \n static int parity(int a)\n {\n a^=a>>16;\n a^=a>>8;\n a^=a>>4;\n a^=a>>2;\n a^=a>>1;\n return a&1;\n }\n/*\n PriorityQueue pq = new PriorityQueue<>((o1, o2) -> {\n if (o1.p < o2.p)\n return 1;\n else if (o1.p > o2.p)\n return -1;\n else\n return 0;\n \n });//decreasing order acc to p*/\nstatic int power(int x, int y, int m) \n { \n if (y == 0) \n return 1; \n \n int p = power(x, y / 2, m) % m; \n p = (p * p) % m; \n \n if (y % 2 == 0) \n return p; \n else\n return (x * p) % m; \n } \n/*static int modinv(int a, int m) \n { \n int g = gcd(a, m); \n if (g != 1) \n return 0;\n else \n { \n return power(a, m - 2, m); \n } \n //return 0;\n } */\n \nstatic int[] product(int[] nums) {\n int[] result = new int[nums.length];\n \n int[] t1 = new int[nums.length];\n int[] t2 = new int[nums.length];\n \n t1[0]=1;\n t2[nums.length-1]=1;\n \n //scan from left to right\n for(int i=0; i0; i--){\n t2[i-1] = t2[i] * nums[i];\n }\n \n for(int i=0;i0)\n {\n sum+=bit[ind];\n ind-= ind & (-ind);\n }\n \n return sum;\n}\n \nstatic void update(int[] bit,int max,int ind,int val)\n{\n while(ind<=max)\n {\n bit[ind]+=val;\n ind+= ind & (-ind);\n }\n}\n \n //static ArrayList[] adj;\n \n static boolean check(long mid,long a,long b)\n {\n long count=1;\n while(count<=mid)\n {\n count++;\n if(a\n {\n int x;\n int y;\n //int z;\n public aksh(int x,int y,int z)\n {\n this.x=x;\n this.y=y;\n //this.z=z;\n }\n public int compareTo(aksh o)\n {\n if(x!=o.x)\n return x-o.x;\n else\n return o.y-y;\n }\n }\n static int get(int arr[], int n) \n { \n int result = 0; \n int x, sum; \n \n // Iterate through every bit \n for(int i=0; i<32; i++) \n { \n // Find sum of set bits at ith position in all \n // array elements \n sum = 0; \n x = (1 << i); \n for(int j=0; j 0) \n { \n prod *= (x % 10); \n x /= 10; \n } \n return prod; \n} \n \n// This function returns the number having \n// maximum product of the digits \nstatic long findNumber(long l, long r) \n{ \n // Converting both integers to strings \n //string a = l.ToString(); \n String b = Long.toString(r); \n \n // Let the current answer be r \n long ans = r; \n for (int i = 0; i < b.length(); i++) \n { \n if (b.charAt(i) == '0') \n continue; \n \n // Stores the current number having \n // current digit one less than current \n // digit in b \n char[] curr = b.toCharArray(); \n curr[i] = (char)(((int)(curr[i] - \n (int)'0') - 1) + (int)('0')); \n \n // Replace all following digits with 9 \n // to maximise the product \n for (int j = i + 1; j < curr.length; j++) \n curr[j] = '9'; \n \n // Convert string to number \n int num = 0; \n for (int j = 0; j < curr.length; j++) \n num = num * 10 + (curr[j] - '0'); \n \n // Check if it lies in range and its product \n // is greater than max product \n if (num >= l && product(ans) < product(num)) \n ans = num; \n } \n \n return product(ans); \n} \n \nstatic long mod=998244353;\n \nstatic long pow(long in, long pow) {\n if(pow == 0) return 1;\n long out = pow(in, pow / 2);\n out = (out * out) % mod;\n if(pow % 2 == 1) out = (out * in) % mod;\n return out;\n }\n static long inv(long in) {\n return pow(in, mod - 2);\n }\n \n static void swap(int x,int y)\n {\n int temp=x;\n x=y;\n y=temp;\n }\n \n static int[] par;\n static int[] size;\n static int find(int i) \n {\n if (par[i] == i)\n return i;\n \n return par[i] = find(par[par[i]]);\n }\n \n static void union(int x, int y) \n {\n x = find(x);\n y = find(y);\n if (x == y)\n return;\n if (size[x] < size[y])\n swap(x, y);\n \n par[y] = x;\n size[x] += size[y];\n }\n \n \n static void multisourcebfs(long[] arr,int n,int m)\n {\n //HashSet vis=new HashSet<>();\n HashMap dis=new HashMap<>();\n Queue q=new LinkedList<>();\n \n for(int i=0;i=maxcount)\n {\n maxcount=dist;\n x=node;\n }\n \n List l = adj[node]; \n for(Integer i: l)\n {\n if(i!=par)\n dfs(i,node,dist+1);\n }\n }\n\n \n\n static int h;\n static int w;\n \n\n static ArrayList cnt;\n\n static void primefact(int n)\n {\n \n for (int i=2;i*i<=n;i++)\n {\n while ((n % i)==0)\n {\n cnt.add(i);\n n /= i;\n }\n }\n\n if(n>1)\n {\n cnt.add(n);\n }\n }\n\n static boolean hash[];\n static void sieve(int n)\n {\n Arrays.fill(hash, true);\n for (int p = 2; p * p < n; p++) \n if (hash[p] == true) \n for (int i = p * 2; i < n; i += p) \n hash[i] = false; \n }\n\n static long div(long n) \n {\n long total = 1; \n for (int p = 2; p <= n; p++) \n { \n if (hash[p]) \n { \n int count = 0; \n if (n % p == 0) \n { \n while (n % p == 0) \n { \n n = n / p; \n count++; \n } \n total = total * (count + 1); \n } \n } \n } \n return total; \n} \n\n\n \n static int upperbound(ArrayList array, int length, int value) \n {\n int low = 0;\n int high = length;\n while (low < high) {\n final int mid = (low + high) / 2;\n if (value >= array.get(mid)) \n {\n low = mid + 1;\n } \n else\n {\n high = mid;\n }\n }\n return low;\n }\n\n static int[][] dp;\n\n static void func(int[][] a,int n,int k,int p)\n {\n for (int i = 1; i < n; i++)\n for (int j = 1; j <= Math.min((i + 1) * k, p); j++)\n for (int t2 = 0; t2 <= Math.min(k, Math.min(j, p)); t2++)\n {\n int aksh = 0;\n if (t2!=0)\n aksh = a[i][t2 - 1];\n\n dp[i][j] = Math.max(dp[i][j], dp[i - 1][j - t2] + aksh);\n }\n }\n\n\n static final long INF = Long.MAX_VALUE/5;\n static ArrayList[] adj;\n static long binpow(long a, long b)\n {\n long res = 1;\n while (b > 0) \n {\n if ((b & 1) !=0)\n res = res * a;\n a = a * a;\n b >>= 1;\n }\n return res;\n }\n\n static int upper(int[] array, int length, int value) {\n int low = 0;\n int high = length;\n while (low < high) {\n final int mid = (low + high) / 2;\n if (value >= array[mid]) {\n low = mid + 1;\n } else {\n high = mid;\n }\n }\n return low;\n }\n static int ans=0;\n static void bs(ArrayList arr, int max, int k,int n)\n {\n int l= 1;\n int h= max;\n ans = h;\n\n while (l<=h)\n {\n int m = (l+h)/2;\n int r = 0;\n\n for (int i = 0; i < n; ++i)\n {\n r += (arr.get(i) + m - 1) / m;\n r--;\n }\n\n if(r <= k)\n {\n ans = m;\n h = m - 1;\n }\n else\n l=m+1;\n }\n }\n \n static boolean pal(String s)\n {\n int n=s.length();\n int l=0;\n int r=n-1;\n int flag=0;\n while(l divisors(long n)\n {\n ArrayList arr=new ArrayList<>();\n for(long i=2;i<=Math.sqrt(n);i++)\n {\n if(n%i==0)\n {\n if(n/i==i)\n arr.add(i);\n else\n {\n arr.add(n/i);\n arr.add(i);\n }\n }\n }\n\n arr.add(n);\n\n return arr;\n } \n\n static int bound(int[] pref,int n,int i)\n {\n int l=0;\n int h=n-1;\n int ans=Integer.MAX_VALUE;\n while(l<=h)\n {\n int mid=l+(h-l)/2;\n if((pref[mid]-pref[i])>=2)\n {\n ans=Math.min(ans,mid);\n h=mid-1;\n }\n else\n l=mid+1;\n }\n return ans;\n }\n static int gcd_(int a,int b) \n { \n if (a == 0) \n return b; \n return gcd_(b % a, a); \n } \n \n \n public static void main(String args[] ) throws Exception \n {\n /* Enter your code here. Read input from STDIN. Print output to STDOUT */\n FastReader sc=new FastReader();\n // String s=sc.next();\n PrintWriter out=new PrintWriter(System.out);\n long sum=0;\n int k=sc.nextInt();\n\n for(int i=1;i<=k;i++)\n {\n for(int j=1;j<=k;j++)\n {\n for(int l=1;l<=k;l++)\n sum+=gcd_(i,gcd_(j,l));\n }\n }\n\n System.out.println(sum);\n \n\n \n }\n }\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nFind \\displaystyle{\\sum_{a=1}^{K}\\sum_{b=1}^{K}\\sum_{c=1}^{K} \\gcd(a,b,c)}.\n\nHere \\gcd(a,b,c) denotes the greatest common divisor of a, b, and c.\n\nConstraints\n\n1 \\leq K \\leq 200\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 value of \\displaystyle{\\sum_{a=1}^{K}\\sum_{b=1}^{K}\\sum_{c=1}^{K} \\gcd(a,b,c)}.\n\nSample Input 1\n\n2\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\n200\n\nSample Output 2\n\n10813692", "sample_input": "2\n"}, "reference_outputs": ["9\n"], "source_document_id": "p02713", "source_text": "Score : 300 points\n\nProblem Statement\n\nFind \\displaystyle{\\sum_{a=1}^{K}\\sum_{b=1}^{K}\\sum_{c=1}^{K} \\gcd(a,b,c)}.\n\nHere \\gcd(a,b,c) denotes the greatest common divisor of a, b, and c.\n\nConstraints\n\n1 \\leq K \\leq 200\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 value of \\displaystyle{\\sum_{a=1}^{K}\\sum_{b=1}^{K}\\sum_{c=1}^{K} \\gcd(a,b,c)}.\n\nSample Input 1\n\n2\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\n200\n\nSample Output 2\n\n10813692", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 15072, "cpu_time_ms": 460, "memory_kb": 33056}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s099520516", "group_id": "codeNet:p02713", "input_text": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n\tstatic InputStream is;\n\tstatic PrintWriter out;\n\tstatic String INPUT = \"\";\n\n\tstatic final long mod = (long) 1e9 + 7;\n\tstatic final int dx[] = { -1, 0, 1, 0 }, dy[] = { 0, -1, 0, 1 };\n\tstatic final int[] dx8 = { -1, -1, -1, 0, 0, 1, 1, 1 }, dy8 = { -1, 0, 1, -1, 1, -1, 0, 1 };\n\tstatic final int inf = Integer.MAX_VALUE / 3;\n\tstatic final long linf = Long.MAX_VALUE / 3;\n\tstatic final double dinf = Double.MAX_VALUE / 3;\n\n\tstatic void solve() {\n\t\tint k = ni();\n\t\tlong ans = 0;\n\t\tfor(int i=1;i<=k;i++) {\n\t\t\tfor(int j=1;j<=k;j++) {\n\t\t\t\tfor(int m=1;m<=k;m++) {\n\t\t\t\t\tlong t = gcd(i,j);\n\t\t\t\t\tt = gcd(t, m);\n\t\t\t\t\tans += t;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tout.println(ans);\n\t}\n\t\n\t//Euclid\n\tstatic long gcd(long x, long y) {\n\t\treturn y == 0 ? x : gcd(y, x % y);\n\t}\n\n\t//libraries\n\tstatic int[] concat(int x, int arr[]) {\n\t\tint ret[] = new int[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 1, ret.length - 1);\n\t\tret[0] = x;\n\t\treturn ret;\n\t}\n\n\tstatic int[] concat(int arr[], int x) {\n\t\tint ret[] = new int[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 0, ret.length - 1);\n\t\tret[ret.length - 1] = x;\n\t\treturn ret;\n\t}\n\n\tstatic long[] concat(long x, long arr[]) {\n\t\tlong ret[] = new long[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 1, ret.length - 1);\n\t\tret[0] = x;\n\t\treturn ret;\n\t}\n\n\tstatic long[] concat(long arr[], long x) {\n\t\tlong ret[] = new long[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 0, ret.length - 1);\n\t\tret[ret.length - 1] = x;\n\t\treturn ret;\n\t}\n\n\tstatic long max(long x, long y) {\n\t\treturn Math.max(x, y);\n\t}\n\n\tstatic long min(long x, long y) {\n\t\treturn Math.min(x, y);\n\t}\n\n\tstatic long max(long x, long y, long z) {\n\t\tx = Math.max(x, y);\n\t\tx = Math.max(x, z);\n\t\treturn x;\n\t}\n\n\tstatic long min(long x, long y, long z) {\n\t\tx = Math.min(x, y);\n\t\tx = Math.min(x, z);\n\t\treturn x;\n\t}\n\n\tstatic double max(double x, double y) {\n\t\treturn Math.max(x, y);\n\t}\n\n\tstatic double min(double x, double y) {\n\t\treturn Math.min(x, y);\n\t}\n\n\tstatic double max(double x, double y, double z) {\n\t\tx = Math.max(x, y);\n\t\tx = Math.max(x, z);\n\t\treturn x;\n\t}\n\n\tstatic double min(double x, double y, double z) {\n\t\tx = Math.min(x, y);\n\t\tx = Math.min(x, z);\n\t\treturn x;\n\t}\n\n\tstatic void rsort(int[] ar) {\n\t\tArrays.sort(ar);\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tint tmp = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = tmp;\n\t\t}\n\t}\n\n\tstatic void rsort(long[] ar) {\n\t\tArrays.sort(ar);\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tlong tmp = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = tmp;\n\t\t}\n\t}\n\n\tstatic void rsort(double[] ar) {\n\t\tArrays.sort(ar);\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tdouble tmp = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = tmp;\n\t\t}\n\t}\n\n\tstatic void fill(int arr[], int x) {\n\t\tArrays.fill(arr, x);\n\t}\n\n\tstatic void fill(long arr[], long x) {\n\t\tArrays.fill(arr, x);\n\t}\n\n\tstatic void fill(double arr[], double x) {\n\t\tArrays.fill(arr, x);\n\t}\n\n\tstatic void fill(int arr[][], int x) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tArrays.fill(arr[i], x);\n\t}\n\n\tstatic void fill(long arr[][], long x) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tArrays.fill(arr[i], x);\n\t}\n\n\tstatic void fill(double arr[][], double x) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tArrays.fill(arr[i], x);\n\t}\n\n\t//MOD culc\n\tstatic long plus(long x, long y) {\n\t\tlong res = (x + y) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\n\tstatic long sub(long x, long y) {\n\t\tlong res = (x - y) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\n\tstatic long mul(long x, long y) {\n\t\tlong res = (x * y) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\n\tstatic long div(long x, long y) {\n\t\tlong res = x * pow(y, mod - 2) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\n\tstatic long pow(long x, long y) {\n\t\tif (y < 0)\n\t\t\treturn 0;\n\t\tif (y == 0)\n\t\t\treturn 1;\n\t\tif (y % 2 == 1)\n\t\t\treturn (x * pow(x, y - 1)) % mod;\n\t\tlong root = pow(x, y / 2);\n\t\treturn root * root % mod;\n\t}\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tis = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());\n\t\tout = new PrintWriter(System.out);\n\t\tsolve();\n\t\tout.flush();\n\t}\n\n\t//input\n\tprivate static byte[] inbuf = new byte[1024];\n\tstatic int lenbuf = 0, ptrbuf = 0;\n\n\tprivate static int readByte() {\n\t\tif (lenbuf == -1)\n\t\t\tthrow new InputMismatchException();\n\t\tif (ptrbuf >= lenbuf) {\n\t\t\tptrbuf = 0;\n\t\t\ttry {\n\t\t\t\tlenbuf = is.read(inbuf);\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new InputMismatchException();\n\t\t\t}\n\t\t\tif (lenbuf <= 0)\n\t\t\t\treturn -1;\n\t\t}\n\t\treturn inbuf[ptrbuf++];\n\t}\n\n\tprivate static boolean isSpaceChar(int c) {\n\t\treturn !(c >= 33 && c <= 126);\n\t}\n\n\tprivate static int skip() {\n\t\tint b;\n\t\twhile ((b = readByte()) != -1 && isSpaceChar(b))\n\t\t\t;\n\t\treturn b;\n\t}\n\n\tprivate static double nd() {\n\t\treturn Double.parseDouble(ns());\n\t}\n\n\tprivate static char nc() {\n\t\treturn (char) skip();\n\t}\n\n\tprivate static String ns() {\n\t\tint b = skip();\n\t\tStringBuilder sb = new StringBuilder();\n\t\twhile (!(isSpaceChar(b))) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\n\tprivate static char[] ns(int n) {\n\t\tchar[] buf = new char[n];\n\t\tint b = skip(), p = 0;\n\t\twhile (p < n && !(isSpaceChar(b))) {\n\t\t\tbuf[p++] = (char) b;\n\t\t\tb = readByte();\n\t\t}\n\t\treturn n == p ? buf : Arrays.copyOf(buf, p);\n\t}\n\n\tprivate static char[][] nm(int n, int m) {\n\t\tchar[][] map = new char[n][];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tmap[i] = ns(m);\n\t\treturn map;\n\t}\n\n\tprivate static int[] na(int n) {\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = ni();\n\t\treturn a;\n\t}\n\n\tprivate static int ni() {\n\t\tint num = 0, b;\n\t\tboolean minus = false;\n\t\twhile ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))\n\t\t\t;\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\n\t\twhile (true) {\n\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t} else {\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n\tprivate static long nl() {\n\t\tlong num = 0;\n\t\tint b;\n\t\tboolean minus = false;\n\t\twhile ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))\n\t\t\t;\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\n\t\twhile (true) {\n\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t} else {\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1586740050, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02713.html", "problem_id": "p02713", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02713/input.txt", "sample_output_relpath": "derived/input_output/data/p02713/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02713/Java/s099520516.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s099520516", "user_id": "u881359256"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n\tstatic InputStream is;\n\tstatic PrintWriter out;\n\tstatic String INPUT = \"\";\n\n\tstatic final long mod = (long) 1e9 + 7;\n\tstatic final int dx[] = { -1, 0, 1, 0 }, dy[] = { 0, -1, 0, 1 };\n\tstatic final int[] dx8 = { -1, -1, -1, 0, 0, 1, 1, 1 }, dy8 = { -1, 0, 1, -1, 1, -1, 0, 1 };\n\tstatic final int inf = Integer.MAX_VALUE / 3;\n\tstatic final long linf = Long.MAX_VALUE / 3;\n\tstatic final double dinf = Double.MAX_VALUE / 3;\n\n\tstatic void solve() {\n\t\tint k = ni();\n\t\tlong ans = 0;\n\t\tfor(int i=1;i<=k;i++) {\n\t\t\tfor(int j=1;j<=k;j++) {\n\t\t\t\tfor(int m=1;m<=k;m++) {\n\t\t\t\t\tlong t = gcd(i,j);\n\t\t\t\t\tt = gcd(t, m);\n\t\t\t\t\tans += t;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tout.println(ans);\n\t}\n\t\n\t//Euclid\n\tstatic long gcd(long x, long y) {\n\t\treturn y == 0 ? x : gcd(y, x % y);\n\t}\n\n\t//libraries\n\tstatic int[] concat(int x, int arr[]) {\n\t\tint ret[] = new int[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 1, ret.length - 1);\n\t\tret[0] = x;\n\t\treturn ret;\n\t}\n\n\tstatic int[] concat(int arr[], int x) {\n\t\tint ret[] = new int[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 0, ret.length - 1);\n\t\tret[ret.length - 1] = x;\n\t\treturn ret;\n\t}\n\n\tstatic long[] concat(long x, long arr[]) {\n\t\tlong ret[] = new long[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 1, ret.length - 1);\n\t\tret[0] = x;\n\t\treturn ret;\n\t}\n\n\tstatic long[] concat(long arr[], long x) {\n\t\tlong ret[] = new long[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 0, ret.length - 1);\n\t\tret[ret.length - 1] = x;\n\t\treturn ret;\n\t}\n\n\tstatic long max(long x, long y) {\n\t\treturn Math.max(x, y);\n\t}\n\n\tstatic long min(long x, long y) {\n\t\treturn Math.min(x, y);\n\t}\n\n\tstatic long max(long x, long y, long z) {\n\t\tx = Math.max(x, y);\n\t\tx = Math.max(x, z);\n\t\treturn x;\n\t}\n\n\tstatic long min(long x, long y, long z) {\n\t\tx = Math.min(x, y);\n\t\tx = Math.min(x, z);\n\t\treturn x;\n\t}\n\n\tstatic double max(double x, double y) {\n\t\treturn Math.max(x, y);\n\t}\n\n\tstatic double min(double x, double y) {\n\t\treturn Math.min(x, y);\n\t}\n\n\tstatic double max(double x, double y, double z) {\n\t\tx = Math.max(x, y);\n\t\tx = Math.max(x, z);\n\t\treturn x;\n\t}\n\n\tstatic double min(double x, double y, double z) {\n\t\tx = Math.min(x, y);\n\t\tx = Math.min(x, z);\n\t\treturn x;\n\t}\n\n\tstatic void rsort(int[] ar) {\n\t\tArrays.sort(ar);\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tint tmp = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = tmp;\n\t\t}\n\t}\n\n\tstatic void rsort(long[] ar) {\n\t\tArrays.sort(ar);\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tlong tmp = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = tmp;\n\t\t}\n\t}\n\n\tstatic void rsort(double[] ar) {\n\t\tArrays.sort(ar);\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tdouble tmp = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = tmp;\n\t\t}\n\t}\n\n\tstatic void fill(int arr[], int x) {\n\t\tArrays.fill(arr, x);\n\t}\n\n\tstatic void fill(long arr[], long x) {\n\t\tArrays.fill(arr, x);\n\t}\n\n\tstatic void fill(double arr[], double x) {\n\t\tArrays.fill(arr, x);\n\t}\n\n\tstatic void fill(int arr[][], int x) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tArrays.fill(arr[i], x);\n\t}\n\n\tstatic void fill(long arr[][], long x) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tArrays.fill(arr[i], x);\n\t}\n\n\tstatic void fill(double arr[][], double x) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tArrays.fill(arr[i], x);\n\t}\n\n\t//MOD culc\n\tstatic long plus(long x, long y) {\n\t\tlong res = (x + y) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\n\tstatic long sub(long x, long y) {\n\t\tlong res = (x - y) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\n\tstatic long mul(long x, long y) {\n\t\tlong res = (x * y) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\n\tstatic long div(long x, long y) {\n\t\tlong res = x * pow(y, mod - 2) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\n\tstatic long pow(long x, long y) {\n\t\tif (y < 0)\n\t\t\treturn 0;\n\t\tif (y == 0)\n\t\t\treturn 1;\n\t\tif (y % 2 == 1)\n\t\t\treturn (x * pow(x, y - 1)) % mod;\n\t\tlong root = pow(x, y / 2);\n\t\treturn root * root % mod;\n\t}\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tis = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());\n\t\tout = new PrintWriter(System.out);\n\t\tsolve();\n\t\tout.flush();\n\t}\n\n\t//input\n\tprivate static byte[] inbuf = new byte[1024];\n\tstatic int lenbuf = 0, ptrbuf = 0;\n\n\tprivate static int readByte() {\n\t\tif (lenbuf == -1)\n\t\t\tthrow new InputMismatchException();\n\t\tif (ptrbuf >= lenbuf) {\n\t\t\tptrbuf = 0;\n\t\t\ttry {\n\t\t\t\tlenbuf = is.read(inbuf);\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new InputMismatchException();\n\t\t\t}\n\t\t\tif (lenbuf <= 0)\n\t\t\t\treturn -1;\n\t\t}\n\t\treturn inbuf[ptrbuf++];\n\t}\n\n\tprivate static boolean isSpaceChar(int c) {\n\t\treturn !(c >= 33 && c <= 126);\n\t}\n\n\tprivate static int skip() {\n\t\tint b;\n\t\twhile ((b = readByte()) != -1 && isSpaceChar(b))\n\t\t\t;\n\t\treturn b;\n\t}\n\n\tprivate static double nd() {\n\t\treturn Double.parseDouble(ns());\n\t}\n\n\tprivate static char nc() {\n\t\treturn (char) skip();\n\t}\n\n\tprivate static String ns() {\n\t\tint b = skip();\n\t\tStringBuilder sb = new StringBuilder();\n\t\twhile (!(isSpaceChar(b))) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\n\tprivate static char[] ns(int n) {\n\t\tchar[] buf = new char[n];\n\t\tint b = skip(), p = 0;\n\t\twhile (p < n && !(isSpaceChar(b))) {\n\t\t\tbuf[p++] = (char) b;\n\t\t\tb = readByte();\n\t\t}\n\t\treturn n == p ? buf : Arrays.copyOf(buf, p);\n\t}\n\n\tprivate static char[][] nm(int n, int m) {\n\t\tchar[][] map = new char[n][];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tmap[i] = ns(m);\n\t\treturn map;\n\t}\n\n\tprivate static int[] na(int n) {\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = ni();\n\t\treturn a;\n\t}\n\n\tprivate static int ni() {\n\t\tint num = 0, b;\n\t\tboolean minus = false;\n\t\twhile ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))\n\t\t\t;\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\n\t\twhile (true) {\n\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t} else {\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n\tprivate static long nl() {\n\t\tlong num = 0;\n\t\tint b;\n\t\tboolean minus = false;\n\t\twhile ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))\n\t\t\t;\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\n\t\twhile (true) {\n\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t} else {\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nFind \\displaystyle{\\sum_{a=1}^{K}\\sum_{b=1}^{K}\\sum_{c=1}^{K} \\gcd(a,b,c)}.\n\nHere \\gcd(a,b,c) denotes the greatest common divisor of a, b, and c.\n\nConstraints\n\n1 \\leq K \\leq 200\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 value of \\displaystyle{\\sum_{a=1}^{K}\\sum_{b=1}^{K}\\sum_{c=1}^{K} \\gcd(a,b,c)}.\n\nSample Input 1\n\n2\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\n200\n\nSample Output 2\n\n10813692", "sample_input": "2\n"}, "reference_outputs": ["9\n"], "source_document_id": "p02713", "source_text": "Score : 300 points\n\nProblem Statement\n\nFind \\displaystyle{\\sum_{a=1}^{K}\\sum_{b=1}^{K}\\sum_{c=1}^{K} \\gcd(a,b,c)}.\n\nHere \\gcd(a,b,c) denotes the greatest common divisor of a, b, and c.\n\nConstraints\n\n1 \\leq K \\leq 200\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 value of \\displaystyle{\\sum_{a=1}^{K}\\sum_{b=1}^{K}\\sum_{c=1}^{K} \\gcd(a,b,c)}.\n\nSample Input 1\n\n2\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\n200\n\nSample Output 2\n\n10813692", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 6324, "cpu_time_ms": 623, "memory_kb": 25796}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s245798615", "group_id": "codeNet:p02713", "input_text": "import java.util.*;\nimport java.lang.*;\nclass Counter extends TreeMap{\n public Counter(){\n super();\n }\n public Counter(List list){\n super();\n for(T e: list) this.addOne(e);\n }\n public Long count(Object elm){\n return getOrDefault(elm,0L);\n }\n public void add(T elm, long amount){\n if(!this.containsKey(elm)) put(elm, amount);\n else replace(elm, get(elm)+amount);\n if(this.count(elm)==0) this.remove(elm);\n }\n public void addOne(T elm){\n this.add(elm, 1);\n }\n public void removeOne(T elm){\n this.add(elm, -1);\n }\n public void removeAll(T elm){\n this.add(elm, this.count(elm));\n }\n public static Counter merge(Counter a, Counter b){\n Counter c = new Counter<>();\n for(T x: a.keySet()) c.add(x, a.count(x));\n for(T y: b.keySet()) c.add(y, b.count(y));\n return c;\n }\n}\nclass MathLib{\n public static long divCeil(long a, long b){\n return (a+b-1)/b;\n }\n public static long power(long a, long x){\n if(x<0) return 0;\n if(x==0) return 1;\n if(x==1) return a;\n if(x%2==0){\n long half = power(a,x/2);\n return half*half;\n }\n return a*power(a,x-1);\n }\n\n public static long gcd(long a, long b){\n if(a divisors(long N){\n LinkedList ans = new LinkedList<>();\n for(long n = (long)(Math.sqrt(N)+2); n>0; n--){\n if(n*n>N) continue;\n else if(n*n==N) ans.add(n);\n else if(N%n==0){\n ans.addFirst(n);\n ans.addLast(N/n);\n }\n }\n return ans;\n }\n public static boolean isPrime(long N){\n return divisors(N).size()==2;\n }\n public static ArrayList primeList(int max){\n boolean[] isp = new boolean[max+1];\n Arrays.fill(isp, true); isp[0]=false; isp[1]=false;\n for(int p=2; p*p<=max; p++) if(isp[p]){\n for(int i=2; i*p<=max; i++) isp[i*p]=false;\n }\n\n ArrayList list = new ArrayList<>();\n for(int p=2; p<=max; p++) if(isp[p]) list.add(p);\n return list;\n }\n\n\n public static Counter factorize(long N){\n Counter c = new Counter<>();\n for(long n=2; n*n<=N; n++){\n while(N%n==0){\n c.addOne(n);\n N /= n;\n }\n }\n if(N>1) c.addOne(N);\n return c;\n }\n}\nclass ArrayLib{\n static E getOrDefault(E[] array, int index, E defaultValue){\n if(index<0 || index>=array.length) return defaultValue;\n return array[index];\n }\n\n static> int maxIndexOfArray(E[] a){\n int ans = 0;\n for(int i=1;i0) ans=i;\n }\n return ans;\n }\n static> E maxValueOfArray(E[] a){\n return a[maxIndexOfArray(a)];\n }\n static> int minIndexOfArray(E[] a){\n int ans = 0;\n for(int i=1;i> E minValueOfArray(E[] a){\n return a[minIndexOfArray(a)];\n }\n\n // minimum x st. array[x] >= elm\n // assert: the array must be sorted before the function call\n static> int lowerBound(E[] array, E elm){\n if(array[0].compareTo(elm)>=0) return 0;\n int min = 0, max = array.length;\n // array[min] < elm\n // array[max] >= elm\n while(min+1 elm\n // assert: the array must be sorted before the function call\n static> int upperBound(E[] array, E elm){\n if(array[0].compareTo(elm)>0) return 0;\n int min = 0, max = array.length;\n // array[min] <= elm\n // array[max] > elm\n while(min+1 list){\n int pivotPos = -1;\n int pivot = 0;\n for (int i=list.size()-2; i>=0; i--) {\n if (list.get(i) < list.get(i+1)) {\n pivotPos = i;\n pivot = list.get(i);\n break;\n }\n }\n\n if (pivotPos==-1 && pivot==0) return false;\n\n int L = pivotPos+1, R = list.size()-1;\n int minPos = -1;\n int min = Integer.MAX_VALUE;\n for (int i=R; i>=L; i--) {\n if (pivot < list.get(i)) {\n if (list.get(i) < min) {\n min = list.get(i);\n minPos = i;\n }\n }\n }\n\n Collections.swap(list, pivotPos, minPos);\n Collections.sort(list.subList(L, R+1));\n\n return true;\n }\n\n static void print(int[] array, String begin, String space, String end){\n StringBuilder sb = new StringBuilder();\n sb.append(begin);\n for(int i=0; i extends TreeMap{\n public Counter(){\n super();\n }\n public Counter(List list){\n super();\n for(T e: list) this.addOne(e);\n }\n public Long count(Object elm){\n return getOrDefault(elm,0L);\n }\n public void add(T elm, long amount){\n if(!this.containsKey(elm)) put(elm, amount);\n else replace(elm, get(elm)+amount);\n if(this.count(elm)==0) this.remove(elm);\n }\n public void addOne(T elm){\n this.add(elm, 1);\n }\n public void removeOne(T elm){\n this.add(elm, -1);\n }\n public void removeAll(T elm){\n this.add(elm, this.count(elm));\n }\n public static Counter merge(Counter a, Counter b){\n Counter c = new Counter<>();\n for(T x: a.keySet()) c.add(x, a.count(x));\n for(T y: b.keySet()) c.add(y, b.count(y));\n return c;\n }\n}\nclass MathLib{\n public static long divCeil(long a, long b){\n return (a+b-1)/b;\n }\n public static long power(long a, long x){\n if(x<0) return 0;\n if(x==0) return 1;\n if(x==1) return a;\n if(x%2==0){\n long half = power(a,x/2);\n return half*half;\n }\n return a*power(a,x-1);\n }\n\n public static long gcd(long a, long b){\n if(a divisors(long N){\n LinkedList ans = new LinkedList<>();\n for(long n = (long)(Math.sqrt(N)+2); n>0; n--){\n if(n*n>N) continue;\n else if(n*n==N) ans.add(n);\n else if(N%n==0){\n ans.addFirst(n);\n ans.addLast(N/n);\n }\n }\n return ans;\n }\n public static boolean isPrime(long N){\n return divisors(N).size()==2;\n }\n public static ArrayList primeList(int max){\n boolean[] isp = new boolean[max+1];\n Arrays.fill(isp, true); isp[0]=false; isp[1]=false;\n for(int p=2; p*p<=max; p++) if(isp[p]){\n for(int i=2; i*p<=max; i++) isp[i*p]=false;\n }\n\n ArrayList list = new ArrayList<>();\n for(int p=2; p<=max; p++) if(isp[p]) list.add(p);\n return list;\n }\n\n\n public static Counter factorize(long N){\n Counter c = new Counter<>();\n for(long n=2; n*n<=N; n++){\n while(N%n==0){\n c.addOne(n);\n N /= n;\n }\n }\n if(N>1) c.addOne(N);\n return c;\n }\n}\nclass ArrayLib{\n static E getOrDefault(E[] array, int index, E defaultValue){\n if(index<0 || index>=array.length) return defaultValue;\n return array[index];\n }\n\n static> int maxIndexOfArray(E[] a){\n int ans = 0;\n for(int i=1;i0) ans=i;\n }\n return ans;\n }\n static> E maxValueOfArray(E[] a){\n return a[maxIndexOfArray(a)];\n }\n static> int minIndexOfArray(E[] a){\n int ans = 0;\n for(int i=1;i> E minValueOfArray(E[] a){\n return a[minIndexOfArray(a)];\n }\n\n // minimum x st. array[x] >= elm\n // assert: the array must be sorted before the function call\n static> int lowerBound(E[] array, E elm){\n if(array[0].compareTo(elm)>=0) return 0;\n int min = 0, max = array.length;\n // array[min] < elm\n // array[max] >= elm\n while(min+1 elm\n // assert: the array must be sorted before the function call\n static> int upperBound(E[] array, E elm){\n if(array[0].compareTo(elm)>0) return 0;\n int min = 0, max = array.length;\n // array[min] <= elm\n // array[max] > elm\n while(min+1 list){\n int pivotPos = -1;\n int pivot = 0;\n for (int i=list.size()-2; i>=0; i--) {\n if (list.get(i) < list.get(i+1)) {\n pivotPos = i;\n pivot = list.get(i);\n break;\n }\n }\n\n if (pivotPos==-1 && pivot==0) return false;\n\n int L = pivotPos+1, R = list.size()-1;\n int minPos = -1;\n int min = Integer.MAX_VALUE;\n for (int i=R; i>=L; i--) {\n if (pivot < list.get(i)) {\n if (list.get(i) < min) {\n min = list.get(i);\n minPos = i;\n }\n }\n }\n\n Collections.swap(list, pivotPos, minPos);\n Collections.sort(list.subList(L, R+1));\n\n return true;\n }\n\n static void print(int[] array, String begin, String space, String end){\n StringBuilder sb = new StringBuilder();\n sb.append(begin);\n for(int i=0; i0)\n {\n if((b&1)==1)r=(r*a)%m; \n b>>=1;\n a=(a*a)%m; \n } \n return r; \n }\n static int i()throws IOException\n {\n if(!st.hasMoreTokens()) st=new StringTokenizer(br.readLine());\n return Integer.parseInt(st.nextToken());\n }\n static long l()throws IOException\n {\n if(!st.hasMoreTokens())st=new StringTokenizer(br.readLine());\n return Long.parseLong(st.nextToken());\n }\n static String s()throws IOException\n {\n if(!st.hasMoreTokens())st=new StringTokenizer(br.readLine());\n return st.nextToken();\n }\n static double d()throws IOException\n {\n if(!st.hasMoreTokens())st=new StringTokenizer(br.readLine());\n return Double.parseDouble(st.nextToken());\n }\n static void p(Object p){System.out.print(p);}\n static void p(String p){System.out.print(p);}\n static void p(int p){System.out.print(p);}\n static void p(double p){System.out.print(p);}\n static void p(long p){System.out.print(p);}\n static void p(char p){System.out.print(p);}\n static void p(boolean p){System.out.print(p);}\n static void pl(Object p){System.out.println(p);}\n static void pl(String p){System.out.println(p);}\n static void pl(int p){System.out.println(p);}\n static void pl(char p){System.out.println(p);}\n static void pl(double p){System.out.println(p);}\n static void pl(long p){System.out.println(p);}\n static void pl(boolean p){System.out.println(p);}\n static void pl(){System.out.println();}\n static int[] ari(int n)throws IOException\n {\n int ar[]=new int[n];\n st=new StringTokenizer(br.readLine());\n for(int x=0;x0)\n {\n if((b&1)==1)r=(r*a)%m; \n b>>=1;\n a=(a*a)%m; \n } \n return r; \n }\n static int i()throws IOException\n {\n if(!st.hasMoreTokens()) st=new StringTokenizer(br.readLine());\n return Integer.parseInt(st.nextToken());\n }\n static long l()throws IOException\n {\n if(!st.hasMoreTokens())st=new StringTokenizer(br.readLine());\n return Long.parseLong(st.nextToken());\n }\n static String s()throws IOException\n {\n if(!st.hasMoreTokens())st=new StringTokenizer(br.readLine());\n return st.nextToken();\n }\n static double d()throws IOException\n {\n if(!st.hasMoreTokens())st=new StringTokenizer(br.readLine());\n return Double.parseDouble(st.nextToken());\n }\n static void p(Object p){System.out.print(p);}\n static void p(String p){System.out.print(p);}\n static void p(int p){System.out.print(p);}\n static void p(double p){System.out.print(p);}\n static void p(long p){System.out.print(p);}\n static void p(char p){System.out.print(p);}\n static void p(boolean p){System.out.print(p);}\n static void pl(Object p){System.out.println(p);}\n static void pl(String p){System.out.println(p);}\n static void pl(int p){System.out.println(p);}\n static void pl(char p){System.out.println(p);}\n static void pl(double p){System.out.println(p);}\n static void pl(long p){System.out.println(p);}\n static void pl(boolean p){System.out.println(p);}\n static void pl(){System.out.println();}\n static int[] ari(int n)throws IOException\n {\n int ar[]=new int[n];\n st=new StringTokenizer(br.readLine());\n for(int x=0;x() {\n {\n \tput('R',1);\n \tput('G',10);\n \tput('B',100);\n }\n }; \t\n \n \tfor(int i = 0;i < n;i++){\n \tif(s.charAt(i) == 'R') rc++;\n \telse if(s.charAt(i) == 'G') gc++;\n \telse if(s.charAt(i) == 'B') bc++;\n }\n \n \tfor(int i = 0;i < n;i++){\n for(int j = i+1;j < n;j++){\n if(j+(j-i) < n){\n istack = (int)cMap.get(s.charAt(i))\n +(int)cMap.get(s.charAt(j))\n +(int)cMap.get(s.charAt(j+(j-i)));\n if(istack == 111) count++;\n }\n }\n }\n \n \tSystem.out.println(rc*gc*bc-count);\n\t}\n}\n", "language": "Java", "metadata": {"date": 1597867690, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02714.html", "problem_id": "p02714", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02714/input.txt", "sample_output_relpath": "derived/input_output/data/p02714/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02714/Java/s489648502.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s489648502", "user_id": "u591547748"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "import java.util.*;\nimport java.lang.Math;\n\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n \tint n = sc.nextInt();\n \tString s = sc.next();\n \tlong count = 0;\n \tlong rc = 0;\n \tlong gc = 0;\n \tlong bc = 0;\n \tint istack;\n \n \tMap cMap = new HashMap() {\n {\n \tput('R',1);\n \tput('G',10);\n \tput('B',100);\n }\n }; \t\n \n \tfor(int i = 0;i < n;i++){\n \tif(s.charAt(i) == 'R') rc++;\n \telse if(s.charAt(i) == 'G') gc++;\n \telse if(s.charAt(i) == 'B') bc++;\n }\n \n \tfor(int i = 0;i < n;i++){\n for(int j = i+1;j < n;j++){\n if(j+(j-i) < n){\n istack = (int)cMap.get(s.charAt(i))\n +(int)cMap.get(s.charAt(j))\n +(int)cMap.get(s.charAt(j+(j-i)));\n if(istack == 111) count++;\n }\n }\n }\n \n \tSystem.out.println(rc*gc*bc-count);\n\t}\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a string S of length N consisting of R, G, and B.\n\nFind the number of triples (i,~j,~k)~(1 \\leq i < j < k \\leq N) that satisfy both of the following conditions:\n\nS_i \\neq S_j, S_i \\neq S_k, and S_j \\neq S_k.\n\nj - i \\neq k - j.\n\nConstraints\n\n1 \\leq N \\leq 4000\n\nS is a string of length N consisting of R, G, and B.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the number of triplets in question.\n\nSample Input 1\n\n4\nRRGB\n\nSample Output 1\n\n1\n\nOnly the triplet (1,~3,~4) satisfies both conditions. The triplet (2,~3,~4) satisfies the first condition but not the second, so it does not count.\n\nSample Input 2\n\n39\nRBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB\n\nSample Output 2\n\n1800", "sample_input": "4\nRRGB\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02714", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a string S of length N consisting of R, G, and B.\n\nFind the number of triples (i,~j,~k)~(1 \\leq i < j < k \\leq N) that satisfy both of the following conditions:\n\nS_i \\neq S_j, S_i \\neq S_k, and S_j \\neq S_k.\n\nj - i \\neq k - j.\n\nConstraints\n\n1 \\leq N \\leq 4000\n\nS is a string of length N consisting of R, G, and B.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the number of triplets in question.\n\nSample Input 1\n\n4\nRRGB\n\nSample Output 1\n\n1\n\nOnly the triplet (1,~3,~4) satisfies both conditions. The triplet (2,~3,~4) satisfies the first condition but not the second, so it does not count.\n\nSample Input 2\n\n39\nRBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB\n\nSample Output 2\n\n1800", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1039, "cpu_time_ms": 275, "memory_kb": 38420}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s210440876", "group_id": "codeNet:p02714", "input_text": "import java.util.*;\nimport java.lang.Math;\n\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n \tint n = sc.nextInt();\n \tString s = sc.next();\n \tint count = 0;\n \tint istack;\n \n \tMap cMap = new HashMap() {\n {\n \tput('R',1);\n \tput('G',10);\n \tput('B',100);\n }\n }; \t\n \n \tfor(int i = 0;i < n;i++){\n for(int j = i+1;j < n;j++){\n for(int k = j+1; k < n;k++){\n if(j - i != k - j){\n istack = (int)cMap.get(s.charAt(i))\n +(int)cMap.get(s.charAt(j))\n +(int)cMap.get(s.charAt(k));\n if(istack == 111) count++;\n }\n }\n }\n }\n \n \tSystem.out.println(count);\n\t}\n}\n", "language": "Java", "metadata": {"date": 1597866091, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02714.html", "problem_id": "p02714", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02714/input.txt", "sample_output_relpath": "derived/input_output/data/p02714/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02714/Java/s210440876.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s210440876", "user_id": "u591547748"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "import java.util.*;\nimport java.lang.Math;\n\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n \tint n = sc.nextInt();\n \tString s = sc.next();\n \tint count = 0;\n \tint istack;\n \n \tMap cMap = new HashMap() {\n {\n \tput('R',1);\n \tput('G',10);\n \tput('B',100);\n }\n }; \t\n \n \tfor(int i = 0;i < n;i++){\n for(int j = i+1;j < n;j++){\n for(int k = j+1; k < n;k++){\n if(j - i != k - j){\n istack = (int)cMap.get(s.charAt(i))\n +(int)cMap.get(s.charAt(j))\n +(int)cMap.get(s.charAt(k));\n if(istack == 111) count++;\n }\n }\n }\n }\n \n \tSystem.out.println(count);\n\t}\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a string S of length N consisting of R, G, and B.\n\nFind the number of triples (i,~j,~k)~(1 \\leq i < j < k \\leq N) that satisfy both of the following conditions:\n\nS_i \\neq S_j, S_i \\neq S_k, and S_j \\neq S_k.\n\nj - i \\neq k - j.\n\nConstraints\n\n1 \\leq N \\leq 4000\n\nS is a string of length N consisting of R, G, and B.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the number of triplets in question.\n\nSample Input 1\n\n4\nRRGB\n\nSample Output 1\n\n1\n\nOnly the triplet (1,~3,~4) satisfies both conditions. The triplet (2,~3,~4) satisfies the first condition but not the second, so it does not count.\n\nSample Input 2\n\n39\nRBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB\n\nSample Output 2\n\n1800", "sample_input": "4\nRRGB\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02714", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a string S of length N consisting of R, G, and B.\n\nFind the number of triples (i,~j,~k)~(1 \\leq i < j < k \\leq N) that satisfy both of the following conditions:\n\nS_i \\neq S_j, S_i \\neq S_k, and S_j \\neq S_k.\n\nj - i \\neq k - j.\n\nConstraints\n\n1 \\leq N \\leq 4000\n\nS is a string of length N consisting of R, G, and B.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the number of triplets in question.\n\nSample Input 1\n\n4\nRRGB\n\nSample Output 1\n\n1\n\nOnly the triplet (1,~3,~4) satisfies both conditions. The triplet (2,~3,~4) satisfies the first condition but not the second, so it does not count.\n\nSample Input 2\n\n39\nRBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB\n\nSample Output 2\n\n1800", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2207, "memory_kb": 39424}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s830912442", "group_id": "codeNet:p02714", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n Main(){\n Scanner scanner = new Scanner(System.in);\n int N = scanner.nextInt();\n String S = scanner.next();\n\n int r=0,g=0,b=0;\n for(int i=0;i=(2*j-i)){\n if(s[i].equals(s[j])==false&&s[j].equals(s[2*j-i])==false&&s[2*j-i].equals(s[i])==false){\n f=f-1;\n }\n }\n }\n }\n System.out.print(f);\n }\n}\n", "language": "Java", "metadata": {"date": 1588916400, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02714.html", "problem_id": "p02714", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02714/input.txt", "sample_output_relpath": "derived/input_output/data/p02714/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02714/Java/s533958829.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s533958829", "user_id": "u587100042"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n \tint n=sc.nextInt(),r=0,b=0,g=0;\n String[] s=sc.next().split(\"\");\n for(int i=0;i=(2*j-i)){\n if(s[i].equals(s[j])==false&&s[j].equals(s[2*j-i])==false&&s[2*j-i].equals(s[i])==false){\n f=f-1;\n }\n }\n }\n }\n System.out.print(f);\n }\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a string S of length N consisting of R, G, and B.\n\nFind the number of triples (i,~j,~k)~(1 \\leq i < j < k \\leq N) that satisfy both of the following conditions:\n\nS_i \\neq S_j, S_i \\neq S_k, and S_j \\neq S_k.\n\nj - i \\neq k - j.\n\nConstraints\n\n1 \\leq N \\leq 4000\n\nS is a string of length N consisting of R, G, and B.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the number of triplets in question.\n\nSample Input 1\n\n4\nRRGB\n\nSample Output 1\n\n1\n\nOnly the triplet (1,~3,~4) satisfies both conditions. The triplet (2,~3,~4) satisfies the first condition but not the second, so it does not count.\n\nSample Input 2\n\n39\nRBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB\n\nSample Output 2\n\n1800", "sample_input": "4\nRRGB\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02714", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a string S of length N consisting of R, G, and B.\n\nFind the number of triples (i,~j,~k)~(1 \\leq i < j < k \\leq N) that satisfy both of the following conditions:\n\nS_i \\neq S_j, S_i \\neq S_k, and S_j \\neq S_k.\n\nj - i \\neq k - j.\n\nConstraints\n\n1 \\leq N \\leq 4000\n\nS is a string of length N consisting of R, G, and B.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the number of triplets in question.\n\nSample Input 1\n\n4\nRRGB\n\nSample Output 1\n\n1\n\nOnly the triplet (1,~3,~4) satisfies both conditions. The triplet (2,~3,~4) satisfies the first condition but not the second, so it does not count.\n\nSample Input 2\n\n39\nRBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB\n\nSample Output 2\n\n1800", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 633, "cpu_time_ms": 208, "memory_kb": 36724}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s691736495", "group_id": "codeNet:p02714", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tString[] sArray = sc.next().split(\"\");\n\t\tint[] rList = new int[n+1];\n\t\tint[] gList = new int[n+1];\n\t\tint[] bList = new int[n+1];\n\t\tint redCount = 0;\n\t\tint greenCount = 0;\n\t\tint blueCount = 0;\n\t\tfor(int i =0;i < sArray.length;i++) {\n\t\t\tif(sArray[i].equals(\"R\")) {\n\t\t\t\tredCount++;\n\t\t\t\trList[i+1]++;\n\t\t\t}\n\t\t\tif(sArray[i].equals(\"G\")) {\n\t\t\t\tgreenCount++;\n\t\t\t\tgList[i+1]++;\n\t\t\t}\n\t\t\tif(sArray[i].equals(\"B\")) {\n\t\t\t\tblueCount++;\n\t\t\t\tbList[i+1]++;\n\t\t\t}\n\t\t}\n\t\tlong answer = redCount * greenCount * blueCount;\n\t\tif(answer == 0) {\n\t\t\tSystem.out.println(0);\n\t\t\treturn;\n\t\t}\n\t\tfor(int red =1;red <= n;red++) {\n\t\t\tif(rList[red] ==0) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tfor(int green =1;green <= n;green++) {\n\t\t\t\tif(gList[green] ==0) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif(red > green) {\n\t\t\t\t\tif(red + (red -green)<=n) {\n\t\t\t\t\t\tif(bList[(red + (red -green))] == 1) {\n\t\t\t\t\t\t\tanswer--;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(green - (red -green)>0) {\n\t\t\t\t\t\tif(bList[(green - (red -green))] == 1) {\n\t\t\t\t\t\t\tanswer--;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}else {\n\t\t\t\t\tif(green + (green -red)<=n) {\n\t\t\t\t\t\tif(bList[(green + (green -red))] == 1) {\n\t\t\t\t\t\t\tanswer--;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(red - (green -red)>0) {\n\t\t\t\t\t\tif(bList[(red - (green -red))] == 1) {\n\t\t\t\t\t\t\tanswer--;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\tif((red + green)%2 ==0 ) {\n\t\t\t\t\tif(bList[((red +green)/2)] == 1) {\n\t\t\t\t\t\tanswer--;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(answer);\n\t}\n\n}", "language": "Java", "metadata": {"date": 1587693378, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02714.html", "problem_id": "p02714", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02714/input.txt", "sample_output_relpath": "derived/input_output/data/p02714/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02714/Java/s691736495.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s691736495", "user_id": "u268132693"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tString[] sArray = sc.next().split(\"\");\n\t\tint[] rList = new int[n+1];\n\t\tint[] gList = new int[n+1];\n\t\tint[] bList = new int[n+1];\n\t\tint redCount = 0;\n\t\tint greenCount = 0;\n\t\tint blueCount = 0;\n\t\tfor(int i =0;i < sArray.length;i++) {\n\t\t\tif(sArray[i].equals(\"R\")) {\n\t\t\t\tredCount++;\n\t\t\t\trList[i+1]++;\n\t\t\t}\n\t\t\tif(sArray[i].equals(\"G\")) {\n\t\t\t\tgreenCount++;\n\t\t\t\tgList[i+1]++;\n\t\t\t}\n\t\t\tif(sArray[i].equals(\"B\")) {\n\t\t\t\tblueCount++;\n\t\t\t\tbList[i+1]++;\n\t\t\t}\n\t\t}\n\t\tlong answer = redCount * greenCount * blueCount;\n\t\tif(answer == 0) {\n\t\t\tSystem.out.println(0);\n\t\t\treturn;\n\t\t}\n\t\tfor(int red =1;red <= n;red++) {\n\t\t\tif(rList[red] ==0) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tfor(int green =1;green <= n;green++) {\n\t\t\t\tif(gList[green] ==0) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif(red > green) {\n\t\t\t\t\tif(red + (red -green)<=n) {\n\t\t\t\t\t\tif(bList[(red + (red -green))] == 1) {\n\t\t\t\t\t\t\tanswer--;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(green - (red -green)>0) {\n\t\t\t\t\t\tif(bList[(green - (red -green))] == 1) {\n\t\t\t\t\t\t\tanswer--;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}else {\n\t\t\t\t\tif(green + (green -red)<=n) {\n\t\t\t\t\t\tif(bList[(green + (green -red))] == 1) {\n\t\t\t\t\t\t\tanswer--;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(red - (green -red)>0) {\n\t\t\t\t\t\tif(bList[(red - (green -red))] == 1) {\n\t\t\t\t\t\t\tanswer--;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\tif((red + green)%2 ==0 ) {\n\t\t\t\t\tif(bList[((red +green)/2)] == 1) {\n\t\t\t\t\t\tanswer--;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(answer);\n\t}\n\n}", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a string S of length N consisting of R, G, and B.\n\nFind the number of triples (i,~j,~k)~(1 \\leq i < j < k \\leq N) that satisfy both of the following conditions:\n\nS_i \\neq S_j, S_i \\neq S_k, and S_j \\neq S_k.\n\nj - i \\neq k - j.\n\nConstraints\n\n1 \\leq N \\leq 4000\n\nS is a string of length N consisting of R, G, and B.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the number of triplets in question.\n\nSample Input 1\n\n4\nRRGB\n\nSample Output 1\n\n1\n\nOnly the triplet (1,~3,~4) satisfies both conditions. The triplet (2,~3,~4) satisfies the first condition but not the second, so it does not count.\n\nSample Input 2\n\n39\nRBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB\n\nSample Output 2\n\n1800", "sample_input": "4\nRRGB\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02714", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a string S of length N consisting of R, G, and B.\n\nFind the number of triples (i,~j,~k)~(1 \\leq i < j < k \\leq N) that satisfy both of the following conditions:\n\nS_i \\neq S_j, S_i \\neq S_k, and S_j \\neq S_k.\n\nj - i \\neq k - j.\n\nConstraints\n\n1 \\leq N \\leq 4000\n\nS is a string of length N consisting of R, G, and B.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the number of triplets in question.\n\nSample Input 1\n\n4\nRRGB\n\nSample Output 1\n\n1\n\nOnly the triplet (1,~3,~4) satisfies both conditions. The triplet (2,~3,~4) satisfies the first condition but not the second, so it does not count.\n\nSample Input 2\n\n39\nRBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB\n\nSample Output 2\n\n1800", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1518, "cpu_time_ms": 160, "memory_kb": 28520}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s297344517", "group_id": "codeNet:p02714", "input_text": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint n = sc.nextInt();\n\t\tString s = sc.next();\n\n\t\tlong r = 0;\n\t\tlong g = 0;\n\t\tlong b = 0;\n\n\t\tfor ( int i=0; i R=new HashSet<>(),G=new HashSet<>(),B=new HashSet<>();\n for(int i=n-1;i>=0;i--){\n if(c[i]=='R'){\n r++;\n R.add(i);\n }else if(c[i]=='G'){\n g++;\n G.add(i);\n }else{\n b++;\n B.add(i);\n }\n arr[0][i]=r;\n arr[1][i]=g;\n arr[2][i]=b;\n }\n for(int i=0;ib){\n return gcd(a%b,b);\n }\n return gcd(a,b%a);\n\n }\n}\n", "language": "Java", "metadata": {"date": 1586934303, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02714.html", "problem_id": "p02714", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02714/input.txt", "sample_output_relpath": "derived/input_output/data/p02714/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02714/Java/s074145318.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s074145318", "user_id": "u459250870"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.List;\n\npublic class Main {\n public static void main(String[] args){\n try{\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n int n=Integer.parseInt(br.readLine());\n String ss=br.readLine();\n char[] c=ss.toCharArray();\n int ans=0;\n int[][] arr=new int[3][n];\n int r=0,g=0,b=0;\n HashSet R=new HashSet<>(),G=new HashSet<>(),B=new HashSet<>();\n for(int i=n-1;i>=0;i--){\n if(c[i]=='R'){\n r++;\n R.add(i);\n }else if(c[i]=='G'){\n g++;\n G.add(i);\n }else{\n b++;\n B.add(i);\n }\n arr[0][i]=r;\n arr[1][i]=g;\n arr[2][i]=b;\n }\n for(int i=0;ib){\n return gcd(a%b,b);\n }\n return gcd(a,b%a);\n\n }\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a string S of length N consisting of R, G, and B.\n\nFind the number of triples (i,~j,~k)~(1 \\leq i < j < k \\leq N) that satisfy both of the following conditions:\n\nS_i \\neq S_j, S_i \\neq S_k, and S_j \\neq S_k.\n\nj - i \\neq k - j.\n\nConstraints\n\n1 \\leq N \\leq 4000\n\nS is a string of length N consisting of R, G, and B.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the number of triplets in question.\n\nSample Input 1\n\n4\nRRGB\n\nSample Output 1\n\n1\n\nOnly the triplet (1,~3,~4) satisfies both conditions. The triplet (2,~3,~4) satisfies the first condition but not the second, so it does not count.\n\nSample Input 2\n\n39\nRBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB\n\nSample Output 2\n\n1800", "sample_input": "4\nRRGB\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02714", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a string S of length N consisting of R, G, and B.\n\nFind the number of triples (i,~j,~k)~(1 \\leq i < j < k \\leq N) that satisfy both of the following conditions:\n\nS_i \\neq S_j, S_i \\neq S_k, and S_j \\neq S_k.\n\nj - i \\neq k - j.\n\nConstraints\n\n1 \\leq N \\leq 4000\n\nS is a string of length N consisting of R, G, and B.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the number of triplets in question.\n\nSample Input 1\n\n4\nRRGB\n\nSample Output 1\n\n1\n\nOnly the triplet (1,~3,~4) satisfies both conditions. The triplet (2,~3,~4) satisfies the first condition but not the second, so it does not count.\n\nSample Input 2\n\n39\nRBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB\n\nSample Output 2\n\n1800", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2352, "cpu_time_ms": 292, "memory_kb": 53320}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s209296877", "group_id": "codeNet:p02714", "input_text": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.util.InputMismatchException;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tnew Main();\n\t}\n\n\tpublic Main() {\n\t\tFasterScanner sc = new FasterScanner(System.in);\n\n\t\tint n = sc.nextInt();\n\t\tString s = sc.nextString();\n\t\tint r = 0;\n\t\tint g = 0;\n\t\tint b = 0;\n\t\tlong sol;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tchar c = s.charAt(i);\n\t\t\tif (c == 'R') r++;\n\t\t\tif (c == 'G') g++;\n\t\t\tif (c == 'B') b++;\n\t\t}\n\t\tsol = r*g*b;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tchar a = s.charAt(i);\n\t\t\tfor (int j = 1; ((i+j) < n) && ((i-j) >= 0); j++) {\n\t\t\t\tchar d = s.charAt(i+j);\n\t\t\t\tchar c = s.charAt(i-j);\n\t\t\t\tif (a != d && a != c && d != c) sol--;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(sol);\n\t\t\t\t\n\t\tsc.close();\n\t}\n\t\n\tclass FasterScanner {\n\t\tprivate InputStream mIs;\n\t\tprivate byte[] buf = new byte[1024];\n\t\tprivate int curChar;\n\t\tprivate int numChars;\n\n\t\tpublic FasterScanner() {\n\t\t\tthis(System.in);\n\t\t}\n\n\t\tpublic FasterScanner(InputStream is) {\n\t\t\tmIs = is;\n\t\t}\n\n\t\tpublic int read() {\n\t\t\tif (numChars == -1)\n\t\t\t\tthrow new InputMismatchException();\n\t\t\tif (curChar >= numChars) {\n\t\t\t\tcurChar = 0;\n\t\t\t\ttry {\n\t\t\t\t\tnumChars = mIs.read(buf);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t\tif (numChars <= 0)\n\t\t\t\t\treturn -1;\n\t\t\t}\n\t\t\treturn buf[curChar++];\n\t\t}\n\n\t\tpublic String nextLine() {\n\t\t\tint c = read();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = read();\n\t\t\tStringBuilder res = new StringBuilder();\n\t\t\tdo {\n\t\t\t\tres.appendCodePoint(c);\n\t\t\t\tc = read();\n\t\t\t} while (!isEndOfLine(c));\n\t\t\treturn res.toString();\n\t\t}\n\n\t\tpublic String nextString() {\n\t\t\tint c = read();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = read();\n\t\t\tStringBuilder res = new StringBuilder();\n\t\t\tdo {\n\t\t\t\tres.appendCodePoint(c);\n\t\t\t\tc = read();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn res.toString();\n\t\t}\n\n\t\tpublic long nextLong() {\n\t\t\tint c = read();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = read();\n\t\t\tint sgn = 1;\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tlong res = 0;\n\t\t\tdo {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres *= 10;\n\t\t\t\tres += c - '0';\n\t\t\t\tc = read();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn res * sgn;\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\tint c = read();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = read();\n\t\t\tint sgn = 1;\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tint res = 0;\n\t\t\tdo {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres *= 10;\n\t\t\t\tres += c - '0';\n\t\t\t\tc = read();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn res * sgn;\n\t\t}\n\n\t\tpublic boolean isSpaceChar(int c) {\n\t\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t\t}\n\n\t\tpublic boolean isEndOfLine(int c) {\n\t\t\treturn c == '\\n' || c == '\\r' || c == -1;\n\t\t}\n\n\t\tpublic void close() {\n\t\t\ttry {\n\t\t\t\tmIs.close();\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t}\n}\n", "language": "Java", "metadata": {"date": 1586897931, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02714.html", "problem_id": "p02714", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02714/input.txt", "sample_output_relpath": "derived/input_output/data/p02714/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02714/Java/s209296877.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s209296877", "user_id": "u254767252"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.util.InputMismatchException;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tnew Main();\n\t}\n\n\tpublic Main() {\n\t\tFasterScanner sc = new FasterScanner(System.in);\n\n\t\tint n = sc.nextInt();\n\t\tString s = sc.nextString();\n\t\tint r = 0;\n\t\tint g = 0;\n\t\tint b = 0;\n\t\tlong sol;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tchar c = s.charAt(i);\n\t\t\tif (c == 'R') r++;\n\t\t\tif (c == 'G') g++;\n\t\t\tif (c == 'B') b++;\n\t\t}\n\t\tsol = r*g*b;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tchar a = s.charAt(i);\n\t\t\tfor (int j = 1; ((i+j) < n) && ((i-j) >= 0); j++) {\n\t\t\t\tchar d = s.charAt(i+j);\n\t\t\t\tchar c = s.charAt(i-j);\n\t\t\t\tif (a != d && a != c && d != c) sol--;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(sol);\n\t\t\t\t\n\t\tsc.close();\n\t}\n\t\n\tclass FasterScanner {\n\t\tprivate InputStream mIs;\n\t\tprivate byte[] buf = new byte[1024];\n\t\tprivate int curChar;\n\t\tprivate int numChars;\n\n\t\tpublic FasterScanner() {\n\t\t\tthis(System.in);\n\t\t}\n\n\t\tpublic FasterScanner(InputStream is) {\n\t\t\tmIs = is;\n\t\t}\n\n\t\tpublic int read() {\n\t\t\tif (numChars == -1)\n\t\t\t\tthrow new InputMismatchException();\n\t\t\tif (curChar >= numChars) {\n\t\t\t\tcurChar = 0;\n\t\t\t\ttry {\n\t\t\t\t\tnumChars = mIs.read(buf);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t\tif (numChars <= 0)\n\t\t\t\t\treturn -1;\n\t\t\t}\n\t\t\treturn buf[curChar++];\n\t\t}\n\n\t\tpublic String nextLine() {\n\t\t\tint c = read();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = read();\n\t\t\tStringBuilder res = new StringBuilder();\n\t\t\tdo {\n\t\t\t\tres.appendCodePoint(c);\n\t\t\t\tc = read();\n\t\t\t} while (!isEndOfLine(c));\n\t\t\treturn res.toString();\n\t\t}\n\n\t\tpublic String nextString() {\n\t\t\tint c = read();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = read();\n\t\t\tStringBuilder res = new StringBuilder();\n\t\t\tdo {\n\t\t\t\tres.appendCodePoint(c);\n\t\t\t\tc = read();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn res.toString();\n\t\t}\n\n\t\tpublic long nextLong() {\n\t\t\tint c = read();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = read();\n\t\t\tint sgn = 1;\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tlong res = 0;\n\t\t\tdo {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres *= 10;\n\t\t\t\tres += c - '0';\n\t\t\t\tc = read();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn res * sgn;\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\tint c = read();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = read();\n\t\t\tint sgn = 1;\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tint res = 0;\n\t\t\tdo {\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres *= 10;\n\t\t\t\tres += c - '0';\n\t\t\t\tc = read();\n\t\t\t} while (!isSpaceChar(c));\n\t\t\treturn res * sgn;\n\t\t}\n\n\t\tpublic boolean isSpaceChar(int c) {\n\t\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t\t}\n\n\t\tpublic boolean isEndOfLine(int c) {\n\t\t\treturn c == '\\n' || c == '\\r' || c == -1;\n\t\t}\n\n\t\tpublic void close() {\n\t\t\ttry {\n\t\t\t\tmIs.close();\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t}\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a string S of length N consisting of R, G, and B.\n\nFind the number of triples (i,~j,~k)~(1 \\leq i < j < k \\leq N) that satisfy both of the following conditions:\n\nS_i \\neq S_j, S_i \\neq S_k, and S_j \\neq S_k.\n\nj - i \\neq k - j.\n\nConstraints\n\n1 \\leq N \\leq 4000\n\nS is a string of length N consisting of R, G, and B.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the number of triplets in question.\n\nSample Input 1\n\n4\nRRGB\n\nSample Output 1\n\n1\n\nOnly the triplet (1,~3,~4) satisfies both conditions. The triplet (2,~3,~4) satisfies the first condition but not the second, so it does not count.\n\nSample Input 2\n\n39\nRBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB\n\nSample Output 2\n\n1800", "sample_input": "4\nRRGB\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02714", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a string S of length N consisting of R, G, and B.\n\nFind the number of triples (i,~j,~k)~(1 \\leq i < j < k \\leq N) that satisfy both of the following conditions:\n\nS_i \\neq S_j, S_i \\neq S_k, and S_j \\neq S_k.\n\nj - i \\neq k - j.\n\nConstraints\n\n1 \\leq N \\leq 4000\n\nS is a string of length N consisting of R, G, and B.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the number of triplets in question.\n\nSample Input 1\n\n4\nRRGB\n\nSample Output 1\n\n1\n\nOnly the triplet (1,~3,~4) satisfies both conditions. The triplet (2,~3,~4) satisfies the first condition but not the second, so it does not count.\n\nSample Input 2\n\n39\nRBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB\n\nSample Output 2\n\n1800", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2871, "cpu_time_ms": 115, "memory_kb": 32928}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s559202341", "group_id": "codeNet:p02714", "input_text": "import java.util.*;\npublic class Main{\n public static void main(String[] args){\n Scanner sc =new Scanner(System.in);\n int N=sc.nextInt();\n String S = sc.next();\n String s[] =S.split(\"\",0);\n int t[] =new int[N];\n int x=0;int w=0;int a=0;int b=0; int c=0;\n for(int i=0;i= 0; i--) {\n if(s.charAt(i) == 'R') {\n rk[i] = rk[i + 1] + 1;\n gk[i] = gk[i + 1];\n bk[i] = bk[i + 1];\n } else if(s.charAt(i) == 'G') {\n gk[i] = gk[i + 1] + 1;\n rk[i] = rk[i + 1];\n bk[i] = bk[i + 1];\n } else {\n bk[i] = bk[i + 1] + 1;\n rk[i] = rk[i + 1];\n gk[i] = gk[i + 1];\n }\n }\n long ans = 0;\n for(int i = 0; i < n - 2; i++) {\n for(int j = i + 1; j < n - 1; j++) {\n int k = j + (j - i);\n if((s.charAt(i) == 'R') && (s.charAt(j) == 'G')) {\n if(k < n) {\n if(s.charAt(k) == 'B') {\n ans += (bk[j + 1] - 1);\n } else {\n ans += bk[j + 1];\n }\n } else {\n ans += bk[j + 1];\n }\n }\n if((s.charAt(i) == 'R') && (s.charAt(j) == 'B')) {\n if(k < n) {\n if(s.charAt(k) == 'G') {\n ans += (gk[j + 1] - 1);\n } else {\n ans += gk[j + 1];\n }\n } else {\n ans += gk[j + 1];\n }\n }\n if((s.charAt(i) == 'G') && (s.charAt(j) == 'R')) {\n if(k < n) {\n if(s.charAt(k) == 'B') {\n ans += (bk[j + 1] - 1);\n } else {\n ans += bk[j + 1];\n }\n } else {\n ans += bk[j + 1];\n }\n }\n if((s.charAt(i) == 'G') && (s.charAt(j) == 'B')) {\n if(k < n) {\n if(s.charAt(k) == 'R') {\n ans += (rk[j + 1] - 1);\n } else {\n ans += rk[j + 1];\n }\n } else {\n ans += rk[j + 1];\n }\n }\n if((s.charAt(i) == 'B') && (s.charAt(j) == 'R')) {\n if(k < n) {\n if(s.charAt(k) == 'G') {\n ans += (gk[j + 1] - 1);\n } else {\n ans += gk[j + 1];\n }\n } else {\n ans += gk[j + 1];\n }\n }\n if((s.charAt(i) == 'B') && (s.charAt(j) == 'G')) {\n if(k < n) {\n if(s.charAt(k) == 'R') {\n ans += (rk[j + 1] - 1);\n } else {\n ans += rk[j + 1];\n }\n } else {\n ans += rk[j + 1];\n }\n } \n }\n }\n System.out.println(ans);\n }\n}", "language": "Java", "metadata": {"date": 1586816494, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02714.html", "problem_id": "p02714", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02714/input.txt", "sample_output_relpath": "derived/input_output/data/p02714/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02714/Java/s088244977.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s088244977", "user_id": "u653981267"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n String s = sc.next();\n long[] rk = new long[n];\n long[] gk = new long[n];\n long[] bk = new long[n];\n if(s.charAt(n - 1) == 'R') {\n rk[n - 1] = 1;\n } else if(s.charAt(n - 1) == 'G') {\n gk[n - 1] = 1;\n } else {\n bk[n - 1] = 1;\n }\n for(int i = n - 2; i >= 0; i--) {\n if(s.charAt(i) == 'R') {\n rk[i] = rk[i + 1] + 1;\n gk[i] = gk[i + 1];\n bk[i] = bk[i + 1];\n } else if(s.charAt(i) == 'G') {\n gk[i] = gk[i + 1] + 1;\n rk[i] = rk[i + 1];\n bk[i] = bk[i + 1];\n } else {\n bk[i] = bk[i + 1] + 1;\n rk[i] = rk[i + 1];\n gk[i] = gk[i + 1];\n }\n }\n long ans = 0;\n for(int i = 0; i < n - 2; i++) {\n for(int j = i + 1; j < n - 1; j++) {\n int k = j + (j - i);\n if((s.charAt(i) == 'R') && (s.charAt(j) == 'G')) {\n if(k < n) {\n if(s.charAt(k) == 'B') {\n ans += (bk[j + 1] - 1);\n } else {\n ans += bk[j + 1];\n }\n } else {\n ans += bk[j + 1];\n }\n }\n if((s.charAt(i) == 'R') && (s.charAt(j) == 'B')) {\n if(k < n) {\n if(s.charAt(k) == 'G') {\n ans += (gk[j + 1] - 1);\n } else {\n ans += gk[j + 1];\n }\n } else {\n ans += gk[j + 1];\n }\n }\n if((s.charAt(i) == 'G') && (s.charAt(j) == 'R')) {\n if(k < n) {\n if(s.charAt(k) == 'B') {\n ans += (bk[j + 1] - 1);\n } else {\n ans += bk[j + 1];\n }\n } else {\n ans += bk[j + 1];\n }\n }\n if((s.charAt(i) == 'G') && (s.charAt(j) == 'B')) {\n if(k < n) {\n if(s.charAt(k) == 'R') {\n ans += (rk[j + 1] - 1);\n } else {\n ans += rk[j + 1];\n }\n } else {\n ans += rk[j + 1];\n }\n }\n if((s.charAt(i) == 'B') && (s.charAt(j) == 'R')) {\n if(k < n) {\n if(s.charAt(k) == 'G') {\n ans += (gk[j + 1] - 1);\n } else {\n ans += gk[j + 1];\n }\n } else {\n ans += gk[j + 1];\n }\n }\n if((s.charAt(i) == 'B') && (s.charAt(j) == 'G')) {\n if(k < n) {\n if(s.charAt(k) == 'R') {\n ans += (rk[j + 1] - 1);\n } else {\n ans += rk[j + 1];\n }\n } else {\n ans += rk[j + 1];\n }\n } \n }\n }\n System.out.println(ans);\n }\n}", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a string S of length N consisting of R, G, and B.\n\nFind the number of triples (i,~j,~k)~(1 \\leq i < j < k \\leq N) that satisfy both of the following conditions:\n\nS_i \\neq S_j, S_i \\neq S_k, and S_j \\neq S_k.\n\nj - i \\neq k - j.\n\nConstraints\n\n1 \\leq N \\leq 4000\n\nS is a string of length N consisting of R, G, and B.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the number of triplets in question.\n\nSample Input 1\n\n4\nRRGB\n\nSample Output 1\n\n1\n\nOnly the triplet (1,~3,~4) satisfies both conditions. The triplet (2,~3,~4) satisfies the first condition but not the second, so it does not count.\n\nSample Input 2\n\n39\nRBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB\n\nSample Output 2\n\n1800", "sample_input": "4\nRRGB\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02714", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a string S of length N consisting of R, G, and B.\n\nFind the number of triples (i,~j,~k)~(1 \\leq i < j < k \\leq N) that satisfy both of the following conditions:\n\nS_i \\neq S_j, S_i \\neq S_k, and S_j \\neq S_k.\n\nj - i \\neq k - j.\n\nConstraints\n\n1 \\leq N \\leq 4000\n\nS is a string of length N consisting of R, G, and B.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the number of triplets in question.\n\nSample Input 1\n\n4\nRRGB\n\nSample Output 1\n\n1\n\nOnly the triplet (1,~3,~4) satisfies both conditions. The triplet (2,~3,~4) satisfies the first condition but not the second, so it does not count.\n\nSample Input 2\n\n39\nRBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB\n\nSample Output 2\n\n1800", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2750, "cpu_time_ms": 340, "memory_kb": 40564}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s514182175", "group_id": "codeNet:p02714", "input_text": "\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.math.BigInteger;\nimport java.util.*;\nimport java.util.stream.LongStream;\n\npublic class Main {\n\n public Main() throws IOException {\n }\n\n public static void main(String[] args) throws IOException {\n new Main().solve();\n }\n\n // private final InputStream in = Files.newInputStream(Paths.get(\"C:\\\\Users\\\\ryo.suzuki\\\\Downloads\\\\02.txt\"));\n private final InputStream in = System.in;\n private final PrintWriter out = new PrintWriter(System.out);\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n private void solve() throws IOException {\n try {\n// solveA();\n// solveB();\n// solveC();\n solveD();\n// solveE();\n// solveF();\n } finally {\n if (in != null) {\n in.close();\n }\n if (out != null) {\n out.flush();\n out.close();\n }\n }\n\n }\n\n // mods\n long MOD = (long) Math.pow(10, 9) + 7;\n\n private void solveA() {\n int n = nextInt();\n while (n > 0) {\n int wk = n % 10;\n n /= 10;\n if (wk == 7) {\n out.println(\"Yes\");\n return;\n }\n }\n out.println(\"No\");\n }\n\n private void solveB() {\n long n = nextLong();\n long res = 0;\n for (long i = 1; i <= n; i++) {\n if (i % 3 != 0 && i % 5 != 0)\n res += i;\n }\n out.println(res);\n }\n\n private void solveC() {\n int k = nextInt();\n long res = 0;\n for (long i = 1; i <= k; i++) {\n for (long j = 1; j <= k; j++) {\n for (long l = 1; l <= k; l++) {\n long wk = gcd(i, j);\n wk = gcd(wk, l);\n res += wk;\n }\n }\n }\n out.println(res);\n }\n\n private void solveD() {\n int n = nextInt();\n char[] s = (next()).toCharArray();\n long r = 0;\n long g = 0;\n long b = 0;\n for (char c : s) {\n switch (c) {\n case 'R':\n r++;\n break;\n case 'G':\n g++;\n break;\n case 'B':\n b++;\n break;\n }\n }\n\n long res = r * g * b;\n if (res == 0) {\n out.println(0);\n return;\n }\n for (int i = 1; i <= n; i++) {\n for (int j = 1; j <= n; j++) {\n if (i - j < 0 || i + j >= n)\n continue;\n if (s[i - j] != s[i] && s[i + j] != s[i] && s[i + j] != s[i - j])\n res--;\n }\n }\n out.println(res);\n }\n\n private void solveE() {\n\n }\n\n private void solveF() {\n\n }\n\n static final long CONST_INF = Long.MAX_VALUE / 4;\n\n\n private static class VectorCalculation {\n /**\n * 点Pと線(AB)の距離\n *\n * @param p\n * @param a\n * @param b\n * @return\n */\n private double distanceDotAndLine(DoublePair p, DoublePair a, DoublePair b) {\n DoublePair ab = new DoublePair(b.x - a.x, b.y - a.y);\n DoublePair ap = new DoublePair(p.x - a.x, p.y - a.y);\n\n // ベクトルAB、APの外積の絶対値が平行四辺形Dの面積になる\n double d = Math.abs(crossVector(ab, ap));\n\n double l = distanceVertex(a, b); // AB間の距離\n\n double h = d / l;\n return h;\n }\n\n /**\n * 2点間距離\n *\n * @param p1\n * @param p2\n * @return\n */\n private double distanceVertex(DoublePair p1, DoublePair p2) {\n double dx = p1.x - p2.x;\n double dy = p1.y - p2.y;\n return Math.sqrt(dx * dx + dy * dy);\n }\n\n /**\n * ベクトル外積\n *\n * @param vl\n * @param vr\n * @return\n */\n private double crossVector(DoublePair vl, DoublePair vr) {\n return vl.x * vr.y - vl.y * vr.x;\n }\n }\n\n private static class DoublePair implements Comparable {\n double x;\n double y;\n\n public DoublePair(double k, double v) {\n this.x = k;\n this.y = v;\n }\n\n public int compareTo(DoublePair pair) {\n return Double.compare(this.y, pair.y);\n }\n }\n\n private static class SimplePair implements Comparable {\n long k;\n long v;\n\n public SimplePair(int k, int v) {\n this.k = k;\n this.v = v;\n }\n\n public SimplePair(long k, long v) {\n this.k = k;\n this.v = v;\n }\n\n public int compareTo(SimplePair pair) {\n return Long.compare(this.v, pair.v);\n }\n }\n\n\n private static class SimpleGraphNode {\n private int n;\n private Map childs;\n\n public SimpleGraphNode(int n) {\n this.n = n;\n childs = new HashMap();\n }\n\n public void addChild(int child, int d) {\n this.childs.put(child, d);\n }\n }\n\n private static class SimpleGraph {\n\n private Map graph;\n\n public SimpleGraph(int[][] list) {\n graph = new HashMap();\n Arrays.stream(list).forEach(l -> {\n int a = l[0];\n int b = l[1];\n int d = l[2];\n graph.put(a, graph.getOrDefault(a, new SimpleGraphNode(a)));\n graph.get(a).addChild(b, d);\n graph.put(b, graph.getOrDefault(b, new SimpleGraphNode(b)));\n graph.get(b).addChild(a, d);\n });\n }\n\n public SimpleGraphNode getNode(int i) {\n return graph.getOrDefault(i, new SimpleGraphNode(-1));\n }\n\n }\n\n private static class GraphNode {\n private long n;\n private Map childs;\n\n public GraphNode(long n) {\n this.n = n;\n childs = new TreeMap();\n }\n\n /**\n * not update\n *\n * @param child\n * @param d\n */\n public void addChild(long child, long d) {\n this.childs.put(child, this.childs.getOrDefault(child, new SimplePair(child, d)));\n }\n\n public SimplePair getChild(long child) {\n return this.childs.getOrDefault(child, new SimplePair(child, CONST_INF));\n }\n }\n\n private static class Graph {\n\n private Map graph;\n int n;\n\n /**\n * @param n 頂点数\n * @param list\n */\n public Graph(int n, int[][] list) {\n this.n = n;\n graph = new HashMap();\n /*\n 隣接行列作成\n 0-indexed\n */\n Arrays.stream(list).forEach(l -> {\n long a = l[0] - 1;\n long b = l[1] - 1;\n long d = l[2];\n graph.put(a, graph.getOrDefault(a, new GraphNode(a)));\n graph.get(a).addChild(b, d);\n graph.put(b, graph.getOrDefault(b, new GraphNode(b)));\n graph.get(b).addChild(a, d);\n });\n /*\n たどり着けない場所はCONST_INFで埋める\n 自分へはCOST=0でたどり着ける\n */\n for (long i = 0; i < n; i++) {\n graph.put(i, graph.getOrDefault(i, new GraphNode(i)));\n GraphNode node = graph.get(i);\n for (int j = 0; j < n; j++) {\n if (i == j)\n node.addChild(j, 0L);\n else\n node.addChild(j, CONST_INF);\n }\n }\n }\n\n /**\n * ワーシャルフロイド\n */\n public void warshallFloyd() {\n for (long k = 0; k < n; k++) {\n for (long i = 0; i < n; i++) {\n for (long j = 0; j < n; j++) {\n long min = Math.min(graph.get(i).getChild(j).v, graph.get(i).getChild(k).v + graph.get(k).getChild(j).v);\n graph.get(i).getChild(j).v = min;\n }\n }\n }\n }\n\n public void partialUpdateAndWarshallFloyd(long x, long y, long w) {\n if (graph.get(x).getChild(y).v > w)\n graph.get(x).getChild(y).v = graph.get(y).getChild(x).v = w;\n long[] l = {x, y};\n for (long k : l) {\n for (long i = 0; i < n; i++) {\n for (long j = 0; j < n; j++) {\n if (graph.get(i).getChild(j).v > graph.get(i).getChild(k).v + graph.get(k).getChild(j).v) {\n graph.get(i).getChild(j).v = graph.get(i).getChild(k).v + graph.get(k).getChild(j).v;\n }\n }\n }\n }\n }\n\n /**\n * 2点間の距離\n *\n * @param from\n * @param to\n * @return\n */\n public long getDistance(long from, long to) {\n return graph.get(from).getChild(to).v;\n }\n\n }\n\n public long calcSimpleCombination(long n, long m, long CONST_MOD) {\n long mole = 1;\n for (long i = 1; i <= n + m; i++) {\n mole *= i;\n mole %= CONST_MOD;\n }\n long deno = 1;\n for (long i = 1; i <= n; i++) {\n deno *= i;\n deno %= CONST_MOD;\n }\n for (int i = 1; i <= m; i++) {\n deno *= i;\n deno %= CONST_MOD;\n }\n deno = modInverse(deno, CONST_MOD);\n return (mole * deno) % CONST_MOD;\n }\n\n long abs(double x) {\n return (long) Math.abs(x);\n }\n\n long round(double x) {\n return Math.round(x);\n }\n\n long floor(double x) {\n return (long) Math.floor(x);\n }\n\n long ceil(double x) {\n return (long) Math.ceil(x);\n }\n\n double sqrt(double x) {\n return Math.sqrt(x);\n }\n\n double pow(double x, double y) {\n return Math.pow(x, y);\n }\n\n long pow(long x, long y) {\n return (long) Math.pow(x, y);\n }\n\n int gcd(int a, int b) {\n return b == 0 ? a : gcd(b, a % b);\n }\n\n long gcd(long a, long b) {\n return b == 0 ? a : gcd(b, a % b);\n }\n\n long lcm(long a, long b) {\n return a * b / gcd(a, b);\n }\n\n public long lcmMod(long... ab) {\n\n Map ps = new HashMap();\n\n for (int abl = 0; abl < ab.length; abl++) {\n long target = ab[abl];\n long l = target;\n for (long p = 2; p * p <= l; p++) {\n long cnt = 0;\n while (target > 1 && target % p == 0) {\n cnt++;\n target /= p;\n }\n if (cnt == 0)\n continue;\n ps.put(p, Long.max(cnt, ps.getOrDefault(p, 0L)));\n }\n if (target > 1)\n ps.put(target, Long.max(1, ps.getOrDefault(target, 0L)));\n }\n long res = 1L;\n for (Map.Entry e : ps.entrySet()) {\n res *= powMod(e.getKey(), e.getValue());\n res %= MOD;\n }\n return res;\n }\n\n int upperToInt(char a) {\n return a - 'A';\n }\n\n int lowerToInt(char a) {\n return a - 'a';\n }\n\n int numToInt(char a) {\n return a - '0';\n }\n\n int charToInt(char a) {\n return a >= 'a' ? lowerToInt(a) : a >= 'A' ? upperToInt(a) : numToInt(a);\n }\n\n char intToUpper(int a) {\n return (char) (a + 'A');\n }\n\n char intToLower(int a) {\n return (char) (a + 'a');\n }\n\n char intToNum(int a) {\n return (char) (a + '0');\n }\n\n void reverse(String array[]) {\n String reversed[] = new String[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void reverse(int array[]) {\n int reversed[] = new int[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void reverse(long array[]) {\n long reversed[] = new long[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void reverse(double array[]) {\n double reversed[] = new double[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void reverse(boolean array[]) {\n boolean reversed[] = new boolean[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void fill(int array[][], int x) {\n for (int a[] : array) {\n Arrays.fill(a, x);\n }\n }\n\n void fill(long array[][], long x) {\n for (long a[] : array) {\n Arrays.fill(a, x);\n }\n }\n\n void fill(double array[][], double x) {\n for (double a[] : array) {\n Arrays.fill(a, x);\n }\n }\n\n void fill(boolean array[][], boolean x) {\n for (boolean a[] : array) {\n Arrays.fill(a, x);\n }\n }\n\n void fill(int array[][][], int x) {\n for (int a[][] : array) {\n fill(a, x);\n }\n }\n\n void fill(long array[][][], long x) {\n for (long a[][] : array) {\n fill(a, x);\n }\n }\n\n void fill(double array[][][], double x) {\n for (double a[][] : array) {\n fill(a, x);\n }\n }\n\n void fill(boolean array[][][], boolean x) {\n for (boolean a[][] : array) {\n fill(a, x);\n }\n }\n\n long L_INF = (long) 1e18 + 7;\n\n boolean isINF(long a) {\n return abs(a) > L_INF / 1000;\n }\n\n boolean isPlusINF(long a) {\n return a > 0 && isINF(a);\n }\n\n boolean isMinusINF(long a) {\n return isPlusINF(-a);\n }\n\n int I_INF = (int) 1e9 + 7;\n\n boolean isINF(int a) {\n return abs(a) > I_INF / 1000;\n }\n\n boolean isPlusINF(int a) {\n return a > 0 && isINF(a);\n }\n\n boolean isMinusINF(int a) {\n return isPlusINF(-a);\n }\n\n /**\n * 指定したx以下の素数をリストアップする\n */\n public long[] getPrimesUnderX(long x) {\n return LongStream.rangeClosed(2, x)\n .filter(i -> LongStream.rangeClosed(2, (long) Math.sqrt(i)).allMatch(j -> i % j != 0)).toArray();\n }\n\n\n public long mod(long i) {\n return i % MOD + ((i % MOD) < 0 ? MOD : 0);\n }\n\n long powMod(long x, long y) {\n if (y == 0) {\n return 1;\n } else {\n long tmp = powMod(x, y / 2);\n return mod(mod(tmp * tmp) * (y % 2 == 0 ? 1 : x));\n }\n }\n\n long inv(long x) {\n return powMod(x, MOD - 2);\n }\n\n int MAX_FACT = 5_000_100;\n long fact[];\n long invFact[];\n\n /**\n * Combination簡易版\n * 5 C 2\n * 異なる n個のものから r個を選ぶ組み合わせの総数 nCr を求めます。\n * 5!(5*4*3*2*1)\n * /\n * 2!(2*1) * (5-2)!(3*2*1)\n *\n * @param n\n * @param r\n * @return\n */\n private long getComb(int n, int r) {\n long tmp = 1;\n for (int i = 1; i <= r; i++) {\n tmp *= n - i + 1;\n tmp = mod(tmp);\n tmp *= inv(i);\n tmp = mod(tmp);\n }\n return tmp;\n }\n\n /**\n * 階乗計算の事前累積和\n * [1, 1, 2, 3, 4, 5, … FACTORIAL_NUM]\n * mod済\n */\n void prepareFact() {\n fact = new long[MAX_FACT];\n Arrays.fill(fact, 0);\n invFact = new long[MAX_FACT];\n Arrays.fill(invFact, 0);\n fact[0] = 1;\n int maxIndex = (int) min(MAX_FACT, (int) MOD);\n for (int i = 1; i < maxIndex; i++) {\n fact[i] = mod(fact[i - 1] * i);\n }\n invFact[maxIndex - 1] = inv(fact[maxIndex - 1]);\n for (int i = maxIndex - 1; i > 0; i--) {\n invFact[i - 1] = mod(invFact[i] * i);\n }\n }\n\n /**\n * 順列\n * nPk -> n! / (n-k)!\n *\n * @param n\n * @param r\n * @return\n */\n long permutation(int n, int r) {\n if (n < 0 || r < 0 || n < r) {\n return 0;\n }\n return mod(fact[n] * invFact[n - r]);\n }\n\n /**\n * 組み合わせ\n * nCk -> n! / k!・(n-k)!\n *\n * @param n\n * @param r\n * @return\n */\n long combination(int n, int r) {\n if (n < 0 || r < 0 || n < r) {\n return 0;\n }\n return mod(permutation(n, r) * invFact[r]);\n }\n\n /**\n * 重複組合せ nHr (同次積)\n * nHr = (n+r-1)Cr\n * 異なるn個のものから重複を許してr個取る組合せの総数\n * 例:\n * リンゴ,ミカン,牛肉の3種類の果物があります.これらの中から6個の食材を買って帰ります.\n * このとき,何通りの買い方がありますか?ただし,含まれない食材があってもよいものとします\n *\n * @param n\n * @param r\n * @return\n */\n long homogeneousProduct(int n, int r) {\n return combination((n - 1) + r, r);\n }\n\n /**\n * 多項係数\n * 文字aをp個,bをq個,cをr個, dをs個 あわせてn個を1列に並べるときの並べ方\n * n! / p!・q!・r!・s!\n *\n * @param n\n * @param strNum\n * @param mod\n * @return\n */\n\n /**\n * フェルマーの小定理を用いて逆元を求める。\n * ある数xのmod p��pは素数)の逆数x'はx' = x^(p-2)\n * 繰り返し二乗法を用いて計算する。\n * http://satanic0258.hatenablog.com/entry/2016/04/29/004730\n * {@link BigInteger#modInverse(BigInteger)}とどちらが速いか?\n *\n * @param x\n * @return\n */\n private long modInverse(long x, long mod) {\n long res = 1L;\n long k = mod - 2L;\n long y = x;\n while (k != 0) {\n if (k % 2 != 0) {\n res = (res * y) % mod;\n }\n y = (y * y) % mod;\n k /= 2;\n }\n return res;\n }\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte())\n return buffer[ptr++];\n else\n return -1;\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n private void skipUnprintable() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr]))\n ptr++;\n }\n\n public boolean hasNext() {\n skipUnprintable();\n return hasNextByte();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public String next() {\n if (!hasNext())\n throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext())\n throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public long min(long... v) {\n long min = Long.MAX_VALUE;\n for (long i : v) min = Math.min(min, i);\n return min;\n }\n\n public long max(long... v) {\n long max = Long.MIN_VALUE;\n for (long i : v) max = Math.max(max, i);\n return max;\n }\n}\n", "language": "Java", "metadata": {"date": 1586809372, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02714.html", "problem_id": "p02714", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02714/input.txt", "sample_output_relpath": "derived/input_output/data/p02714/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02714/Java/s514182175.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s514182175", "user_id": "u345932819"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.math.BigInteger;\nimport java.util.*;\nimport java.util.stream.LongStream;\n\npublic class Main {\n\n public Main() throws IOException {\n }\n\n public static void main(String[] args) throws IOException {\n new Main().solve();\n }\n\n // private final InputStream in = Files.newInputStream(Paths.get(\"C:\\\\Users\\\\ryo.suzuki\\\\Downloads\\\\02.txt\"));\n private final InputStream in = System.in;\n private final PrintWriter out = new PrintWriter(System.out);\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n private void solve() throws IOException {\n try {\n// solveA();\n// solveB();\n// solveC();\n solveD();\n// solveE();\n// solveF();\n } finally {\n if (in != null) {\n in.close();\n }\n if (out != null) {\n out.flush();\n out.close();\n }\n }\n\n }\n\n // mods\n long MOD = (long) Math.pow(10, 9) + 7;\n\n private void solveA() {\n int n = nextInt();\n while (n > 0) {\n int wk = n % 10;\n n /= 10;\n if (wk == 7) {\n out.println(\"Yes\");\n return;\n }\n }\n out.println(\"No\");\n }\n\n private void solveB() {\n long n = nextLong();\n long res = 0;\n for (long i = 1; i <= n; i++) {\n if (i % 3 != 0 && i % 5 != 0)\n res += i;\n }\n out.println(res);\n }\n\n private void solveC() {\n int k = nextInt();\n long res = 0;\n for (long i = 1; i <= k; i++) {\n for (long j = 1; j <= k; j++) {\n for (long l = 1; l <= k; l++) {\n long wk = gcd(i, j);\n wk = gcd(wk, l);\n res += wk;\n }\n }\n }\n out.println(res);\n }\n\n private void solveD() {\n int n = nextInt();\n char[] s = (next()).toCharArray();\n long r = 0;\n long g = 0;\n long b = 0;\n for (char c : s) {\n switch (c) {\n case 'R':\n r++;\n break;\n case 'G':\n g++;\n break;\n case 'B':\n b++;\n break;\n }\n }\n\n long res = r * g * b;\n if (res == 0) {\n out.println(0);\n return;\n }\n for (int i = 1; i <= n; i++) {\n for (int j = 1; j <= n; j++) {\n if (i - j < 0 || i + j >= n)\n continue;\n if (s[i - j] != s[i] && s[i + j] != s[i] && s[i + j] != s[i - j])\n res--;\n }\n }\n out.println(res);\n }\n\n private void solveE() {\n\n }\n\n private void solveF() {\n\n }\n\n static final long CONST_INF = Long.MAX_VALUE / 4;\n\n\n private static class VectorCalculation {\n /**\n * 点Pと線(AB)の距離\n *\n * @param p\n * @param a\n * @param b\n * @return\n */\n private double distanceDotAndLine(DoublePair p, DoublePair a, DoublePair b) {\n DoublePair ab = new DoublePair(b.x - a.x, b.y - a.y);\n DoublePair ap = new DoublePair(p.x - a.x, p.y - a.y);\n\n // ベクトルAB、APの外積の絶対値が平行四辺形Dの面積になる\n double d = Math.abs(crossVector(ab, ap));\n\n double l = distanceVertex(a, b); // AB間の距離\n\n double h = d / l;\n return h;\n }\n\n /**\n * 2点間距離\n *\n * @param p1\n * @param p2\n * @return\n */\n private double distanceVertex(DoublePair p1, DoublePair p2) {\n double dx = p1.x - p2.x;\n double dy = p1.y - p2.y;\n return Math.sqrt(dx * dx + dy * dy);\n }\n\n /**\n * ベクトル外積\n *\n * @param vl\n * @param vr\n * @return\n */\n private double crossVector(DoublePair vl, DoublePair vr) {\n return vl.x * vr.y - vl.y * vr.x;\n }\n }\n\n private static class DoublePair implements Comparable {\n double x;\n double y;\n\n public DoublePair(double k, double v) {\n this.x = k;\n this.y = v;\n }\n\n public int compareTo(DoublePair pair) {\n return Double.compare(this.y, pair.y);\n }\n }\n\n private static class SimplePair implements Comparable {\n long k;\n long v;\n\n public SimplePair(int k, int v) {\n this.k = k;\n this.v = v;\n }\n\n public SimplePair(long k, long v) {\n this.k = k;\n this.v = v;\n }\n\n public int compareTo(SimplePair pair) {\n return Long.compare(this.v, pair.v);\n }\n }\n\n\n private static class SimpleGraphNode {\n private int n;\n private Map childs;\n\n public SimpleGraphNode(int n) {\n this.n = n;\n childs = new HashMap();\n }\n\n public void addChild(int child, int d) {\n this.childs.put(child, d);\n }\n }\n\n private static class SimpleGraph {\n\n private Map graph;\n\n public SimpleGraph(int[][] list) {\n graph = new HashMap();\n Arrays.stream(list).forEach(l -> {\n int a = l[0];\n int b = l[1];\n int d = l[2];\n graph.put(a, graph.getOrDefault(a, new SimpleGraphNode(a)));\n graph.get(a).addChild(b, d);\n graph.put(b, graph.getOrDefault(b, new SimpleGraphNode(b)));\n graph.get(b).addChild(a, d);\n });\n }\n\n public SimpleGraphNode getNode(int i) {\n return graph.getOrDefault(i, new SimpleGraphNode(-1));\n }\n\n }\n\n private static class GraphNode {\n private long n;\n private Map childs;\n\n public GraphNode(long n) {\n this.n = n;\n childs = new TreeMap();\n }\n\n /**\n * not update\n *\n * @param child\n * @param d\n */\n public void addChild(long child, long d) {\n this.childs.put(child, this.childs.getOrDefault(child, new SimplePair(child, d)));\n }\n\n public SimplePair getChild(long child) {\n return this.childs.getOrDefault(child, new SimplePair(child, CONST_INF));\n }\n }\n\n private static class Graph {\n\n private Map graph;\n int n;\n\n /**\n * @param n 頂点数\n * @param list\n */\n public Graph(int n, int[][] list) {\n this.n = n;\n graph = new HashMap();\n /*\n 隣接行列作成\n 0-indexed\n */\n Arrays.stream(list).forEach(l -> {\n long a = l[0] - 1;\n long b = l[1] - 1;\n long d = l[2];\n graph.put(a, graph.getOrDefault(a, new GraphNode(a)));\n graph.get(a).addChild(b, d);\n graph.put(b, graph.getOrDefault(b, new GraphNode(b)));\n graph.get(b).addChild(a, d);\n });\n /*\n たどり着けない場所はCONST_INFで埋める\n 自分へはCOST=0でたどり着ける\n */\n for (long i = 0; i < n; i++) {\n graph.put(i, graph.getOrDefault(i, new GraphNode(i)));\n GraphNode node = graph.get(i);\n for (int j = 0; j < n; j++) {\n if (i == j)\n node.addChild(j, 0L);\n else\n node.addChild(j, CONST_INF);\n }\n }\n }\n\n /**\n * ワーシャルフロイド\n */\n public void warshallFloyd() {\n for (long k = 0; k < n; k++) {\n for (long i = 0; i < n; i++) {\n for (long j = 0; j < n; j++) {\n long min = Math.min(graph.get(i).getChild(j).v, graph.get(i).getChild(k).v + graph.get(k).getChild(j).v);\n graph.get(i).getChild(j).v = min;\n }\n }\n }\n }\n\n public void partialUpdateAndWarshallFloyd(long x, long y, long w) {\n if (graph.get(x).getChild(y).v > w)\n graph.get(x).getChild(y).v = graph.get(y).getChild(x).v = w;\n long[] l = {x, y};\n for (long k : l) {\n for (long i = 0; i < n; i++) {\n for (long j = 0; j < n; j++) {\n if (graph.get(i).getChild(j).v > graph.get(i).getChild(k).v + graph.get(k).getChild(j).v) {\n graph.get(i).getChild(j).v = graph.get(i).getChild(k).v + graph.get(k).getChild(j).v;\n }\n }\n }\n }\n }\n\n /**\n * 2点間の距離\n *\n * @param from\n * @param to\n * @return\n */\n public long getDistance(long from, long to) {\n return graph.get(from).getChild(to).v;\n }\n\n }\n\n public long calcSimpleCombination(long n, long m, long CONST_MOD) {\n long mole = 1;\n for (long i = 1; i <= n + m; i++) {\n mole *= i;\n mole %= CONST_MOD;\n }\n long deno = 1;\n for (long i = 1; i <= n; i++) {\n deno *= i;\n deno %= CONST_MOD;\n }\n for (int i = 1; i <= m; i++) {\n deno *= i;\n deno %= CONST_MOD;\n }\n deno = modInverse(deno, CONST_MOD);\n return (mole * deno) % CONST_MOD;\n }\n\n long abs(double x) {\n return (long) Math.abs(x);\n }\n\n long round(double x) {\n return Math.round(x);\n }\n\n long floor(double x) {\n return (long) Math.floor(x);\n }\n\n long ceil(double x) {\n return (long) Math.ceil(x);\n }\n\n double sqrt(double x) {\n return Math.sqrt(x);\n }\n\n double pow(double x, double y) {\n return Math.pow(x, y);\n }\n\n long pow(long x, long y) {\n return (long) Math.pow(x, y);\n }\n\n int gcd(int a, int b) {\n return b == 0 ? a : gcd(b, a % b);\n }\n\n long gcd(long a, long b) {\n return b == 0 ? a : gcd(b, a % b);\n }\n\n long lcm(long a, long b) {\n return a * b / gcd(a, b);\n }\n\n public long lcmMod(long... ab) {\n\n Map ps = new HashMap();\n\n for (int abl = 0; abl < ab.length; abl++) {\n long target = ab[abl];\n long l = target;\n for (long p = 2; p * p <= l; p++) {\n long cnt = 0;\n while (target > 1 && target % p == 0) {\n cnt++;\n target /= p;\n }\n if (cnt == 0)\n continue;\n ps.put(p, Long.max(cnt, ps.getOrDefault(p, 0L)));\n }\n if (target > 1)\n ps.put(target, Long.max(1, ps.getOrDefault(target, 0L)));\n }\n long res = 1L;\n for (Map.Entry e : ps.entrySet()) {\n res *= powMod(e.getKey(), e.getValue());\n res %= MOD;\n }\n return res;\n }\n\n int upperToInt(char a) {\n return a - 'A';\n }\n\n int lowerToInt(char a) {\n return a - 'a';\n }\n\n int numToInt(char a) {\n return a - '0';\n }\n\n int charToInt(char a) {\n return a >= 'a' ? lowerToInt(a) : a >= 'A' ? upperToInt(a) : numToInt(a);\n }\n\n char intToUpper(int a) {\n return (char) (a + 'A');\n }\n\n char intToLower(int a) {\n return (char) (a + 'a');\n }\n\n char intToNum(int a) {\n return (char) (a + '0');\n }\n\n void reverse(String array[]) {\n String reversed[] = new String[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void reverse(int array[]) {\n int reversed[] = new int[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void reverse(long array[]) {\n long reversed[] = new long[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void reverse(double array[]) {\n double reversed[] = new double[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void reverse(boolean array[]) {\n boolean reversed[] = new boolean[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void fill(int array[][], int x) {\n for (int a[] : array) {\n Arrays.fill(a, x);\n }\n }\n\n void fill(long array[][], long x) {\n for (long a[] : array) {\n Arrays.fill(a, x);\n }\n }\n\n void fill(double array[][], double x) {\n for (double a[] : array) {\n Arrays.fill(a, x);\n }\n }\n\n void fill(boolean array[][], boolean x) {\n for (boolean a[] : array) {\n Arrays.fill(a, x);\n }\n }\n\n void fill(int array[][][], int x) {\n for (int a[][] : array) {\n fill(a, x);\n }\n }\n\n void fill(long array[][][], long x) {\n for (long a[][] : array) {\n fill(a, x);\n }\n }\n\n void fill(double array[][][], double x) {\n for (double a[][] : array) {\n fill(a, x);\n }\n }\n\n void fill(boolean array[][][], boolean x) {\n for (boolean a[][] : array) {\n fill(a, x);\n }\n }\n\n long L_INF = (long) 1e18 + 7;\n\n boolean isINF(long a) {\n return abs(a) > L_INF / 1000;\n }\n\n boolean isPlusINF(long a) {\n return a > 0 && isINF(a);\n }\n\n boolean isMinusINF(long a) {\n return isPlusINF(-a);\n }\n\n int I_INF = (int) 1e9 + 7;\n\n boolean isINF(int a) {\n return abs(a) > I_INF / 1000;\n }\n\n boolean isPlusINF(int a) {\n return a > 0 && isINF(a);\n }\n\n boolean isMinusINF(int a) {\n return isPlusINF(-a);\n }\n\n /**\n * 指定したx以下の素数をリストアップする\n */\n public long[] getPrimesUnderX(long x) {\n return LongStream.rangeClosed(2, x)\n .filter(i -> LongStream.rangeClosed(2, (long) Math.sqrt(i)).allMatch(j -> i % j != 0)).toArray();\n }\n\n\n public long mod(long i) {\n return i % MOD + ((i % MOD) < 0 ? MOD : 0);\n }\n\n long powMod(long x, long y) {\n if (y == 0) {\n return 1;\n } else {\n long tmp = powMod(x, y / 2);\n return mod(mod(tmp * tmp) * (y % 2 == 0 ? 1 : x));\n }\n }\n\n long inv(long x) {\n return powMod(x, MOD - 2);\n }\n\n int MAX_FACT = 5_000_100;\n long fact[];\n long invFact[];\n\n /**\n * Combination簡易版\n * 5 C 2\n * 異なる n個のものから r個を選ぶ組み合わせの総数 nCr を求めます。\n * 5!(5*4*3*2*1)\n * /\n * 2!(2*1) * (5-2)!(3*2*1)\n *\n * @param n\n * @param r\n * @return\n */\n private long getComb(int n, int r) {\n long tmp = 1;\n for (int i = 1; i <= r; i++) {\n tmp *= n - i + 1;\n tmp = mod(tmp);\n tmp *= inv(i);\n tmp = mod(tmp);\n }\n return tmp;\n }\n\n /**\n * 階乗計算の事前累積和\n * [1, 1, 2, 3, 4, 5, … FACTORIAL_NUM]\n * mod済\n */\n void prepareFact() {\n fact = new long[MAX_FACT];\n Arrays.fill(fact, 0);\n invFact = new long[MAX_FACT];\n Arrays.fill(invFact, 0);\n fact[0] = 1;\n int maxIndex = (int) min(MAX_FACT, (int) MOD);\n for (int i = 1; i < maxIndex; i++) {\n fact[i] = mod(fact[i - 1] * i);\n }\n invFact[maxIndex - 1] = inv(fact[maxIndex - 1]);\n for (int i = maxIndex - 1; i > 0; i--) {\n invFact[i - 1] = mod(invFact[i] * i);\n }\n }\n\n /**\n * 順列\n * nPk -> n! / (n-k)!\n *\n * @param n\n * @param r\n * @return\n */\n long permutation(int n, int r) {\n if (n < 0 || r < 0 || n < r) {\n return 0;\n }\n return mod(fact[n] * invFact[n - r]);\n }\n\n /**\n * 組み合わせ\n * nCk -> n! / k!・(n-k)!\n *\n * @param n\n * @param r\n * @return\n */\n long combination(int n, int r) {\n if (n < 0 || r < 0 || n < r) {\n return 0;\n }\n return mod(permutation(n, r) * invFact[r]);\n }\n\n /**\n * 重複組合せ nHr (同次積)\n * nHr = (n+r-1)Cr\n * 異なるn個のものから重複を許してr個取る組合せの総数\n * 例:\n * リンゴ,ミカン,牛肉の3種類の果物があります.これらの中から6個の食材を買って帰ります.\n * このとき,何通りの買い方がありますか?ただし,含まれない食材があってもよいものとします\n *\n * @param n\n * @param r\n * @return\n */\n long homogeneousProduct(int n, int r) {\n return combination((n - 1) + r, r);\n }\n\n /**\n * 多項係数\n * 文字aをp個,bをq個,cをr個, dをs個 あわせてn個を1列に並べるときの並べ方\n * n! / p!・q!・r!・s!\n *\n * @param n\n * @param strNum\n * @param mod\n * @return\n */\n\n /**\n * フェルマーの小定理を用いて逆元を求める。\n * ある数xのmod p(pは素数)の逆数x'はx' = x^(p-2)\n * 繰り返し二乗法を用いて計算する。\n * http://satanic0258.hatenablog.com/entry/2016/04/29/004730\n * {@link BigInteger#modInverse(BigInteger)}とどちらが速いか?\n *\n * @param x\n * @return\n */\n private long modInverse(long x, long mod) {\n long res = 1L;\n long k = mod - 2L;\n long y = x;\n while (k != 0) {\n if (k % 2 != 0) {\n res = (res * y) % mod;\n }\n y = (y * y) % mod;\n k /= 2;\n }\n return res;\n }\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte())\n return buffer[ptr++];\n else\n return -1;\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n private void skipUnprintable() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr]))\n ptr++;\n }\n\n public boolean hasNext() {\n skipUnprintable();\n return hasNextByte();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public String next() {\n if (!hasNext())\n throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext())\n throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public long min(long... v) {\n long min = Long.MAX_VALUE;\n for (long i : v) min = Math.min(min, i);\n return min;\n }\n\n public long max(long... v) {\n long max = Long.MIN_VALUE;\n for (long i : v) max = Math.max(max, i);\n return max;\n }\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a string S of length N consisting of R, G, and B.\n\nFind the number of triples (i,~j,~k)~(1 \\leq i < j < k \\leq N) that satisfy both of the following conditions:\n\nS_i \\neq S_j, S_i \\neq S_k, and S_j \\neq S_k.\n\nj - i \\neq k - j.\n\nConstraints\n\n1 \\leq N \\leq 4000\n\nS is a string of length N consisting of R, G, and B.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the number of triplets in question.\n\nSample Input 1\n\n4\nRRGB\n\nSample Output 1\n\n1\n\nOnly the triplet (1,~3,~4) satisfies both conditions. The triplet (2,~3,~4) satisfies the first condition but not the second, so it does not count.\n\nSample Input 2\n\n39\nRBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB\n\nSample Output 2\n\n1800", "sample_input": "4\nRRGB\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02714", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a string S of length N consisting of R, G, and B.\n\nFind the number of triples (i,~j,~k)~(1 \\leq i < j < k \\leq N) that satisfy both of the following conditions:\n\nS_i \\neq S_j, S_i \\neq S_k, and S_j \\neq S_k.\n\nj - i \\neq k - j.\n\nConstraints\n\n1 \\leq N \\leq 4000\n\nS is a string of length N consisting of R, G, and B.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the number of triplets in question.\n\nSample Input 1\n\n4\nRRGB\n\nSample Output 1\n\n1\n\nOnly the triplet (1,~3,~4) satisfies both conditions. The triplet (2,~3,~4) satisfies the first condition but not the second, so it does not count.\n\nSample Input 2\n\n39\nRBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB\n\nSample Output 2\n\n1800", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 21387, "cpu_time_ms": 121, "memory_kb": 32912}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s751212973", "group_id": "codeNet:p02714", "input_text": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner stdIn = new Scanner(System.in);\n int a = stdIn.nextInt() ;\n String S = stdIn.next();\n char C1,C2,C3 ;\n int count = 0;\n\n for (int i = 0; i < a; i++) {\n C1 = S.charAt(i) ;\n for (int j = i+1; j R = new ArrayList<>();\n List G = new ArrayList<>();\n List B = new ArrayList<>();\n\n for (int i = 0; i < S.length(); i++) {\n char c = S.charAt(i);\n if(c=='R'){\n R.add(i);\n }else if (c=='G'){\n G.add(i);\n }else{\n B.add(i);\n }\n }\n\n\n int ans = 0;\n for (int i :R) {\n for (int j :G) {\n for (int k :B) {\n if ( (ij && j >k)) {\n if(i+k != 2 *j){\n ans++;\n }\n }else if( (i k && k >j)){\n if(i+j != 2 *k){\n ans++;\n }\n }else if( (j < i && i i && i >k)){\n if(j+k != 2 *i){\n ans++;\n }\n\n }\n }\n }\n }\n System.out.println(ans);\n }\n\n}\n", "language": "Java", "metadata": {"date": 1586743348, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02714.html", "problem_id": "p02714", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02714/input.txt", "sample_output_relpath": "derived/input_output/data/p02714/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02714/Java/s201758618.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s201758618", "user_id": "u584924463"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n String S = sc.next();\n\n List R = new ArrayList<>();\n List G = new ArrayList<>();\n List B = new ArrayList<>();\n\n for (int i = 0; i < S.length(); i++) {\n char c = S.charAt(i);\n if(c=='R'){\n R.add(i);\n }else if (c=='G'){\n G.add(i);\n }else{\n B.add(i);\n }\n }\n\n\n int ans = 0;\n for (int i :R) {\n for (int j :G) {\n for (int k :B) {\n if ( (ij && j >k)) {\n if(i+k != 2 *j){\n ans++;\n }\n }else if( (i k && k >j)){\n if(i+j != 2 *k){\n ans++;\n }\n }else if( (j < i && i i && i >k)){\n if(j+k != 2 *i){\n ans++;\n }\n\n }\n }\n }\n }\n System.out.println(ans);\n }\n\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a string S of length N consisting of R, G, and B.\n\nFind the number of triples (i,~j,~k)~(1 \\leq i < j < k \\leq N) that satisfy both of the following conditions:\n\nS_i \\neq S_j, S_i \\neq S_k, and S_j \\neq S_k.\n\nj - i \\neq k - j.\n\nConstraints\n\n1 \\leq N \\leq 4000\n\nS is a string of length N consisting of R, G, and B.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the number of triplets in question.\n\nSample Input 1\n\n4\nRRGB\n\nSample Output 1\n\n1\n\nOnly the triplet (1,~3,~4) satisfies both conditions. The triplet (2,~3,~4) satisfies the first condition but not the second, so it does not count.\n\nSample Input 2\n\n39\nRBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB\n\nSample Output 2\n\n1800", "sample_input": "4\nRRGB\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02714", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a string S of length N consisting of R, G, and B.\n\nFind the number of triples (i,~j,~k)~(1 \\leq i < j < k \\leq N) that satisfy both of the following conditions:\n\nS_i \\neq S_j, S_i \\neq S_k, and S_j \\neq S_k.\n\nj - i \\neq k - j.\n\nConstraints\n\n1 \\leq N \\leq 4000\n\nS is a string of length N consisting of R, G, and B.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the number of triplets in question.\n\nSample Input 1\n\n4\nRRGB\n\nSample Output 1\n\n1\n\nOnly the triplet (1,~3,~4) satisfies both conditions. The triplet (2,~3,~4) satisfies the first condition but not the second, so it does not count.\n\nSample Input 2\n\n39\nRBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB\n\nSample Output 2\n\n1800", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1307, "cpu_time_ms": 2207, "memory_kb": 53628}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s846342901", "group_id": "codeNet:p02714", "input_text": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint a = sc.nextInt();\n\t\t\n\t\tString s = sc.next();\n int ans = 0;\n int r = 0;\n int g = 0;\n int b = 0;\n for(int i=0;i3){for(int i=0;i3){for(int i=0;i R = new ArrayList<>();\n List G = new ArrayList<>();\n List B = new ArrayList<>();\n\n for (int i = 0; i < S.length(); i++) {\n char c = S.charAt(i);\n if(c=='R'){\n R.add(i);\n }else if (c=='G'){\n G.add(i);\n }else{\n B.add(i);\n }\n }\n\n\n int ans = 0;\n for (int i :R) {\n for (int j :G) {\n for (int k :B) {\n int[] aa= new int[3];\n aa[0]=i;\n aa[1]=j;\n aa[2]=k;\n Arrays.sort(aa);\n if(aa[1]-aa[0] != aa[2]-aa[1])\n ans ++;\n }\n }\n }\n System.out.println(ans);\n }\n\n static int gcd(int a, int b ){\n if (a == 0)\n return b;\n\n return gcd(b%a, a);\n }\n\n}\n", "language": "Java", "metadata": {"date": 1586742597, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02714.html", "problem_id": "p02714", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02714/input.txt", "sample_output_relpath": "derived/input_output/data/p02714/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02714/Java/s714335121.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s714335121", "user_id": "u584924463"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n String S = sc.next();\n\n List R = new ArrayList<>();\n List G = new ArrayList<>();\n List B = new ArrayList<>();\n\n for (int i = 0; i < S.length(); i++) {\n char c = S.charAt(i);\n if(c=='R'){\n R.add(i);\n }else if (c=='G'){\n G.add(i);\n }else{\n B.add(i);\n }\n }\n\n\n int ans = 0;\n for (int i :R) {\n for (int j :G) {\n for (int k :B) {\n int[] aa= new int[3];\n aa[0]=i;\n aa[1]=j;\n aa[2]=k;\n Arrays.sort(aa);\n if(aa[1]-aa[0] != aa[2]-aa[1])\n ans ++;\n }\n }\n }\n System.out.println(ans);\n }\n\n static int gcd(int a, int b ){\n if (a == 0)\n return b;\n\n return gcd(b%a, a);\n }\n\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a string S of length N consisting of R, G, and B.\n\nFind the number of triples (i,~j,~k)~(1 \\leq i < j < k \\leq N) that satisfy both of the following conditions:\n\nS_i \\neq S_j, S_i \\neq S_k, and S_j \\neq S_k.\n\nj - i \\neq k - j.\n\nConstraints\n\n1 \\leq N \\leq 4000\n\nS is a string of length N consisting of R, G, and B.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the number of triplets in question.\n\nSample Input 1\n\n4\nRRGB\n\nSample Output 1\n\n1\n\nOnly the triplet (1,~3,~4) satisfies both conditions. The triplet (2,~3,~4) satisfies the first condition but not the second, so it does not count.\n\nSample Input 2\n\n39\nRBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB\n\nSample Output 2\n\n1800", "sample_input": "4\nRRGB\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02714", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a string S of length N consisting of R, G, and B.\n\nFind the number of triples (i,~j,~k)~(1 \\leq i < j < k \\leq N) that satisfy both of the following conditions:\n\nS_i \\neq S_j, S_i \\neq S_k, and S_j \\neq S_k.\n\nj - i \\neq k - j.\n\nConstraints\n\n1 \\leq N \\leq 4000\n\nS is a string of length N consisting of R, G, and B.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the number of triplets in question.\n\nSample Input 1\n\n4\nRRGB\n\nSample Output 1\n\n1\n\nOnly the triplet (1,~3,~4) satisfies both conditions. The triplet (2,~3,~4) satisfies the first condition but not the second, so it does not count.\n\nSample Input 2\n\n39\nRBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB\n\nSample Output 2\n\n1800", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1139, "cpu_time_ms": 2207, "memory_kb": 55636}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s754124797", "group_id": "codeNet:p02714", "input_text": "import java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n // write your code here\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n String s = sc.next();\n\n long r = 0;\n long g = 0;\n long b = 0;\n\n for(int i = 0 ; i < s.length() ; i++){\n switch (s.charAt(i)){\n case 'R':\n r++;\n break;\n case 'G':\n g++;\n break;\n case 'B':\n b++;\n break;\n }\n }\n\n long sum = r*g*b;\n\n for(int i = 0 ; i < n ; i++){\n for(int d = 1 ; i + 2*d < n ; d++){\n if(s.charAt(i) != s.charAt(i+d) && s.charAt(i+d) != s.charAt(i+2*d) && s.charAt(i+2*d) != s.charAt(i)){\n sum--;\n }\n }\n }\n\n System.out.println(sum);\n }\n}\n", "language": "Java", "metadata": {"date": 1586741909, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02714.html", "problem_id": "p02714", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02714/input.txt", "sample_output_relpath": "derived/input_output/data/p02714/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02714/Java/s754124797.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s754124797", "user_id": "u729617972"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n // write your code here\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n String s = sc.next();\n\n long r = 0;\n long g = 0;\n long b = 0;\n\n for(int i = 0 ; i < s.length() ; i++){\n switch (s.charAt(i)){\n case 'R':\n r++;\n break;\n case 'G':\n g++;\n break;\n case 'B':\n b++;\n break;\n }\n }\n\n long sum = r*g*b;\n\n for(int i = 0 ; i < n ; i++){\n for(int d = 1 ; i + 2*d < n ; d++){\n if(s.charAt(i) != s.charAt(i+d) && s.charAt(i+d) != s.charAt(i+2*d) && s.charAt(i+2*d) != s.charAt(i)){\n sum--;\n }\n }\n }\n\n System.out.println(sum);\n }\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a string S of length N consisting of R, G, and B.\n\nFind the number of triples (i,~j,~k)~(1 \\leq i < j < k \\leq N) that satisfy both of the following conditions:\n\nS_i \\neq S_j, S_i \\neq S_k, and S_j \\neq S_k.\n\nj - i \\neq k - j.\n\nConstraints\n\n1 \\leq N \\leq 4000\n\nS is a string of length N consisting of R, G, and B.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the number of triplets in question.\n\nSample Input 1\n\n4\nRRGB\n\nSample Output 1\n\n1\n\nOnly the triplet (1,~3,~4) satisfies both conditions. The triplet (2,~3,~4) satisfies the first condition but not the second, so it does not count.\n\nSample Input 2\n\n39\nRBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB\n\nSample Output 2\n\n1800", "sample_input": "4\nRRGB\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02714", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a string S of length N consisting of R, G, and B.\n\nFind the number of triples (i,~j,~k)~(1 \\leq i < j < k \\leq N) that satisfy both of the following conditions:\n\nS_i \\neq S_j, S_i \\neq S_k, and S_j \\neq S_k.\n\nj - i \\neq k - j.\n\nConstraints\n\n1 \\leq N \\leq 4000\n\nS is a string of length N consisting of R, G, and B.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the number of triplets in question.\n\nSample Input 1\n\n4\nRRGB\n\nSample Output 1\n\n1\n\nOnly the triplet (1,~3,~4) satisfies both conditions. The triplet (2,~3,~4) satisfies the first condition but not the second, so it does not count.\n\nSample Input 2\n\n39\nRBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB\n\nSample Output 2\n\n1800", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 970, "cpu_time_ms": 182, "memory_kb": 37080}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s393954720", "group_id": "codeNet:p02714", "input_text": "import java.util.*;\nimport static java.lang.Math.*;\n\npublic class Main {\n\tpublic static void main(String[] args) throws Exception {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\t// 入力\n\t\tint n = sc.nextInt();\n\t\tString s = sc.next();\n\t\t\n\t\t// 計算\n\t\tlong result = 0;\n\t\tint[] sumR = new int[n+1];\n\t\tint[] sumG = new int[n+1];\n\t\tint[] sumB = new int[n+1];\n\t\tfor(int i = 0; i < n; i++){\n\t\t char a = s.charAt(i);\n\t\t if(a == 'R'){\n\t\t sumR[i+1] += sumR[i] + 1;\n\t\t sumG[i+1] += sumG[i];\n\t\t sumB[i+1] += sumB[i];\n\t\t }\n\t\t if(a == 'G'){\n\t\t sumR[i+1] += sumR[i];\n\t\t sumG[i+1] += sumG[i] + 1;\n\t\t sumB[i+1] += sumB[i];\n\t\t }\n\t\t if(a == 'B'){\n\t\t sumR[i+1] += sumR[i];\n\t\t sumG[i+1] += sumG[i];\n\t\t sumB[i+1] += sumB[i] + 1;\n\t\t }\n\t\t}\n\t\tfor(int i = 0; i < n; i++){\n\t\t for(int j = i+1; j < n; j++){\n\t\t char a = s.charAt(i);\n\t\t char b = s.charAt(j);\n\t\t if(a == b) continue;\n\t\t if((a == 'R' && b == 'G') || (a == 'G' && b == 'R')){\n\t\t result += sumB[n]-sumB[j+1];\n\t\t }\n\t\t if((a == 'G' && b == 'B') || (a == 'B' && b == 'G')){\n\t\t result += sumR[n]-sumR[j+1];\n\t\t }\n\t\t if((a == 'B' && b == 'R') || (a == 'R' && b == 'B')){\n\t\t result += sumG[n]-sumG[j+1];\n\t\t }\n\t\t if(j-i+j < n && s.charAt(j-i+j) != a && s.charAt(j-i+j) != b) result--;\n\t\t }\n\t\t}\n\t\t\n\t\t// 出力\n\t\tSystem.out.println(result);\n\t}\n\t\n}\n\n", "language": "Java", "metadata": {"date": 1586741476, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02714.html", "problem_id": "p02714", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02714/input.txt", "sample_output_relpath": "derived/input_output/data/p02714/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02714/Java/s393954720.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s393954720", "user_id": "u513960802"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "import java.util.*;\nimport static java.lang.Math.*;\n\npublic class Main {\n\tpublic static void main(String[] args) throws Exception {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\t// 入力\n\t\tint n = sc.nextInt();\n\t\tString s = sc.next();\n\t\t\n\t\t// 計算\n\t\tlong result = 0;\n\t\tint[] sumR = new int[n+1];\n\t\tint[] sumG = new int[n+1];\n\t\tint[] sumB = new int[n+1];\n\t\tfor(int i = 0; i < n; i++){\n\t\t char a = s.charAt(i);\n\t\t if(a == 'R'){\n\t\t sumR[i+1] += sumR[i] + 1;\n\t\t sumG[i+1] += sumG[i];\n\t\t sumB[i+1] += sumB[i];\n\t\t }\n\t\t if(a == 'G'){\n\t\t sumR[i+1] += sumR[i];\n\t\t sumG[i+1] += sumG[i] + 1;\n\t\t sumB[i+1] += sumB[i];\n\t\t }\n\t\t if(a == 'B'){\n\t\t sumR[i+1] += sumR[i];\n\t\t sumG[i+1] += sumG[i];\n\t\t sumB[i+1] += sumB[i] + 1;\n\t\t }\n\t\t}\n\t\tfor(int i = 0; i < n; i++){\n\t\t for(int j = i+1; j < n; j++){\n\t\t char a = s.charAt(i);\n\t\t char b = s.charAt(j);\n\t\t if(a == b) continue;\n\t\t if((a == 'R' && b == 'G') || (a == 'G' && b == 'R')){\n\t\t result += sumB[n]-sumB[j+1];\n\t\t }\n\t\t if((a == 'G' && b == 'B') || (a == 'B' && b == 'G')){\n\t\t result += sumR[n]-sumR[j+1];\n\t\t }\n\t\t if((a == 'B' && b == 'R') || (a == 'R' && b == 'B')){\n\t\t result += sumG[n]-sumG[j+1];\n\t\t }\n\t\t if(j-i+j < n && s.charAt(j-i+j) != a && s.charAt(j-i+j) != b) result--;\n\t\t }\n\t\t}\n\t\t\n\t\t// 出力\n\t\tSystem.out.println(result);\n\t}\n\t\n}\n\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a string S of length N consisting of R, G, and B.\n\nFind the number of triples (i,~j,~k)~(1 \\leq i < j < k \\leq N) that satisfy both of the following conditions:\n\nS_i \\neq S_j, S_i \\neq S_k, and S_j \\neq S_k.\n\nj - i \\neq k - j.\n\nConstraints\n\n1 \\leq N \\leq 4000\n\nS is a string of length N consisting of R, G, and B.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the number of triplets in question.\n\nSample Input 1\n\n4\nRRGB\n\nSample Output 1\n\n1\n\nOnly the triplet (1,~3,~4) satisfies both conditions. The triplet (2,~3,~4) satisfies the first condition but not the second, so it does not count.\n\nSample Input 2\n\n39\nRBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB\n\nSample Output 2\n\n1800", "sample_input": "4\nRRGB\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02714", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a string S of length N consisting of R, G, and B.\n\nFind the number of triples (i,~j,~k)~(1 \\leq i < j < k \\leq N) that satisfy both of the following conditions:\n\nS_i \\neq S_j, S_i \\neq S_k, and S_j \\neq S_k.\n\nj - i \\neq k - j.\n\nConstraints\n\n1 \\leq N \\leq 4000\n\nS is a string of length N consisting of R, G, and B.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the number of triplets in question.\n\nSample Input 1\n\n4\nRRGB\n\nSample Output 1\n\n1\n\nOnly the triplet (1,~3,~4) satisfies both conditions. The triplet (2,~3,~4) satisfies the first condition but not the second, so it does not count.\n\nSample Input 2\n\n39\nRBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB\n\nSample Output 2\n\n1800", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1466, "cpu_time_ms": 187, "memory_kb": 28160}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s375404129", "group_id": "codeNet:p02714", "input_text": "import java.io.*;\nimport java.util.*;\npublic class Main\n{\n\t\n\tprivate void solve()throws IOException\n\t{\n\t\tint n=nextInt();\n\t\tchar s[]=(\" \"+nextLine()).toCharArray();\n\t\tint freq[]=new int[128];\n\t\tfor(int i=1;i<=n;i++)\n\t\t\tfreq[s[i]]++;\n\t\tlong ans=1l*freq['R']*freq['G']*freq['B'];\n\t\tfor(int i=1;i<=n;i++)\n\t\t{\n\t\t\tfor(int j=1;i-j>=1 && i+j<=n;j++)\n\t\t\t\tif(s[i]!=s[i-j] && s[i]!=s[i+j] && s[i-j]!=s[i+j])\n\t\t\t\t\tans--;\n\t\t}\n\t\tout.println(ans);\n\t}\n\n\t \n\t///////////////////////////////////////////////////////////\n\n\tpublic void run()throws IOException\n\t{\n\t\tbr=new BufferedReader(new InputStreamReader(System.in));\n\t\tst=null;\n\t\tout=new PrintWriter(System.out);\n\n\t\tsolve();\n\n\t\tbr.close();\n\t\tout.close();\n\t}\n\tpublic static void main(String args[])throws IOException{\n\t\tnew Main().run();\n\t}\n\tBufferedReader br;\n\tStringTokenizer st;\n\tPrintWriter out;\n\tString nextToken()throws IOException{\n\t\twhile(st==null || !st.hasMoreTokens())\n\t\tst=new StringTokenizer(br.readLine());\n\t\treturn st.nextToken();\n\t}\n\tString nextLine()throws IOException{\n\t\treturn br.readLine();\n\t}\n\tint nextInt()throws IOException{\n\t\treturn Integer.parseInt(nextToken());\n\t}\n\tlong nextLong()throws IOException{\n\t\treturn Long.parseLong(nextToken());\n\t}\n\tdouble nextDouble()throws IOException{\n\t\treturn Double.parseDouble(nextToken());\n\t}\n}", "language": "Java", "metadata": {"date": 1586740300, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02714.html", "problem_id": "p02714", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02714/input.txt", "sample_output_relpath": "derived/input_output/data/p02714/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02714/Java/s375404129.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s375404129", "user_id": "u441770899"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "import java.io.*;\nimport java.util.*;\npublic class Main\n{\n\t\n\tprivate void solve()throws IOException\n\t{\n\t\tint n=nextInt();\n\t\tchar s[]=(\" \"+nextLine()).toCharArray();\n\t\tint freq[]=new int[128];\n\t\tfor(int i=1;i<=n;i++)\n\t\t\tfreq[s[i]]++;\n\t\tlong ans=1l*freq['R']*freq['G']*freq['B'];\n\t\tfor(int i=1;i<=n;i++)\n\t\t{\n\t\t\tfor(int j=1;i-j>=1 && i+j<=n;j++)\n\t\t\t\tif(s[i]!=s[i-j] && s[i]!=s[i+j] && s[i-j]!=s[i+j])\n\t\t\t\t\tans--;\n\t\t}\n\t\tout.println(ans);\n\t}\n\n\t \n\t///////////////////////////////////////////////////////////\n\n\tpublic void run()throws IOException\n\t{\n\t\tbr=new BufferedReader(new InputStreamReader(System.in));\n\t\tst=null;\n\t\tout=new PrintWriter(System.out);\n\n\t\tsolve();\n\n\t\tbr.close();\n\t\tout.close();\n\t}\n\tpublic static void main(String args[])throws IOException{\n\t\tnew Main().run();\n\t}\n\tBufferedReader br;\n\tStringTokenizer st;\n\tPrintWriter out;\n\tString nextToken()throws IOException{\n\t\twhile(st==null || !st.hasMoreTokens())\n\t\tst=new StringTokenizer(br.readLine());\n\t\treturn st.nextToken();\n\t}\n\tString nextLine()throws IOException{\n\t\treturn br.readLine();\n\t}\n\tint nextInt()throws IOException{\n\t\treturn Integer.parseInt(nextToken());\n\t}\n\tlong nextLong()throws IOException{\n\t\treturn Long.parseLong(nextToken());\n\t}\n\tdouble nextDouble()throws IOException{\n\t\treturn Double.parseDouble(nextToken());\n\t}\n}", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a string S of length N consisting of R, G, and B.\n\nFind the number of triples (i,~j,~k)~(1 \\leq i < j < k \\leq N) that satisfy both of the following conditions:\n\nS_i \\neq S_j, S_i \\neq S_k, and S_j \\neq S_k.\n\nj - i \\neq k - j.\n\nConstraints\n\n1 \\leq N \\leq 4000\n\nS is a string of length N consisting of R, G, and B.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the number of triplets in question.\n\nSample Input 1\n\n4\nRRGB\n\nSample Output 1\n\n1\n\nOnly the triplet (1,~3,~4) satisfies both conditions. The triplet (2,~3,~4) satisfies the first condition but not the second, so it does not count.\n\nSample Input 2\n\n39\nRBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB\n\nSample Output 2\n\n1800", "sample_input": "4\nRRGB\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02714", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a string S of length N consisting of R, G, and B.\n\nFind the number of triples (i,~j,~k)~(1 \\leq i < j < k \\leq N) that satisfy both of the following conditions:\n\nS_i \\neq S_j, S_i \\neq S_k, and S_j \\neq S_k.\n\nj - i \\neq k - j.\n\nConstraints\n\n1 \\leq N \\leq 4000\n\nS is a string of length N consisting of R, G, and B.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the number of triplets in question.\n\nSample Input 1\n\n4\nRRGB\n\nSample Output 1\n\n1\n\nOnly the triplet (1,~3,~4) satisfies both conditions. The triplet (2,~3,~4) satisfies the first condition but not the second, so it does not count.\n\nSample Input 2\n\n39\nRBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB\n\nSample Output 2\n\n1800", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1288, "cpu_time_ms": 152, "memory_kb": 36724}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s507250710", "group_id": "codeNet:p02717", "input_text": "import java.util.*;\n\npublic class Main{\n\tpublic static void main(String args[]){\n\t\t\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tString a = sc.next();\n\t\tString b = sc.next();\n\t\tString c = sc.next();\n\t\t\n\t\tSystem.out.println(b+a+c);\n\t\tSystem.out.println(c+b+a); \n\t}\n}", "language": "Java", "metadata": {"date": 1588456666, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02717.html", "problem_id": "p02717", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02717/input.txt", "sample_output_relpath": "derived/input_output/data/p02717/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02717/Java/s507250710.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s507250710", "user_id": "u753182648"}, "prompt_components": {"gold_output": "3 1 2\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main{\n\tpublic static void main(String args[]){\n\t\t\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tString a = sc.next();\n\t\tString b = sc.next();\n\t\tString c = sc.next();\n\t\t\n\t\tSystem.out.println(b+a+c);\n\t\tSystem.out.println(c+b+a); \n\t}\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have three boxes A, B, and C, each of which contains an integer.\n\nCurrently, the boxes A, B, and C contain the integers X, Y, and Z, respectively.\n\nWe will now do the operations below in order. Find the content of each box afterward.\n\nSwap the contents of the boxes A and B\n\nSwap the contents of the boxes A and C\n\nConstraints\n\n1 \\leq X,Y,Z \\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 Z\n\nOutput\n\nPrint the integers contained in the boxes A, B, and C, in this order, with space in between.\n\nSample Input 1\n\n1 2 3\n\nSample Output 1\n\n3 1 2\n\nAfter the contents of the boxes A and B are swapped, A, B, and C contain 2, 1, and 3, respectively.\n\nThen, after the contents of A and C are swapped, A, B, and C contain 3, 1, and 2, respectively.\n\nSample Input 2\n\n100 100 100\n\nSample Output 2\n\n100 100 100\n\nSample Input 3\n\n41 59 31\n\nSample Output 3\n\n31 41 59", "sample_input": "1 2 3\n"}, "reference_outputs": ["3 1 2\n"], "source_document_id": "p02717", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have three boxes A, B, and C, each of which contains an integer.\n\nCurrently, the boxes A, B, and C contain the integers X, Y, and Z, respectively.\n\nWe will now do the operations below in order. Find the content of each box afterward.\n\nSwap the contents of the boxes A and B\n\nSwap the contents of the boxes A and C\n\nConstraints\n\n1 \\leq X,Y,Z \\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 Z\n\nOutput\n\nPrint the integers contained in the boxes A, B, and C, in this order, with space in between.\n\nSample Input 1\n\n1 2 3\n\nSample Output 1\n\n3 1 2\n\nAfter the contents of the boxes A and B are swapped, A, B, and C contain 2, 1, and 3, respectively.\n\nThen, after the contents of A and C are swapped, A, B, and C contain 3, 1, and 2, respectively.\n\nSample Input 2\n\n100 100 100\n\nSample Output 2\n\n100 100 100\n\nSample Input 3\n\n41 59 31\n\nSample Output 3\n\n31 41 59", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 111, "memory_kb": 23764}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s232442103", "group_id": "codeNet:p02717", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\t// 入力値の取得\n\t\tint X = sc.nextInt();\n\t\tint Y = sc.nextInt();\n\t\tint Z = sc.nextInt();\n\t\t\n\t\t// 結果の出力\n\t\tSystem.out.println(Z + \" \" + X + \" \" + Y);\n\n\t\tsc.close();\n\t}\n}\n", "language": "Java", "metadata": {"date": 1586182770, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02717.html", "problem_id": "p02717", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02717/input.txt", "sample_output_relpath": "derived/input_output/data/p02717/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02717/Java/s232442103.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s232442103", "user_id": "u088262437"}, "prompt_components": {"gold_output": "3 1 2\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\t// 入力値の取得\n\t\tint X = sc.nextInt();\n\t\tint Y = sc.nextInt();\n\t\tint Z = sc.nextInt();\n\t\t\n\t\t// 結果の出力\n\t\tSystem.out.println(Z + \" \" + X + \" \" + Y);\n\n\t\tsc.close();\n\t}\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have three boxes A, B, and C, each of which contains an integer.\n\nCurrently, the boxes A, B, and C contain the integers X, Y, and Z, respectively.\n\nWe will now do the operations below in order. Find the content of each box afterward.\n\nSwap the contents of the boxes A and B\n\nSwap the contents of the boxes A and C\n\nConstraints\n\n1 \\leq X,Y,Z \\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 Z\n\nOutput\n\nPrint the integers contained in the boxes A, B, and C, in this order, with space in between.\n\nSample Input 1\n\n1 2 3\n\nSample Output 1\n\n3 1 2\n\nAfter the contents of the boxes A and B are swapped, A, B, and C contain 2, 1, and 3, respectively.\n\nThen, after the contents of A and C are swapped, A, B, and C contain 3, 1, and 2, respectively.\n\nSample Input 2\n\n100 100 100\n\nSample Output 2\n\n100 100 100\n\nSample Input 3\n\n41 59 31\n\nSample Output 3\n\n31 41 59", "sample_input": "1 2 3\n"}, "reference_outputs": ["3 1 2\n"], "source_document_id": "p02717", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have three boxes A, B, and C, each of which contains an integer.\n\nCurrently, the boxes A, B, and C contain the integers X, Y, and Z, respectively.\n\nWe will now do the operations below in order. Find the content of each box afterward.\n\nSwap the contents of the boxes A and B\n\nSwap the contents of the boxes A and C\n\nConstraints\n\n1 \\leq X,Y,Z \\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 Z\n\nOutput\n\nPrint the integers contained in the boxes A, B, and C, in this order, with space in between.\n\nSample Input 1\n\n1 2 3\n\nSample Output 1\n\n3 1 2\n\nAfter the contents of the boxes A and B are swapped, A, B, and C contain 2, 1, and 3, respectively.\n\nThen, after the contents of A and C are swapped, A, B, and C contain 3, 1, and 2, respectively.\n\nSample Input 2\n\n100 100 100\n\nSample Output 2\n\n100 100 100\n\nSample Input 3\n\n41 59 31\n\nSample Output 3\n\n31 41 59", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 94, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s269322487", "group_id": "codeNet:p02717", "input_text": "import java.util.*;\nimport static java.lang.System.out;\n\npublic class Main {\n public static void main(String... args) {\n Scanner sc = new Scanner(System.in);\n int a = Integer.parseInt(sc.next());\n int b = Integer.parseInt(sc.next());\n int c = Integer.parseInt(sc.next());\n int tmp = 0;\n tmp = a;\n a = b;\n b = tmp;\n tmp = a;\n a = c;\n c = tmp;\n System.out.println(a + \" \" + b + \" \" + c);\n\n }\n}", "language": "Java", "metadata": {"date": 1586171128, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02717.html", "problem_id": "p02717", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02717/input.txt", "sample_output_relpath": "derived/input_output/data/p02717/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02717/Java/s269322487.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s269322487", "user_id": "u831655548"}, "prompt_components": {"gold_output": "3 1 2\n", "input_to_evaluate": "import java.util.*;\nimport static java.lang.System.out;\n\npublic class Main {\n public static void main(String... args) {\n Scanner sc = new Scanner(System.in);\n int a = Integer.parseInt(sc.next());\n int b = Integer.parseInt(sc.next());\n int c = Integer.parseInt(sc.next());\n int tmp = 0;\n tmp = a;\n a = b;\n b = tmp;\n tmp = a;\n a = c;\n c = tmp;\n System.out.println(a + \" \" + b + \" \" + c);\n\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have three boxes A, B, and C, each of which contains an integer.\n\nCurrently, the boxes A, B, and C contain the integers X, Y, and Z, respectively.\n\nWe will now do the operations below in order. Find the content of each box afterward.\n\nSwap the contents of the boxes A and B\n\nSwap the contents of the boxes A and C\n\nConstraints\n\n1 \\leq X,Y,Z \\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 Z\n\nOutput\n\nPrint the integers contained in the boxes A, B, and C, in this order, with space in between.\n\nSample Input 1\n\n1 2 3\n\nSample Output 1\n\n3 1 2\n\nAfter the contents of the boxes A and B are swapped, A, B, and C contain 2, 1, and 3, respectively.\n\nThen, after the contents of A and C are swapped, A, B, and C contain 3, 1, and 2, respectively.\n\nSample Input 2\n\n100 100 100\n\nSample Output 2\n\n100 100 100\n\nSample Input 3\n\n41 59 31\n\nSample Output 3\n\n31 41 59", "sample_input": "1 2 3\n"}, "reference_outputs": ["3 1 2\n"], "source_document_id": "p02717", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have three boxes A, B, and C, each of which contains an integer.\n\nCurrently, the boxes A, B, and C contain the integers X, Y, and Z, respectively.\n\nWe will now do the operations below in order. Find the content of each box afterward.\n\nSwap the contents of the boxes A and B\n\nSwap the contents of the boxes A and C\n\nConstraints\n\n1 \\leq X,Y,Z \\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 Z\n\nOutput\n\nPrint the integers contained in the boxes A, B, and C, in this order, with space in between.\n\nSample Input 1\n\n1 2 3\n\nSample Output 1\n\n3 1 2\n\nAfter the contents of the boxes A and B are swapped, A, B, and C contain 2, 1, and 3, respectively.\n\nThen, after the contents of A and C are swapped, A, B, and C contain 3, 1, and 2, respectively.\n\nSample Input 2\n\n100 100 100\n\nSample Output 2\n\n100 100 100\n\nSample Input 3\n\n41 59 31\n\nSample Output 3\n\n31 41 59", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 481, "cpu_time_ms": 90, "memory_kb": 25172}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s194128173", "group_id": "codeNet:p02717", "input_text": "import java.util.Scanner;\n\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n int b = sc.nextInt();\n int c = sc.nextInt();\n sc.close();\n \n int tmp = a;\n a = b;\n b = tmp;\n \n tmp = a;\n a = c;\n c = tmp;\n \n System.out.println(a + \" \" + b + \" \" + c);\n \n }\n}", "language": "Java", "metadata": {"date": 1586111713, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02717.html", "problem_id": "p02717", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02717/input.txt", "sample_output_relpath": "derived/input_output/data/p02717/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02717/Java/s194128173.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s194128173", "user_id": "u845571316"}, "prompt_components": {"gold_output": "3 1 2\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n int b = sc.nextInt();\n int c = sc.nextInt();\n sc.close();\n \n int tmp = a;\n a = b;\n b = tmp;\n \n tmp = a;\n a = c;\n c = tmp;\n \n System.out.println(a + \" \" + b + \" \" + c);\n \n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have three boxes A, B, and C, each of which contains an integer.\n\nCurrently, the boxes A, B, and C contain the integers X, Y, and Z, respectively.\n\nWe will now do the operations below in order. Find the content of each box afterward.\n\nSwap the contents of the boxes A and B\n\nSwap the contents of the boxes A and C\n\nConstraints\n\n1 \\leq X,Y,Z \\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 Z\n\nOutput\n\nPrint the integers contained in the boxes A, B, and C, in this order, with space in between.\n\nSample Input 1\n\n1 2 3\n\nSample Output 1\n\n3 1 2\n\nAfter the contents of the boxes A and B are swapped, A, B, and C contain 2, 1, and 3, respectively.\n\nThen, after the contents of A and C are swapped, A, B, and C contain 3, 1, and 2, respectively.\n\nSample Input 2\n\n100 100 100\n\nSample Output 2\n\n100 100 100\n\nSample Input 3\n\n41 59 31\n\nSample Output 3\n\n31 41 59", "sample_input": "1 2 3\n"}, "reference_outputs": ["3 1 2\n"], "source_document_id": "p02717", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have three boxes A, B, and C, each of which contains an integer.\n\nCurrently, the boxes A, B, and C contain the integers X, Y, and Z, respectively.\n\nWe will now do the operations below in order. Find the content of each box afterward.\n\nSwap the contents of the boxes A and B\n\nSwap the contents of the boxes A and C\n\nConstraints\n\n1 \\leq X,Y,Z \\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 Z\n\nOutput\n\nPrint the integers contained in the boxes A, B, and C, in this order, with space in between.\n\nSample Input 1\n\n1 2 3\n\nSample Output 1\n\n3 1 2\n\nAfter the contents of the boxes A and B are swapped, A, B, and C contain 2, 1, and 3, respectively.\n\nThen, after the contents of A and C are swapped, A, B, and C contain 3, 1, and 2, respectively.\n\nSample Input 2\n\n100 100 100\n\nSample Output 2\n\n100 100 100\n\nSample Input 3\n\n41 59 31\n\nSample Output 3\n\n31 41 59", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 373, "cpu_time_ms": 93, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s510902948", "group_id": "codeNet:p02717", "input_text": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int temp = 0;\n\n System.out.println(\"input 1st integer\");\n int a = sc.nextInt();\n System.out.println(\"input 2nd integer\");\n int b = sc.nextInt();\n System.out.println(\"input 3rd integer\");\n int c = sc.nextInt();\n\n temp = a;\n a = b;\n b = temp;\n\n temp = a;\n a = c;\n c = temp;\n\n System.out.println(a + \" \" + b + \" \" + c);\n }\n}\n", "language": "Java", "metadata": {"date": 1586084189, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02717.html", "problem_id": "p02717", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02717/input.txt", "sample_output_relpath": "derived/input_output/data/p02717/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02717/Java/s510902948.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s510902948", "user_id": "u204830879"}, "prompt_components": {"gold_output": "3 1 2\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int temp = 0;\n\n System.out.println(\"input 1st integer\");\n int a = sc.nextInt();\n System.out.println(\"input 2nd integer\");\n int b = sc.nextInt();\n System.out.println(\"input 3rd integer\");\n int c = sc.nextInt();\n\n temp = a;\n a = b;\n b = temp;\n\n temp = a;\n a = c;\n c = temp;\n\n System.out.println(a + \" \" + b + \" \" + c);\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have three boxes A, B, and C, each of which contains an integer.\n\nCurrently, the boxes A, B, and C contain the integers X, Y, and Z, respectively.\n\nWe will now do the operations below in order. Find the content of each box afterward.\n\nSwap the contents of the boxes A and B\n\nSwap the contents of the boxes A and C\n\nConstraints\n\n1 \\leq X,Y,Z \\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 Z\n\nOutput\n\nPrint the integers contained in the boxes A, B, and C, in this order, with space in between.\n\nSample Input 1\n\n1 2 3\n\nSample Output 1\n\n3 1 2\n\nAfter the contents of the boxes A and B are swapped, A, B, and C contain 2, 1, and 3, respectively.\n\nThen, after the contents of A and C are swapped, A, B, and C contain 3, 1, and 2, respectively.\n\nSample Input 2\n\n100 100 100\n\nSample Output 2\n\n100 100 100\n\nSample Input 3\n\n41 59 31\n\nSample Output 3\n\n31 41 59", "sample_input": "1 2 3\n"}, "reference_outputs": ["3 1 2\n"], "source_document_id": "p02717", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have three boxes A, B, and C, each of which contains an integer.\n\nCurrently, the boxes A, B, and C contain the integers X, Y, and Z, respectively.\n\nWe will now do the operations below in order. Find the content of each box afterward.\n\nSwap the contents of the boxes A and B\n\nSwap the contents of the boxes A and C\n\nConstraints\n\n1 \\leq X,Y,Z \\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 Z\n\nOutput\n\nPrint the integers contained in the boxes A, B, and C, in this order, with space in between.\n\nSample Input 1\n\n1 2 3\n\nSample Output 1\n\n3 1 2\n\nAfter the contents of the boxes A and B are swapped, A, B, and C contain 2, 1, and 3, respectively.\n\nThen, after the contents of A and C are swapped, A, B, and C contain 3, 1, and 2, respectively.\n\nSample Input 2\n\n100 100 100\n\nSample Output 2\n\n100 100 100\n\nSample Input 3\n\n41 59 31\n\nSample Output 3\n\n31 41 59", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 561, "cpu_time_ms": 93, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s555694061", "group_id": "codeNet:p02717", "input_text": "import java.util.*;\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int y = sc.nextInt();\n int z = sc.nextInt();\n System.out.println(z+\" \"+x+\" \"+y);\n }\n}\n", "language": "Java", "metadata": {"date": 1586049730, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02717.html", "problem_id": "p02717", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02717/input.txt", "sample_output_relpath": "derived/input_output/data/p02717/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02717/Java/s555694061.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s555694061", "user_id": "u806768852"}, "prompt_components": {"gold_output": "3 1 2\n", "input_to_evaluate": "import java.util.*;\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int y = sc.nextInt();\n int z = sc.nextInt();\n System.out.println(z+\" \"+x+\" \"+y);\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have three boxes A, B, and C, each of which contains an integer.\n\nCurrently, the boxes A, B, and C contain the integers X, Y, and Z, respectively.\n\nWe will now do the operations below in order. Find the content of each box afterward.\n\nSwap the contents of the boxes A and B\n\nSwap the contents of the boxes A and C\n\nConstraints\n\n1 \\leq X,Y,Z \\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 Z\n\nOutput\n\nPrint the integers contained in the boxes A, B, and C, in this order, with space in between.\n\nSample Input 1\n\n1 2 3\n\nSample Output 1\n\n3 1 2\n\nAfter the contents of the boxes A and B are swapped, A, B, and C contain 2, 1, and 3, respectively.\n\nThen, after the contents of A and C are swapped, A, B, and C contain 3, 1, and 2, respectively.\n\nSample Input 2\n\n100 100 100\n\nSample Output 2\n\n100 100 100\n\nSample Input 3\n\n41 59 31\n\nSample Output 3\n\n31 41 59", "sample_input": "1 2 3\n"}, "reference_outputs": ["3 1 2\n"], "source_document_id": "p02717", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have three boxes A, B, and C, each of which contains an integer.\n\nCurrently, the boxes A, B, and C contain the integers X, Y, and Z, respectively.\n\nWe will now do the operations below in order. Find the content of each box afterward.\n\nSwap the contents of the boxes A and B\n\nSwap the contents of the boxes A and C\n\nConstraints\n\n1 \\leq X,Y,Z \\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 Z\n\nOutput\n\nPrint the integers contained in the boxes A, B, and C, in this order, with space in between.\n\nSample Input 1\n\n1 2 3\n\nSample Output 1\n\n3 1 2\n\nAfter the contents of the boxes A and B are swapped, A, B, and C contain 2, 1, and 3, respectively.\n\nThen, after the contents of A and C are swapped, A, B, and C contain 3, 1, and 2, respectively.\n\nSample Input 2\n\n100 100 100\n\nSample Output 2\n\n100 100 100\n\nSample Input 3\n\n41 59 31\n\nSample Output 3\n\n31 41 59", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 245, "cpu_time_ms": 95, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s588663245", "group_id": "codeNet:p02717", "input_text": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n int b = sc.nextInt();\n int c = sc.nextInt();\n System.out.println(c + \" \" + a + \" \" + b);\n }\n\n\n}\n\n// x * 3 <= 16", "language": "Java", "metadata": {"date": 1586049124, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02717.html", "problem_id": "p02717", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02717/input.txt", "sample_output_relpath": "derived/input_output/data/p02717/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02717/Java/s588663245.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s588663245", "user_id": "u198680972"}, "prompt_components": {"gold_output": "3 1 2\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n int b = sc.nextInt();\n int c = sc.nextInt();\n System.out.println(c + \" \" + a + \" \" + b);\n }\n\n\n}\n\n// x * 3 <= 16", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have three boxes A, B, and C, each of which contains an integer.\n\nCurrently, the boxes A, B, and C contain the integers X, Y, and Z, respectively.\n\nWe will now do the operations below in order. Find the content of each box afterward.\n\nSwap the contents of the boxes A and B\n\nSwap the contents of the boxes A and C\n\nConstraints\n\n1 \\leq X,Y,Z \\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 Z\n\nOutput\n\nPrint the integers contained in the boxes A, B, and C, in this order, with space in between.\n\nSample Input 1\n\n1 2 3\n\nSample Output 1\n\n3 1 2\n\nAfter the contents of the boxes A and B are swapped, A, B, and C contain 2, 1, and 3, respectively.\n\nThen, after the contents of A and C are swapped, A, B, and C contain 3, 1, and 2, respectively.\n\nSample Input 2\n\n100 100 100\n\nSample Output 2\n\n100 100 100\n\nSample Input 3\n\n41 59 31\n\nSample Output 3\n\n31 41 59", "sample_input": "1 2 3\n"}, "reference_outputs": ["3 1 2\n"], "source_document_id": "p02717", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have three boxes A, B, and C, each of which contains an integer.\n\nCurrently, the boxes A, B, and C contain the integers X, Y, and Z, respectively.\n\nWe will now do the operations below in order. Find the content of each box afterward.\n\nSwap the contents of the boxes A and B\n\nSwap the contents of the boxes A and C\n\nConstraints\n\n1 \\leq X,Y,Z \\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 Z\n\nOutput\n\nPrint the integers contained in the boxes A, B, and C, in this order, with space in between.\n\nSample Input 1\n\n1 2 3\n\nSample Output 1\n\n3 1 2\n\nAfter the contents of the boxes A and B are swapped, A, B, and C contain 2, 1, and 3, respectively.\n\nThen, after the contents of A and C are swapped, A, B, and C contain 3, 1, and 2, respectively.\n\nSample Input 2\n\n100 100 100\n\nSample Output 2\n\n100 100 100\n\nSample Input 3\n\n41 59 31\n\nSample Output 3\n\n31 41 59", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 97, "memory_kb": 20948}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s283370835", "group_id": "codeNet:p02717", "input_text": "import java.util.*;\n public class Main {\n \tpublic static void main(String[] args){\n \t\tScanner sc = new Scanner(System.in);\n \t\tint a = sc.nextInt();\n \t\tint b = sc.nextInt();\n \t\tint c = sc.nextInt();\n \t\tSystem.out.print(c);\n System.out.print(a);\n System.out.print(b);\n \t}\n }", "language": "Java", "metadata": {"date": 1586049088, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02717.html", "problem_id": "p02717", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02717/input.txt", "sample_output_relpath": "derived/input_output/data/p02717/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02717/Java/s283370835.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s283370835", "user_id": "u111044572"}, "prompt_components": {"gold_output": "3 1 2\n", "input_to_evaluate": "import java.util.*;\n public class Main {\n \tpublic static void main(String[] args){\n \t\tScanner sc = new Scanner(System.in);\n \t\tint a = sc.nextInt();\n \t\tint b = sc.nextInt();\n \t\tint c = sc.nextInt();\n \t\tSystem.out.print(c);\n System.out.print(a);\n System.out.print(b);\n \t}\n }", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have three boxes A, B, and C, each of which contains an integer.\n\nCurrently, the boxes A, B, and C contain the integers X, Y, and Z, respectively.\n\nWe will now do the operations below in order. Find the content of each box afterward.\n\nSwap the contents of the boxes A and B\n\nSwap the contents of the boxes A and C\n\nConstraints\n\n1 \\leq X,Y,Z \\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 Z\n\nOutput\n\nPrint the integers contained in the boxes A, B, and C, in this order, with space in between.\n\nSample Input 1\n\n1 2 3\n\nSample Output 1\n\n3 1 2\n\nAfter the contents of the boxes A and B are swapped, A, B, and C contain 2, 1, and 3, respectively.\n\nThen, after the contents of A and C are swapped, A, B, and C contain 3, 1, and 2, respectively.\n\nSample Input 2\n\n100 100 100\n\nSample Output 2\n\n100 100 100\n\nSample Input 3\n\n41 59 31\n\nSample Output 3\n\n31 41 59", "sample_input": "1 2 3\n"}, "reference_outputs": ["3 1 2\n"], "source_document_id": "p02717", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have three boxes A, B, and C, each of which contains an integer.\n\nCurrently, the boxes A, B, and C contain the integers X, Y, and Z, respectively.\n\nWe will now do the operations below in order. Find the content of each box afterward.\n\nSwap the contents of the boxes A and B\n\nSwap the contents of the boxes A and C\n\nConstraints\n\n1 \\leq X,Y,Z \\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 Z\n\nOutput\n\nPrint the integers contained in the boxes A, B, and C, in this order, with space in between.\n\nSample Input 1\n\n1 2 3\n\nSample Output 1\n\n3 1 2\n\nAfter the contents of the boxes A and B are swapped, A, B, and C contain 2, 1, and 3, respectively.\n\nThen, after the contents of A and C are swapped, A, B, and C contain 3, 1, and 2, respectively.\n\nSample Input 2\n\n100 100 100\n\nSample Output 2\n\n100 100 100\n\nSample Input 3\n\n41 59 31\n\nSample Output 3\n\n31 41 59", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 111, "memory_kb": 22868}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s266989039", "group_id": "codeNet:p02717", "input_text": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Scanner;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n abc161_a solver = new abc161_a();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class abc161_a {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int A = in.nextInt();\n int B = in.nextInt();\n int C = in.nextInt();\n int Wk;\n\n Wk = A;\n A = B;\n B = Wk;\n Wk = C;\n C = A;\n A = Wk;\n out.print(A);\n out.print(' ');\n out.print(B);\n out.print(' ');\n out.print(C);\n out.println();\n }\n\n }\n}\n\n", "language": "Java", "metadata": {"date": 1586048893, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02717.html", "problem_id": "p02717", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02717/input.txt", "sample_output_relpath": "derived/input_output/data/p02717/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02717/Java/s266989039.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s266989039", "user_id": "u054465385"}, "prompt_components": {"gold_output": "3 1 2\n", "input_to_evaluate": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Scanner;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n abc161_a solver = new abc161_a();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class abc161_a {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int A = in.nextInt();\n int B = in.nextInt();\n int C = in.nextInt();\n int Wk;\n\n Wk = A;\n A = B;\n B = Wk;\n Wk = C;\n C = A;\n A = Wk;\n out.print(A);\n out.print(' ');\n out.print(B);\n out.print(' ');\n out.print(C);\n out.println();\n }\n\n }\n}\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have three boxes A, B, and C, each of which contains an integer.\n\nCurrently, the boxes A, B, and C contain the integers X, Y, and Z, respectively.\n\nWe will now do the operations below in order. Find the content of each box afterward.\n\nSwap the contents of the boxes A and B\n\nSwap the contents of the boxes A and C\n\nConstraints\n\n1 \\leq X,Y,Z \\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 Z\n\nOutput\n\nPrint the integers contained in the boxes A, B, and C, in this order, with space in between.\n\nSample Input 1\n\n1 2 3\n\nSample Output 1\n\n3 1 2\n\nAfter the contents of the boxes A and B are swapped, A, B, and C contain 2, 1, and 3, respectively.\n\nThen, after the contents of A and C are swapped, A, B, and C contain 3, 1, and 2, respectively.\n\nSample Input 2\n\n100 100 100\n\nSample Output 2\n\n100 100 100\n\nSample Input 3\n\n41 59 31\n\nSample Output 3\n\n31 41 59", "sample_input": "1 2 3\n"}, "reference_outputs": ["3 1 2\n"], "source_document_id": "p02717", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have three boxes A, B, and C, each of which contains an integer.\n\nCurrently, the boxes A, B, and C contain the integers X, Y, and Z, respectively.\n\nWe will now do the operations below in order. Find the content of each box afterward.\n\nSwap the contents of the boxes A and B\n\nSwap the contents of the boxes A and C\n\nConstraints\n\n1 \\leq X,Y,Z \\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 Z\n\nOutput\n\nPrint the integers contained in the boxes A, B, and C, in this order, with space in between.\n\nSample Input 1\n\n1 2 3\n\nSample Output 1\n\n3 1 2\n\nAfter the contents of the boxes A and B are swapped, A, B, and C contain 2, 1, and 3, respectively.\n\nThen, after the contents of A and C are swapped, A, B, and C contain 3, 1, and 2, respectively.\n\nSample Input 2\n\n100 100 100\n\nSample Output 2\n\n100 100 100\n\nSample Input 3\n\n41 59 31\n\nSample Output 3\n\n31 41 59", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1101, "cpu_time_ms": 111, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s742749527", "group_id": "codeNet:p02717", "input_text": "import java.util.*;\npublic class Main {\n\tpublic static void main(String args[]) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint A = sc.nextInt();\n\t\tint B = sc.nextInt();\n\t\tint C = sc.nextInt();\n\t\tint temp = A;\n\t\tA = B;\n\t\tB = temp;\n\t\ttemp = A;\n\t\tA = C;\n\t\tC = temp;\n\t\tSystem.out.println(A+\" \"+B+\" \"+C);\n\t\t\n\t\t\n\t}\n\t\n\n}\n", "language": "Java", "metadata": {"date": 1586048598, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02717.html", "problem_id": "p02717", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02717/input.txt", "sample_output_relpath": "derived/input_output/data/p02717/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02717/Java/s742749527.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s742749527", "user_id": "u014079196"}, "prompt_components": {"gold_output": "3 1 2\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n\tpublic static void main(String args[]) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint A = sc.nextInt();\n\t\tint B = sc.nextInt();\n\t\tint C = sc.nextInt();\n\t\tint temp = A;\n\t\tA = B;\n\t\tB = temp;\n\t\ttemp = A;\n\t\tA = C;\n\t\tC = temp;\n\t\tSystem.out.println(A+\" \"+B+\" \"+C);\n\t\t\n\t\t\n\t}\n\t\n\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have three boxes A, B, and C, each of which contains an integer.\n\nCurrently, the boxes A, B, and C contain the integers X, Y, and Z, respectively.\n\nWe will now do the operations below in order. Find the content of each box afterward.\n\nSwap the contents of the boxes A and B\n\nSwap the contents of the boxes A and C\n\nConstraints\n\n1 \\leq X,Y,Z \\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 Z\n\nOutput\n\nPrint the integers contained in the boxes A, B, and C, in this order, with space in between.\n\nSample Input 1\n\n1 2 3\n\nSample Output 1\n\n3 1 2\n\nAfter the contents of the boxes A and B are swapped, A, B, and C contain 2, 1, and 3, respectively.\n\nThen, after the contents of A and C are swapped, A, B, and C contain 3, 1, and 2, respectively.\n\nSample Input 2\n\n100 100 100\n\nSample Output 2\n\n100 100 100\n\nSample Input 3\n\n41 59 31\n\nSample Output 3\n\n31 41 59", "sample_input": "1 2 3\n"}, "reference_outputs": ["3 1 2\n"], "source_document_id": "p02717", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have three boxes A, B, and C, each of which contains an integer.\n\nCurrently, the boxes A, B, and C contain the integers X, Y, and Z, respectively.\n\nWe will now do the operations below in order. Find the content of each box afterward.\n\nSwap the contents of the boxes A and B\n\nSwap the contents of the boxes A and C\n\nConstraints\n\n1 \\leq X,Y,Z \\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 Z\n\nOutput\n\nPrint the integers contained in the boxes A, B, and C, in this order, with space in between.\n\nSample Input 1\n\n1 2 3\n\nSample Output 1\n\n3 1 2\n\nAfter the contents of the boxes A and B are swapped, A, B, and C contain 2, 1, and 3, respectively.\n\nThen, after the contents of A and C are swapped, A, B, and C contain 3, 1, and 2, respectively.\n\nSample Input 2\n\n100 100 100\n\nSample Output 2\n\n100 100 100\n\nSample Input 3\n\n41 59 31\n\nSample Output 3\n\n31 41 59", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 105, "memory_kb": 21972}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s936875515", "group_id": "codeNet:p02717", "input_text": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int y = sc.nextInt();\n int z = sc.nextInt();\n System.out.println(z + \" \" + x + \" \" + y);\n }\n}\n", "language": "Java", "metadata": {"date": 1586048579, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02717.html", "problem_id": "p02717", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02717/input.txt", "sample_output_relpath": "derived/input_output/data/p02717/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02717/Java/s936875515.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s936875515", "user_id": "u095434379"}, "prompt_components": {"gold_output": "3 1 2\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n int y = sc.nextInt();\n int z = sc.nextInt();\n System.out.println(z + \" \" + x + \" \" + y);\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have three boxes A, B, and C, each of which contains an integer.\n\nCurrently, the boxes A, B, and C contain the integers X, Y, and Z, respectively.\n\nWe will now do the operations below in order. Find the content of each box afterward.\n\nSwap the contents of the boxes A and B\n\nSwap the contents of the boxes A and C\n\nConstraints\n\n1 \\leq X,Y,Z \\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 Z\n\nOutput\n\nPrint the integers contained in the boxes A, B, and C, in this order, with space in between.\n\nSample Input 1\n\n1 2 3\n\nSample Output 1\n\n3 1 2\n\nAfter the contents of the boxes A and B are swapped, A, B, and C contain 2, 1, and 3, respectively.\n\nThen, after the contents of A and C are swapped, A, B, and C contain 3, 1, and 2, respectively.\n\nSample Input 2\n\n100 100 100\n\nSample Output 2\n\n100 100 100\n\nSample Input 3\n\n41 59 31\n\nSample Output 3\n\n31 41 59", "sample_input": "1 2 3\n"}, "reference_outputs": ["3 1 2\n"], "source_document_id": "p02717", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have three boxes A, B, and C, each of which contains an integer.\n\nCurrently, the boxes A, B, and C contain the integers X, Y, and Z, respectively.\n\nWe will now do the operations below in order. Find the content of each box afterward.\n\nSwap the contents of the boxes A and B\n\nSwap the contents of the boxes A and C\n\nConstraints\n\n1 \\leq X,Y,Z \\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 Z\n\nOutput\n\nPrint the integers contained in the boxes A, B, and C, in this order, with space in between.\n\nSample Input 1\n\n1 2 3\n\nSample Output 1\n\n3 1 2\n\nAfter the contents of the boxes A and B are swapped, A, B, and C contain 2, 1, and 3, respectively.\n\nThen, after the contents of A and C are swapped, A, B, and C contain 3, 1, and 2, respectively.\n\nSample Input 2\n\n100 100 100\n\nSample Output 2\n\n100 100 100\n\nSample Input 3\n\n41 59 31\n\nSample Output 3\n\n31 41 59", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 129, "memory_kb": 21716}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s745463819", "group_id": "codeNet:p02717", "input_text": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner(System.in);\n\t\tint x = sc.nextInt(), y = sc.nextInt(), z = sc.nextInt();\n\t\tSystem.out.println(z + \" \" + x + \" \" + y);\n\t}\n\t\n\tstatic class FastScanner {\n\t\tprivate BufferedReader reader = null;\n\t private StringTokenizer tokenizer = null;\n\t public FastScanner(InputStream in) {\n\t reader = new BufferedReader(new InputStreamReader(in));\n\t tokenizer = null;\n\t }\n\n\t public String next() {\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t tokenizer = new StringTokenizer(reader.readLine());\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\t return tokenizer.nextToken();\n\t }\n\n\t public String nextLine() {\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t return reader.readLine();\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\n\t return tokenizer.nextToken(\"\\n\");\n\t }\n\n\t public long nextLong() {\n\t return Long.parseLong(next());\n\t }\n\n\t public int nextInt() {\n\t return Integer.parseInt(next());\n\t }\n\n\t public double nextDouble() {\n\t return Double.parseDouble(next());\n\t }\n\n\t public int[] nextIntArray(int n) {\n\t int[] a = new int[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextInt();\n\t return a;\n\t }\n\n\t public long[] nextLongArray(int n) {\n\t long[] a = new long[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextLong();\n\t return a;\n\t }\n\t}\n}", "language": "Java", "metadata": {"date": 1586048525, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02717.html", "problem_id": "p02717", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02717/input.txt", "sample_output_relpath": "derived/input_output/data/p02717/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02717/Java/s745463819.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s745463819", "user_id": "u368078055"}, "prompt_components": {"gold_output": "3 1 2\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner(System.in);\n\t\tint x = sc.nextInt(), y = sc.nextInt(), z = sc.nextInt();\n\t\tSystem.out.println(z + \" \" + x + \" \" + y);\n\t}\n\t\n\tstatic class FastScanner {\n\t\tprivate BufferedReader reader = null;\n\t private StringTokenizer tokenizer = null;\n\t public FastScanner(InputStream in) {\n\t reader = new BufferedReader(new InputStreamReader(in));\n\t tokenizer = null;\n\t }\n\n\t public String next() {\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t tokenizer = new StringTokenizer(reader.readLine());\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\t return tokenizer.nextToken();\n\t }\n\n\t public String nextLine() {\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t return reader.readLine();\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\n\t return tokenizer.nextToken(\"\\n\");\n\t }\n\n\t public long nextLong() {\n\t return Long.parseLong(next());\n\t }\n\n\t public int nextInt() {\n\t return Integer.parseInt(next());\n\t }\n\n\t public double nextDouble() {\n\t return Double.parseDouble(next());\n\t }\n\n\t public int[] nextIntArray(int n) {\n\t int[] a = new int[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextInt();\n\t return a;\n\t }\n\n\t public long[] nextLongArray(int n) {\n\t long[] a = new long[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextLong();\n\t return a;\n\t }\n\t}\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have three boxes A, B, and C, each of which contains an integer.\n\nCurrently, the boxes A, B, and C contain the integers X, Y, and Z, respectively.\n\nWe will now do the operations below in order. Find the content of each box afterward.\n\nSwap the contents of the boxes A and B\n\nSwap the contents of the boxes A and C\n\nConstraints\n\n1 \\leq X,Y,Z \\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 Z\n\nOutput\n\nPrint the integers contained in the boxes A, B, and C, in this order, with space in between.\n\nSample Input 1\n\n1 2 3\n\nSample Output 1\n\n3 1 2\n\nAfter the contents of the boxes A and B are swapped, A, B, and C contain 2, 1, and 3, respectively.\n\nThen, after the contents of A and C are swapped, A, B, and C contain 3, 1, and 2, respectively.\n\nSample Input 2\n\n100 100 100\n\nSample Output 2\n\n100 100 100\n\nSample Input 3\n\n41 59 31\n\nSample Output 3\n\n31 41 59", "sample_input": "1 2 3\n"}, "reference_outputs": ["3 1 2\n"], "source_document_id": "p02717", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have three boxes A, B, and C, each of which contains an integer.\n\nCurrently, the boxes A, B, and C contain the integers X, Y, and Z, respectively.\n\nWe will now do the operations below in order. Find the content of each box afterward.\n\nSwap the contents of the boxes A and B\n\nSwap the contents of the boxes A and C\n\nConstraints\n\n1 \\leq X,Y,Z \\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 Z\n\nOutput\n\nPrint the integers contained in the boxes A, B, and C, in this order, with space in between.\n\nSample Input 1\n\n1 2 3\n\nSample Output 1\n\n3 1 2\n\nAfter the contents of the boxes A and B are swapped, A, B, and C contain 2, 1, and 3, respectively.\n\nThen, after the contents of A and C are swapped, A, B, and C contain 3, 1, and 2, respectively.\n\nSample Input 2\n\n100 100 100\n\nSample Output 2\n\n100 100 100\n\nSample Input 3\n\n41 59 31\n\nSample Output 3\n\n31 41 59", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1879, "cpu_time_ms": 69, "memory_kb": 21332}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s264492124", "group_id": "codeNet:p02718", "input_text": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int m = sc.nextInt();\n int a;\n int sum = 0;\n int count = 0;\n for(int i = 0;i=sum/4/m){\n count++;\n }\n } \n if(count=sum/4/m){\n count++;\n }\n } \n if(count n = new ArrayList<>();\n \n for(int i=0; i=a){\n count++;\n }\n \n }\n if(M<=count){\n System.out.println(\"Yes\");\n }\n else{\n System.out.println(\"No\");\n }\n }\n }\n", "language": "Java", "metadata": {"date": 1593198496, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02718.html", "problem_id": "p02718", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02718/input.txt", "sample_output_relpath": "derived/input_output/data/p02718/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02718/Java/s895508347.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s895508347", "user_id": "u429342487"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.*;\n \n\tpublic class Main {\n\t\tpublic static void main(String[] args) {\n \tScanner sc = new Scanner(System.in);\n \n \tint N =sc.nextInt();\n \tint M =sc.nextInt();\n \n List n = new ArrayList<>();\n \n for(int i=0; i=a){\n count++;\n }\n \n }\n if(M<=count){\n System.out.println(\"Yes\");\n }\n else{\n System.out.println(\"No\");\n }\n }\n }\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "sample_input": "4 1\n5 4 2 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02718", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 785, "cpu_time_ms": 124, "memory_kb": 36072}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s333144268", "group_id": "codeNet:p02718", "input_text": "import java.util.Scanner;\npublic class Main {\n\tpublic static void main(String[] args) {\n\n//\t入力の読み込み\n\t\tScanner sc = new Scanner(System.in);\n\t\tint shurui = sc.nextInt(); //商品の種類数\n\t\tdouble select = sc.nextInt(); //選びたい商品数\n\t\tdouble sum = 0; //総投票数\n\t\tint shouhin[] = new int[shurui]; //商品配列\n\n//\tお菓子1つずつに得票数を記入\n\t\tfor(int i=0 ; i= kijun) {\n\t\t\t\tcount ++;\n\t\t\t}\n\t\t}\n\n//\t選べる商品がM個以上あるかどうか\n\t\tSystem.out.println(count >= select ? \"Yes\" : \"No\");\n\t}\n}", "language": "Java", "metadata": {"date": 1591382258, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02718.html", "problem_id": "p02718", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02718/input.txt", "sample_output_relpath": "derived/input_output/data/p02718/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02718/Java/s333144268.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s333144268", "user_id": "u824555610"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.Scanner;\npublic class Main {\n\tpublic static void main(String[] args) {\n\n//\t入力の読み込み\n\t\tScanner sc = new Scanner(System.in);\n\t\tint shurui = sc.nextInt(); //商品の種類数\n\t\tdouble select = sc.nextInt(); //選びたい商品数\n\t\tdouble sum = 0; //総投票数\n\t\tint shouhin[] = new int[shurui]; //商品配列\n\n//\tお菓子1つずつに得票数を記入\n\t\tfor(int i=0 ; i= kijun) {\n\t\t\t\tcount ++;\n\t\t\t}\n\t\t}\n\n//\t選べる商品がM個以上あるかどうか\n\t\tSystem.out.println(count >= select ? \"Yes\" : \"No\");\n\t}\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "sample_input": "4 1\n5 4 2 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02718", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 876, "cpu_time_ms": 89, "memory_kb": 27228}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s965127235", "group_id": "codeNet:p02718", "input_text": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n int N, M;\n Scanner sc = new Scanner(System.in);\n N = sc.nextInt();\n M = sc.nextInt();\n int[] a = new int[N];\n double check = 0;\n for(int i = 0 ; i < N ; i++)\n {\n a[i] = sc.nextInt();\n check += a[i];\n }\n check *= 1/(4F*M);\n int count = 0;\n for(int i = 0 ; i < N ; i++)\n {\n count += (a[i] >= (int)check) ? 1 : 0;\n }\n System.out.println(count >= M ? \"Yes\" : \"No\");\n }\n}\n", "language": "Java", "metadata": {"date": 1591119920, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02718.html", "problem_id": "p02718", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02718/input.txt", "sample_output_relpath": "derived/input_output/data/p02718/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02718/Java/s965127235.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s965127235", "user_id": "u104386856"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n int N, M;\n Scanner sc = new Scanner(System.in);\n N = sc.nextInt();\n M = sc.nextInt();\n int[] a = new int[N];\n double check = 0;\n for(int i = 0 ; i < N ; i++)\n {\n a[i] = sc.nextInt();\n check += a[i];\n }\n check *= 1/(4F*M);\n int count = 0;\n for(int i = 0 ; i < N ; i++)\n {\n count += (a[i] >= (int)check) ? 1 : 0;\n }\n System.out.println(count >= M ? \"Yes\" : \"No\");\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "sample_input": "4 1\n5 4 2 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02718", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 601, "cpu_time_ms": 113, "memory_kb": 35744}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s317020035", "group_id": "codeNet:p02718", "input_text": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int M = sc.nextInt();\n int[] A = new int[N];\n int check =0, total =0;\n for (int i=0; i= total / (4 * M)) {\n check++;\n }\n }\n if (check >= M) {\n System.out.println(\"Yes\");\n } else {\n System.out.println(\"No\");\n }\n }\n}", "language": "Java", "metadata": {"date": 1590950206, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02718.html", "problem_id": "p02718", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02718/input.txt", "sample_output_relpath": "derived/input_output/data/p02718/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02718/Java/s317020035.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s317020035", "user_id": "u538283043"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int M = sc.nextInt();\n int[] A = new int[N];\n int check =0, total =0;\n for (int i=0; i= total / (4 * M)) {\n check++;\n }\n }\n if (check >= M) {\n System.out.println(\"Yes\");\n } else {\n System.out.println(\"No\");\n }\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "sample_input": "4 1\n5 4 2 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02718", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 524, "cpu_time_ms": 100, "memory_kb": 27204}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s056723163", "group_id": "codeNet:p02718", "input_text": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args){\n \n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n double M = sc.nextDouble();\n\n int[]list = new int[N];\n int all=0;\n for(int i=0; i= all/4/M){\n count++;\n }\n }\n\t\tif(count >= M){\n System.out.println(\"Yes\");\n }else{\n System.out.println(\"No\");\n }\n}\n}", "language": "Java", "metadata": {"date": 1590658871, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02718.html", "problem_id": "p02718", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02718/input.txt", "sample_output_relpath": "derived/input_output/data/p02718/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02718/Java/s056723163.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s056723163", "user_id": "u980385246"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args){\n \n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n double M = sc.nextDouble();\n\n int[]list = new int[N];\n int all=0;\n for(int i=0; i= all/4/M){\n count++;\n }\n }\n\t\tif(count >= M){\n System.out.println(\"Yes\");\n }else{\n System.out.println(\"No\");\n }\n}\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "sample_input": "4 1\n5 4 2 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02718", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 641, "cpu_time_ms": 124, "memory_kb": 36688}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s329060793", "group_id": "codeNet:p02718", "input_text": "import java.util.*;\nclass Main{\n static Scanner sc=new Scanner(System.in);\n public static void main(String[] args){\n int N = sc.nextInt();\n int M = sc.nextInt();\n int a[] = new int[N];\n \tint sum = 0;\n for(int i=0;i=(N-M-1);i--){\n if(a[i]<(sum/(4*M))){\n anst = false;\n break;\n }\n }\n if(anst)\n System.out.println(\"Yes\");\n else\n System.out.println(\"No\");\n }\n}", "language": "Java", "metadata": {"date": 1587866197, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02718.html", "problem_id": "p02718", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02718/input.txt", "sample_output_relpath": "derived/input_output/data/p02718/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02718/Java/s329060793.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s329060793", "user_id": "u699628455"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.*;\nclass Main{\n static Scanner sc=new Scanner(System.in);\n public static void main(String[] args){\n int N = sc.nextInt();\n int M = sc.nextInt();\n int a[] = new int[N];\n \tint sum = 0;\n for(int i=0;i=(N-M-1);i--){\n if(a[i]<(sum/(4*M))){\n anst = false;\n break;\n }\n }\n if(anst)\n System.out.println(\"Yes\");\n else\n System.out.println(\"No\");\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "sample_input": "4 1\n5 4 2 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02718", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 112, "memory_kb": 23892}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s525280586", "group_id": "codeNet:p02718", "input_text": "import java.io.IOException;\nimport java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) throws IOException {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n int m = in.nextInt();\n int[] arr = new int[n];\n int sum = 0;\n\n for (int i = 0; i < n; i++) {\n arr[i] = in.nextInt();\n sum += arr[i];\n }\n int count = 0;\n for (int i = 0; i < n; i++) {\n if (arr[i] >= 1 / (4 * m)) {\n count++;\n }\n }\n System.out.println(count > m ? \"Yes\" : \"No\");\n\n }\n}", "language": "Java", "metadata": {"date": 1587532898, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02718.html", "problem_id": "p02718", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02718/input.txt", "sample_output_relpath": "derived/input_output/data/p02718/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02718/Java/s525280586.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s525280586", "user_id": "u453420992"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.io.IOException;\nimport java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) throws IOException {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n int m = in.nextInt();\n int[] arr = new int[n];\n int sum = 0;\n\n for (int i = 0; i < n; i++) {\n arr[i] = in.nextInt();\n sum += arr[i];\n }\n int count = 0;\n for (int i = 0; i < n; i++) {\n if (arr[i] >= 1 / (4 * m)) {\n count++;\n }\n }\n System.out.println(count > m ? \"Yes\" : \"No\");\n\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "sample_input": "4 1\n5 4 2 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02718", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 111, "memory_kb": 23892}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s831404549", "group_id": "codeNet:p02718", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tScanner kb = new Scanner(System.in);\n\t\tint n = kb.nextInt();\n\t\tint m = kb.nextInt();\n\t\tint p = m;\n\t\tint[] a = new int[n];\n\t\tint count = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint j = kb.nextInt();\n\t\t\tcount += j;\n\t\t\ta[i] = j;\n\t\t}\n\t\tfor (int b : a) {\n\t\t\tif (count / (4 * m) <= b) {\n\t\t\t\tp -= 1;\n\t\t\t}\n\t\t}\n\t\tif (p <= 0) {\n\t\t\tSystem.out.println(\"Yes\");\n\t\t} else {\n\t\t\tSystem.out.println(\"No\");\n\t\t}\n\n\t\tkb.close();\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1587530348, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02718.html", "problem_id": "p02718", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02718/input.txt", "sample_output_relpath": "derived/input_output/data/p02718/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02718/Java/s831404549.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s831404549", "user_id": "u163375557"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tScanner kb = new Scanner(System.in);\n\t\tint n = kb.nextInt();\n\t\tint m = kb.nextInt();\n\t\tint p = m;\n\t\tint[] a = new int[n];\n\t\tint count = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint j = kb.nextInt();\n\t\t\tcount += j;\n\t\t\ta[i] = j;\n\t\t}\n\t\tfor (int b : a) {\n\t\t\tif (count / (4 * m) <= b) {\n\t\t\t\tp -= 1;\n\t\t\t}\n\t\t}\n\t\tif (p <= 0) {\n\t\t\tSystem.out.println(\"Yes\");\n\t\t} else {\n\t\t\tSystem.out.println(\"No\");\n\t\t}\n\n\t\tkb.close();\n\t}\n\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "sample_input": "4 1\n5 4 2 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02718", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 112, "memory_kb": 23636}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s818948943", "group_id": "codeNet:p02718", "input_text": "import java.util.Scanner;\nclass Main {\n public static void main(String args[]){\n Scanner sc = new Scanner(System.in);\n int n , m;\n n = sc.nextInt();\n m = sc.nextInt();\n int[] A = new int[n];\n int i , counter;\n counter = 0;\n for(i=0; i < n ;i++){\n A[i] = sc.nextInt();\n if(A[i] / 4 / m < 0){\n counter++;\n }\n }\n if(counter <= m){\n System.out.println(\"Yes\");\n }else{\n System.out.println(\"No\");\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1587442441, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02718.html", "problem_id": "p02718", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02718/input.txt", "sample_output_relpath": "derived/input_output/data/p02718/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02718/Java/s818948943.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s818948943", "user_id": "u795783760"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.Scanner;\nclass Main {\n public static void main(String args[]){\n Scanner sc = new Scanner(System.in);\n int n , m;\n n = sc.nextInt();\n m = sc.nextInt();\n int[] A = new int[n];\n int i , counter;\n counter = 0;\n for(i=0; i < n ;i++){\n A[i] = sc.nextInt();\n if(A[i] / 4 / m < 0){\n counter++;\n }\n }\n if(counter <= m){\n System.out.println(\"Yes\");\n }else{\n System.out.println(\"No\");\n }\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "sample_input": "4 1\n5 4 2 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02718", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 119, "memory_kb": 23508}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s500286613", "group_id": "codeNet:p02718", "input_text": " import java.io.BufferedReader;\n import java.io.IOException;\n import java.io.InputStreamReader;\n import java.util.Arrays;\n import java.util.stream.IntStream;\n\n public class Main {\n\n public static void main(String[] args) throws IOException {\n\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n String [] line = br.readLine().split(\" \");\n int n = Integer.parseInt(line[0]);\n int m = Integer.parseInt(line[1]);\n\n String [] votes = br.readLine().split(\" \");\n int [] voteInt = new int[n];\n int sum = IntStream.of(voteInt).sum();\n\n int min = sum/(4*m);\n if(voteInt[n-m-1] >= min){\n System.out.println(\"Yes\");\n }\n else{\n System.out.println(\"No\");\n }\n }\n }\n\n", "language": "Java", "metadata": {"date": 1586942411, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02718.html", "problem_id": "p02718", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02718/input.txt", "sample_output_relpath": "derived/input_output/data/p02718/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02718/Java/s500286613.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s500286613", "user_id": "u661563080"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": " import java.io.BufferedReader;\n import java.io.IOException;\n import java.io.InputStreamReader;\n import java.util.Arrays;\n import java.util.stream.IntStream;\n\n public class Main {\n\n public static void main(String[] args) throws IOException {\n\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n String [] line = br.readLine().split(\" \");\n int n = Integer.parseInt(line[0]);\n int m = Integer.parseInt(line[1]);\n\n String [] votes = br.readLine().split(\" \");\n int [] voteInt = new int[n];\n int sum = IntStream.of(voteInt).sum();\n\n int min = sum/(4*m);\n if(voteInt[n-m-1] >= min){\n System.out.println(\"Yes\");\n }\n else{\n System.out.println(\"No\");\n }\n }\n }\n\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "sample_input": "4 1\n5 4 2 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02718", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 873, "cpu_time_ms": 211, "memory_kb": 26836}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s161792375", "group_id": "codeNet:p02718", "input_text": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.lang.reflect.Array;\nimport java.util.StringTokenizer;\nimport java.util.Scanner;\nimport java.lang.*;\nimport java.io.*;\nimport java.util.*;\nimport java.lang.Integer;\nimport java.util.HashMap;\n\npublic class Main {\n // driver function to test the above functions\n public static void main(String args[]) throws IOException {\n Reader.init(System.in);\n int n = Reader.nextInt();\n int m = Reader.nextInt();\n int[] arr = new int[n];\n\n double sum = 0;\n for (int i=0; i=sum){\n ans++;\n }\n }\n if (ans>=m) {\n System.out.println(\"Yes\");\n }\n else {\n System.out.println(\"No\");\n }\n\n }\n}\n\nclass Node{\n char val;\n Node nxt = null;\n Node prev=null;\n\n\n}\n\n\n\nclass solu{\n\n}\n\n/** Class for buffered reading int and double values */\nclass Reader {\n static BufferedReader reader;\n static StringTokenizer tokenizer;\n\n /** call this method to initialize reader for InputStream */\n static void init(InputStream input) {\n reader = new BufferedReader(\n new InputStreamReader(input) );\n tokenizer = new StringTokenizer(\"\");\n }\n\n /** get next word */\n static String next() throws IOException {\n while ( ! tokenizer.hasMoreTokens() ) {\n //TODO add check for eof if necessary\n tokenizer = new StringTokenizer(\n reader.readLine() );\n }\n return tokenizer.nextToken();\n }\n\n static int nextInt() throws IOException {\n return Integer.parseInt( next() );\n }\n\n static long nextLong() throws IOException {\n return Long.parseLong( next() );\n }\n\n static double nextDouble() throws IOException {\n return Double.parseDouble( next() );\n }\n\n static String line() throws IOException {\n return reader.readLine();\n }\n}", "language": "Java", "metadata": {"date": 1586855853, "filename_ext": "java", "original_language": "Java7 (OpenJDK 1.7.0)", "problem_description_relpath": "problem_descriptions/p02718.html", "problem_id": "p02718", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02718/input.txt", "sample_output_relpath": "derived/input_output/data/p02718/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02718/Java/s161792375.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s161792375", "user_id": "u965868411"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.lang.reflect.Array;\nimport java.util.StringTokenizer;\nimport java.util.Scanner;\nimport java.lang.*;\nimport java.io.*;\nimport java.util.*;\nimport java.lang.Integer;\nimport java.util.HashMap;\n\npublic class Main {\n // driver function to test the above functions\n public static void main(String args[]) throws IOException {\n Reader.init(System.in);\n int n = Reader.nextInt();\n int m = Reader.nextInt();\n int[] arr = new int[n];\n\n double sum = 0;\n for (int i=0; i=sum){\n ans++;\n }\n }\n if (ans>=m) {\n System.out.println(\"Yes\");\n }\n else {\n System.out.println(\"No\");\n }\n\n }\n}\n\nclass Node{\n char val;\n Node nxt = null;\n Node prev=null;\n\n\n}\n\n\n\nclass solu{\n\n}\n\n/** Class for buffered reading int and double values */\nclass Reader {\n static BufferedReader reader;\n static StringTokenizer tokenizer;\n\n /** call this method to initialize reader for InputStream */\n static void init(InputStream input) {\n reader = new BufferedReader(\n new InputStreamReader(input) );\n tokenizer = new StringTokenizer(\"\");\n }\n\n /** get next word */\n static String next() throws IOException {\n while ( ! tokenizer.hasMoreTokens() ) {\n //TODO add check for eof if necessary\n tokenizer = new StringTokenizer(\n reader.readLine() );\n }\n return tokenizer.nextToken();\n }\n\n static int nextInt() throws IOException {\n return Integer.parseInt( next() );\n }\n\n static long nextLong() throws IOException {\n return Long.parseLong( next() );\n }\n\n static double nextDouble() throws IOException {\n return Double.parseDouble( next() );\n }\n\n static String line() throws IOException {\n return reader.readLine();\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "sample_input": "4 1\n5 4 2 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02718", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2235, "cpu_time_ms": 80, "memory_kb": 20692}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s071095662", "group_id": "codeNet:p02718", "input_text": "import java.io.PrintWriter;\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n // write your code here\n\n Scanner in = new Scanner(System.in);\n PrintWriter out = new PrintWriter(System.out);\n\n int n = in.nextInt(), m = in.nextInt();\n int total = 0;\n int[] votes = new int[n];\n for (int i = 0; i < n; i++) {\n votes[i] = in.nextInt();\n total += votes[i];\n }\n\n int criteria = total / (4 * m);\n int count = 0;\n for (int vote: votes) {\n if (vote >= criteria)count++;\n }\n \n out.println(count >= m ? \"YES\": \"NO\");\n out.close();\n\n }\n}\n", "language": "Java", "metadata": {"date": 1586690503, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02718.html", "problem_id": "p02718", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02718/input.txt", "sample_output_relpath": "derived/input_output/data/p02718/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02718/Java/s071095662.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s071095662", "user_id": "u448404064"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.io.PrintWriter;\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n // write your code here\n\n Scanner in = new Scanner(System.in);\n PrintWriter out = new PrintWriter(System.out);\n\n int n = in.nextInt(), m = in.nextInt();\n int total = 0;\n int[] votes = new int[n];\n for (int i = 0; i < n; i++) {\n votes[i] = in.nextInt();\n total += votes[i];\n }\n\n int criteria = total / (4 * m);\n int count = 0;\n for (int vote: votes) {\n if (vote >= criteria)count++;\n }\n \n out.println(count >= m ? \"YES\": \"NO\");\n out.close();\n\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "sample_input": "4 1\n5 4 2 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02718", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 710, "cpu_time_ms": 107, "memory_kb": 23764}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s252484080", "group_id": "codeNet:p02718", "input_text": "\nimport java.util.Arrays;\nimport java.util.Scanner;\n\n/*\n * To change this license header, choose License Headers in Project Properties.\n * To change this template file, choose Tools | Templates\n * and open the template in the editor.\n */\n\n/**\n *\n * @author wnqmw\n */\npublic class Main {\n public static void main(String args[]){\n Scanner kb = new Scanner(System.in);\n int nums = kb.nextInt(), sel = kb.nextInt();\n \n int[] num = new int[nums];\n \n int total = 0, totalvotes = 0;\n for(int i = 0; i < nums; i++){\n num[i] = kb.nextInt();\n totalvotes += num[i];\n \n \n }\n Arrays.sort(num);\n for(int i = nums-1; i >= 0; i--){\n if(num[i] >= totalvotes/(4*sel)){\n total++;\n if(total == sel){\n break;\n }\n }\n }\n if(total < sel){\n System.out.println(\"No\");\n }else{\n System.out.println(\"Yes\");\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1586336506, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02718.html", "problem_id": "p02718", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02718/input.txt", "sample_output_relpath": "derived/input_output/data/p02718/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02718/Java/s252484080.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s252484080", "user_id": "u817596860"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "\nimport java.util.Arrays;\nimport java.util.Scanner;\n\n/*\n * To change this license header, choose License Headers in Project Properties.\n * To change this template file, choose Tools | Templates\n * and open the template in the editor.\n */\n\n/**\n *\n * @author wnqmw\n */\npublic class Main {\n public static void main(String args[]){\n Scanner kb = new Scanner(System.in);\n int nums = kb.nextInt(), sel = kb.nextInt();\n \n int[] num = new int[nums];\n \n int total = 0, totalvotes = 0;\n for(int i = 0; i < nums; i++){\n num[i] = kb.nextInt();\n totalvotes += num[i];\n \n \n }\n Arrays.sort(num);\n for(int i = nums-1; i >= 0; i--){\n if(num[i] >= totalvotes/(4*sel)){\n total++;\n if(total == sel){\n break;\n }\n }\n }\n if(total < sel){\n System.out.println(\"No\");\n }else{\n System.out.println(\"Yes\");\n }\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "sample_input": "4 1\n5 4 2 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02718", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1042, "cpu_time_ms": 107, "memory_kb": 23892}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s897340744", "group_id": "codeNet:p02718", "input_text": "import java.util.Collections;\nimport java.util.PriorityQueue;\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\t// 入力値の取得\n\t\tint N = sc.nextInt();\n\t\tint M = sc.nextInt();\n\t\t\n\t\tdouble sum = 0;\n\t\tPriorityQueue pq = new PriorityQueue<> (Collections.reverseOrder());\n\t\t\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tint Ai = sc.nextInt();\n\t\t\tsum += Ai;\n\t\t\tpq.add(Ai);\n\t\t}\n\t\t\n\t\tdouble threshold = sum / (4 * M);\n\t\t\n\t\tboolean result = true;\n\t\tfor (int i = 0; i < M; i++) {\n\t\t\tif (pq.poll() < threshold) {\n\t\t\t\tresult = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// 結果の出力\n\t\tSystem.out.println(result?\"Yes\":\"No\");\n\n\t\tsc.close();\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1586185797, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02718.html", "problem_id": "p02718", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02718/input.txt", "sample_output_relpath": "derived/input_output/data/p02718/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02718/Java/s897340744.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s897340744", "user_id": "u088262437"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.Collections;\nimport java.util.PriorityQueue;\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\t// 入力値の取得\n\t\tint N = sc.nextInt();\n\t\tint M = sc.nextInt();\n\t\t\n\t\tdouble sum = 0;\n\t\tPriorityQueue pq = new PriorityQueue<> (Collections.reverseOrder());\n\t\t\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tint Ai = sc.nextInt();\n\t\t\tsum += Ai;\n\t\t\tpq.add(Ai);\n\t\t}\n\t\t\n\t\tdouble threshold = sum / (4 * M);\n\t\t\n\t\tboolean result = true;\n\t\tfor (int i = 0; i < M; i++) {\n\t\t\tif (pq.poll() < threshold) {\n\t\t\t\tresult = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// 結果の出力\n\t\tSystem.out.println(result?\"Yes\":\"No\");\n\n\t\tsc.close();\n\t}\n\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "sample_input": "4 1\n5 4 2 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02718", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 712, "cpu_time_ms": 110, "memory_kb": 23764}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s552360731", "group_id": "codeNet:p02718", "input_text": "import java.util.*;\n\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int m = sc.nextInt();\n int[] a = new int[n];\n for(int i = 0; i < n; i++){\n a[i] = sc.nextInt();\n }\n int sum = 0;\n for(int i = 0; i < n; i++){\n sum = sum + a[i];\n }\n double border = sum/(4*m);\n Arrays.sort(a);\n int count = 0;\n for(int i = 1; i < n-1; i++){\n if(a[n-i] >= border){\n count++;\n } else {\n break;\n }\n }\n if(count >= m){\n System.out.print(\"Yes\");\n } else {\n System.out.print(\"No\");\n }\n }\n}", "language": "Java", "metadata": {"date": 1586178372, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02718.html", "problem_id": "p02718", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02718/input.txt", "sample_output_relpath": "derived/input_output/data/p02718/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02718/Java/s552360731.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s552360731", "user_id": "u990037841"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int m = sc.nextInt();\n int[] a = new int[n];\n for(int i = 0; i < n; i++){\n a[i] = sc.nextInt();\n }\n int sum = 0;\n for(int i = 0; i < n; i++){\n sum = sum + a[i];\n }\n double border = sum/(4*m);\n Arrays.sort(a);\n int count = 0;\n for(int i = 1; i < n-1; i++){\n if(a[n-i] >= border){\n count++;\n } else {\n break;\n }\n }\n if(count >= m){\n System.out.print(\"Yes\");\n } else {\n System.out.print(\"No\");\n }\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "sample_input": "4 1\n5 4 2 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02718", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 773, "cpu_time_ms": 109, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s556952817", "group_id": "codeNet:p02718", "input_text": "import java.util.*;\nimport java.math.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int m = sc.nextInt();\n\n int[] a = new int[n];\n\n long sum = 0;\n\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextInt();\n sum += a[i];\n }\n\n int count = 0;\n double k = (double)1/(4*m);\n\n for (int i = 0; i < n; i++) {\n if (a[i] >= k*sum) {\n count++;\n }\n if (count == m) {\n System.out.println(\"Yes\");\n return;\n }\n }\n\n System.out.println(\"No\");\n\n\n\n }\n\n}\n", "language": "Java", "metadata": {"date": 1586111237, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02718.html", "problem_id": "p02718", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02718/input.txt", "sample_output_relpath": "derived/input_output/data/p02718/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02718/Java/s556952817.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s556952817", "user_id": "u387775763"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.*;\nimport java.math.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int m = sc.nextInt();\n\n int[] a = new int[n];\n\n long sum = 0;\n\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextInt();\n sum += a[i];\n }\n\n int count = 0;\n double k = (double)1/(4*m);\n\n for (int i = 0; i < n; i++) {\n if (a[i] >= k*sum) {\n count++;\n }\n if (count == m) {\n System.out.println(\"Yes\");\n return;\n }\n }\n\n System.out.println(\"No\");\n\n\n\n }\n\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "sample_input": "4 1\n5 4 2 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02718", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 110, "memory_kb": 21716}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s632215041", "group_id": "codeNet:p02718", "input_text": "import java.util.Scanner;\npublic class Main\n{\n\tpublic static void main(String[] args)\n {\n \t Scanner sc = new Scanner(System.in);\n \t\n \tString[] sep = sc.nextLine().split(\" \");\n \tint n = Integer.parseInt(sep[0]);\n \tint m = Integer.parseInt(sep[1]);\n \tint[] bigger = new int[n];\n \tString[] sepa = sc.nextLine().split(\" \");\n \tint sumVote = 0;\n \tfor(int i = 0; i < n; i++)\n {\n \tbigger[i] = Integer.parseInt(sepa[i]);\n \tsumVote += bigger[i];\n }\n \tint judge = 0;\n \tfor(int i = 0; i < n; i++)\n {\n \tint amari = sumVote % (4 * m);\n if(bigger[i] > sumVote / (4 * m))\n {\n judge++;\n }else if(bigger[i] == sumVote / (4 * m) && sumVote % (4 * m) == 0){\n \t judge++;\n }\n }\n \n if(judge >= m)\n {\n \tSystem.out.print(\"Yes\");\n }else{\n \tSystem.out.print(\"No\");\n }\n }\n}", "language": "Java", "metadata": {"date": 1586054359, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02718.html", "problem_id": "p02718", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02718/input.txt", "sample_output_relpath": "derived/input_output/data/p02718/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02718/Java/s632215041.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s632215041", "user_id": "u028693637"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.Scanner;\npublic class Main\n{\n\tpublic static void main(String[] args)\n {\n \t Scanner sc = new Scanner(System.in);\n \t\n \tString[] sep = sc.nextLine().split(\" \");\n \tint n = Integer.parseInt(sep[0]);\n \tint m = Integer.parseInt(sep[1]);\n \tint[] bigger = new int[n];\n \tString[] sepa = sc.nextLine().split(\" \");\n \tint sumVote = 0;\n \tfor(int i = 0; i < n; i++)\n {\n \tbigger[i] = Integer.parseInt(sepa[i]);\n \tsumVote += bigger[i];\n }\n \tint judge = 0;\n \tfor(int i = 0; i < n; i++)\n {\n \tint amari = sumVote % (4 * m);\n if(bigger[i] > sumVote / (4 * m))\n {\n judge++;\n }else if(bigger[i] == sumVote / (4 * m) && sumVote % (4 * m) == 0){\n \t judge++;\n }\n }\n \n if(judge >= m)\n {\n \tSystem.out.print(\"Yes\");\n }else{\n \tSystem.out.print(\"No\");\n }\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "sample_input": "4 1\n5 4 2 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02718", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 971, "cpu_time_ms": 101, "memory_kb": 21716}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s469295611", "group_id": "codeNet:p02718", "input_text": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\n\n\npublic class Main {\n private static int MOD = 1000000007;\n\n\n public static void main(String[] args) throws IOException {\n InputStreamReader isr = new InputStreamReader(System.in);\n BufferedReader br = new BufferedReader(isr);\n String str = br.readLine();\n String[] split = str.split(\" \");\n int n = Integer.parseInt(split[0]);\n int m = Integer.parseInt(split[1]);\n\n split = br.readLine().split(\" \");\n\n int total = 0;\n\n List hyous = new ArrayList<>();\n for (String s : split) {\n int hyou = Integer.parseInt(s);\n total += hyou;\n hyous.add(hyou);\n }\n\n hyous.sort(Collections.reverseOrder());\n\n int ikichi = total / (4 * m);\n int amari = total % (4 * m);\n if(amari != 0) {\n ikichi++;\n }\n for (int i = 0; i < m; i++) {\n int hyou = hyous.get(i);\n if (hyou < ikichi) {\n System.out.println(\"No\");\n return;\n }\n }\n\n System.out.println(\"Yes\");\n\n }\n}\n", "language": "Java", "metadata": {"date": 1586054239, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02718.html", "problem_id": "p02718", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02718/input.txt", "sample_output_relpath": "derived/input_output/data/p02718/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02718/Java/s469295611.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s469295611", "user_id": "u454024532"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\n\n\npublic class Main {\n private static int MOD = 1000000007;\n\n\n public static void main(String[] args) throws IOException {\n InputStreamReader isr = new InputStreamReader(System.in);\n BufferedReader br = new BufferedReader(isr);\n String str = br.readLine();\n String[] split = str.split(\" \");\n int n = Integer.parseInt(split[0]);\n int m = Integer.parseInt(split[1]);\n\n split = br.readLine().split(\" \");\n\n int total = 0;\n\n List hyous = new ArrayList<>();\n for (String s : split) {\n int hyou = Integer.parseInt(s);\n total += hyou;\n hyous.add(hyou);\n }\n\n hyous.sort(Collections.reverseOrder());\n\n int ikichi = total / (4 * m);\n int amari = total % (4 * m);\n if(amari != 0) {\n ikichi++;\n }\n for (int i = 0; i < m; i++) {\n int hyou = hyous.get(i);\n if (hyou < ikichi) {\n System.out.println(\"No\");\n return;\n }\n }\n\n System.out.println(\"Yes\");\n\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "sample_input": "4 1\n5 4 2 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02718", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 72, "memory_kb": 22484}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s402677381", "group_id": "codeNet:p02718", "input_text": "import java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Scanner;\n \n\n//result = Math.pow(num1, num3)\n//StringBuffer str = new StringBuffer(hoge1);\n//String hoge2 = str.reverse().toString();\n//map.containsKey(A)\n//Map map = new HashMap(n);\n//ArrayList cc = new ArrayList<>(n);\n//Collections.sort(list);\n//Array.sort(list);\n//Arrays.asList(c).contains(\"a\")\n\npublic class Main {\n\tprivate static Scanner sc = new Scanner(System.in);\n\tstatic void p(String ans) {System.out.println(ans);};\n\tstatic void p(int ans) {System.out.println(ans);};\n\tstatic void p(long ans) {System.out.println(ans);};\n\tstatic void p(double ans) {System.out.println(ans);};\n\t//static String eikomoji[]={\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\",\"h\",\"i\",\"j\",\"k\",\"l\",\"m\",\"n\",\"o\",\"p\",\"q\",\"r\",\"s\",\"t\",\"u\",\"v\",\"w\",\"x\",\"y\",\"z\"};\n\tpublic static void main(String[] args) {\n\tint N=sc.nextInt();\n\tint M=sc.nextInt();\n\tArrayList cc = new ArrayList<>(N+1);\n\tlong wa=0;\n\tfor(int i=0;i=(wa/(4*M))) {\n\t\tctn++;\n\t\t}\n\t\tif(ctn==M) {\n\t\t\tp(\"Yes\");\n\t\t\ta=false;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(a) {\n\t\tp(\"No\");\n\t}\n\t//if() {}\n\t\n\t\n\t}\n}\n", "language": "Java", "metadata": {"date": 1586052034, "filename_ext": "java", "original_language": "Java7 (OpenJDK 1.7.0)", "problem_description_relpath": "problem_descriptions/p02718.html", "problem_id": "p02718", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02718/input.txt", "sample_output_relpath": "derived/input_output/data/p02718/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02718/Java/s402677381.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s402677381", "user_id": "u563321291"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Scanner;\n \n\n//result = Math.pow(num1, num3)\n//StringBuffer str = new StringBuffer(hoge1);\n//String hoge2 = str.reverse().toString();\n//map.containsKey(A)\n//Map map = new HashMap(n);\n//ArrayList cc = new ArrayList<>(n);\n//Collections.sort(list);\n//Array.sort(list);\n//Arrays.asList(c).contains(\"a\")\n\npublic class Main {\n\tprivate static Scanner sc = new Scanner(System.in);\n\tstatic void p(String ans) {System.out.println(ans);};\n\tstatic void p(int ans) {System.out.println(ans);};\n\tstatic void p(long ans) {System.out.println(ans);};\n\tstatic void p(double ans) {System.out.println(ans);};\n\t//static String eikomoji[]={\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\",\"h\",\"i\",\"j\",\"k\",\"l\",\"m\",\"n\",\"o\",\"p\",\"q\",\"r\",\"s\",\"t\",\"u\",\"v\",\"w\",\"x\",\"y\",\"z\"};\n\tpublic static void main(String[] args) {\n\tint N=sc.nextInt();\n\tint M=sc.nextInt();\n\tArrayList cc = new ArrayList<>(N+1);\n\tlong wa=0;\n\tfor(int i=0;i=(wa/(4*M))) {\n\t\tctn++;\n\t\t}\n\t\tif(ctn==M) {\n\t\t\tp(\"Yes\");\n\t\t\ta=false;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(a) {\n\t\tp(\"No\");\n\t}\n\t//if() {}\n\t\n\t\n\t}\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "sample_input": "4 1\n5 4 2 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02718", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1304, "cpu_time_ms": 119, "memory_kb": 22740}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s713377103", "group_id": "codeNet:p02718", "input_text": "import java.util.*;\n\nclass Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int M = sc.nextInt();\n \n \tInteger a[] = new Integer[N];\n \tfor (int i=0; i= sum2) {\n i2++;\n }\n \t\n \tif (i2 >= M)\n System.out.println(\"Yes\");\n else\n System.out.println(\"No\");\n }\n}", "language": "Java", "metadata": {"date": 1586050386, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02718.html", "problem_id": "p02718", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02718/input.txt", "sample_output_relpath": "derived/input_output/data/p02718/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02718/Java/s713377103.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s713377103", "user_id": "u857143297"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.*;\n\nclass Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int M = sc.nextInt();\n \n \tInteger a[] = new Integer[N];\n \tfor (int i=0; i= sum2) {\n i2++;\n }\n \t\n \tif (i2 >= M)\n System.out.println(\"Yes\");\n else\n System.out.println(\"No\");\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "sample_input": "4 1\n5 4 2 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02718", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 733, "cpu_time_ms": 102, "memory_kb": 21716}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s201316048", "group_id": "codeNet:p02718", "input_text": "import java.util.*;\nimport java.lang.*;\nimport java.io.*;\n\n/* Name of the class has to be \"Main\" only if the class is public. */\nclass Main\n{\n\tpublic static void main (String[] args) throws java.lang.Exception\n\t{\n\t\t// your code goes here\n\t\ttry {\n\t\t Scanner sc=new Scanner(System.in);\n\t\t int n=sc.nextInt();\n\t\t int m=sc.nextInt();\n\t\t int sum=0;\n\t\t int ar[]=new int[n];\n\t\t for(int i=0;i=sum)\n\t\t c++;\n\t\t if(c==m)\n\t\t break;\n\t\t }\n\t\t if(c=sum)\n\t\t c++;\n\t\t if(c==m)\n\t\t break;\n\t\t }\n\t\t if(c= total) {\n\t\t\t\taryPick[ctr]=ary[j];\n\t\t\t\tctr++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tsc.close();\n\t\tlog( (ctr= total) {\n\t\t\t\taryPick[ctr]=ary[j];\n\t\t\t\tctr++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tsc.close();\n\t\tlog( (ctr= m){\n break;\n }\n if(a[i] >= v){\n count++;\n }\n }\n if(count < m){\n System.out.println(\"No\");\n }else{\n System.out.println(\"Yes\");\n }\n }\n}", "language": "Java", "metadata": {"date": 1586049585, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02718.html", "problem_id": "p02718", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02718/input.txt", "sample_output_relpath": "derived/input_output/data/p02718/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02718/Java/s186808482.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s186808482", "user_id": "u817042904"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int m = sc.nextInt();\n int sum = 0;\n int[] a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextInt();\n sum += a[i];\n }\n int v = sum / (4 * m);\n int count = 0;\n for (int i = 0; i < n; i++) {\n if(count >= m){\n break;\n }\n if(a[i] >= v){\n count++;\n }\n }\n if(count < m){\n System.out.println(\"No\");\n }else{\n System.out.println(\"Yes\");\n }\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "sample_input": "4 1\n5 4 2 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02718", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 719, "cpu_time_ms": 108, "memory_kb": 23892}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s271173701", "group_id": "codeNet:p02718", "input_text": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n int m = scan.nextInt();\n int[] a = new int[n];\n int sum = 0;\n int b = 0;\n for(int i = 0; i < n; i++){\n a[i] = scan.nextInt();\n sum += a[i];\n }\n for(int i = 0; i < n; i++){\n if(a[i] >= sum / (4 * m) && sum % (4 * m) == 0){\n b++;\n }else if(a[i] > sum / (4 * m)){\n b++;\n }\n }\n if(b >= m){\n System.out.println(\"Yes\");\n }else{\n System.out.println(\"No\");\n }\n }\n}", "language": "Java", "metadata": {"date": 1586049141, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02718.html", "problem_id": "p02718", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02718/input.txt", "sample_output_relpath": "derived/input_output/data/p02718/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02718/Java/s271173701.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s271173701", "user_id": "u459100168"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n int m = scan.nextInt();\n int[] a = new int[n];\n int sum = 0;\n int b = 0;\n for(int i = 0; i < n; i++){\n a[i] = scan.nextInt();\n sum += a[i];\n }\n for(int i = 0; i < n; i++){\n if(a[i] >= sum / (4 * m) && sum % (4 * m) == 0){\n b++;\n }else if(a[i] > sum / (4 * m)){\n b++;\n }\n }\n if(b >= m){\n System.out.println(\"Yes\");\n }else{\n System.out.println(\"No\");\n }\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "sample_input": "4 1\n5 4 2 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02718", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 708, "cpu_time_ms": 111, "memory_kb": 23764}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s718116221", "group_id": "codeNet:p02718", "input_text": "import java.util.Arrays;\nimport java.util.Scanner;\n\nclass Solver {\n public void Solve() {\n int n = sc.nextInt();\n int m = sc.nextInt();\n int a[] = new int[n];\n long wa = 0;\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextInt();\n wa += a[i];\n }\n Arrays.sort(a);\n double dd = wa * 1.0 / (4.0 * m);\n int cnt = 0;\n for (int i = 0; i < n; i++) {\n if (a[i] >= dd) {\n cnt++;\n } else {\n\n }\n }\n if (cnt >= m) {\n System.out.println(\"Yes\");\n } else {\n System.out.println(\"No\");\n }\n\n }\n\n Scanner sc;\n\n Solver(Scanner in) {\n this.sc = in;\n }\n}\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n Solver s = new Solver(sc);\n s.Solve();\n sc.close();\n }\n}\n", "language": "Java", "metadata": {"date": 1586049019, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02718.html", "problem_id": "p02718", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02718/input.txt", "sample_output_relpath": "derived/input_output/data/p02718/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02718/Java/s718116221.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s718116221", "user_id": "u045712871"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.Arrays;\nimport java.util.Scanner;\n\nclass Solver {\n public void Solve() {\n int n = sc.nextInt();\n int m = sc.nextInt();\n int a[] = new int[n];\n long wa = 0;\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextInt();\n wa += a[i];\n }\n Arrays.sort(a);\n double dd = wa * 1.0 / (4.0 * m);\n int cnt = 0;\n for (int i = 0; i < n; i++) {\n if (a[i] >= dd) {\n cnt++;\n } else {\n\n }\n }\n if (cnt >= m) {\n System.out.println(\"Yes\");\n } else {\n System.out.println(\"No\");\n }\n\n }\n\n Scanner sc;\n\n Solver(Scanner in) {\n this.sc = in;\n }\n}\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n Solver s = new Solver(sc);\n s.Solve();\n sc.close();\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "sample_input": "4 1\n5 4 2 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02718", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 934, "cpu_time_ms": 118, "memory_kb": 23508}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s539898807", "group_id": "codeNet:p02718", "input_text": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.util.Arrays;\nimport java.util.NoSuchElementException;\nimport java.util.Scanner;\n\npublic class Main implements Runnable{\n\n\tpublic static void main(String[] args) {\n\t\tnew Thread(null,new Main(), \"\" ,Runtime.getRuntime().maxMemory()).start();\n\t}\n\t\n\tpublic void run() {\n\t\tFastScanner sc=new FastScanner();\n\t\tint N=sc.nextInt();\n\t\tint M=sc.nextInt();\n\t\tint[] A=new int[N];\n\t\tfor(int i=0;i=sum)++p;\n\t\tSystem.out.println(p>=M?\"Yes\":\"No\");\n\t}\n\t\n\tvoid tr(Object...objects) {System.out.println(Arrays.deepToString(objects));}\n}\n\nclass FastScanner {\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n }else{\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}\n private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}\n public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}\n public String next() {\n if (!hasNext()) throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while(isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n public long nextLong() {\n if (!hasNext()) throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while(true){\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n }else if(b == -1 || !isPrintableChar(b)){\n return minus ? -n : n;\n }else{\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }\n \n public double nextDouble() { return Double.parseDouble(next());}\n}", "language": "Java", "metadata": {"date": 1586048853, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02718.html", "problem_id": "p02718", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02718/input.txt", "sample_output_relpath": "derived/input_output/data/p02718/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02718/Java/s539898807.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s539898807", "user_id": "u313111801"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.util.Arrays;\nimport java.util.NoSuchElementException;\nimport java.util.Scanner;\n\npublic class Main implements Runnable{\n\n\tpublic static void main(String[] args) {\n\t\tnew Thread(null,new Main(), \"\" ,Runtime.getRuntime().maxMemory()).start();\n\t}\n\t\n\tpublic void run() {\n\t\tFastScanner sc=new FastScanner();\n\t\tint N=sc.nextInt();\n\t\tint M=sc.nextInt();\n\t\tint[] A=new int[N];\n\t\tfor(int i=0;i=sum)++p;\n\t\tSystem.out.println(p>=M?\"Yes\":\"No\");\n\t}\n\t\n\tvoid tr(Object...objects) {System.out.println(Arrays.deepToString(objects));}\n}\n\nclass FastScanner {\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n }else{\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}\n private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}\n public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}\n public String next() {\n if (!hasNext()) throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while(isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n public long nextLong() {\n if (!hasNext()) throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while(true){\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n }else if(b == -1 || !isPrintableChar(b)){\n return minus ? -n : n;\n }else{\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }\n \n public double nextDouble() { return Double.parseDouble(next());}\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "sample_input": "4 1\n5 4 2 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02718", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2839, "cpu_time_ms": 228, "memory_kb": 28500}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s044607448", "group_id": "codeNet:p02718", "input_text": "\n\nimport static java.lang.System.*;\n\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.util.NoSuchElementException;\n\npublic class Main {\n\n\tpublic void solve() {\n\n\t\tint N = nextInt();\n\t\tint M = nextInt();\n\t\tint[] A = new int[N];\n\t\tint total = 0;\n\t\tfor(int i=0;ix) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tString result = count >= M ? \"Yes\" :\"No\";\n\t\tout.println(result);\n\t}\n\n\tprivate final InputStream in = System.in;\n\tprivate final byte[] buffer = new byte[1024];\n\tprivate int ptr = 0;\n\tprivate int buflen = 0;\n\n\tprivate boolean hasNextByte() {\n\t\tif (ptr < buflen) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\tptr = 0;\n\t\t\ttry {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\tprivate int readByte() {\n\t\tif (hasNextByte())\n\t\t\treturn buffer[ptr++];\n\t\telse\n\t\t\treturn -1;\n\t}\n\n\tprivate static boolean isPrintableChar(int c) {\n\t\treturn 33 <= c && c <= 126;\n\t}\n\n\tprivate void skipUnprintable() {\n\t\twhile (hasNextByte() && !isPrintableChar(buffer[ptr]))\n\t\t\tptr++;\n\t}\n\n\tpublic boolean hasNext() {\n\t\tskipUnprintable();\n\t\treturn hasNextByte();\n\t}\n\n\tpublic String next() {\n\t\tif (!hasNext())\n\t\t\tthrow new NoSuchElementException();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint b = readByte();\n\t\twhile (isPrintableChar(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\n\tpublic long nextLong() {\n\t\tif (!hasNext())\n\t\t\tthrow new NoSuchElementException();\n\t\tlong n = 0;\n\t\tboolean minus = false;\n\t\tint b = readByte();\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\tif (b < '0' || '9' < b) {\n\t\t\tthrow new NumberFormatException();\n\t\t}\n\t\twhile (true) {\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n\tpublic int nextInt() {\n\t\treturn (int) nextLong();\n\t}\n\n\tpublic int gcd(int a, int b) {\n\t\treturn b == 0 ? a : gcd(b, a % b);\n\t}\n\n\tlong gcd(long a, long b) {\n\t\treturn b == 0 ? a : gcd(b, a % b);\n\t}\n\n\tlong lcm(long a, long b) {\n\t\treturn a * b / gcd(a, b);\n\t}\n\n\tdouble sqrt(double x) {\n\t\treturn Math.sqrt(x);\n\t}\n\n\tdouble pow(double x, double y) {\n\t\treturn Math.pow(x, y);\n\t}\n\tint max(int a,int b) {\n\t\treturn Math.max(a, b);\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tMain m = new Main();\n\n\t\tm.solve();\n\t}\n\n\tpublic void println(Object o) {\n\t\tout.println(o);\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1586048773, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02718.html", "problem_id": "p02718", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02718/input.txt", "sample_output_relpath": "derived/input_output/data/p02718/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02718/Java/s044607448.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s044607448", "user_id": "u980887005"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "\n\nimport static java.lang.System.*;\n\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.util.NoSuchElementException;\n\npublic class Main {\n\n\tpublic void solve() {\n\n\t\tint N = nextInt();\n\t\tint M = nextInt();\n\t\tint[] A = new int[N];\n\t\tint total = 0;\n\t\tfor(int i=0;ix) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tString result = count >= M ? \"Yes\" :\"No\";\n\t\tout.println(result);\n\t}\n\n\tprivate final InputStream in = System.in;\n\tprivate final byte[] buffer = new byte[1024];\n\tprivate int ptr = 0;\n\tprivate int buflen = 0;\n\n\tprivate boolean hasNextByte() {\n\t\tif (ptr < buflen) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\tptr = 0;\n\t\t\ttry {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\tprivate int readByte() {\n\t\tif (hasNextByte())\n\t\t\treturn buffer[ptr++];\n\t\telse\n\t\t\treturn -1;\n\t}\n\n\tprivate static boolean isPrintableChar(int c) {\n\t\treturn 33 <= c && c <= 126;\n\t}\n\n\tprivate void skipUnprintable() {\n\t\twhile (hasNextByte() && !isPrintableChar(buffer[ptr]))\n\t\t\tptr++;\n\t}\n\n\tpublic boolean hasNext() {\n\t\tskipUnprintable();\n\t\treturn hasNextByte();\n\t}\n\n\tpublic String next() {\n\t\tif (!hasNext())\n\t\t\tthrow new NoSuchElementException();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint b = readByte();\n\t\twhile (isPrintableChar(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\n\tpublic long nextLong() {\n\t\tif (!hasNext())\n\t\t\tthrow new NoSuchElementException();\n\t\tlong n = 0;\n\t\tboolean minus = false;\n\t\tint b = readByte();\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\tif (b < '0' || '9' < b) {\n\t\t\tthrow new NumberFormatException();\n\t\t}\n\t\twhile (true) {\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n\tpublic int nextInt() {\n\t\treturn (int) nextLong();\n\t}\n\n\tpublic int gcd(int a, int b) {\n\t\treturn b == 0 ? a : gcd(b, a % b);\n\t}\n\n\tlong gcd(long a, long b) {\n\t\treturn b == 0 ? a : gcd(b, a % b);\n\t}\n\n\tlong lcm(long a, long b) {\n\t\treturn a * b / gcd(a, b);\n\t}\n\n\tdouble sqrt(double x) {\n\t\treturn Math.sqrt(x);\n\t}\n\n\tdouble pow(double x, double y) {\n\t\treturn Math.pow(x, y);\n\t}\n\tint max(int a,int b) {\n\t\treturn Math.max(a, b);\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tMain m = new Main();\n\n\t\tm.solve();\n\t}\n\n\tpublic void println(Object o) {\n\t\tout.println(o);\n\t}\n\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "sample_input": "4 1\n5 4 2 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02718", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2591, "cpu_time_ms": 101, "memory_kb": 22996}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s074835894", "group_id": "codeNet:p02718", "input_text": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n private static boolean solve(int n, int m, int[] as) {\n Arrays.sort(as);\n int sum = 0;\n for (int a : as) {\n sum += a;\n }\n\n return as[n - m] >= sum / (4 * m);\n }\n\n private static void execute(ContestReader reader, ContestWriter out) {\n int n = reader.nextInt();\n int m = reader.nextInt();\n int[] as = reader.nextInt(n);\n out.println(solve(n, m, as) ? \"Yes\" : \"No\");\n }\n \n public static void main(String[] args) {\n ContestReader reader = new ContestReader(System.in);\n ContestWriter out = new ContestWriter(System.out);\n execute(reader, out);\n out.flush();\n }\n}\n\nclass ContestWriter extends PrintWriter {\n ContestWriter(PrintStream printeStream) {\n super(printeStream);\n }\n\n public void printList(List list) {\n for (Object object : list) {\n println(object);\n }\n }\n\n public void printListOneLine(List list) {\n List stringList = new ArrayList<>();\n for (Object object : list) {\n stringList.add(object.toString());\n }\n println(String.join(\" \", stringList));\n }\n}\n\nclass ContestReader {\n private static final int BUFFER_SIZE = 1024;\n \n private final InputStream stream;\n private final byte[] buffer;\n private int pointer;\n private int bufferLength;\n \n ContestReader(InputStream stream) {\n this.stream = stream;\n this.buffer = new byte[BUFFER_SIZE];\n this.pointer = 0;\n this.bufferLength = 0;\n }\n \n private boolean hasNextByte() {\n if (pointer < bufferLength) {\n return true;\n }\n \n pointer = 0;\n try {\n bufferLength = stream.read(buffer);\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n return bufferLength > 0;\n }\n \n private int readByte() {\n if (hasNextByte()) {\n return buffer[pointer++];\n } else {\n return -1;\n }\n }\n \n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n \n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[pointer])) {\n pointer++;\n }\n return hasNextByte();\n }\n \n public String next() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n StringBuilder sb = new StringBuilder();\n while(true) {\n int b = readByte();\n if (!isPrintableChar(b)) {\n break;\n }\n sb.appendCodePoint(b);\n }\n return sb.toString();\n }\n \n public String nextLine() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n StringBuilder sb = new StringBuilder();\n while(true) {\n int b = readByte();\n if (!isPrintableChar(b) && b != 0x20) {\n break;\n }\n sb.appendCodePoint(b);\n }\n return sb.toString();\n }\n \n public char nextChar() {\n return next().charAt(0);\n }\n \n public int nextInt() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n \n int n = 0;\n boolean minus = false;\n \n {\n int b = readByte();\n if (b == '-') {\n minus = true;\n } else if ('0' <= b && b <= '9') {\n n = b - '0';\n } else {\n throw new NumberFormatException();\n }\n }\n \n while(true){\n int b = readByte();\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n }\n }\n \n public long nextLong() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n \n long n = 0;\n boolean minus = false;\n \n {\n int b = readByte();\n if (b == '-') {\n minus = true;\n } else if ('0' <= b && b <= '9') {\n n = b - '0';\n } else {\n throw new NumberFormatException();\n }\n }\n \n while(true){\n int b = readByte();\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n }\n }\n \n public double nextDouble() {\n return Double.parseDouble(next());\n }\n \n public String[] next(int n) {\n String[] array = new String[n];\n for (int i = 0; i < n; i++) {\n array[i] = next();\n }\n return array;\n }\n \n public String[] nextLine(int n) {\n String[] array = new String[n];\n for (int i = 0; i < n; i++) {\n array[i] = nextLine();\n }\n return array;\n }\n \n public char[] nextChar(int n) {\n char[] array = new char[n];\n for (int i = 0; i < n; i++) {\n array[i] = nextChar();\n }\n return array;\n }\n \n public int[] nextInt(int n) {\n int[] array = new int[n];\n for (int i = 0; i < n; i++) {\n array[i] = nextInt();\n }\n return array;\n }\n \n public long[] nextLong(int n) {\n long[] array = new long[n];\n for (int i = 0; i < n; i++) {\n array[i] = nextLong();\n }\n return array;\n }\n \n public double[] nextDouble(int n) {\n double[] array = new double[n];\n for (int i = 0; i < n; i++) {\n array[i] = nextDouble();\n }\n return array;\n }\n \n public char[] nextCharArray() {\n return next().toCharArray();\n }\n \n public String[][] next(int n, int m) {\n String[][] matrix = new String[n][m];\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n matrix[i][j] = next();\n }\n }\n return matrix;\n }\n \n public int[][] nextInt(int n, int m) {\n int[][] matrix = new int[n][m];\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n matrix[i][j] = nextInt();\n }\n }\n return matrix;\n }\n \n public char[][] nextChar(int n, int m) {\n char[][] matrix = new char[n][m];\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n matrix[i][j] = nextChar();\n }\n }\n return matrix;\n }\n \n public long[][] nextLong(int n, int m) {\n long[][] matrix = new long[n][m];\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n matrix[i][j] = nextLong();\n }\n }\n return matrix;\n }\n \n public double[][] nextDouble(int n, int m) {\n double[][] matrix = new double[n][m];\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n matrix[i][j] = nextDouble();\n }\n }\n return matrix;\n }\n \n public char[][] nextCharArray(int n) {\n char[][] matrix = new char[n][];\n for (int i = 0; i < n; i++) {\n matrix[i] = next().toCharArray();\n }\n return matrix;\n }\n}\n", "language": "Java", "metadata": {"date": 1586048734, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02718.html", "problem_id": "p02718", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02718/input.txt", "sample_output_relpath": "derived/input_output/data/p02718/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02718/Java/s074835894.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s074835894", "user_id": "u853633924"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n private static boolean solve(int n, int m, int[] as) {\n Arrays.sort(as);\n int sum = 0;\n for (int a : as) {\n sum += a;\n }\n\n return as[n - m] >= sum / (4 * m);\n }\n\n private static void execute(ContestReader reader, ContestWriter out) {\n int n = reader.nextInt();\n int m = reader.nextInt();\n int[] as = reader.nextInt(n);\n out.println(solve(n, m, as) ? \"Yes\" : \"No\");\n }\n \n public static void main(String[] args) {\n ContestReader reader = new ContestReader(System.in);\n ContestWriter out = new ContestWriter(System.out);\n execute(reader, out);\n out.flush();\n }\n}\n\nclass ContestWriter extends PrintWriter {\n ContestWriter(PrintStream printeStream) {\n super(printeStream);\n }\n\n public void printList(List list) {\n for (Object object : list) {\n println(object);\n }\n }\n\n public void printListOneLine(List list) {\n List stringList = new ArrayList<>();\n for (Object object : list) {\n stringList.add(object.toString());\n }\n println(String.join(\" \", stringList));\n }\n}\n\nclass ContestReader {\n private static final int BUFFER_SIZE = 1024;\n \n private final InputStream stream;\n private final byte[] buffer;\n private int pointer;\n private int bufferLength;\n \n ContestReader(InputStream stream) {\n this.stream = stream;\n this.buffer = new byte[BUFFER_SIZE];\n this.pointer = 0;\n this.bufferLength = 0;\n }\n \n private boolean hasNextByte() {\n if (pointer < bufferLength) {\n return true;\n }\n \n pointer = 0;\n try {\n bufferLength = stream.read(buffer);\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n return bufferLength > 0;\n }\n \n private int readByte() {\n if (hasNextByte()) {\n return buffer[pointer++];\n } else {\n return -1;\n }\n }\n \n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n \n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[pointer])) {\n pointer++;\n }\n return hasNextByte();\n }\n \n public String next() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n StringBuilder sb = new StringBuilder();\n while(true) {\n int b = readByte();\n if (!isPrintableChar(b)) {\n break;\n }\n sb.appendCodePoint(b);\n }\n return sb.toString();\n }\n \n public String nextLine() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n StringBuilder sb = new StringBuilder();\n while(true) {\n int b = readByte();\n if (!isPrintableChar(b) && b != 0x20) {\n break;\n }\n sb.appendCodePoint(b);\n }\n return sb.toString();\n }\n \n public char nextChar() {\n return next().charAt(0);\n }\n \n public int nextInt() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n \n int n = 0;\n boolean minus = false;\n \n {\n int b = readByte();\n if (b == '-') {\n minus = true;\n } else if ('0' <= b && b <= '9') {\n n = b - '0';\n } else {\n throw new NumberFormatException();\n }\n }\n \n while(true){\n int b = readByte();\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n }\n }\n \n public long nextLong() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n \n long n = 0;\n boolean minus = false;\n \n {\n int b = readByte();\n if (b == '-') {\n minus = true;\n } else if ('0' <= b && b <= '9') {\n n = b - '0';\n } else {\n throw new NumberFormatException();\n }\n }\n \n while(true){\n int b = readByte();\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n }\n }\n \n public double nextDouble() {\n return Double.parseDouble(next());\n }\n \n public String[] next(int n) {\n String[] array = new String[n];\n for (int i = 0; i < n; i++) {\n array[i] = next();\n }\n return array;\n }\n \n public String[] nextLine(int n) {\n String[] array = new String[n];\n for (int i = 0; i < n; i++) {\n array[i] = nextLine();\n }\n return array;\n }\n \n public char[] nextChar(int n) {\n char[] array = new char[n];\n for (int i = 0; i < n; i++) {\n array[i] = nextChar();\n }\n return array;\n }\n \n public int[] nextInt(int n) {\n int[] array = new int[n];\n for (int i = 0; i < n; i++) {\n array[i] = nextInt();\n }\n return array;\n }\n \n public long[] nextLong(int n) {\n long[] array = new long[n];\n for (int i = 0; i < n; i++) {\n array[i] = nextLong();\n }\n return array;\n }\n \n public double[] nextDouble(int n) {\n double[] array = new double[n];\n for (int i = 0; i < n; i++) {\n array[i] = nextDouble();\n }\n return array;\n }\n \n public char[] nextCharArray() {\n return next().toCharArray();\n }\n \n public String[][] next(int n, int m) {\n String[][] matrix = new String[n][m];\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n matrix[i][j] = next();\n }\n }\n return matrix;\n }\n \n public int[][] nextInt(int n, int m) {\n int[][] matrix = new int[n][m];\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n matrix[i][j] = nextInt();\n }\n }\n return matrix;\n }\n \n public char[][] nextChar(int n, int m) {\n char[][] matrix = new char[n][m];\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n matrix[i][j] = nextChar();\n }\n }\n return matrix;\n }\n \n public long[][] nextLong(int n, int m) {\n long[][] matrix = new long[n][m];\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n matrix[i][j] = nextLong();\n }\n }\n return matrix;\n }\n \n public double[][] nextDouble(int n, int m) {\n double[][] matrix = new double[n][m];\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n matrix[i][j] = nextDouble();\n }\n }\n return matrix;\n }\n \n public char[][] nextCharArray(int n) {\n char[][] matrix = new char[n][];\n for (int i = 0; i < n; i++) {\n matrix[i] = next().toCharArray();\n }\n return matrix;\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "sample_input": "4 1\n5 4 2 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02718", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\n\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of votes.\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq M \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nA_i are distinct.\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_N\n\nOutput\n\nIf M popular items can be selected, print Yes; otherwise, print No.\n\nSample Input 1\n\n4 1\n5 4 2 1\n\nSample Output 1\n\nYes\n\nThere were 12 votes in total. The most popular item received 5 votes, and we can select it.\n\nSample Input 2\n\n3 2\n380 19 1\n\nSample Output 2\n\nNo\n\nThere were 400 votes in total. The second and third most popular items received less than \\dfrac{1}{4\\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.\n\nSample Input 3\n\n12 3\n4 56 78 901 2 345 67 890 123 45 6 789\n\nSample Output 3\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 6558, "cpu_time_ms": 72, "memory_kb": 22868}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s331873899", "group_id": "codeNet:p02718", "input_text": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\n\npublic class Main {\n\n\tstatic BufferedReader reader;\n\tfinal static boolean MODE_DEBUG = false;\n\t//static field here\n\t\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\treader = new BufferedReader(new InputStreamReader(System.in));\n\t\t//code here\n\t\tint[] NM = readLineInt();\n\t\tint N = NM[0];\n\t\tint M = NM[1];\n\t\tint[] a = readLineInt();\n\t\tint ALL = 0;\n\t\tfor(int i=0;i=ALL) {ans++;}\n\t\t}\n\t\t\n\t\tprint(ans>=M?\"Yes\":\"No\");\n\t}\n\t\n\t//functions here\n\t//note that all methods should be STATIC\n\n\n\tprivate static int arraySearch(T needle, T[] heystack) {\n\t\tfor(int i=0;i=ALL) {ans++;}\n\t\t}\n\t\t\n\t\tprint(ans>=M?\"Yes\":\"No\");\n\t}\n\t\n\t//functions here\n\t//note that all methods should be STATIC\n\n\n\tprivate static int arraySearch(T needle, T[] heystack) {\n\t\tfor(int i=0;i p = new ArrayList<>();\n List q = new ArrayList<>();\n List r = new ArrayList<>();\n for (int i = 0; i < a; i++) {\n p.add(Long.parseLong(in.next()));\n }\n for (int i = 0; i < b; i++) {\n q.add(Long.parseLong(in.next()));\n }\n for (int i = 0; i < c; i++) {\n r.add(Long.parseLong(in.next()));\n }\n p.sort(Comparator.reverseOrder());\n q.sort(Comparator.reverseOrder());\n\n PriorityQueue s = new PriorityQueue<>(a, (o1, o2) -> Long.compare(o2, o1));\n for (int i = 0; i < x; i++) {\n s.add(p.get(i));\n }\n for (int i = 0; i < y; i++) {\n s.add(q.get(i));\n }\n for (int i = 0; i < c; i++) {\n s.add(r.get(i));\n }\n long result = 0;\n for (int i = 1; i <= x + y; i++) {\n result += s.poll();\n }\n\n out.println(result);\n\n }\n\n }\n}\n\n", "language": "Java", "metadata": {"date": 1600112683, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02727.html", "problem_id": "p02727", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02727/input.txt", "sample_output_relpath": "derived/input_output/data/p02727/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02727/Java/s936708184.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s936708184", "user_id": "u745688558"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.List;\nimport java.util.PriorityQueue;\nimport java.util.Scanner;\nimport java.util.Comparator;\nimport java.util.ArrayList;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n RedGreenApples solver = new RedGreenApples();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class RedGreenApples {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n\n int x = in.nextInt();\n int y = in.nextInt();\n int a = in.nextInt();\n int b = in.nextInt();\n int c = in.nextInt();\n List p = new ArrayList<>();\n List q = new ArrayList<>();\n List r = new ArrayList<>();\n for (int i = 0; i < a; i++) {\n p.add(Long.parseLong(in.next()));\n }\n for (int i = 0; i < b; i++) {\n q.add(Long.parseLong(in.next()));\n }\n for (int i = 0; i < c; i++) {\n r.add(Long.parseLong(in.next()));\n }\n p.sort(Comparator.reverseOrder());\n q.sort(Comparator.reverseOrder());\n\n PriorityQueue s = new PriorityQueue<>(a, (o1, o2) -> Long.compare(o2, o1));\n for (int i = 0; i < x; i++) {\n s.add(p.get(i));\n }\n for (int i = 0; i < y; i++) {\n s.add(q.get(i));\n }\n for (int i = 0; i < c; i++) {\n s.add(r.get(i));\n }\n long result = 0;\n for (int i = 1; i <= x + y; i++) {\n result += s.poll();\n }\n\n out.println(result);\n\n }\n\n }\n}\n\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nYou are going to eat X red apples and Y green apples.\n\nYou have A red apples of deliciousness p_1,p_2, \\dots, p_A, B green apples of deliciousness q_1,q_2, \\dots, q_B, and C colorless apples of deliciousness r_1,r_2, \\dots, r_C.\n\nBefore eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively.\n\nFrom the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible.\n\nFind the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.\n\nConstraints\n\n1 \\leq X \\leq A \\leq 10^5\n\n1 \\leq Y \\leq B \\leq 10^5\n\n1 \\leq C \\leq 10^5\n\n1 \\leq p_i \\leq 10^9\n\n1 \\leq q_i \\leq 10^9\n\n1 \\leq r_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\nX Y A B C\np_1 p_2 ... p_A\nq_1 q_2 ... q_B\nr_1 r_2 ... r_C\n\nOutput\n\nPrint the maximum possible sum of the deliciousness of the eaten apples.\n\nSample Input 1\n\n1 2 2 2 1\n2 4\n5 1\n3\n\nSample Output 1\n\n12\n\nThe maximum possible sum of the deliciousness of the eaten apples can be achieved as follows:\n\nEat the 2-nd red apple.\n\nEat the 1-st green apple.\n\nPaint the 1-st colorless apple green and eat it.\n\nSample Input 2\n\n2 2 2 2 2\n8 6\n9 1\n2 1\n\nSample Output 2\n\n25\n\nSample Input 3\n\n2 2 4 4 4\n11 12 13 14\n21 22 23 24\n1 2 3 4\n\nSample Output 3\n\n74", "sample_input": "1 2 2 2 1\n2 4\n5 1\n3\n"}, "reference_outputs": ["12\n"], "source_document_id": "p02727", "source_text": "Score : 500 points\n\nProblem Statement\n\nYou are going to eat X red apples and Y green apples.\n\nYou have A red apples of deliciousness p_1,p_2, \\dots, p_A, B green apples of deliciousness q_1,q_2, \\dots, q_B, and C colorless apples of deliciousness r_1,r_2, \\dots, r_C.\n\nBefore eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively.\n\nFrom the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible.\n\nFind the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.\n\nConstraints\n\n1 \\leq X \\leq A \\leq 10^5\n\n1 \\leq Y \\leq B \\leq 10^5\n\n1 \\leq C \\leq 10^5\n\n1 \\leq p_i \\leq 10^9\n\n1 \\leq q_i \\leq 10^9\n\n1 \\leq r_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\nX Y A B C\np_1 p_2 ... p_A\nq_1 q_2 ... q_B\nr_1 r_2 ... r_C\n\nOutput\n\nPrint the maximum possible sum of the deliciousness of the eaten apples.\n\nSample Input 1\n\n1 2 2 2 1\n2 4\n5 1\n3\n\nSample Output 1\n\n12\n\nThe maximum possible sum of the deliciousness of the eaten apples can be achieved as follows:\n\nEat the 2-nd red apple.\n\nEat the 1-st green apple.\n\nPaint the 1-st colorless apple green and eat it.\n\nSample Input 2\n\n2 2 2 2 2\n8 6\n9 1\n2 1\n\nSample Output 2\n\n25\n\nSample Input 3\n\n2 2 4 4 4\n11 12 13 14\n21 22 23 24\n1 2 3 4\n\nSample Output 3\n\n74", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2073, "cpu_time_ms": 841, "memory_kb": 68920}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s122500791", "group_id": "codeNet:p02727", "input_text": "\nimport java.util.Arrays;\nimport java.util.PriorityQueue;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint x = Integer.parseInt(sc.next());\n\t\tint y = Integer.parseInt(sc.next());\n\t\t\n\t\tint a = Integer.parseInt(sc.next());\n\t\tint b = Integer.parseInt(sc.next());\n\t\tint c = Integer.parseInt(sc.next());\n\t\t\n\t\tint red[] = new int [a];\n\t\tint green[] = new int [b];\n\t\tint non[] = new int [c];\n\t\t\n\t\tfor(int i = 0 ; i < a ;i++) {\n\t\t\tred[i] = Integer.parseInt(sc.next());\n\t\t}\n\t\tfor(int i = 0 ; i < b ; i++) {\n\t\t\tgreen[i] = Integer.parseInt(sc.next());\n\t\t}\n\t\tfor(int i = 0 ; i < c ; i++) {\n\t\t\tnon[i] = Integer.parseInt(sc.next());\n\t\t}\n \t\t\n\t\tPriorityQueue pq = new PriorityQueue();\n\t\n\t\tArrays.sort(red);\n\t\tArrays.sort(green);\n\t\t\n\t\tfor(int i = a-1 ; i >= Math.max(0, a-x) ; i--) {\n\t\t\tpq.add(red[i]);\n\t\t}\n\n\t\tfor(int i = b-1 ; i >= Math.max(0, b-y) ; i--) {\n\t\t\tpq.add(green[i]);\n\t\t}\n\t\t\n\t\tfor(int i = 0 ; i < c ;i++) {\n\t\t\tpq.add(non[i]);\n\t\t}\n\t\t\n\t\twhile(pq.size() > x + y) {\n\t\t\tpq.poll();\n\t\t}\n\t\t\n\t\tlong sum = 0;\n\t\t\n\t\tfor(int i = 0 ; i < x+ y ; i++) {\n\t\t\tsum += (long)pq.poll();\n\t\t}\n\t\t\n\t\tSystem.out.println(sum);\n\t\t\n\t\n\t}\n\t\n\n}\n", "language": "Java", "metadata": {"date": 1586450949, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02727.html", "problem_id": "p02727", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02727/input.txt", "sample_output_relpath": "derived/input_output/data/p02727/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02727/Java/s122500791.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s122500791", "user_id": "u920212194"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "\nimport java.util.Arrays;\nimport java.util.PriorityQueue;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint x = Integer.parseInt(sc.next());\n\t\tint y = Integer.parseInt(sc.next());\n\t\t\n\t\tint a = Integer.parseInt(sc.next());\n\t\tint b = Integer.parseInt(sc.next());\n\t\tint c = Integer.parseInt(sc.next());\n\t\t\n\t\tint red[] = new int [a];\n\t\tint green[] = new int [b];\n\t\tint non[] = new int [c];\n\t\t\n\t\tfor(int i = 0 ; i < a ;i++) {\n\t\t\tred[i] = Integer.parseInt(sc.next());\n\t\t}\n\t\tfor(int i = 0 ; i < b ; i++) {\n\t\t\tgreen[i] = Integer.parseInt(sc.next());\n\t\t}\n\t\tfor(int i = 0 ; i < c ; i++) {\n\t\t\tnon[i] = Integer.parseInt(sc.next());\n\t\t}\n \t\t\n\t\tPriorityQueue pq = new PriorityQueue();\n\t\n\t\tArrays.sort(red);\n\t\tArrays.sort(green);\n\t\t\n\t\tfor(int i = a-1 ; i >= Math.max(0, a-x) ; i--) {\n\t\t\tpq.add(red[i]);\n\t\t}\n\n\t\tfor(int i = b-1 ; i >= Math.max(0, b-y) ; i--) {\n\t\t\tpq.add(green[i]);\n\t\t}\n\t\t\n\t\tfor(int i = 0 ; i < c ;i++) {\n\t\t\tpq.add(non[i]);\n\t\t}\n\t\t\n\t\twhile(pq.size() > x + y) {\n\t\t\tpq.poll();\n\t\t}\n\t\t\n\t\tlong sum = 0;\n\t\t\n\t\tfor(int i = 0 ; i < x+ y ; i++) {\n\t\t\tsum += (long)pq.poll();\n\t\t}\n\t\t\n\t\tSystem.out.println(sum);\n\t\t\n\t\n\t}\n\t\n\n}\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nYou are going to eat X red apples and Y green apples.\n\nYou have A red apples of deliciousness p_1,p_2, \\dots, p_A, B green apples of deliciousness q_1,q_2, \\dots, q_B, and C colorless apples of deliciousness r_1,r_2, \\dots, r_C.\n\nBefore eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively.\n\nFrom the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible.\n\nFind the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.\n\nConstraints\n\n1 \\leq X \\leq A \\leq 10^5\n\n1 \\leq Y \\leq B \\leq 10^5\n\n1 \\leq C \\leq 10^5\n\n1 \\leq p_i \\leq 10^9\n\n1 \\leq q_i \\leq 10^9\n\n1 \\leq r_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\nX Y A B C\np_1 p_2 ... p_A\nq_1 q_2 ... q_B\nr_1 r_2 ... r_C\n\nOutput\n\nPrint the maximum possible sum of the deliciousness of the eaten apples.\n\nSample Input 1\n\n1 2 2 2 1\n2 4\n5 1\n3\n\nSample Output 1\n\n12\n\nThe maximum possible sum of the deliciousness of the eaten apples can be achieved as follows:\n\nEat the 2-nd red apple.\n\nEat the 1-st green apple.\n\nPaint the 1-st colorless apple green and eat it.\n\nSample Input 2\n\n2 2 2 2 2\n8 6\n9 1\n2 1\n\nSample Output 2\n\n25\n\nSample Input 3\n\n2 2 4 4 4\n11 12 13 14\n21 22 23 24\n1 2 3 4\n\nSample Output 3\n\n74", "sample_input": "1 2 2 2 1\n2 4\n5 1\n3\n"}, "reference_outputs": ["12\n"], "source_document_id": "p02727", "source_text": "Score : 500 points\n\nProblem Statement\n\nYou are going to eat X red apples and Y green apples.\n\nYou have A red apples of deliciousness p_1,p_2, \\dots, p_A, B green apples of deliciousness q_1,q_2, \\dots, q_B, and C colorless apples of deliciousness r_1,r_2, \\dots, r_C.\n\nBefore eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively.\n\nFrom the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible.\n\nFind the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.\n\nConstraints\n\n1 \\leq X \\leq A \\leq 10^5\n\n1 \\leq Y \\leq B \\leq 10^5\n\n1 \\leq C \\leq 10^5\n\n1 \\leq p_i \\leq 10^9\n\n1 \\leq q_i \\leq 10^9\n\n1 \\leq r_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\nX Y A B C\np_1 p_2 ... p_A\nq_1 q_2 ... q_B\nr_1 r_2 ... r_C\n\nOutput\n\nPrint the maximum possible sum of the deliciousness of the eaten apples.\n\nSample Input 1\n\n1 2 2 2 1\n2 4\n5 1\n3\n\nSample Output 1\n\n12\n\nThe maximum possible sum of the deliciousness of the eaten apples can be achieved as follows:\n\nEat the 2-nd red apple.\n\nEat the 1-st green apple.\n\nPaint the 1-st colorless apple green and eat it.\n\nSample Input 2\n\n2 2 2 2 2\n8 6\n9 1\n2 1\n\nSample Output 2\n\n25\n\nSample Input 3\n\n2 2 4 4 4\n11 12 13 14\n21 22 23 24\n1 2 3 4\n\nSample Output 3\n\n74", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1214, "cpu_time_ms": 825, "memory_kb": 63464}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s926481016", "group_id": "codeNet:p02727", "input_text": "\nimport java.io.InputStream;\nimport java.io.PrintStream;\nimport java.lang.reflect.Array;\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.PriorityQueue;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n solve(System.in, System.out);\n }\n\n static void solve(InputStream is, PrintStream os) {\n // Your code here!\n Scanner scan = new Scanner(is);\n int X = scan.nextInt();\n int Y = scan.nextInt();\n int A = scan.nextInt();\n int B = scan.nextInt();\n int C = scan.nextInt();\n ArrayList aValueList = new ArrayList();\n ArrayList bValueList = new ArrayList();\n ArrayList cValueList = new ArrayList();\n for(int i = 0 ; i < A; i++) {\n aValueList.add(scan.nextInt());\n }\n for(int i = 0 ; i < B; i++) {\n bValueList.add(scan.nextInt());\n }\n for(int i = 0 ; i < C; i++) {\n cValueList.add(scan.nextInt());\n }\n\n Collections.sort(aValueList, Collections.reverseOrder());\n Collections.sort(bValueList, Collections.reverseOrder());\n Collections.sort(cValueList, Collections.reverseOrder());\n\n PriorityQueue pq = new PriorityQueue<>(Collections.reverseOrder());\n for(int i = 0 ; i < X; i++) {\n pq.offer(aValueList.get(i));\n }\n for(int i = 0 ; i < Y; i++) {\n pq.offer(bValueList.get(i));\n }\n pq.addAll(cValueList);\n\n long ans = 0;\n for(int i = 0; i < X+Y; i++) {\n ans += pq.poll();\n }\n\n os.println(ans);\n\n }\n}", "language": "Java", "metadata": {"date": 1585711850, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02727.html", "problem_id": "p02727", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02727/input.txt", "sample_output_relpath": "derived/input_output/data/p02727/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02727/Java/s926481016.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s926481016", "user_id": "u921681484"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "\nimport java.io.InputStream;\nimport java.io.PrintStream;\nimport java.lang.reflect.Array;\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.PriorityQueue;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n solve(System.in, System.out);\n }\n\n static void solve(InputStream is, PrintStream os) {\n // Your code here!\n Scanner scan = new Scanner(is);\n int X = scan.nextInt();\n int Y = scan.nextInt();\n int A = scan.nextInt();\n int B = scan.nextInt();\n int C = scan.nextInt();\n ArrayList aValueList = new ArrayList();\n ArrayList bValueList = new ArrayList();\n ArrayList cValueList = new ArrayList();\n for(int i = 0 ; i < A; i++) {\n aValueList.add(scan.nextInt());\n }\n for(int i = 0 ; i < B; i++) {\n bValueList.add(scan.nextInt());\n }\n for(int i = 0 ; i < C; i++) {\n cValueList.add(scan.nextInt());\n }\n\n Collections.sort(aValueList, Collections.reverseOrder());\n Collections.sort(bValueList, Collections.reverseOrder());\n Collections.sort(cValueList, Collections.reverseOrder());\n\n PriorityQueue pq = new PriorityQueue<>(Collections.reverseOrder());\n for(int i = 0 ; i < X; i++) {\n pq.offer(aValueList.get(i));\n }\n for(int i = 0 ; i < Y; i++) {\n pq.offer(bValueList.get(i));\n }\n pq.addAll(cValueList);\n\n long ans = 0;\n for(int i = 0; i < X+Y; i++) {\n ans += pq.poll();\n }\n\n os.println(ans);\n\n }\n}", "problem_context": "Score : 500 points\n\nProblem Statement\n\nYou are going to eat X red apples and Y green apples.\n\nYou have A red apples of deliciousness p_1,p_2, \\dots, p_A, B green apples of deliciousness q_1,q_2, \\dots, q_B, and C colorless apples of deliciousness r_1,r_2, \\dots, r_C.\n\nBefore eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively.\n\nFrom the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible.\n\nFind the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.\n\nConstraints\n\n1 \\leq X \\leq A \\leq 10^5\n\n1 \\leq Y \\leq B \\leq 10^5\n\n1 \\leq C \\leq 10^5\n\n1 \\leq p_i \\leq 10^9\n\n1 \\leq q_i \\leq 10^9\n\n1 \\leq r_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\nX Y A B C\np_1 p_2 ... p_A\nq_1 q_2 ... q_B\nr_1 r_2 ... r_C\n\nOutput\n\nPrint the maximum possible sum of the deliciousness of the eaten apples.\n\nSample Input 1\n\n1 2 2 2 1\n2 4\n5 1\n3\n\nSample Output 1\n\n12\n\nThe maximum possible sum of the deliciousness of the eaten apples can be achieved as follows:\n\nEat the 2-nd red apple.\n\nEat the 1-st green apple.\n\nPaint the 1-st colorless apple green and eat it.\n\nSample Input 2\n\n2 2 2 2 2\n8 6\n9 1\n2 1\n\nSample Output 2\n\n25\n\nSample Input 3\n\n2 2 4 4 4\n11 12 13 14\n21 22 23 24\n1 2 3 4\n\nSample Output 3\n\n74", "sample_input": "1 2 2 2 1\n2 4\n5 1\n3\n"}, "reference_outputs": ["12\n"], "source_document_id": "p02727", "source_text": "Score : 500 points\n\nProblem Statement\n\nYou are going to eat X red apples and Y green apples.\n\nYou have A red apples of deliciousness p_1,p_2, \\dots, p_A, B green apples of deliciousness q_1,q_2, \\dots, q_B, and C colorless apples of deliciousness r_1,r_2, \\dots, r_C.\n\nBefore eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively.\n\nFrom the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible.\n\nFind the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.\n\nConstraints\n\n1 \\leq X \\leq A \\leq 10^5\n\n1 \\leq Y \\leq B \\leq 10^5\n\n1 \\leq C \\leq 10^5\n\n1 \\leq p_i \\leq 10^9\n\n1 \\leq q_i \\leq 10^9\n\n1 \\leq r_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\nX Y A B C\np_1 p_2 ... p_A\nq_1 q_2 ... q_B\nr_1 r_2 ... r_C\n\nOutput\n\nPrint the maximum possible sum of the deliciousness of the eaten apples.\n\nSample Input 1\n\n1 2 2 2 1\n2 4\n5 1\n3\n\nSample Output 1\n\n12\n\nThe maximum possible sum of the deliciousness of the eaten apples can be achieved as follows:\n\nEat the 2-nd red apple.\n\nEat the 1-st green apple.\n\nPaint the 1-st colorless apple green and eat it.\n\nSample Input 2\n\n2 2 2 2 2\n8 6\n9 1\n2 1\n\nSample Output 2\n\n25\n\nSample Input 3\n\n2 2 4 4 4\n11 12 13 14\n21 22 23 24\n1 2 3 4\n\nSample Output 3\n\n74", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1751, "cpu_time_ms": 1020, "memory_kb": 100556}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s933126907", "group_id": "codeNet:p02727", "input_text": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.stream.LongStream;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\nimport java.io.BufferedReader;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n MyScanner in = new MyScanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n E solver = new E();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class E {\n public void solve(int testNumber, MyScanner in, PrintWriter out) {\n int X = in.nextInt();\n int Y = in.nextInt();\n int A = in.nextInt();\n int B = in.nextInt();\n int C = in.nextInt();\n long[] p = in.nextLongArray(A);\n long[] q = in.nextLongArray(B);\n long[] r = in.nextLongArray(C);\n Arrays.sort(p);\n Arrays.sort(q);\n Arrays.sort(r);\n long[] ps = Arrays.copyOfRange(p, A - X, A);\n long[] qs = Arrays.copyOfRange(q, B - Y, B);\n long[] ls = new long[X + Y];\n System.arraycopy(ps, 0, ls, 0, X);\n System.arraycopy(qs, 0, ls, X, Y);\n Arrays.sort(ls);\n long sum = LongStream.of(ls).sum();\n for (int i = 0; i < X + Y && i < C; i++) {\n long v = ls[i];\n if (v < r[C - 1 - i]) {\n sum += r[C - 1 - i] - v;\n }\n }\n out.println(sum);\n }\n\n }\n\n static class MyScanner {\n private BufferedReader in;\n private StringTokenizer st;\n\n public MyScanner(InputStream stream) {\n in = new BufferedReader(new InputStreamReader(stream));\n }\n\n public String next() {\n while (st == null || !st.hasMoreTokens()) {\n try {\n String rl = in.readLine();\n if (rl == null) {\n return null;\n }\n st = new StringTokenizer(rl);\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return st.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public long[] nextLongArray(int n) {\n long[] a = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = nextLong();\n }\n return a;\n }\n\n }\n}\n\n", "language": "Java", "metadata": {"date": 1585455251, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02727.html", "problem_id": "p02727", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02727/input.txt", "sample_output_relpath": "derived/input_output/data/p02727/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02727/Java/s933126907.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s933126907", "user_id": "u305384049"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.stream.LongStream;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\nimport java.io.BufferedReader;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n MyScanner in = new MyScanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n E solver = new E();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class E {\n public void solve(int testNumber, MyScanner in, PrintWriter out) {\n int X = in.nextInt();\n int Y = in.nextInt();\n int A = in.nextInt();\n int B = in.nextInt();\n int C = in.nextInt();\n long[] p = in.nextLongArray(A);\n long[] q = in.nextLongArray(B);\n long[] r = in.nextLongArray(C);\n Arrays.sort(p);\n Arrays.sort(q);\n Arrays.sort(r);\n long[] ps = Arrays.copyOfRange(p, A - X, A);\n long[] qs = Arrays.copyOfRange(q, B - Y, B);\n long[] ls = new long[X + Y];\n System.arraycopy(ps, 0, ls, 0, X);\n System.arraycopy(qs, 0, ls, X, Y);\n Arrays.sort(ls);\n long sum = LongStream.of(ls).sum();\n for (int i = 0; i < X + Y && i < C; i++) {\n long v = ls[i];\n if (v < r[C - 1 - i]) {\n sum += r[C - 1 - i] - v;\n }\n }\n out.println(sum);\n }\n\n }\n\n static class MyScanner {\n private BufferedReader in;\n private StringTokenizer st;\n\n public MyScanner(InputStream stream) {\n in = new BufferedReader(new InputStreamReader(stream));\n }\n\n public String next() {\n while (st == null || !st.hasMoreTokens()) {\n try {\n String rl = in.readLine();\n if (rl == null) {\n return null;\n }\n st = new StringTokenizer(rl);\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return st.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public long[] nextLongArray(int n) {\n long[] a = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = nextLong();\n }\n return a;\n }\n\n }\n}\n\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nYou are going to eat X red apples and Y green apples.\n\nYou have A red apples of deliciousness p_1,p_2, \\dots, p_A, B green apples of deliciousness q_1,q_2, \\dots, q_B, and C colorless apples of deliciousness r_1,r_2, \\dots, r_C.\n\nBefore eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively.\n\nFrom the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible.\n\nFind the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.\n\nConstraints\n\n1 \\leq X \\leq A \\leq 10^5\n\n1 \\leq Y \\leq B \\leq 10^5\n\n1 \\leq C \\leq 10^5\n\n1 \\leq p_i \\leq 10^9\n\n1 \\leq q_i \\leq 10^9\n\n1 \\leq r_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\nX Y A B C\np_1 p_2 ... p_A\nq_1 q_2 ... q_B\nr_1 r_2 ... r_C\n\nOutput\n\nPrint the maximum possible sum of the deliciousness of the eaten apples.\n\nSample Input 1\n\n1 2 2 2 1\n2 4\n5 1\n3\n\nSample Output 1\n\n12\n\nThe maximum possible sum of the deliciousness of the eaten apples can be achieved as follows:\n\nEat the 2-nd red apple.\n\nEat the 1-st green apple.\n\nPaint the 1-st colorless apple green and eat it.\n\nSample Input 2\n\n2 2 2 2 2\n8 6\n9 1\n2 1\n\nSample Output 2\n\n25\n\nSample Input 3\n\n2 2 4 4 4\n11 12 13 14\n21 22 23 24\n1 2 3 4\n\nSample Output 3\n\n74", "sample_input": "1 2 2 2 1\n2 4\n5 1\n3\n"}, "reference_outputs": ["12\n"], "source_document_id": "p02727", "source_text": "Score : 500 points\n\nProblem Statement\n\nYou are going to eat X red apples and Y green apples.\n\nYou have A red apples of deliciousness p_1,p_2, \\dots, p_A, B green apples of deliciousness q_1,q_2, \\dots, q_B, and C colorless apples of deliciousness r_1,r_2, \\dots, r_C.\n\nBefore eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively.\n\nFrom the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible.\n\nFind the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.\n\nConstraints\n\n1 \\leq X \\leq A \\leq 10^5\n\n1 \\leq Y \\leq B \\leq 10^5\n\n1 \\leq C \\leq 10^5\n\n1 \\leq p_i \\leq 10^9\n\n1 \\leq q_i \\leq 10^9\n\n1 \\leq r_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\nX Y A B C\np_1 p_2 ... p_A\nq_1 q_2 ... q_B\nr_1 r_2 ... r_C\n\nOutput\n\nPrint the maximum possible sum of the deliciousness of the eaten apples.\n\nSample Input 1\n\n1 2 2 2 1\n2 4\n5 1\n3\n\nSample Output 1\n\n12\n\nThe maximum possible sum of the deliciousness of the eaten apples can be achieved as follows:\n\nEat the 2-nd red apple.\n\nEat the 1-st green apple.\n\nPaint the 1-st colorless apple green and eat it.\n\nSample Input 2\n\n2 2 2 2 2\n8 6\n9 1\n2 1\n\nSample Output 2\n\n25\n\nSample Input 3\n\n2 2 4 4 4\n11 12 13 14\n21 22 23 24\n1 2 3 4\n\nSample Output 3\n\n74", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2907, "cpu_time_ms": 495, "memory_kb": 55268}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s877205226", "group_id": "codeNet:p02727", "input_text": "import java.io.*;\nimport java.util.*;\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tScanner inputs = new Scanner(System.in);\n\t\tint x = inputs.nextInt();\n\t\tint y = inputs.nextInt();\n\t\tint red = inputs.nextInt();\n\t\tint[] r = new int[red];\n\t\tint green = inputs.nextInt();\n\t\tint[] g = new int[green];\n\t\tint clear = inputs.nextInt();\n\t\tint[] c = new int[clear];\n\t\tfor(int i=0;i app = new PriorityQueue();\n\t\tint sum =0;\n\t\tfor(int i=red-x;inum) {\n\t\t\t\tsum-=num;\n\t\t\t\tapp.remove();\n\t\t\t\tapp.add(c[track]);\n\t\t\t\tsum+=c[track];\n\t\t\t}\n\t\t\ttrack++;\n\t\t}\n\t\tSystem.out.println(sum);\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1585448101, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02727.html", "problem_id": "p02727", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02727/input.txt", "sample_output_relpath": "derived/input_output/data/p02727/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02727/Java/s877205226.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s877205226", "user_id": "u700675429"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "import java.io.*;\nimport java.util.*;\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tScanner inputs = new Scanner(System.in);\n\t\tint x = inputs.nextInt();\n\t\tint y = inputs.nextInt();\n\t\tint red = inputs.nextInt();\n\t\tint[] r = new int[red];\n\t\tint green = inputs.nextInt();\n\t\tint[] g = new int[green];\n\t\tint clear = inputs.nextInt();\n\t\tint[] c = new int[clear];\n\t\tfor(int i=0;i app = new PriorityQueue();\n\t\tint sum =0;\n\t\tfor(int i=red-x;inum) {\n\t\t\t\tsum-=num;\n\t\t\t\tapp.remove();\n\t\t\t\tapp.add(c[track]);\n\t\t\t\tsum+=c[track];\n\t\t\t}\n\t\t\ttrack++;\n\t\t}\n\t\tSystem.out.println(sum);\n\t}\n\n}\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nYou are going to eat X red apples and Y green apples.\n\nYou have A red apples of deliciousness p_1,p_2, \\dots, p_A, B green apples of deliciousness q_1,q_2, \\dots, q_B, and C colorless apples of deliciousness r_1,r_2, \\dots, r_C.\n\nBefore eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively.\n\nFrom the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible.\n\nFind the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.\n\nConstraints\n\n1 \\leq X \\leq A \\leq 10^5\n\n1 \\leq Y \\leq B \\leq 10^5\n\n1 \\leq C \\leq 10^5\n\n1 \\leq p_i \\leq 10^9\n\n1 \\leq q_i \\leq 10^9\n\n1 \\leq r_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\nX Y A B C\np_1 p_2 ... p_A\nq_1 q_2 ... q_B\nr_1 r_2 ... r_C\n\nOutput\n\nPrint the maximum possible sum of the deliciousness of the eaten apples.\n\nSample Input 1\n\n1 2 2 2 1\n2 4\n5 1\n3\n\nSample Output 1\n\n12\n\nThe maximum possible sum of the deliciousness of the eaten apples can be achieved as follows:\n\nEat the 2-nd red apple.\n\nEat the 1-st green apple.\n\nPaint the 1-st colorless apple green and eat it.\n\nSample Input 2\n\n2 2 2 2 2\n8 6\n9 1\n2 1\n\nSample Output 2\n\n25\n\nSample Input 3\n\n2 2 4 4 4\n11 12 13 14\n21 22 23 24\n1 2 3 4\n\nSample Output 3\n\n74", "sample_input": "1 2 2 2 1\n2 4\n5 1\n3\n"}, "reference_outputs": ["12\n"], "source_document_id": "p02727", "source_text": "Score : 500 points\n\nProblem Statement\n\nYou are going to eat X red apples and Y green apples.\n\nYou have A red apples of deliciousness p_1,p_2, \\dots, p_A, B green apples of deliciousness q_1,q_2, \\dots, q_B, and C colorless apples of deliciousness r_1,r_2, \\dots, r_C.\n\nBefore eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively.\n\nFrom the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible.\n\nFind the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.\n\nConstraints\n\n1 \\leq X \\leq A \\leq 10^5\n\n1 \\leq Y \\leq B \\leq 10^5\n\n1 \\leq C \\leq 10^5\n\n1 \\leq p_i \\leq 10^9\n\n1 \\leq q_i \\leq 10^9\n\n1 \\leq r_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\nX Y A B C\np_1 p_2 ... p_A\nq_1 q_2 ... q_B\nr_1 r_2 ... r_C\n\nOutput\n\nPrint the maximum possible sum of the deliciousness of the eaten apples.\n\nSample Input 1\n\n1 2 2 2 1\n2 4\n5 1\n3\n\nSample Output 1\n\n12\n\nThe maximum possible sum of the deliciousness of the eaten apples can be achieved as follows:\n\nEat the 2-nd red apple.\n\nEat the 1-st green apple.\n\nPaint the 1-st colorless apple green and eat it.\n\nSample Input 2\n\n2 2 2 2 2\n8 6\n9 1\n2 1\n\nSample Output 2\n\n25\n\nSample Input 3\n\n2 2 4 4 4\n11 12 13 14\n21 22 23 24\n1 2 3 4\n\nSample Output 3\n\n74", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1076, "cpu_time_ms": 859, "memory_kb": 92612}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s697371848", "group_id": "codeNet:p02727", "input_text": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.InputMismatchException;\nimport java.util.Iterator;\nimport java.util.NoSuchElementException;\n\npublic class Main {\n static void solve(MyScanner in, MyWriter out) {\n int x = in.nextInt();\n int y = in.nextInt();\n int a = in.nextInt();\n int b = in.nextInt();\n int c = in.nextInt();\n long[] p = in.nextLongArray(a);\n long[] q = in.nextLongArray(b);\n long[] r = in.nextLongArray(c);\n\n Arrays.sort(p);\n Arrays.sort(q);\n reverse(p);\n reverse(q);\n long[] s = new long[x + y];\n long answer = 0;\n for (int i = 0; i < x; i++) {\n s[i] = p[i];\n answer += p[i];\n }\n for (int i = x, j = 0; j < y; i++, j++) {\n s[i] = q[j];\n answer += q[j];\n }\n Arrays.sort(s);\n Arrays.sort(r);\n for (int i = c - 1, j = 0; i >= 0; i--, j++) {\n if (r[i] <= s[j]) {\n break;\n }\n answer -= s[j];\n answer += r[i];\n }\n out.println(answer);\n }\n private static void reverse(long[] a) {\n reverse(a, 0, a.length);\n }\n private static void reverse(long[] a, int fromIndex, int toIndex) {\n if (fromIndex < 0 || toIndex > a.length || fromIndex > toIndex) {\n throw new IndexOutOfBoundsException();\n }\n for (int i = fromIndex, j = toIndex - 1; i < j; i++, j--) {\n long tmp = a[i];\n a[i] = a[j];\n a[j] = tmp;\n }\n }\n public static void main(String[] args) {\n MyWriter w = new MyWriter(System.out);\n solve(new MyScanner(System.in), w);\n w.flush();\n }\n static final class MyScanner {\n static final int BUFFER_SIZE = 8192;\n private final InputStream in;\n private final byte[] buffer = new byte[BUFFER_SIZE];\n private int point;\n private int readLength;\n\n MyScanner(InputStream in) {\n this.in = in;\n }\n private byte readByte() {\n if (point < readLength) {\n byte result = buffer[point];\n point += 1;\n return result;\n }\n try {\n readLength = in.read(buffer);\n } catch (IOException e) {\n throw new AssertionError(null, e);\n }\n if (readLength == -1) {\n return -1;\n }\n point = 1;\n return buffer[0];\n }\n private static boolean isPrintableCharExceptSpace(byte c) {\n return 33 <= c && c <= 126;\n }\n public char nextChar() {\n byte c = readByte();\n while (!(c == -1 || isPrintableCharExceptSpace(c))) {\n c = readByte();\n }\n if (c == -1) {\n throw new NoSuchElementException();\n }\n return (char)c;\n }\n public String next() {\n return next(16);\n }\n public String next(int n) {\n byte c = readByte();\n while (!(c == -1 || isPrintableCharExceptSpace(c))) {\n c = readByte();\n }\n if (c == -1) {\n throw new NoSuchElementException();\n }\n StringBuilder b = new StringBuilder(n);\n do {\n b.append((char)c);\n c = readByte();\n } while (c != -1 && isPrintableCharExceptSpace(c));\n return b.toString();\n }\n public long nextLong() {\n byte c = readByte();\n while (!(c == -1 || isPrintableCharExceptSpace(c))) {\n c = readByte();\n }\n if (c == -1) {\n throw new NoSuchElementException();\n }\n boolean minus = false;\n if (c == '-') {\n minus = true;\n c = readByte();\n }\n long result = 0L;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n result = result * 10L + (c - '0');\n c = readByte();\n } while (c != -1 && isPrintableCharExceptSpace(c));\n return minus ? -result : result;\n }\n public int nextInt() {\n long n = nextLong();\n if (n < Integer.MIN_VALUE || n > Integer.MAX_VALUE) {\n throw new InputMismatchException();\n }\n return (int)n;\n }\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n public int[] nextIntArray(int n) {\n int[] result = new int[n];\n for (int i = 0; i < n; i++) {\n result[i] = nextInt();\n }\n return result;\n }\n public long[] nextLongArray(int n) {\n long[] result = new long[n];\n for (int i = 0; i < n; i++) {\n result[i] = nextLong();\n }\n return result;\n }\n public char[] nextCharArray(int n) {\n char[] result = new char[n];\n for (int i = 0; i < n; i++) {\n result[i] = nextChar();\n }\n return result;\n }\n public char[][] next2dCharArray(int n, int m) {\n char[][] result = new char[n][m];\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n result[i][j] = nextChar();\n }\n }\n return result;\n }\n public int[][] nextVerticalIntArrays(int arrayCount, int arrayLength) {\n int[][] result = new int[arrayCount][arrayLength];\n for (int i = 0; i < arrayLength; i++) {\n for (int j = 0; j < arrayCount; j++) {\n result[j][i] = nextInt();\n }\n }\n return result;\n }\n public long[][] nextVerticalLongArrays(int arrayCount,\n int arrayLength) {\n long[][] result = new long[arrayCount][arrayLength];\n for (int i = 0; i < arrayLength; i++) {\n for (int j = 0; j < arrayCount; j++) {\n result[j][i] = nextLong();\n }\n }\n return result;\n }\n public char[][] nextVerticalCharArrays(int arrayCount,\n int arrayLength) {\n char[][] result = new char[arrayCount][arrayLength];\n for (int i = 0; i < arrayLength; i++) {\n for (int j = 0; j < arrayCount; j++) {\n result[j][i] = nextChar();\n }\n }\n return result;\n }\n }\n static final class MyWriter extends PrintWriter {\n MyWriter(OutputStream out) {\n super(out);\n }\n public void joinAndPrintln(int[] x) {\n joinAndPrintln(x, \" \");\n }\n public void joinAndPrintln(int[] x, String delimiter) {\n StringBuilder b = new StringBuilder();\n if (x.length > 0) {\n b.append(x[0]);\n for (int i = 1; i < x.length; i++) {\n b.append(delimiter).append(x[i]);\n }\n }\n println(b.toString());\n }\n public void joinAndPrintln(long[] x) {\n joinAndPrintln(x, \" \");\n }\n public void joinAndPrintln(long[] x, String delimiter) {\n StringBuilder b = new StringBuilder();\n if (x.length > 0) {\n b.append(x[0]);\n for (int i = 1; i < x.length; i++) {\n b.append(delimiter).append(x[i]);\n }\n }\n println(b.toString());\n }\n public void joinAndPrintln(Iterable iterable) {\n joinAndPrintln(iterable, \" \");\n }\n public void joinAndPrintln(Iterable iterable, String delimiter) {\n StringBuilder b = new StringBuilder();\n for (Iterator i = iterable.iterator(); i.hasNext();) {\n b.append(i.next());\n while (i.hasNext()) {\n b.append(delimiter).append(i.next());\n }\n }\n println(b.toString());\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1585447416, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02727.html", "problem_id": "p02727", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02727/input.txt", "sample_output_relpath": "derived/input_output/data/p02727/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02727/Java/s697371848.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s697371848", "user_id": "u097304477"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.InputMismatchException;\nimport java.util.Iterator;\nimport java.util.NoSuchElementException;\n\npublic class Main {\n static void solve(MyScanner in, MyWriter out) {\n int x = in.nextInt();\n int y = in.nextInt();\n int a = in.nextInt();\n int b = in.nextInt();\n int c = in.nextInt();\n long[] p = in.nextLongArray(a);\n long[] q = in.nextLongArray(b);\n long[] r = in.nextLongArray(c);\n\n Arrays.sort(p);\n Arrays.sort(q);\n reverse(p);\n reverse(q);\n long[] s = new long[x + y];\n long answer = 0;\n for (int i = 0; i < x; i++) {\n s[i] = p[i];\n answer += p[i];\n }\n for (int i = x, j = 0; j < y; i++, j++) {\n s[i] = q[j];\n answer += q[j];\n }\n Arrays.sort(s);\n Arrays.sort(r);\n for (int i = c - 1, j = 0; i >= 0; i--, j++) {\n if (r[i] <= s[j]) {\n break;\n }\n answer -= s[j];\n answer += r[i];\n }\n out.println(answer);\n }\n private static void reverse(long[] a) {\n reverse(a, 0, a.length);\n }\n private static void reverse(long[] a, int fromIndex, int toIndex) {\n if (fromIndex < 0 || toIndex > a.length || fromIndex > toIndex) {\n throw new IndexOutOfBoundsException();\n }\n for (int i = fromIndex, j = toIndex - 1; i < j; i++, j--) {\n long tmp = a[i];\n a[i] = a[j];\n a[j] = tmp;\n }\n }\n public static void main(String[] args) {\n MyWriter w = new MyWriter(System.out);\n solve(new MyScanner(System.in), w);\n w.flush();\n }\n static final class MyScanner {\n static final int BUFFER_SIZE = 8192;\n private final InputStream in;\n private final byte[] buffer = new byte[BUFFER_SIZE];\n private int point;\n private int readLength;\n\n MyScanner(InputStream in) {\n this.in = in;\n }\n private byte readByte() {\n if (point < readLength) {\n byte result = buffer[point];\n point += 1;\n return result;\n }\n try {\n readLength = in.read(buffer);\n } catch (IOException e) {\n throw new AssertionError(null, e);\n }\n if (readLength == -1) {\n return -1;\n }\n point = 1;\n return buffer[0];\n }\n private static boolean isPrintableCharExceptSpace(byte c) {\n return 33 <= c && c <= 126;\n }\n public char nextChar() {\n byte c = readByte();\n while (!(c == -1 || isPrintableCharExceptSpace(c))) {\n c = readByte();\n }\n if (c == -1) {\n throw new NoSuchElementException();\n }\n return (char)c;\n }\n public String next() {\n return next(16);\n }\n public String next(int n) {\n byte c = readByte();\n while (!(c == -1 || isPrintableCharExceptSpace(c))) {\n c = readByte();\n }\n if (c == -1) {\n throw new NoSuchElementException();\n }\n StringBuilder b = new StringBuilder(n);\n do {\n b.append((char)c);\n c = readByte();\n } while (c != -1 && isPrintableCharExceptSpace(c));\n return b.toString();\n }\n public long nextLong() {\n byte c = readByte();\n while (!(c == -1 || isPrintableCharExceptSpace(c))) {\n c = readByte();\n }\n if (c == -1) {\n throw new NoSuchElementException();\n }\n boolean minus = false;\n if (c == '-') {\n minus = true;\n c = readByte();\n }\n long result = 0L;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n result = result * 10L + (c - '0');\n c = readByte();\n } while (c != -1 && isPrintableCharExceptSpace(c));\n return minus ? -result : result;\n }\n public int nextInt() {\n long n = nextLong();\n if (n < Integer.MIN_VALUE || n > Integer.MAX_VALUE) {\n throw new InputMismatchException();\n }\n return (int)n;\n }\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n public int[] nextIntArray(int n) {\n int[] result = new int[n];\n for (int i = 0; i < n; i++) {\n result[i] = nextInt();\n }\n return result;\n }\n public long[] nextLongArray(int n) {\n long[] result = new long[n];\n for (int i = 0; i < n; i++) {\n result[i] = nextLong();\n }\n return result;\n }\n public char[] nextCharArray(int n) {\n char[] result = new char[n];\n for (int i = 0; i < n; i++) {\n result[i] = nextChar();\n }\n return result;\n }\n public char[][] next2dCharArray(int n, int m) {\n char[][] result = new char[n][m];\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n result[i][j] = nextChar();\n }\n }\n return result;\n }\n public int[][] nextVerticalIntArrays(int arrayCount, int arrayLength) {\n int[][] result = new int[arrayCount][arrayLength];\n for (int i = 0; i < arrayLength; i++) {\n for (int j = 0; j < arrayCount; j++) {\n result[j][i] = nextInt();\n }\n }\n return result;\n }\n public long[][] nextVerticalLongArrays(int arrayCount,\n int arrayLength) {\n long[][] result = new long[arrayCount][arrayLength];\n for (int i = 0; i < arrayLength; i++) {\n for (int j = 0; j < arrayCount; j++) {\n result[j][i] = nextLong();\n }\n }\n return result;\n }\n public char[][] nextVerticalCharArrays(int arrayCount,\n int arrayLength) {\n char[][] result = new char[arrayCount][arrayLength];\n for (int i = 0; i < arrayLength; i++) {\n for (int j = 0; j < arrayCount; j++) {\n result[j][i] = nextChar();\n }\n }\n return result;\n }\n }\n static final class MyWriter extends PrintWriter {\n MyWriter(OutputStream out) {\n super(out);\n }\n public void joinAndPrintln(int[] x) {\n joinAndPrintln(x, \" \");\n }\n public void joinAndPrintln(int[] x, String delimiter) {\n StringBuilder b = new StringBuilder();\n if (x.length > 0) {\n b.append(x[0]);\n for (int i = 1; i < x.length; i++) {\n b.append(delimiter).append(x[i]);\n }\n }\n println(b.toString());\n }\n public void joinAndPrintln(long[] x) {\n joinAndPrintln(x, \" \");\n }\n public void joinAndPrintln(long[] x, String delimiter) {\n StringBuilder b = new StringBuilder();\n if (x.length > 0) {\n b.append(x[0]);\n for (int i = 1; i < x.length; i++) {\n b.append(delimiter).append(x[i]);\n }\n }\n println(b.toString());\n }\n public void joinAndPrintln(Iterable iterable) {\n joinAndPrintln(iterable, \" \");\n }\n public void joinAndPrintln(Iterable iterable, String delimiter) {\n StringBuilder b = new StringBuilder();\n for (Iterator i = iterable.iterator(); i.hasNext();) {\n b.append(i.next());\n while (i.hasNext()) {\n b.append(delimiter).append(i.next());\n }\n }\n println(b.toString());\n }\n }\n}\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nYou are going to eat X red apples and Y green apples.\n\nYou have A red apples of deliciousness p_1,p_2, \\dots, p_A, B green apples of deliciousness q_1,q_2, \\dots, q_B, and C colorless apples of deliciousness r_1,r_2, \\dots, r_C.\n\nBefore eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively.\n\nFrom the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible.\n\nFind the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.\n\nConstraints\n\n1 \\leq X \\leq A \\leq 10^5\n\n1 \\leq Y \\leq B \\leq 10^5\n\n1 \\leq C \\leq 10^5\n\n1 \\leq p_i \\leq 10^9\n\n1 \\leq q_i \\leq 10^9\n\n1 \\leq r_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\nX Y A B C\np_1 p_2 ... p_A\nq_1 q_2 ... q_B\nr_1 r_2 ... r_C\n\nOutput\n\nPrint the maximum possible sum of the deliciousness of the eaten apples.\n\nSample Input 1\n\n1 2 2 2 1\n2 4\n5 1\n3\n\nSample Output 1\n\n12\n\nThe maximum possible sum of the deliciousness of the eaten apples can be achieved as follows:\n\nEat the 2-nd red apple.\n\nEat the 1-st green apple.\n\nPaint the 1-st colorless apple green and eat it.\n\nSample Input 2\n\n2 2 2 2 2\n8 6\n9 1\n2 1\n\nSample Output 2\n\n25\n\nSample Input 3\n\n2 2 4 4 4\n11 12 13 14\n21 22 23 24\n1 2 3 4\n\nSample Output 3\n\n74", "sample_input": "1 2 2 2 1\n2 4\n5 1\n3\n"}, "reference_outputs": ["12\n"], "source_document_id": "p02727", "source_text": "Score : 500 points\n\nProblem Statement\n\nYou are going to eat X red apples and Y green apples.\n\nYou have A red apples of deliciousness p_1,p_2, \\dots, p_A, B green apples of deliciousness q_1,q_2, \\dots, q_B, and C colorless apples of deliciousness r_1,r_2, \\dots, r_C.\n\nBefore eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively.\n\nFrom the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible.\n\nFind the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.\n\nConstraints\n\n1 \\leq X \\leq A \\leq 10^5\n\n1 \\leq Y \\leq B \\leq 10^5\n\n1 \\leq C \\leq 10^5\n\n1 \\leq p_i \\leq 10^9\n\n1 \\leq q_i \\leq 10^9\n\n1 \\leq r_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\nX Y A B C\np_1 p_2 ... p_A\nq_1 q_2 ... q_B\nr_1 r_2 ... r_C\n\nOutput\n\nPrint the maximum possible sum of the deliciousness of the eaten apples.\n\nSample Input 1\n\n1 2 2 2 1\n2 4\n5 1\n3\n\nSample Output 1\n\n12\n\nThe maximum possible sum of the deliciousness of the eaten apples can be achieved as follows:\n\nEat the 2-nd red apple.\n\nEat the 1-st green apple.\n\nPaint the 1-st colorless apple green and eat it.\n\nSample Input 2\n\n2 2 2 2 2\n8 6\n9 1\n2 1\n\nSample Output 2\n\n25\n\nSample Input 3\n\n2 2 4 4 4\n11 12 13 14\n21 22 23 24\n1 2 3 4\n\nSample Output 3\n\n74", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 8491, "cpu_time_ms": 292, "memory_kb": 30816}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s257604890", "group_id": "codeNet:p02727", "input_text": "import java.util.*;\nimport java.math.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner cin = new Scanner(System.in);\n int x = cin.nextInt();\n int y = cin.nextInt();\n int A = cin.nextInt();\n int B = cin.nextInt();\n int C = cin.nextInt();\n Integer[] a = new Integer[A];\n Integer[] b = new Integer[B];\n Integer[] c = new Integer[C+x+y];\n for(int i = 0; i < A; i++){\n \ta[i] = cin.nextInt();\n }\n Arrays.sort(a, 0, A, Collections.reverseOrder());\n for(int i = 0; i < B; i++){\n \tb[i] = cin.nextInt();\n }\n Arrays.sort(b,0,B,Collections.reverseOrder());\n \n for(int i = 0; i < C; i++){\n \tc[i] = cin.nextInt();\n }\n for(int i = C; i < C+x; i++){\n \tc[i] = a[i-C];\n }\n for(int i = C+x; i < C+x+y; i++){\n \tc[i] = b[i-C-x];\n }\n Arrays.sort(c,0,C+x+y,Collections.reverseOrder());\n \n long ans = 0;\n for(int i = 0; i < x+y; i++){\n \tans += c[i];\n }\n \n System.out.println(ans);\n }\n}", "language": "Java", "metadata": {"date": 1585446865, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02727.html", "problem_id": "p02727", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02727/input.txt", "sample_output_relpath": "derived/input_output/data/p02727/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02727/Java/s257604890.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s257604890", "user_id": "u688537480"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "import java.util.*;\nimport java.math.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner cin = new Scanner(System.in);\n int x = cin.nextInt();\n int y = cin.nextInt();\n int A = cin.nextInt();\n int B = cin.nextInt();\n int C = cin.nextInt();\n Integer[] a = new Integer[A];\n Integer[] b = new Integer[B];\n Integer[] c = new Integer[C+x+y];\n for(int i = 0; i < A; i++){\n \ta[i] = cin.nextInt();\n }\n Arrays.sort(a, 0, A, Collections.reverseOrder());\n for(int i = 0; i < B; i++){\n \tb[i] = cin.nextInt();\n }\n Arrays.sort(b,0,B,Collections.reverseOrder());\n \n for(int i = 0; i < C; i++){\n \tc[i] = cin.nextInt();\n }\n for(int i = C; i < C+x; i++){\n \tc[i] = a[i-C];\n }\n for(int i = C+x; i < C+x+y; i++){\n \tc[i] = b[i-C-x];\n }\n Arrays.sort(c,0,C+x+y,Collections.reverseOrder());\n \n long ans = 0;\n for(int i = 0; i < x+y; i++){\n \tans += c[i];\n }\n \n System.out.println(ans);\n }\n}", "problem_context": "Score : 500 points\n\nProblem Statement\n\nYou are going to eat X red apples and Y green apples.\n\nYou have A red apples of deliciousness p_1,p_2, \\dots, p_A, B green apples of deliciousness q_1,q_2, \\dots, q_B, and C colorless apples of deliciousness r_1,r_2, \\dots, r_C.\n\nBefore eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively.\n\nFrom the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible.\n\nFind the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.\n\nConstraints\n\n1 \\leq X \\leq A \\leq 10^5\n\n1 \\leq Y \\leq B \\leq 10^5\n\n1 \\leq C \\leq 10^5\n\n1 \\leq p_i \\leq 10^9\n\n1 \\leq q_i \\leq 10^9\n\n1 \\leq r_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\nX Y A B C\np_1 p_2 ... p_A\nq_1 q_2 ... q_B\nr_1 r_2 ... r_C\n\nOutput\n\nPrint the maximum possible sum of the deliciousness of the eaten apples.\n\nSample Input 1\n\n1 2 2 2 1\n2 4\n5 1\n3\n\nSample Output 1\n\n12\n\nThe maximum possible sum of the deliciousness of the eaten apples can be achieved as follows:\n\nEat the 2-nd red apple.\n\nEat the 1-st green apple.\n\nPaint the 1-st colorless apple green and eat it.\n\nSample Input 2\n\n2 2 2 2 2\n8 6\n9 1\n2 1\n\nSample Output 2\n\n25\n\nSample Input 3\n\n2 2 4 4 4\n11 12 13 14\n21 22 23 24\n1 2 3 4\n\nSample Output 3\n\n74", "sample_input": "1 2 2 2 1\n2 4\n5 1\n3\n"}, "reference_outputs": ["12\n"], "source_document_id": "p02727", "source_text": "Score : 500 points\n\nProblem Statement\n\nYou are going to eat X red apples and Y green apples.\n\nYou have A red apples of deliciousness p_1,p_2, \\dots, p_A, B green apples of deliciousness q_1,q_2, \\dots, q_B, and C colorless apples of deliciousness r_1,r_2, \\dots, r_C.\n\nBefore eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively.\n\nFrom the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible.\n\nFind the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.\n\nConstraints\n\n1 \\leq X \\leq A \\leq 10^5\n\n1 \\leq Y \\leq B \\leq 10^5\n\n1 \\leq C \\leq 10^5\n\n1 \\leq p_i \\leq 10^9\n\n1 \\leq q_i \\leq 10^9\n\n1 \\leq r_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\nX Y A B C\np_1 p_2 ... p_A\nq_1 q_2 ... q_B\nr_1 r_2 ... r_C\n\nOutput\n\nPrint the maximum possible sum of the deliciousness of the eaten apples.\n\nSample Input 1\n\n1 2 2 2 1\n2 4\n5 1\n3\n\nSample Output 1\n\n12\n\nThe maximum possible sum of the deliciousness of the eaten apples can be achieved as follows:\n\nEat the 2-nd red apple.\n\nEat the 1-st green apple.\n\nPaint the 1-st colorless apple green and eat it.\n\nSample Input 2\n\n2 2 2 2 2\n8 6\n9 1\n2 1\n\nSample Output 2\n\n25\n\nSample Input 3\n\n2 2 4 4 4\n11 12 13 14\n21 22 23 24\n1 2 3 4\n\nSample Output 3\n\n74", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1138, "cpu_time_ms": 1309, "memory_kb": 100728}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s648805828", "group_id": "codeNet:p02727", "input_text": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.PriorityQueue;\nimport java.io.BufferedWriter;\nimport java.io.Writer;\nimport java.io.OutputStreamWriter;\nimport java.util.InputMismatchException;\nimport java.io.IOException;\nimport java.util.Collections;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author --\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n OutputWriter out = new OutputWriter(outputStream);\n ERedAndGreenApples solver = new ERedAndGreenApples();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class ERedAndGreenApples {\n public void solve(int testNumber, InputReader c, OutputWriter w) {\n int x = c.readInt(), y = c.readInt(), a = c.readInt(), b = c.readInt(), cc = c.readInt();\n int aa[] = c.readIntArray(a), bb[] = c.readIntArray(b), ccc[] = c.readIntArray(cc);\n Sort.mergeSort(aa, 0, a);\n Sort.mergeSort(bb, 0, b);\n PriorityQueue pq = new PriorityQueue<>();\n for (int i = 0; i < x; i++) {\n pq.add(aa[a - 1 - i]);\n }\n for (int i = 0; i < y; i++) {\n pq.add(bb[b - 1 - i]);\n }\n PriorityQueue pp = new PriorityQueue<>(Collections.reverseOrder());\n for (int i = 0; i < cc; i++) {\n pp.add(ccc[i]);\n }\n if (pq.peek() < pp.peek()) {\n int lll = pp.poll();\n pq.poll();\n pq.add(lll);\n }\n\n long res = 0;\n for (int xx : pq) {\n res += xx;\n }\n w.printLine(res);\n\n }\n\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private InputReader.SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int[] readIntArray(int size) {\n int[] array = new int[size];\n for (int i = 0; i < size; i++) {\n array[i] = readInt();\n }\n return array;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public int readInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }\n\n public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }\n\n static class Sort {\n public static void mergeSort(int[] a, int low, int high) {\n if (high - low < 2) {\n return;\n }\n int mid = (low + high) >>> 1;\n mergeSort(a, low, mid);\n mergeSort(a, mid, high);\n int[] b = Arrays.copyOfRange(a, low, mid);\n for (int i = low, j = mid, k = 0; k < b.length; i++) {\n if (j == high || b[k] <= a[j]) {\n a[i] = b[k++];\n } else {\n a[i] = a[j++];\n }\n }\n }\n\n }\n\n static class OutputWriter {\n private final PrintWriter writer;\n\n public OutputWriter(OutputStream outputStream) {\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n }\n\n public OutputWriter(Writer writer) {\n this.writer = new PrintWriter(writer);\n }\n\n public void close() {\n writer.close();\n }\n\n public void printLine(long i) {\n writer.println(i);\n }\n\n }\n}\n\n", "language": "Java", "metadata": {"date": 1585445883, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02727.html", "problem_id": "p02727", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02727/input.txt", "sample_output_relpath": "derived/input_output/data/p02727/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02727/Java/s648805828.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s648805828", "user_id": "u768031280"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.PriorityQueue;\nimport java.io.BufferedWriter;\nimport java.io.Writer;\nimport java.io.OutputStreamWriter;\nimport java.util.InputMismatchException;\nimport java.io.IOException;\nimport java.util.Collections;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author --\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n OutputWriter out = new OutputWriter(outputStream);\n ERedAndGreenApples solver = new ERedAndGreenApples();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class ERedAndGreenApples {\n public void solve(int testNumber, InputReader c, OutputWriter w) {\n int x = c.readInt(), y = c.readInt(), a = c.readInt(), b = c.readInt(), cc = c.readInt();\n int aa[] = c.readIntArray(a), bb[] = c.readIntArray(b), ccc[] = c.readIntArray(cc);\n Sort.mergeSort(aa, 0, a);\n Sort.mergeSort(bb, 0, b);\n PriorityQueue pq = new PriorityQueue<>();\n for (int i = 0; i < x; i++) {\n pq.add(aa[a - 1 - i]);\n }\n for (int i = 0; i < y; i++) {\n pq.add(bb[b - 1 - i]);\n }\n PriorityQueue pp = new PriorityQueue<>(Collections.reverseOrder());\n for (int i = 0; i < cc; i++) {\n pp.add(ccc[i]);\n }\n if (pq.peek() < pp.peek()) {\n int lll = pp.poll();\n pq.poll();\n pq.add(lll);\n }\n\n long res = 0;\n for (int xx : pq) {\n res += xx;\n }\n w.printLine(res);\n\n }\n\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private InputReader.SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int[] readIntArray(int size) {\n int[] array = new int[size];\n for (int i = 0; i < size; i++) {\n array[i] = readInt();\n }\n return array;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public int readInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }\n\n public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }\n\n static class Sort {\n public static void mergeSort(int[] a, int low, int high) {\n if (high - low < 2) {\n return;\n }\n int mid = (low + high) >>> 1;\n mergeSort(a, low, mid);\n mergeSort(a, mid, high);\n int[] b = Arrays.copyOfRange(a, low, mid);\n for (int i = low, j = mid, k = 0; k < b.length; i++) {\n if (j == high || b[k] <= a[j]) {\n a[i] = b[k++];\n } else {\n a[i] = a[j++];\n }\n }\n }\n\n }\n\n static class OutputWriter {\n private final PrintWriter writer;\n\n public OutputWriter(OutputStream outputStream) {\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n }\n\n public OutputWriter(Writer writer) {\n this.writer = new PrintWriter(writer);\n }\n\n public void close() {\n writer.close();\n }\n\n public void printLine(long i) {\n writer.println(i);\n }\n\n }\n}\n\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nYou are going to eat X red apples and Y green apples.\n\nYou have A red apples of deliciousness p_1,p_2, \\dots, p_A, B green apples of deliciousness q_1,q_2, \\dots, q_B, and C colorless apples of deliciousness r_1,r_2, \\dots, r_C.\n\nBefore eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively.\n\nFrom the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible.\n\nFind the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.\n\nConstraints\n\n1 \\leq X \\leq A \\leq 10^5\n\n1 \\leq Y \\leq B \\leq 10^5\n\n1 \\leq C \\leq 10^5\n\n1 \\leq p_i \\leq 10^9\n\n1 \\leq q_i \\leq 10^9\n\n1 \\leq r_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\nX Y A B C\np_1 p_2 ... p_A\nq_1 q_2 ... q_B\nr_1 r_2 ... r_C\n\nOutput\n\nPrint the maximum possible sum of the deliciousness of the eaten apples.\n\nSample Input 1\n\n1 2 2 2 1\n2 4\n5 1\n3\n\nSample Output 1\n\n12\n\nThe maximum possible sum of the deliciousness of the eaten apples can be achieved as follows:\n\nEat the 2-nd red apple.\n\nEat the 1-st green apple.\n\nPaint the 1-st colorless apple green and eat it.\n\nSample Input 2\n\n2 2 2 2 2\n8 6\n9 1\n2 1\n\nSample Output 2\n\n25\n\nSample Input 3\n\n2 2 4 4 4\n11 12 13 14\n21 22 23 24\n1 2 3 4\n\nSample Output 3\n\n74", "sample_input": "1 2 2 2 1\n2 4\n5 1\n3\n"}, "reference_outputs": ["12\n"], "source_document_id": "p02727", "source_text": "Score : 500 points\n\nProblem Statement\n\nYou are going to eat X red apples and Y green apples.\n\nYou have A red apples of deliciousness p_1,p_2, \\dots, p_A, B green apples of deliciousness q_1,q_2, \\dots, q_B, and C colorless apples of deliciousness r_1,r_2, \\dots, r_C.\n\nBefore eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively.\n\nFrom the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible.\n\nFind the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.\n\nConstraints\n\n1 \\leq X \\leq A \\leq 10^5\n\n1 \\leq Y \\leq B \\leq 10^5\n\n1 \\leq C \\leq 10^5\n\n1 \\leq p_i \\leq 10^9\n\n1 \\leq q_i \\leq 10^9\n\n1 \\leq r_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\nX Y A B C\np_1 p_2 ... p_A\nq_1 q_2 ... q_B\nr_1 r_2 ... r_C\n\nOutput\n\nPrint the maximum possible sum of the deliciousness of the eaten apples.\n\nSample Input 1\n\n1 2 2 2 1\n2 4\n5 1\n3\n\nSample Output 1\n\n12\n\nThe maximum possible sum of the deliciousness of the eaten apples can be achieved as follows:\n\nEat the 2-nd red apple.\n\nEat the 1-st green apple.\n\nPaint the 1-st colorless apple green and eat it.\n\nSample Input 2\n\n2 2 2 2 2\n8 6\n9 1\n2 1\n\nSample Output 2\n\n25\n\nSample Input 3\n\n2 2 4 4 4\n11 12 13 14\n21 22 23 24\n1 2 3 4\n\nSample Output 3\n\n74", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 5205, "cpu_time_ms": 245, "memory_kb": 41652}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s805796057", "group_id": "codeNet:p02743", "input_text": "\nimport java.util.Scanner;\n\npublic class Main {\n\n \n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int a = scanner.nextInt();\n int b = scanner.nextInt();\n int c = scanner.nextInt();\n if(Math.sqrt(a) + Math.sqrt(b) < Math.sqrt(c)){\n System.out.println(\"Yes\");\n } else{\n System.out.println(\"No\");\n }\n }\n \n}\n", "language": "Java", "metadata": {"date": 1590540253, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02743.html", "problem_id": "p02743", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02743/input.txt", "sample_output_relpath": "derived/input_output/data/p02743/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02743/Java/s805796057.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s805796057", "user_id": "u362532770"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "\nimport java.util.Scanner;\n\npublic class Main {\n\n \n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int a = scanner.nextInt();\n int b = scanner.nextInt();\n int c = scanner.nextInt();\n if(Math.sqrt(a) + Math.sqrt(b) < Math.sqrt(c)){\n System.out.println(\"Yes\");\n } else{\n System.out.println(\"No\");\n }\n }\n \n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nDoes \\sqrt{a} + \\sqrt{b} < \\sqrt{c} hold?\n\nConstraints\n\n1 \\leq a, b, c \\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\n\nOutput\n\nIf \\sqrt{a} + \\sqrt{b} < \\sqrt{c}, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 3 9\n\nSample Output 1\n\nNo\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{9} does not hold.\n\nSample Input 2\n\n2 3 10\n\nSample Output 2\n\nYes\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{10} holds.", "sample_input": "2 3 9\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02743", "source_text": "Score : 300 points\n\nProblem Statement\n\nDoes \\sqrt{a} + \\sqrt{b} < \\sqrt{c} hold?\n\nConstraints\n\n1 \\leq a, b, c \\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\n\nOutput\n\nIf \\sqrt{a} + \\sqrt{b} < \\sqrt{c}, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 3 9\n\nSample Output 1\n\nNo\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{9} does not hold.\n\nSample Input 2\n\n2 3 10\n\nSample Output 2\n\nYes\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{10} holds.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 402, "cpu_time_ms": 93, "memory_kb": 22740}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s713424835", "group_id": "codeNet:p02743", "input_text": "import java.util.*;\nclass Main{\n public static void main(String[] args){\n Scanner scanner = new Scanner(System.in);\n long a = scanner.nextLong();\n long b = scanner.nextLong();\n long c = scanner.nextLong();\n long d=c-a-b;\n if(4*a*b0) {\n System.out.println(\"Yes\");\n }else {\n System.out.println(\"No\");\n }\n }\n}\n\n", "language": "Java", "metadata": {"date": 1588688272, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02743.html", "problem_id": "p02743", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02743/input.txt", "sample_output_relpath": "derived/input_output/data/p02743/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02743/Java/s713424835.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s713424835", "user_id": "u005491552"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "import java.util.*;\nclass Main{\n public static void main(String[] args){\n Scanner scanner = new Scanner(System.in);\n long a = scanner.nextLong();\n long b = scanner.nextLong();\n long c = scanner.nextLong();\n long d=c-a-b;\n if(4*a*b0) {\n System.out.println(\"Yes\");\n }else {\n System.out.println(\"No\");\n }\n }\n}\n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nDoes \\sqrt{a} + \\sqrt{b} < \\sqrt{c} hold?\n\nConstraints\n\n1 \\leq a, b, c \\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\n\nOutput\n\nIf \\sqrt{a} + \\sqrt{b} < \\sqrt{c}, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 3 9\n\nSample Output 1\n\nNo\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{9} does not hold.\n\nSample Input 2\n\n2 3 10\n\nSample Output 2\n\nYes\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{10} holds.", "sample_input": "2 3 9\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02743", "source_text": "Score : 300 points\n\nProblem Statement\n\nDoes \\sqrt{a} + \\sqrt{b} < \\sqrt{c} hold?\n\nConstraints\n\n1 \\leq a, b, c \\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\n\nOutput\n\nIf \\sqrt{a} + \\sqrt{b} < \\sqrt{c}, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 3 9\n\nSample Output 1\n\nNo\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{9} does not hold.\n\nSample Input 2\n\n2 3 10\n\nSample Output 2\n\nYes\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{10} holds.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 402, "cpu_time_ms": 96, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s449610045", "group_id": "codeNet:p02743", "input_text": "import java.util.*;\npublic class Main {\n\n public static void main(String[] args) { \n Scanner sc = new Scanner(System.in);\n long a = sc.nextLong();\n long b = sc.nextLong();\n long c = sc.nextLong();\n if(c - a - b > 0 && 4 * a * b < (c - a - b) * (c - a - b))\n System.out.println(\"Yes\");\n else\n System.out.println(\"No\");\n }\n}\n", "language": "Java", "metadata": {"date": 1587521929, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02743.html", "problem_id": "p02743", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02743/input.txt", "sample_output_relpath": "derived/input_output/data/p02743/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02743/Java/s449610045.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s449610045", "user_id": "u941274418"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n\n public static void main(String[] args) { \n Scanner sc = new Scanner(System.in);\n long a = sc.nextLong();\n long b = sc.nextLong();\n long c = sc.nextLong();\n if(c - a - b > 0 && 4 * a * b < (c - a - b) * (c - a - b))\n System.out.println(\"Yes\");\n else\n System.out.println(\"No\");\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nDoes \\sqrt{a} + \\sqrt{b} < \\sqrt{c} hold?\n\nConstraints\n\n1 \\leq a, b, c \\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\n\nOutput\n\nIf \\sqrt{a} + \\sqrt{b} < \\sqrt{c}, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 3 9\n\nSample Output 1\n\nNo\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{9} does not hold.\n\nSample Input 2\n\n2 3 10\n\nSample Output 2\n\nYes\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{10} holds.", "sample_input": "2 3 9\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02743", "source_text": "Score : 300 points\n\nProblem Statement\n\nDoes \\sqrt{a} + \\sqrt{b} < \\sqrt{c} hold?\n\nConstraints\n\n1 \\leq a, b, c \\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\n\nOutput\n\nIf \\sqrt{a} + \\sqrt{b} < \\sqrt{c}, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 3 9\n\nSample Output 1\n\nNo\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{9} does not hold.\n\nSample Input 2\n\n2 3 10\n\nSample Output 2\n\nYes\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{10} holds.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 95, "memory_kb": 23380}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s785193456", "group_id": "codeNet:p02743", "input_text": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.List;\n\npublic class Main {\n\n public static void main(String[] args) throws Exception {\n\n InputStreamReader is = new InputStreamReader(System.in);\n BufferedReader reader = new BufferedReader(is);\n\n List mylist = new ArrayList<>();\n\n // 標準入力からの値を変数strinputに代入\n String strinput = reader.readLine();\n\n while (strinput != null) {\n\n mylist.add(strinput);\n strinput = reader.readLine();\n\n }\n\n String arr_temp[] = mylist.get(0).split(\" \");\n int a = Integer.valueOf(arr_temp[0]);\n int b = Integer.valueOf(arr_temp[1]);\n int c = Integer.valueOf(arr_temp[2]);\n\n System.out.println(a + b + 2 * Math.sqrt((double) a) + Math.sqrt((double) b) < c ? \"Yes\" : \"No\");\n\n }\n\n}\n", "language": "Java", "metadata": {"date": 1585521069, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02743.html", "problem_id": "p02743", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02743/input.txt", "sample_output_relpath": "derived/input_output/data/p02743/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02743/Java/s785193456.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s785193456", "user_id": "u200239931"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.List;\n\npublic class Main {\n\n public static void main(String[] args) throws Exception {\n\n InputStreamReader is = new InputStreamReader(System.in);\n BufferedReader reader = new BufferedReader(is);\n\n List mylist = new ArrayList<>();\n\n // 標準入力からの値を変数strinputに代入\n String strinput = reader.readLine();\n\n while (strinput != null) {\n\n mylist.add(strinput);\n strinput = reader.readLine();\n\n }\n\n String arr_temp[] = mylist.get(0).split(\" \");\n int a = Integer.valueOf(arr_temp[0]);\n int b = Integer.valueOf(arr_temp[1]);\n int c = Integer.valueOf(arr_temp[2]);\n\n System.out.println(a + b + 2 * Math.sqrt((double) a) + Math.sqrt((double) b) < c ? \"Yes\" : \"No\");\n\n }\n\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nDoes \\sqrt{a} + \\sqrt{b} < \\sqrt{c} hold?\n\nConstraints\n\n1 \\leq a, b, c \\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\n\nOutput\n\nIf \\sqrt{a} + \\sqrt{b} < \\sqrt{c}, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 3 9\n\nSample Output 1\n\nNo\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{9} does not hold.\n\nSample Input 2\n\n2 3 10\n\nSample Output 2\n\nYes\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{10} holds.", "sample_input": "2 3 9\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02743", "source_text": "Score : 300 points\n\nProblem Statement\n\nDoes \\sqrt{a} + \\sqrt{b} < \\sqrt{c} hold?\n\nConstraints\n\n1 \\leq a, b, c \\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\n\nOutput\n\nIf \\sqrt{a} + \\sqrt{b} < \\sqrt{c}, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 3 9\n\nSample Output 1\n\nNo\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{9} does not hold.\n\nSample Input 2\n\n2 3 10\n\nSample Output 2\n\nYes\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{10} holds.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 914, "cpu_time_ms": 73, "memory_kb": 21332}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s788021960", "group_id": "codeNet:p02743", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] arg){\n\t\tScanner sc = new Scanner(System.in);\n\t\tdouble a = sc.nextDouble();\n\t\tdouble b = sc.nextDouble();\n\t\tdouble c = sc.nextDouble();\n\n\t\tif(Math.sqrt(a) + Math.sqrt(b) < Math.sqrt(c)){\n\t\t\tSystem.out.println(\"Yes\");\n\t\t} else {\n\t\t\tSystem.out.println(\"No\");\n\t\t}\n\n\t}\n\n\n}", "language": "Java", "metadata": {"date": 1584457381, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02743.html", "problem_id": "p02743", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02743/input.txt", "sample_output_relpath": "derived/input_output/data/p02743/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02743/Java/s788021960.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s788021960", "user_id": "u975026125"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] arg){\n\t\tScanner sc = new Scanner(System.in);\n\t\tdouble a = sc.nextDouble();\n\t\tdouble b = sc.nextDouble();\n\t\tdouble c = sc.nextDouble();\n\n\t\tif(Math.sqrt(a) + Math.sqrt(b) < Math.sqrt(c)){\n\t\t\tSystem.out.println(\"Yes\");\n\t\t} else {\n\t\t\tSystem.out.println(\"No\");\n\t\t}\n\n\t}\n\n\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nDoes \\sqrt{a} + \\sqrt{b} < \\sqrt{c} hold?\n\nConstraints\n\n1 \\leq a, b, c \\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\n\nOutput\n\nIf \\sqrt{a} + \\sqrt{b} < \\sqrt{c}, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 3 9\n\nSample Output 1\n\nNo\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{9} does not hold.\n\nSample Input 2\n\n2 3 10\n\nSample Output 2\n\nYes\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{10} holds.", "sample_input": "2 3 9\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02743", "source_text": "Score : 300 points\n\nProblem Statement\n\nDoes \\sqrt{a} + \\sqrt{b} < \\sqrt{c} hold?\n\nConstraints\n\n1 \\leq a, b, c \\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\n\nOutput\n\nIf \\sqrt{a} + \\sqrt{b} < \\sqrt{c}, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 3 9\n\nSample Output 1\n\nNo\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{9} does not hold.\n\nSample Input 2\n\n2 3 10\n\nSample Output 2\n\nYes\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{10} holds.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 348, "cpu_time_ms": 110, "memory_kb": 24276}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s157924031", "group_id": "codeNet:p02743", "input_text": "import java.io.*;\nimport java.math.BigDecimal;\nimport java.net.Inet4Address;\nimport java.util.*;\nimport java.util.Map.Entry;\npublic class Main {\n ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n//////// /////////\n//////// /////////\n//////// HHHH HHHH EEEEEEEEEEEEE MMMM MMMM OOOOOO SSSSSSS EEEEEEEEEEEEE /////////\n//////// HHHH HHHH EEEEEEEEEEEEE MMMMMM MMMMMM OOO OOO SSSS SSS EEEEEEEEEEEEE /////////\n//////// HHHH HHHH EEEEE MMMM MMM MMM MMMM OOO OOO SSSS SSS EEEEE /////////\n//////// HHHH HHHH EEEEE MMMM MMMMMM MMMM OOO OOO SSSS EEEEE /////////\n//////// HHHH HHHH EEEEE MMMM MMMM OOO OOO SSSSSSS EEEEE /////////\n//////// HHHHHHHHHHHHHHHH EEEEEEEEEEE MMMM MMMM OOO OOO SSSSSS EEEEEEEEEEE /////////\n//////// HHHHHHHHHHHHHHHH EEEEEEEEEEE MMMM MMMM OOO OOO SSSSSSS EEEEEEEEEEE /////////\n//////// HHHH HHHH EEEEE MMMM MMMM OOO OOO SSSS EEEEE /////////\n//////// HHHH HHHH EEEEE MMMM MMMM OOO OOO SSS SSSS EEEEE /////////\n//////// HHHH HHHH EEEEEEEEEEEEE MMMM MMMM OOO OOO SSS SSSS EEEEEEEEEEEEE /////////\n//////// HHHH HHHH EEEEEEEEEEEEE MMMM MMMM OOOOOO SSSSSSS EEEEEEEEEEEEE /////////\n//////// /////////\n//////// /////////\n////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\n public static void main(String[] args) throws IOException, InterruptedException {\n Scanner sc = new Scanner(System.in);\n PrintWriter pw = new PrintWriter(System.out);\n int a = sc.nextInt();\n int b= sc.nextInt();\n int c = sc.nextInt();\n if (Double.compare(Math.sqrt(c),Math.sqrt(a)+Math.sqrt(b))>0&&Math.abs(Math.sqrt(c)-Math.sqrt(a)-Math.sqrt(b))>1e-7){\n pw.println(\"Yes\");\n }\n else pw.println(\"No\");\n pw.flush();\n }\n static class Scanner {\n StringTokenizer st;\n BufferedReader br;\n\n public Scanner(FileReader r) {\n br = new BufferedReader(r);\n }\n\n public Scanner(InputStream s) {\n br = new BufferedReader(new InputStreamReader(s));\n }\n\n public String next() throws IOException {\n while (st == null || !st.hasMoreTokens())\n st = new StringTokenizer(br.readLine());\n return st.nextToken();\n }\n\n public int nextInt() throws IOException {\n return Integer.parseInt(next());\n }\n\n public long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n\n public String nextLine() throws IOException {\n return br.readLine();\n }\n\n public double nextDouble() throws IOException {\n String x = next();\n StringBuilder sb = new StringBuilder(\"0\");\n double res = 0, f = 1;\n boolean dec = false, neg = false;\n int start = 0;\n if (x.charAt(0) == '-') {\n neg = true;\n start++;\n }\n for (int i = start; i < x.length(); i++)\n if (x.charAt(i) == '.') {\n res = Long.parseLong(sb.toString());\n sb = new StringBuilder(\"0\");\n dec = true;\n } else {\n sb.append(x.charAt(i));\n if (dec)\n f *= 10;\n }\n res += Long.parseLong(sb.toString()) / f;\n return res * (neg ? -1 : 1);\n }\n\n public boolean ready() throws IOException {\n return br.ready();\n }\n }\n\n}", "language": "Java", "metadata": {"date": 1584406578, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02743.html", "problem_id": "p02743", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02743/input.txt", "sample_output_relpath": "derived/input_output/data/p02743/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02743/Java/s157924031.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s157924031", "user_id": "u391044041"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "import java.io.*;\nimport java.math.BigDecimal;\nimport java.net.Inet4Address;\nimport java.util.*;\nimport java.util.Map.Entry;\npublic class Main {\n ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n//////// /////////\n//////// /////////\n//////// HHHH HHHH EEEEEEEEEEEEE MMMM MMMM OOOOOO SSSSSSS EEEEEEEEEEEEE /////////\n//////// HHHH HHHH EEEEEEEEEEEEE MMMMMM MMMMMM OOO OOO SSSS SSS EEEEEEEEEEEEE /////////\n//////// HHHH HHHH EEEEE MMMM MMM MMM MMMM OOO OOO SSSS SSS EEEEE /////////\n//////// HHHH HHHH EEEEE MMMM MMMMMM MMMM OOO OOO SSSS EEEEE /////////\n//////// HHHH HHHH EEEEE MMMM MMMM OOO OOO SSSSSSS EEEEE /////////\n//////// HHHHHHHHHHHHHHHH EEEEEEEEEEE MMMM MMMM OOO OOO SSSSSS EEEEEEEEEEE /////////\n//////// HHHHHHHHHHHHHHHH EEEEEEEEEEE MMMM MMMM OOO OOO SSSSSSS EEEEEEEEEEE /////////\n//////// HHHH HHHH EEEEE MMMM MMMM OOO OOO SSSS EEEEE /////////\n//////// HHHH HHHH EEEEE MMMM MMMM OOO OOO SSS SSSS EEEEE /////////\n//////// HHHH HHHH EEEEEEEEEEEEE MMMM MMMM OOO OOO SSS SSSS EEEEEEEEEEEEE /////////\n//////// HHHH HHHH EEEEEEEEEEEEE MMMM MMMM OOOOOO SSSSSSS EEEEEEEEEEEEE /////////\n//////// /////////\n//////// /////////\n////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\n public static void main(String[] args) throws IOException, InterruptedException {\n Scanner sc = new Scanner(System.in);\n PrintWriter pw = new PrintWriter(System.out);\n int a = sc.nextInt();\n int b= sc.nextInt();\n int c = sc.nextInt();\n if (Double.compare(Math.sqrt(c),Math.sqrt(a)+Math.sqrt(b))>0&&Math.abs(Math.sqrt(c)-Math.sqrt(a)-Math.sqrt(b))>1e-7){\n pw.println(\"Yes\");\n }\n else pw.println(\"No\");\n pw.flush();\n }\n static class Scanner {\n StringTokenizer st;\n BufferedReader br;\n\n public Scanner(FileReader r) {\n br = new BufferedReader(r);\n }\n\n public Scanner(InputStream s) {\n br = new BufferedReader(new InputStreamReader(s));\n }\n\n public String next() throws IOException {\n while (st == null || !st.hasMoreTokens())\n st = new StringTokenizer(br.readLine());\n return st.nextToken();\n }\n\n public int nextInt() throws IOException {\n return Integer.parseInt(next());\n }\n\n public long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n\n public String nextLine() throws IOException {\n return br.readLine();\n }\n\n public double nextDouble() throws IOException {\n String x = next();\n StringBuilder sb = new StringBuilder(\"0\");\n double res = 0, f = 1;\n boolean dec = false, neg = false;\n int start = 0;\n if (x.charAt(0) == '-') {\n neg = true;\n start++;\n }\n for (int i = start; i < x.length(); i++)\n if (x.charAt(i) == '.') {\n res = Long.parseLong(sb.toString());\n sb = new StringBuilder(\"0\");\n dec = true;\n } else {\n sb.append(x.charAt(i));\n if (dec)\n f *= 10;\n }\n res += Long.parseLong(sb.toString()) / f;\n return res * (neg ? -1 : 1);\n }\n\n public boolean ready() throws IOException {\n return br.ready();\n }\n }\n\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nDoes \\sqrt{a} + \\sqrt{b} < \\sqrt{c} hold?\n\nConstraints\n\n1 \\leq a, b, c \\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\n\nOutput\n\nIf \\sqrt{a} + \\sqrt{b} < \\sqrt{c}, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 3 9\n\nSample Output 1\n\nNo\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{9} does not hold.\n\nSample Input 2\n\n2 3 10\n\nSample Output 2\n\nYes\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{10} holds.", "sample_input": "2 3 9\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02743", "source_text": "Score : 300 points\n\nProblem Statement\n\nDoes \\sqrt{a} + \\sqrt{b} < \\sqrt{c} hold?\n\nConstraints\n\n1 \\leq a, b, c \\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\n\nOutput\n\nIf \\sqrt{a} + \\sqrt{b} < \\sqrt{c}, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 3 9\n\nSample Output 1\n\nNo\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{9} does not hold.\n\nSample Input 2\n\n2 3 10\n\nSample Output 2\n\nYes\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{10} holds.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 5622, "cpu_time_ms": 71, "memory_kb": 22612}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s614618493", "group_id": "codeNet:p02743", "input_text": "import java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n new Main().run();\n }\n\n void run() {\n //入力\n \t@SuppressWarnings(\"resource\")\n\t\tScanner sc = new Scanner(System.in);\n \tlong a = (long) Math.sqrt(sc.nextLong());\n \tlong b = (long) Math.sqrt(sc.nextLong());\n \tlong c = (long) Math.sqrt(sc.nextLong());\n\n\n\n \tif( a + b < c) {\n \t\tSystem.out.println(\"Yes\");\n \t} else {\n \t\tSystem.out.println(\"No\");\n \t}\n }\n}", "language": "Java", "metadata": {"date": 1584324044, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02743.html", "problem_id": "p02743", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02743/input.txt", "sample_output_relpath": "derived/input_output/data/p02743/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02743/Java/s614618493.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s614618493", "user_id": "u068577033"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n new Main().run();\n }\n\n void run() {\n //入力\n \t@SuppressWarnings(\"resource\")\n\t\tScanner sc = new Scanner(System.in);\n \tlong a = (long) Math.sqrt(sc.nextLong());\n \tlong b = (long) Math.sqrt(sc.nextLong());\n \tlong c = (long) Math.sqrt(sc.nextLong());\n\n\n\n \tif( a + b < c) {\n \t\tSystem.out.println(\"Yes\");\n \t} else {\n \t\tSystem.out.println(\"No\");\n \t}\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nDoes \\sqrt{a} + \\sqrt{b} < \\sqrt{c} hold?\n\nConstraints\n\n1 \\leq a, b, c \\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\n\nOutput\n\nIf \\sqrt{a} + \\sqrt{b} < \\sqrt{c}, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 3 9\n\nSample Output 1\n\nNo\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{9} does not hold.\n\nSample Input 2\n\n2 3 10\n\nSample Output 2\n\nYes\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{10} holds.", "sample_input": "2 3 9\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02743", "source_text": "Score : 300 points\n\nProblem Statement\n\nDoes \\sqrt{a} + \\sqrt{b} < \\sqrt{c} hold?\n\nConstraints\n\n1 \\leq a, b, c \\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\n\nOutput\n\nIf \\sqrt{a} + \\sqrt{b} < \\sqrt{c}, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 3 9\n\nSample Output 1\n\nNo\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{9} does not hold.\n\nSample Input 2\n\n2 3 10\n\nSample Output 2\n\nYes\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{10} holds.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 95, "memory_kb": 23252}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s087351339", "group_id": "codeNet:p02743", "input_text": "import java.util.*;\n\n\npublic class Main {\n\tpublic static void main (String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tdouble a = sc.nextInt();\n\t\tdouble b = sc.nextInt();\n\t\tdouble c = sc.nextInt();\n\t\tif(c-a-b > 0 && 4*a*b < (c-a-b)*(c-a-b)) {\n\t\t\tSystem.out.println(\"Yes\");\n\t\t}\n\t\telse {\n\t\t\tSystem.out.println(\"No\");\n\t\t}\n\t}\t\n}", "language": "Java", "metadata": {"date": 1584240431, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02743.html", "problem_id": "p02743", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02743/input.txt", "sample_output_relpath": "derived/input_output/data/p02743/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02743/Java/s087351339.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s087351339", "user_id": "u172546930"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "import java.util.*;\n\n\npublic class Main {\n\tpublic static void main (String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tdouble a = sc.nextInt();\n\t\tdouble b = sc.nextInt();\n\t\tdouble c = sc.nextInt();\n\t\tif(c-a-b > 0 && 4*a*b < (c-a-b)*(c-a-b)) {\n\t\t\tSystem.out.println(\"Yes\");\n\t\t}\n\t\telse {\n\t\t\tSystem.out.println(\"No\");\n\t\t}\n\t}\t\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nDoes \\sqrt{a} + \\sqrt{b} < \\sqrt{c} hold?\n\nConstraints\n\n1 \\leq a, b, c \\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\n\nOutput\n\nIf \\sqrt{a} + \\sqrt{b} < \\sqrt{c}, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 3 9\n\nSample Output 1\n\nNo\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{9} does not hold.\n\nSample Input 2\n\n2 3 10\n\nSample Output 2\n\nYes\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{10} holds.", "sample_input": "2 3 9\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02743", "source_text": "Score : 300 points\n\nProblem Statement\n\nDoes \\sqrt{a} + \\sqrt{b} < \\sqrt{c} hold?\n\nConstraints\n\n1 \\leq a, b, c \\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\n\nOutput\n\nIf \\sqrt{a} + \\sqrt{b} < \\sqrt{c}, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 3 9\n\nSample Output 1\n\nNo\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{9} does not hold.\n\nSample Input 2\n\n2 3 10\n\nSample Output 2\n\nYes\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{10} holds.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 94, "memory_kb": 23760}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s274186617", "group_id": "codeNet:p02743", "input_text": " import java.io.BufferedReader;\n import java.io.IOException;\n import java.io.InputStream;\n import java.io.InputStreamReader;\n import java.math.BigInteger;\n import java.util.StringTokenizer;\n\npublic class Main {\n private static class FastScanner {\n private BufferedReader reader = null;\n private StringTokenizer tokenizer = null;\n\n public FastScanner(InputStream in) {\n reader = new BufferedReader(new InputStreamReader(in));\n tokenizer = null;\n }\n\n public String next() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public String nextLine() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n return reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n\n return tokenizer.nextToken(\"\\n\");\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public int[] nextIntArray(int n) {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n return a;\n }\n\n public long[] nextLongArray(int n) {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = nextLong();\n return a;\n }\n }\n\n public static void main(String[] args) {\n FastScanner sc = new FastScanner(System.in);\n long a = sc.nextLong();\n long b = sc.nextLong();\n long c = sc.nextLong();\n BigInteger left = BigInteger.valueOf(1L);\n left = left.multiply(BigInteger.valueOf(4L));\n left = left.multiply(BigInteger.valueOf(a));\n left = left.multiply(BigInteger.valueOf(b));\n BigInteger right = BigInteger.valueOf(1L);\n right = right.multiply(BigInteger.valueOf(c - a - b));\n right = right.multiply(BigInteger.valueOf(c - a - b));\n if (left.compareTo(right) < 0) {\n System.out.println(\"Yes\");\n } else {\n System.out.println(\"No\");\n }\n }\n}", "language": "Java", "metadata": {"date": 1584240102, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02743.html", "problem_id": "p02743", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02743/input.txt", "sample_output_relpath": "derived/input_output/data/p02743/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02743/Java/s274186617.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s274186617", "user_id": "u562002567"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": " import java.io.BufferedReader;\n import java.io.IOException;\n import java.io.InputStream;\n import java.io.InputStreamReader;\n import java.math.BigInteger;\n import java.util.StringTokenizer;\n\npublic class Main {\n private static class FastScanner {\n private BufferedReader reader = null;\n private StringTokenizer tokenizer = null;\n\n public FastScanner(InputStream in) {\n reader = new BufferedReader(new InputStreamReader(in));\n tokenizer = null;\n }\n\n public String next() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public String nextLine() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n return reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n\n return tokenizer.nextToken(\"\\n\");\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public int[] nextIntArray(int n) {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n return a;\n }\n\n public long[] nextLongArray(int n) {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = nextLong();\n return a;\n }\n }\n\n public static void main(String[] args) {\n FastScanner sc = new FastScanner(System.in);\n long a = sc.nextLong();\n long b = sc.nextLong();\n long c = sc.nextLong();\n BigInteger left = BigInteger.valueOf(1L);\n left = left.multiply(BigInteger.valueOf(4L));\n left = left.multiply(BigInteger.valueOf(a));\n left = left.multiply(BigInteger.valueOf(b));\n BigInteger right = BigInteger.valueOf(1L);\n right = right.multiply(BigInteger.valueOf(c - a - b));\n right = right.multiply(BigInteger.valueOf(c - a - b));\n if (left.compareTo(right) < 0) {\n System.out.println(\"Yes\");\n } else {\n System.out.println(\"No\");\n }\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nDoes \\sqrt{a} + \\sqrt{b} < \\sqrt{c} hold?\n\nConstraints\n\n1 \\leq a, b, c \\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\n\nOutput\n\nIf \\sqrt{a} + \\sqrt{b} < \\sqrt{c}, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 3 9\n\nSample Output 1\n\nNo\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{9} does not hold.\n\nSample Input 2\n\n2 3 10\n\nSample Output 2\n\nYes\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{10} holds.", "sample_input": "2 3 9\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02743", "source_text": "Score : 300 points\n\nProblem Statement\n\nDoes \\sqrt{a} + \\sqrt{b} < \\sqrt{c} hold?\n\nConstraints\n\n1 \\leq a, b, c \\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\n\nOutput\n\nIf \\sqrt{a} + \\sqrt{b} < \\sqrt{c}, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 3 9\n\nSample Output 1\n\nNo\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{9} does not hold.\n\nSample Input 2\n\n2 3 10\n\nSample Output 2\n\nYes\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{10} holds.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2269, "cpu_time_ms": 87, "memory_kb": 22996}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s855731804", "group_id": "codeNet:p02743", "input_text": "import java.util.*;\n\n\npublic class Main {\n\tpublic static void main (String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tdouble a = sc.nextInt();\n\t\tdouble b = sc.nextInt();\n\t\tdouble c = sc.nextInt();\n\t\ta = Math.sqrt(a);\n\t\tb = Math.sqrt(b);\n\t\tc = Math.sqrt(c);\n\t\tif((a+b)/c<1) {\n\t\t\tSystem.out.println(\"Yes\");\n\t\t}\n\t\telse {\n\t\t\tSystem.out.println(\"No\");\n\t\t}\n\t}\t\n}", "language": "Java", "metadata": {"date": 1584239984, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02743.html", "problem_id": "p02743", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02743/input.txt", "sample_output_relpath": "derived/input_output/data/p02743/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02743/Java/s855731804.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s855731804", "user_id": "u172546930"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "import java.util.*;\n\n\npublic class Main {\n\tpublic static void main (String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tdouble a = sc.nextInt();\n\t\tdouble b = sc.nextInt();\n\t\tdouble c = sc.nextInt();\n\t\ta = Math.sqrt(a);\n\t\tb = Math.sqrt(b);\n\t\tc = Math.sqrt(c);\n\t\tif((a+b)/c<1) {\n\t\t\tSystem.out.println(\"Yes\");\n\t\t}\n\t\telse {\n\t\t\tSystem.out.println(\"No\");\n\t\t}\n\t}\t\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nDoes \\sqrt{a} + \\sqrt{b} < \\sqrt{c} hold?\n\nConstraints\n\n1 \\leq a, b, c \\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\n\nOutput\n\nIf \\sqrt{a} + \\sqrt{b} < \\sqrt{c}, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 3 9\n\nSample Output 1\n\nNo\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{9} does not hold.\n\nSample Input 2\n\n2 3 10\n\nSample Output 2\n\nYes\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{10} holds.", "sample_input": "2 3 9\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02743", "source_text": "Score : 300 points\n\nProblem Statement\n\nDoes \\sqrt{a} + \\sqrt{b} < \\sqrt{c} hold?\n\nConstraints\n\n1 \\leq a, b, c \\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\n\nOutput\n\nIf \\sqrt{a} + \\sqrt{b} < \\sqrt{c}, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 3 9\n\nSample Output 1\n\nNo\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{9} does not hold.\n\nSample Input 2\n\n2 3 10\n\nSample Output 2\n\nYes\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{10} holds.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 98, "memory_kb": 23892}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s395988009", "group_id": "codeNet:p02743", "input_text": "import java.util.Scanner;\n \nclass Main{\n public static void main(String args[]){\n Scanner sc = new Scanner(System.in);\n long a = sc.nextLong();\n long b = sc.nextLong();\n long c = sc.nextLong();\n if(c>a+b&&4*a*b<(long)Math.pow(c-a-b,2)){\n System.out.print(\"Yes\");\n } else {\n System.out.print(\"No\");\n }\n }\n}", "language": "Java", "metadata": {"date": 1584239970, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02743.html", "problem_id": "p02743", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02743/input.txt", "sample_output_relpath": "derived/input_output/data/p02743/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02743/Java/s395988009.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s395988009", "user_id": "u750192625"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "import java.util.Scanner;\n \nclass Main{\n public static void main(String args[]){\n Scanner sc = new Scanner(System.in);\n long a = sc.nextLong();\n long b = sc.nextLong();\n long c = sc.nextLong();\n if(c>a+b&&4*a*b<(long)Math.pow(c-a-b,2)){\n System.out.print(\"Yes\");\n } else {\n System.out.print(\"No\");\n }\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nDoes \\sqrt{a} + \\sqrt{b} < \\sqrt{c} hold?\n\nConstraints\n\n1 \\leq a, b, c \\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\n\nOutput\n\nIf \\sqrt{a} + \\sqrt{b} < \\sqrt{c}, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 3 9\n\nSample Output 1\n\nNo\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{9} does not hold.\n\nSample Input 2\n\n2 3 10\n\nSample Output 2\n\nYes\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{10} holds.", "sample_input": "2 3 9\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02743", "source_text": "Score : 300 points\n\nProblem Statement\n\nDoes \\sqrt{a} + \\sqrt{b} < \\sqrt{c} hold?\n\nConstraints\n\n1 \\leq a, b, c \\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\n\nOutput\n\nIf \\sqrt{a} + \\sqrt{b} < \\sqrt{c}, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 3 9\n\nSample Output 1\n\nNo\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{9} does not hold.\n\nSample Input 2\n\n2 3 10\n\nSample Output 2\n\nYes\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{10} holds.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 338, "cpu_time_ms": 97, "memory_kb": 23764}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s332942398", "group_id": "codeNet:p02743", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\t\n\tpublic static void main(String[] args) {\n\t\t\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint ytotal = scanner.nextInt();\n\t\tint xtotal = scanner.nextInt();\n\t\tint c = scanner.nextInt();\n\t\t\n\t\tif(Math.sqrt(xtotal) + Math.sqrt(ytotal) < Math.sqrt(c)) {\n\t\t\tSystem.out.println(\"Yes\");\n\t\t}else {\n\t\t\tSystem.out.println(\"No\");\n\t\t}\n\t\t\n\t}\n\t\t\t\n}", "language": "Java", "metadata": {"date": 1584239960, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02743.html", "problem_id": "p02743", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02743/input.txt", "sample_output_relpath": "derived/input_output/data/p02743/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02743/Java/s332942398.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s332942398", "user_id": "u634549990"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\t\n\tpublic static void main(String[] args) {\n\t\t\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint ytotal = scanner.nextInt();\n\t\tint xtotal = scanner.nextInt();\n\t\tint c = scanner.nextInt();\n\t\t\n\t\tif(Math.sqrt(xtotal) + Math.sqrt(ytotal) < Math.sqrt(c)) {\n\t\t\tSystem.out.println(\"Yes\");\n\t\t}else {\n\t\t\tSystem.out.println(\"No\");\n\t\t}\n\t\t\n\t}\n\t\t\t\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nDoes \\sqrt{a} + \\sqrt{b} < \\sqrt{c} hold?\n\nConstraints\n\n1 \\leq a, b, c \\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\n\nOutput\n\nIf \\sqrt{a} + \\sqrt{b} < \\sqrt{c}, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 3 9\n\nSample Output 1\n\nNo\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{9} does not hold.\n\nSample Input 2\n\n2 3 10\n\nSample Output 2\n\nYes\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{10} holds.", "sample_input": "2 3 9\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02743", "source_text": "Score : 300 points\n\nProblem Statement\n\nDoes \\sqrt{a} + \\sqrt{b} < \\sqrt{c} hold?\n\nConstraints\n\n1 \\leq a, b, c \\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\n\nOutput\n\nIf \\sqrt{a} + \\sqrt{b} < \\sqrt{c}, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 3 9\n\nSample Output 1\n\nNo\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{9} does not hold.\n\nSample Input 2\n\n2 3 10\n\nSample Output 2\n\nYes\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{10} holds.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 383, "cpu_time_ms": 99, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s373270662", "group_id": "codeNet:p02743", "input_text": "import java.util.*;\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n \n int a = sc.nextInt();\n int b = sc.nextInt();\n int c = sc.nextInt();\n \n long aa = (long)Math.sqrt(a);\n if(aa*aa> a) {\n aa--;\n }\n long bb = (long)Math.sqrt(a);\n if(bb*bb > b) {\n bb--;\n }\n \n long cc = (long)Math.sqrt(a);\n if(cc*cc > c) {\n cc--;\n }\n \n \n if (aa + bb < cc) {\n System.out.println(\"Yes\");\n } else {\n System.out.println(\"No\");\n } \n } \n}", "language": "Java", "metadata": {"date": 1584239886, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02743.html", "problem_id": "p02743", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02743/input.txt", "sample_output_relpath": "derived/input_output/data/p02743/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02743/Java/s373270662.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s373270662", "user_id": "u462253630"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n \n int a = sc.nextInt();\n int b = sc.nextInt();\n int c = sc.nextInt();\n \n long aa = (long)Math.sqrt(a);\n if(aa*aa> a) {\n aa--;\n }\n long bb = (long)Math.sqrt(a);\n if(bb*bb > b) {\n bb--;\n }\n \n long cc = (long)Math.sqrt(a);\n if(cc*cc > c) {\n cc--;\n }\n \n \n if (aa + bb < cc) {\n System.out.println(\"Yes\");\n } else {\n System.out.println(\"No\");\n } \n } \n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nDoes \\sqrt{a} + \\sqrt{b} < \\sqrt{c} hold?\n\nConstraints\n\n1 \\leq a, b, c \\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\n\nOutput\n\nIf \\sqrt{a} + \\sqrt{b} < \\sqrt{c}, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 3 9\n\nSample Output 1\n\nNo\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{9} does not hold.\n\nSample Input 2\n\n2 3 10\n\nSample Output 2\n\nYes\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{10} holds.", "sample_input": "2 3 9\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02743", "source_text": "Score : 300 points\n\nProblem Statement\n\nDoes \\sqrt{a} + \\sqrt{b} < \\sqrt{c} hold?\n\nConstraints\n\n1 \\leq a, b, c \\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\n\nOutput\n\nIf \\sqrt{a} + \\sqrt{b} < \\sqrt{c}, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 3 9\n\nSample Output 1\n\nNo\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{9} does not hold.\n\nSample Input 2\n\n2 3 10\n\nSample Output 2\n\nYes\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{10} holds.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 653, "cpu_time_ms": 96, "memory_kb": 23764}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s864476212", "group_id": "codeNet:p02743", "input_text": "\nimport java.util.Scanner;\n\npublic class Main{\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint A = sc.nextInt();\n\t\tint B = sc.nextInt();\n\t\tint C = sc.nextInt();\n\n\t\tdouble ansA = Math.sqrt(A);\n\t\tdouble ansB = Math.sqrt(B);\n\t\tdouble ansC = Math.sqrt(C);\n\t\t\n\t\tdouble AB = ansA + ansB;\n\n\t\tif (AB = 0){\n\t\t\tif(4*a*b < c*c-2*a*c-2*b*c+a*a+2*a*b+b*b){\n\t\t\t\tSystem.out.println(\"Yes\");\n\t\t\t}else{\n\t\t\t\tSystem.out.println(\"No\");\n\t\t\t}\n\t\t}else{\n\t\t\tSystem.out.println(\"No\");\n\t\t}\n\t}\n}\n", "language": "Java", "metadata": {"date": 1584238962, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02743.html", "problem_id": "p02743", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02743/input.txt", "sample_output_relpath": "derived/input_output/data/p02743/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02743/Java/s506752538.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s506752538", "user_id": "u685049671"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tlong a = sc.nextLong();\n\t\tlong b = sc.nextLong();\n\t\tlong c = sc.nextLong();\n\t\tif(c-a-b >= 0){\n\t\t\tif(4*a*b < c*c-2*a*c-2*b*c+a*a+2*a*b+b*b){\n\t\t\t\tSystem.out.println(\"Yes\");\n\t\t\t}else{\n\t\t\t\tSystem.out.println(\"No\");\n\t\t\t}\n\t\t}else{\n\t\t\tSystem.out.println(\"No\");\n\t\t}\n\t}\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nDoes \\sqrt{a} + \\sqrt{b} < \\sqrt{c} hold?\n\nConstraints\n\n1 \\leq a, b, c \\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\n\nOutput\n\nIf \\sqrt{a} + \\sqrt{b} < \\sqrt{c}, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 3 9\n\nSample Output 1\n\nNo\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{9} does not hold.\n\nSample Input 2\n\n2 3 10\n\nSample Output 2\n\nYes\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{10} holds.", "sample_input": "2 3 9\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02743", "source_text": "Score : 300 points\n\nProblem Statement\n\nDoes \\sqrt{a} + \\sqrt{b} < \\sqrt{c} hold?\n\nConstraints\n\n1 \\leq a, b, c \\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\n\nOutput\n\nIf \\sqrt{a} + \\sqrt{b} < \\sqrt{c}, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 3 9\n\nSample Output 1\n\nNo\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{9} does not hold.\n\nSample Input 2\n\n2 3 10\n\nSample Output 2\n\nYes\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{10} holds.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 393, "cpu_time_ms": 94, "memory_kb": 23252}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s267319546", "group_id": "codeNet:p02743", "input_text": "import java.util.*;\nimport java.io.PrintWriter;\npublic class Main{\n\tpublic static void main(String[] args){\n\t\tScanner sc=new Scanner(System.in);\n\t\tdouble a=sc.nextDouble();\n\t\tdouble b=sc.nextDouble();\n\t\tdouble c=sc.nextDouble();\n\t\tif((-a-b+c)*(-a-b+c)/4>a*b){\n\t\t\tSystem.out.println(\"Yes\");\n\t\t}else{\n\t\t\tSystem.out.println(\"No\");\n\t\t}\n\t}\n}\n", "language": "Java", "metadata": {"date": 1584238732, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02743.html", "problem_id": "p02743", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02743/input.txt", "sample_output_relpath": "derived/input_output/data/p02743/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02743/Java/s267319546.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s267319546", "user_id": "u504228740"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "import java.util.*;\nimport java.io.PrintWriter;\npublic class Main{\n\tpublic static void main(String[] args){\n\t\tScanner sc=new Scanner(System.in);\n\t\tdouble a=sc.nextDouble();\n\t\tdouble b=sc.nextDouble();\n\t\tdouble c=sc.nextDouble();\n\t\tif((-a-b+c)*(-a-b+c)/4>a*b){\n\t\t\tSystem.out.println(\"Yes\");\n\t\t}else{\n\t\t\tSystem.out.println(\"No\");\n\t\t}\n\t}\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nDoes \\sqrt{a} + \\sqrt{b} < \\sqrt{c} hold?\n\nConstraints\n\n1 \\leq a, b, c \\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\n\nOutput\n\nIf \\sqrt{a} + \\sqrt{b} < \\sqrt{c}, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 3 9\n\nSample Output 1\n\nNo\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{9} does not hold.\n\nSample Input 2\n\n2 3 10\n\nSample Output 2\n\nYes\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{10} holds.", "sample_input": "2 3 9\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02743", "source_text": "Score : 300 points\n\nProblem Statement\n\nDoes \\sqrt{a} + \\sqrt{b} < \\sqrt{c} hold?\n\nConstraints\n\n1 \\leq a, b, c \\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\n\nOutput\n\nIf \\sqrt{a} + \\sqrt{b} < \\sqrt{c}, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 3 9\n\nSample Output 1\n\nNo\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{9} does not hold.\n\nSample Input 2\n\n2 3 10\n\nSample Output 2\n\nYes\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{10} holds.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 116, "memory_kb": 23124}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s160641327", "group_id": "codeNet:p02743", "input_text": "import java.util.*;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\t\t\n\t\tlong a = sc.nextLong();\t\t\n\t\tlong b = sc.nextLong();\n\t\tlong c = sc.nextLong();\n\t\tdouble x = lessThanSqrt(a)+lessThanSqrt(b);\n\t\tdouble y = lessThanSqrt(c);\n\t\t\tif(x a) {\n\t\t\t\t\tb--;\n\t\t\t\t}\n\t\t\t\treturn b;\n\t\t\t}\n\t\t\n\t\t\n\n\t}\t", "language": "Java", "metadata": {"date": 1584238312, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02743.html", "problem_id": "p02743", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02743/input.txt", "sample_output_relpath": "derived/input_output/data/p02743/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02743/Java/s160641327.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s160641327", "user_id": "u911912079"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\t\t\n\t\tlong a = sc.nextLong();\t\t\n\t\tlong b = sc.nextLong();\n\t\tlong c = sc.nextLong();\n\t\tdouble x = lessThanSqrt(a)+lessThanSqrt(b);\n\t\tdouble y = lessThanSqrt(c);\n\t\t\tif(x a) {\n\t\t\t\t\tb--;\n\t\t\t\t}\n\t\t\t\treturn b;\n\t\t\t}\n\t\t\n\t\t\n\n\t}\t", "problem_context": "Score : 300 points\n\nProblem Statement\n\nDoes \\sqrt{a} + \\sqrt{b} < \\sqrt{c} hold?\n\nConstraints\n\n1 \\leq a, b, c \\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\n\nOutput\n\nIf \\sqrt{a} + \\sqrt{b} < \\sqrt{c}, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 3 9\n\nSample Output 1\n\nNo\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{9} does not hold.\n\nSample Input 2\n\n2 3 10\n\nSample Output 2\n\nYes\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{10} holds.", "sample_input": "2 3 9\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02743", "source_text": "Score : 300 points\n\nProblem Statement\n\nDoes \\sqrt{a} + \\sqrt{b} < \\sqrt{c} hold?\n\nConstraints\n\n1 \\leq a, b, c \\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\n\nOutput\n\nIf \\sqrt{a} + \\sqrt{b} < \\sqrt{c}, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 3 9\n\nSample Output 1\n\nNo\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{9} does not hold.\n\nSample Input 2\n\n2 3 10\n\nSample Output 2\n\nYes\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{10} holds.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 818, "cpu_time_ms": 94, "memory_kb": 23764}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s606654311", "group_id": "codeNet:p02743", "input_text": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.math.BigInteger;\nimport java.util.StringTokenizer;\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner(System.in);\n\t\tlong a = sc.nextLong(), b = sc.nextLong(), c = sc.nextLong();\n\t\tif(c-a-b <= 0) {\n\t\t\tSystem.out.println(\"No\");\n\t\t}else {\n\t\t\tBigInteger left = BigInteger.valueOf((long)Math.pow(c-a-b, 2));\n\t\t\tBigInteger right = BigInteger.valueOf(4*a*b);\n\t\tif(left.compareTo(right) == 1) {\n\t\t\tSystem.out.println(\"Yes\");\n\t\t}else {\n\t\t\tSystem.out.println(\"No\");\n\t\t}\n\t\t}\n\t}\n\n\tstatic class FastScanner {\n\t\tprivate BufferedReader reader = null;\n\t private StringTokenizer tokenizer = null;\n\t public FastScanner(InputStream in) {\n\t reader = new BufferedReader(new InputStreamReader(in));\n\t tokenizer = null;\n\t }\n\n\t public String next() {\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t tokenizer = new StringTokenizer(reader.readLine());\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\t return tokenizer.nextToken();\n\t }\n\n\t public String nextLine() {\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t return reader.readLine();\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\n\t return tokenizer.nextToken(\"\\n\");\n\t }\n\n\t public long nextLong() {\n\t return Long.parseLong(next());\n\t }\n\n\t public int nextInt() {\n\t return Integer.parseInt(next());\n\t }\n\n\t public double nextDouble() {\n\t return Double.parseDouble(next());\n\t }\n\n\t public int[] nextIntArray(int n) {\n\t int[] a = new int[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextInt();\n\t return a;\n\t }\n\n\t public long[] nextLongArray(int n) {\n\t long[] a = new long[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextLong();\n\t return a;\n\t }\n\t}\n}", "language": "Java", "metadata": {"date": 1584238009, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02743.html", "problem_id": "p02743", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02743/input.txt", "sample_output_relpath": "derived/input_output/data/p02743/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02743/Java/s606654311.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s606654311", "user_id": "u368078055"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.math.BigInteger;\nimport java.util.StringTokenizer;\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner(System.in);\n\t\tlong a = sc.nextLong(), b = sc.nextLong(), c = sc.nextLong();\n\t\tif(c-a-b <= 0) {\n\t\t\tSystem.out.println(\"No\");\n\t\t}else {\n\t\t\tBigInteger left = BigInteger.valueOf((long)Math.pow(c-a-b, 2));\n\t\t\tBigInteger right = BigInteger.valueOf(4*a*b);\n\t\tif(left.compareTo(right) == 1) {\n\t\t\tSystem.out.println(\"Yes\");\n\t\t}else {\n\t\t\tSystem.out.println(\"No\");\n\t\t}\n\t\t}\n\t}\n\n\tstatic class FastScanner {\n\t\tprivate BufferedReader reader = null;\n\t private StringTokenizer tokenizer = null;\n\t public FastScanner(InputStream in) {\n\t reader = new BufferedReader(new InputStreamReader(in));\n\t tokenizer = null;\n\t }\n\n\t public String next() {\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t tokenizer = new StringTokenizer(reader.readLine());\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\t return tokenizer.nextToken();\n\t }\n\n\t public String nextLine() {\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t return reader.readLine();\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\n\t return tokenizer.nextToken(\"\\n\");\n\t }\n\n\t public long nextLong() {\n\t return Long.parseLong(next());\n\t }\n\n\t public int nextInt() {\n\t return Integer.parseInt(next());\n\t }\n\n\t public double nextDouble() {\n\t return Double.parseDouble(next());\n\t }\n\n\t public int[] nextIntArray(int n) {\n\t int[] a = new int[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextInt();\n\t return a;\n\t }\n\n\t public long[] nextLongArray(int n) {\n\t long[] a = new long[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextLong();\n\t return a;\n\t }\n\t}\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nDoes \\sqrt{a} + \\sqrt{b} < \\sqrt{c} hold?\n\nConstraints\n\n1 \\leq a, b, c \\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\n\nOutput\n\nIf \\sqrt{a} + \\sqrt{b} < \\sqrt{c}, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 3 9\n\nSample Output 1\n\nNo\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{9} does not hold.\n\nSample Input 2\n\n2 3 10\n\nSample Output 2\n\nYes\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{10} holds.", "sample_input": "2 3 9\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02743", "source_text": "Score : 300 points\n\nProblem Statement\n\nDoes \\sqrt{a} + \\sqrt{b} < \\sqrt{c} hold?\n\nConstraints\n\n1 \\leq a, b, c \\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\n\nOutput\n\nIf \\sqrt{a} + \\sqrt{b} < \\sqrt{c}, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 3 9\n\nSample Output 1\n\nNo\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{9} does not hold.\n\nSample Input 2\n\n2 3 10\n\nSample Output 2\n\nYes\n\n\\sqrt{2} + \\sqrt{3} < \\sqrt{10} holds.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2151, "cpu_time_ms": 82, "memory_kb": 22612}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s747159546", "group_id": "codeNet:p02743", "input_text": "import java.util.Scanner;\npublic class Main{\n public static void main(String[] args) {\n Scanner kbd = new Scanner(System.in);\n int a=kbd.nextInt();\n int b=kbd.nextInt();\n int c=kbd.nextInt();\n long a2 = (long)Math.sqrt(a);\n long b2 = (long)Math.sqrt(b);\n long c2 = (long)Math.sqrt(c);\n\n if(a2+b21) {\n\t\t\tmid = (upperBorder + lowerBorder)/2;\n\t\t\tif(orderedArray[mid]<=num) {\n\t\t\t\tlowerBorder = mid;\n\t\t\t}else {\n\t\t\t\tupperBorder = mid;\n\t\t\t}\n\t\t}\n\t\treturn lowerBorder;\n\t}\n\n\t//二分探索\n\t//k <= num となる最小のList要素kのインデックスを返す\n\tstatic private int binarySearch(long num, ArrayList orderedList){\n\t\tint lowerBorder = -1;\n\t\tint upperBorder = orderedList.size();\n\t\tint mid;\n\n\t\twhile(upperBorder - lowerBorder >1) {\n\t\t\tmid = (upperBorder + lowerBorder)/2;\n\t\t\tif(orderedList.get(mid)<=num) {\n\t\t\t\tlowerBorder = mid;\n\t\t\t}else {\n\t\t\t\tupperBorder = mid;\n\t\t\t}\n\t\t}\n\t\treturn lowerBorder;\n\t}\n\n\t//aとbの最小公倍数を求める\n\tpublic static int gcd(int a, int b) {\n\t\treturn b == 0 ? a: gcd(b, a % b);\n\t}\n\tpublic static long gcd(long a, long b) {\n\t\treturn b == 0 ? a: gcd(b, a % b);\n\t}\n\n\t//Union-Find用の配列を要素数nで初期化\n\tstatic void ufInit(int n){\n\t\tparent = new int[n];\n\t\trank = new int[n];\n\t}\n\n\t//Union-Findの要素の最上位の親(グループ名)を返す\n\tstatic int ufFind(int a) {\n\t\tif(parent[a]==a) {\n\t\t\treturn a;\n\t\t}else {\n\t\t\treturn ufFind(parent[a]);\n\t\t}\n\t}\n\n\t//Union-Find木を連結する\n\tstatic void ufUnite(int a, int b) {\n\t\ta = parent[a];\n\t\tb = parent[b];\n\n\t\tif(a==b) {\n\t\t\treturn;\n\t\t}\n\t\tif(rank[a] > rank[b]){\n\t\t\tparent[b]=a;\n\t\t}else {\n\t\t\tparent[a]=b;\n\t\t\tif(rank[a]==rank[b]) {\n\t\t\t\trank[b]++;\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic boolean ufSame(int a, int b) {\n\t\treturn ufFind(a)==ufFind(b);\n\t}\n}\n", "language": "Java", "metadata": {"date": 1596953130, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02761.html", "problem_id": "p02761", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02761/input.txt", "sample_output_relpath": "derived/input_output/data/p02761/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02761/Java/s329626122.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s329626122", "user_id": "u784982404"}, "prompt_components": {"gold_output": "702\n", "input_to_evaluate": "import java.io.IOException;\nimport java.util.ArrayList;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tstatic int[][] map;\n\tstatic int[][] directions8= {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};\n\tstatic int[][] directions4= {{-1,0},{1,0},{0,-1},{0,1}};\n\tstatic long ans;\n\tstatic int[] parent;//union-find用\n\tstatic int[] rank;//union-find用\n\n\tpublic static void main(String[] args) throws IOException {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tint M = sc.nextInt();\n\n\t\tint[] s = new int[M];\n\t\tint[] c = new int[M];\n\n\t\tfor(int i = 0;i1) {\n\t\t\tmid = (upperBorder + lowerBorder)/2;\n\t\t\tif(orderedArray[mid]<=num) {\n\t\t\t\tlowerBorder = mid;\n\t\t\t}else {\n\t\t\t\tupperBorder = mid;\n\t\t\t}\n\t\t}\n\t\treturn lowerBorder;\n\t}\n\n\t//二分探索\n\t//k <= num となる最小のList要素kのインデックスを返す\n\tstatic private int binarySearch(long num, ArrayList orderedList){\n\t\tint lowerBorder = -1;\n\t\tint upperBorder = orderedList.size();\n\t\tint mid;\n\n\t\twhile(upperBorder - lowerBorder >1) {\n\t\t\tmid = (upperBorder + lowerBorder)/2;\n\t\t\tif(orderedList.get(mid)<=num) {\n\t\t\t\tlowerBorder = mid;\n\t\t\t}else {\n\t\t\t\tupperBorder = mid;\n\t\t\t}\n\t\t}\n\t\treturn lowerBorder;\n\t}\n\n\t//aとbの最小公倍数を求める\n\tpublic static int gcd(int a, int b) {\n\t\treturn b == 0 ? a: gcd(b, a % b);\n\t}\n\tpublic static long gcd(long a, long b) {\n\t\treturn b == 0 ? a: gcd(b, a % b);\n\t}\n\n\t//Union-Find用の配列を要素数nで初期化\n\tstatic void ufInit(int n){\n\t\tparent = new int[n];\n\t\trank = new int[n];\n\t}\n\n\t//Union-Findの要素の最上位の親(グループ名)を返す\n\tstatic int ufFind(int a) {\n\t\tif(parent[a]==a) {\n\t\t\treturn a;\n\t\t}else {\n\t\t\treturn ufFind(parent[a]);\n\t\t}\n\t}\n\n\t//Union-Find木を連結する\n\tstatic void ufUnite(int a, int b) {\n\t\ta = parent[a];\n\t\tb = parent[b];\n\n\t\tif(a==b) {\n\t\t\treturn;\n\t\t}\n\t\tif(rank[a] > rank[b]){\n\t\t\tparent[b]=a;\n\t\t}else {\n\t\t\tparent[a]=b;\n\t\t\tif(rank[a]==rank[b]) {\n\t\t\t\trank[b]++;\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic boolean ufSame(int a, int b) {\n\t\treturn ufFind(a)==ufFind(b);\n\t}\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "sample_input": "3 3\n1 7\n3 2\n1 7\n"}, "reference_outputs": ["702\n"], "source_document_id": "p02761", "source_text": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3372, "cpu_time_ms": 120, "memory_kb": 35800}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s902283359", "group_id": "codeNet:p02761", "input_text": "import java.util.*;\n\nclass Main {\n\n\tstatic Scanner sc = new Scanner(System.in);\n\n\tpublic static void main(String[] args) {\n\t\tint N=sc.nextInt(),M=sc.nextInt(),s[]=new int[M],c[]=new int[M];\n\t\tMap a=new HashMap();\n\t\tint ans=0;\n\t\tfor(int i=0;i a=new HashMap();\n\t\tint ans=0;\n\t\tfor(int i=0;i 0 ; i--) {\n ans += num[i] * digit;\n digit *= 10;\n }\n\n System.out.println(ans);\n }\n}\n", "language": "Java", "metadata": {"date": 1592488482, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02761.html", "problem_id": "p02761", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02761/input.txt", "sample_output_relpath": "derived/input_output/data/p02761/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02761/Java/s928014217.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s928014217", "user_id": "u230831496"}, "prompt_components": {"gold_output": "702\n", "input_to_evaluate": "\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n\n int N = scanner.nextInt();\n int M = scanner.nextInt();\n int[] num = new int[N + 1];\n\n for (int i = 0 ; i < M ; i++) {\n int si = scanner.nextInt();\n int ci = scanner.nextInt();\n\n if (si == 1 && ci == 0) {\n System.out.println(-1);\n return;\n }\n if (num[si] != 0 && num[si] != ci) {\n System.out.println(-1);\n return;\n }\n num[si] = ci;\n }\n if (num[1] == 0) num[1] = 1;\n\n int ans = 0;\n int digit = 1;\n for (int i = N ; i > 0 ; i--) {\n ans += num[i] * digit;\n digit *= 10;\n }\n\n System.out.println(ans);\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "sample_input": "3 3\n1 7\n3 2\n1 7\n"}, "reference_outputs": ["702\n"], "source_document_id": "p02761", "source_text": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 885, "cpu_time_ms": 98, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s217785908", "group_id": "codeNet:p02761", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint n = sc.nextInt();\n\t\tint m = sc.nextInt();\n\t\tint[][] a = new int[m][2];\n\n\t\tint i = 0;\n\t\twhile(i < m) {\n\t\t\ta[i][0] = sc.nextInt();\n\t\t\ta[i][1] = sc.nextInt();\n\t\t\ti++;\n\t\t}\n\t\tint[] z = new int[n];\n\t\tfor(i = 0; i < n; i++) {\n\t\t\tz[i] = 10;\n\t\t}\n\n\t\tboolean flag = true;\n\n\t\tfor(i = 0; i < m; i++) {\n\t\t\tif(z[a[i][0]-1] == 10 || z[a[i][0]-1] == a[i][1]) {\n\t\t\t\tz[a[i][0]-1] = a[i][1];\n\t\t\t}else {\n\t\t\t\tflag = false;\n\t\t\t}\n\t\t}\n\t\tif(z[0] ==0 && n>1) {\n\t\t\tflag = false;\n\t\t}\n\t\tif(flag == true) {\n\t\t\tfor(i = 0; i < n; i++) {\n\t\t\t\tif(z[i]==10) {\n\t\t\t\t\tz[i]=0;\n\t\t\t\t}\n\t\t\t\tSystem.out.print(z[i]);\n\t\t\t}\n\t\t}else {\n\t\t\tSystem.out.println(-1);\n\t\t}\n\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1588198081, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02761.html", "problem_id": "p02761", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02761/input.txt", "sample_output_relpath": "derived/input_output/data/p02761/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02761/Java/s217785908.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s217785908", "user_id": "u640845358"}, "prompt_components": {"gold_output": "702\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint n = sc.nextInt();\n\t\tint m = sc.nextInt();\n\t\tint[][] a = new int[m][2];\n\n\t\tint i = 0;\n\t\twhile(i < m) {\n\t\t\ta[i][0] = sc.nextInt();\n\t\t\ta[i][1] = sc.nextInt();\n\t\t\ti++;\n\t\t}\n\t\tint[] z = new int[n];\n\t\tfor(i = 0; i < n; i++) {\n\t\t\tz[i] = 10;\n\t\t}\n\n\t\tboolean flag = true;\n\n\t\tfor(i = 0; i < m; i++) {\n\t\t\tif(z[a[i][0]-1] == 10 || z[a[i][0]-1] == a[i][1]) {\n\t\t\t\tz[a[i][0]-1] = a[i][1];\n\t\t\t}else {\n\t\t\t\tflag = false;\n\t\t\t}\n\t\t}\n\t\tif(z[0] ==0 && n>1) {\n\t\t\tflag = false;\n\t\t}\n\t\tif(flag == true) {\n\t\t\tfor(i = 0; i < n; i++) {\n\t\t\t\tif(z[i]==10) {\n\t\t\t\t\tz[i]=0;\n\t\t\t\t}\n\t\t\t\tSystem.out.print(z[i]);\n\t\t\t}\n\t\t}else {\n\t\t\tSystem.out.println(-1);\n\t\t}\n\n\t}\n\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "sample_input": "3 3\n1 7\n3 2\n1 7\n"}, "reference_outputs": ["702\n"], "source_document_id": "p02761", "source_text": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 816, "cpu_time_ms": 95, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s005569154", "group_id": "codeNet:p02761", "input_text": "import java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\t//List list=new ArrayList(Arrays.asList(s.split(\"\")));\n\t\t//List list=new ArrayList();\n\t\t//int[][] array = new int[3][3];\n\t\tint n = sc.nextInt();\n\t\tint m = sc.nextInt();\n\t\tList list_answer=new ArrayList();\n\t\tList list_keta = new ArrayList();\n\t\tList list_su = new ArrayList();\n\t\tfor(int i=0;m>i;i++) {\n\t\t\tint s = sc.nextInt();\n\t\t\tint c = sc.nextInt();\n\t\t\tlist_keta.add(s);\n\t\t\tlist_su.add(c);\n\t\t}\n\n\t\tif(n==1) {\n\t\t\tfor(int j=0;10>j;j++) {\n\t\t\t\tint count=0;\n\t\t\t\tString x = String.valueOf(j);\n\t\t\t\tList list=new ArrayList(Arrays.asList(x.split(\"\")));\n\t\t\t\tfor(int i=0;m>i;i++) {\n\t\t\t\t\tString y = String.valueOf(list_su.get(i));\n\t\t\t\t\tif(list.get(list_keta.get(i)-1).equals(y))\n\t\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t\tif(count==m)\n\t\t\t\t\tlist_answer.add(j);\n\t\t\t}\n\t\t}\n\n\t\telse if(n==2) {\n\t\t\tfor(int j=10;100>j;j++) {\n\t\t\t\tint count=0;\n\t\t\t\tString x = String.valueOf(j);\n\t\t\t\tList list=new ArrayList(Arrays.asList(x.split(\"\")));\n\t\t\t\tfor(int i=0;m>i;i++) {\n\t\t\t\t\tString y = String.valueOf(list_su.get(i));\n\t\t\t\t\tif(list.get(list_keta.get(i)-1).equals(y))\n\t\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t\tif(count==m)\n\t\t\t\t\tlist_answer.add(j);\n\t\t\t}\n\n\t\t}\n\n\t\telse {\n\t\t\tfor(int j=100;1000>j;j++) {\n\t\t\t\tint count=0;\n\t\t\t\tString x = String.valueOf(j);\n\t\t\t\tList list=new ArrayList(Arrays.asList(x.split(\"\")));\n\t\t\t\tfor(int i=0;m>i;i++) {\n\t\t\t\t\tString y = String.valueOf(list_su.get(i));\n\t\t\t\t\tif(list.get(list_keta.get(i)-1).equals(y))\n\t\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t\tif(count==m)\n\t\t\t\t\tlist_answer.add(j);\n\t\t\t}\n\n\t\t}\n\n\t\tif(list_answer.size()==0)\n\t\t\tSystem.out.println(-1);\n\t\telse\n\t\t\tSystem.out.println(Collections.min(list_answer));\n\t}\n}", "language": "Java", "metadata": {"date": 1586831131, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02761.html", "problem_id": "p02761", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02761/input.txt", "sample_output_relpath": "derived/input_output/data/p02761/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02761/Java/s005569154.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s005569154", "user_id": "u543569321"}, "prompt_components": {"gold_output": "702\n", "input_to_evaluate": "import java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\t//List list=new ArrayList(Arrays.asList(s.split(\"\")));\n\t\t//List list=new ArrayList();\n\t\t//int[][] array = new int[3][3];\n\t\tint n = sc.nextInt();\n\t\tint m = sc.nextInt();\n\t\tList list_answer=new ArrayList();\n\t\tList list_keta = new ArrayList();\n\t\tList list_su = new ArrayList();\n\t\tfor(int i=0;m>i;i++) {\n\t\t\tint s = sc.nextInt();\n\t\t\tint c = sc.nextInt();\n\t\t\tlist_keta.add(s);\n\t\t\tlist_su.add(c);\n\t\t}\n\n\t\tif(n==1) {\n\t\t\tfor(int j=0;10>j;j++) {\n\t\t\t\tint count=0;\n\t\t\t\tString x = String.valueOf(j);\n\t\t\t\tList list=new ArrayList(Arrays.asList(x.split(\"\")));\n\t\t\t\tfor(int i=0;m>i;i++) {\n\t\t\t\t\tString y = String.valueOf(list_su.get(i));\n\t\t\t\t\tif(list.get(list_keta.get(i)-1).equals(y))\n\t\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t\tif(count==m)\n\t\t\t\t\tlist_answer.add(j);\n\t\t\t}\n\t\t}\n\n\t\telse if(n==2) {\n\t\t\tfor(int j=10;100>j;j++) {\n\t\t\t\tint count=0;\n\t\t\t\tString x = String.valueOf(j);\n\t\t\t\tList list=new ArrayList(Arrays.asList(x.split(\"\")));\n\t\t\t\tfor(int i=0;m>i;i++) {\n\t\t\t\t\tString y = String.valueOf(list_su.get(i));\n\t\t\t\t\tif(list.get(list_keta.get(i)-1).equals(y))\n\t\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t\tif(count==m)\n\t\t\t\t\tlist_answer.add(j);\n\t\t\t}\n\n\t\t}\n\n\t\telse {\n\t\t\tfor(int j=100;1000>j;j++) {\n\t\t\t\tint count=0;\n\t\t\t\tString x = String.valueOf(j);\n\t\t\t\tList list=new ArrayList(Arrays.asList(x.split(\"\")));\n\t\t\t\tfor(int i=0;m>i;i++) {\n\t\t\t\t\tString y = String.valueOf(list_su.get(i));\n\t\t\t\t\tif(list.get(list_keta.get(i)-1).equals(y))\n\t\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t\tif(count==m)\n\t\t\t\t\tlist_answer.add(j);\n\t\t\t}\n\n\t\t}\n\n\t\tif(list_answer.size()==0)\n\t\t\tSystem.out.println(-1);\n\t\telse\n\t\t\tSystem.out.println(Collections.min(list_answer));\n\t}\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "sample_input": "3 3\n1 7\n3 2\n1 7\n"}, "reference_outputs": ["702\n"], "source_document_id": "p02761", "source_text": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1927, "cpu_time_ms": 136, "memory_kb": 23124}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s573644890", "group_id": "codeNet:p02761", "input_text": "import java.io.BufferedReader;\nimport java.io.FileReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.io.ObjectInputStream.GetField;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.LinkedList;\nimport java.util.Map.Entry;\nimport java.util.PriorityQueue;\nimport java.util.Queue;\nimport java.util.Scanner;\nimport java.util.StringTokenizer;\nimport java.util.TreeMap;\nimport java.util.TreeSet;\n\npublic class Main {\n\tstatic ArrayList adj[];\n\tstatic PrintWriter out = new PrintWriter(System.out);\n\tpublic static long mod;\n\n\tstatic long notmemo[][][];\n\tstatic int k;\n\tstatic int a[];\n\tstatic int b[];\n\tstatic int m;\n\tstatic char c[];\n\n\n\tstatic int trace[];\n\tstatic int h;\n\tstatic int x;\n\tstatic int ans1;\n\tstatic int ans2;\n static char t[];\n\tstatic char l[];\n\tstatic char r[];\n public static void main(String args[]) throws IOException {\n\t\tScanner sc = new Scanner(System.in);\n int n=sc.nextInt();\n int m=sc.nextInt();\n TreeSet set=new TreeSet<>();\n int a[]=new int[n];\n while(m-->0) {\n \tint s=sc.nextInt();\n \tint c=sc.nextInt();\n \tif(set.contains(s)&&c!=a[s-1]) {\n \tSystem.out.println(-1);\n \treturn;\n \t}\n \telse\n \ta[s-1]=c;\n \tset.add(s);\n \t\n }\n boolean f=false;\n for (int i = 0; i < a.length&&n>1; i++) {\n\t\tif(a[i]==0&&!f) {\n\t\t\tSystem.out.println(-1);\n\t\t\treturn;\n\t\t}\n\t\telse if(a[i]!=0&&!f) {\n\t\t\tf=true;\n\t\t}\n\t}\n for(int x:a) {\n \tSystem.out.print(x);\n }\n }\n\tpublic static int solve(char m[]) {\n\t\tint count[]=new int[c.length+1];\n\t\tfor (int i = 1; i < count.length; i++) {\n\t\t\tcount[i]=count[i-1]+((m[i-1]==c[i-1])? 1:0);\n\t\t}\n\t\tint ans=(int) 1e9;\n\t\tfor (int i = 0; i 3) {\n\t\t\t return 0;\n\t\t }\n\t\t if(idx==h) {\n\t\t\t return 1;\n\t\t }\n\t\t if(notmemo[idx][count][state]!=-1) {\n\t\t\t return notmemo[idx][count][state];\n\t\t }\n\t\t //System.out.println(\"the sun will come out tommorow \"+count);\n\t\t long ans=0;\n\t\t for (int i = 0; i <=9; i++) {\n\t\t\tif(state==1&&i!=0) {\n\t\t\t\tans+=dp(idx+1, count+1, state);\n\t\t\t}\n\t\t\telse if(i==0&&(l[idx]!='0'||state==1)) {\n\t\t\t\tans+=dp(idx+1, count, 1);\t\t\n\t\t\t}\n\t\t\telse if(i==0&&(l[idx]=='0'&&state==0)) {\n\t\t\t\tans+=dp(idx+1, count, state);\t\t\n\t\t\t}\n\t\t\telse if(state==0&&i==(Integer.parseInt(\"\"+l[idx]))) {\n\t\t\t\tans+=dp(idx+1, count+1, state);\t\n\t\t\t}\n\t\t\n\t\t\telse if(state==0&&i<(Integer.parseInt(\"\"+l[idx]))) {\n\t\t\t\tans+=dp(idx+1, count+1,1);\t\t\t\t\t\n\t\t }\n\t\t \n\t\n }\t\n\n\treturn notmemo[idx][count][state]=ans;\n\t }\n\n\tstatic class book implements Comparable {\n\t\tint idx;\n\t\tlong score;\n\n\t\tpublic book(int i, long s) {\n\t\t\tidx = i;\n\t\t\tscore = s;\n\t\t}\n\n\t\tpublic int compareTo(book o) {\n\t\t\treturn (int) (o.score - score);\n\t\t}\n\t}\n\n\tstatic class library implements Comparable {\n\t\tint numofbooks;\n\t\tint signup;\n\t\tint shiprate;\n\t\tint idx;\n\n\t\tpublic library(int a, int b, int c, int idx) {\n\t\t\tnumofbooks = a;\n\t\t\tsignup = b;\n\t\t\tshiprate = c;\n\t\t\tthis.idx = idx;\n\t\t}\n\n\t\t@Override\n\t\tpublic int compareTo(library o) {\n\t\tif(signup==o.signup) {\n\t\t\t return o.numofbooks-numofbooks;\n\t\t}\n\t\treturn signup - o.signup;\n\t\t\n\t\t}\n\t}\n\n\n\t\n\tstatic boolean isPal(String s) {\n\t\tint j = s.length() - 1;\n\t\tc = s.toCharArray();\n\t\tArrays.sort(c);\n\t\tfor (int i = 0; i < c.length; i++) {\n\n\t\t}\n\t\treturn true;\n\t}\n\n\tstatic String s;\n\n\tstatic boolean isOn(int S, int j) {\n\t\treturn (S & 1 << j) != 0;\n\t}\n\n\tstatic int y, d;\n\n\tstatic void extendedEuclid(int a, int b) {\n\t\tif (b == 0) {\n\t\t\tx = 1;\n\t\t\ty = 0;\n\t\t\td = a;\n\t\t\treturn;\n\t\t}\n\t\textendedEuclid(b, a % b);\n\t\tint x1 = y;\n\t\tint y1 = x - a / b * y;\n\t\tx = x1;\n\t\ty = y1;\n\t}\n\n\tstatic boolean f = true;\n\n\tstatic class SegmentTree { // 1-based DS, OOP\n\n\t\tint N; // the number of elements in the array as a power of 2 (i.e. after padding)\n\t\tint[] array, sTree, lazy;\n\n\t\tSegmentTree(int[] in) {\n\t\t\tarray = in;\n\t\t\tN = in.length - 1;\n\t\t\tsTree = new int[N << 1]; // no. of nodes = 2*N - 1, we add one to cross out index zero\n\t\t\tlazy = new int[N << 1];\n\t\t\tbuild(1, 1, N);\n\t\t}\n\n\t\tvoid build(int node, int b, int e) // O(n)\n\t\t{\n\t\t\tif (b == e)\n\t\t\t\tsTree[node] = array[b];\n\t\t\telse {\n\t\t\t\tint mid = b + e >> 1;\n\t\t\t\tbuild(node << 1, b, mid);\n\t\t\t\tbuild(node << 1 | 1, mid + 1, e);\n\t\t\t\tsTree[node] = sTree[node << 1] + sTree[node << 1 | 1];\n\t\t\t}\n\t\t}\n\n\t\tvoid update_point(int index, int val) // O(log n)\n\t\t{\n\t\t\tindex += N - 1;\n\t\t\tsTree[index] += val;\n\t\t\twhile (index > 1) {\n\t\t\t\tindex >>= 1;\n\t\t\t\tsTree[index] = Math.max(sTree[index << 1], sTree[index << 1 | 1]);\n\t\t\t}\n\t\t}\n\n\t\tvoid update_range(int i, int j, int val) // O(log n)\n\t\t{\n\t\t\tupdate_range(1, 1, N, i, j, val);\n\t\t}\n\n\t\tvoid update_range(int node, int b, int e, int i, int j, int val) {\n\t\t\tif (i > e || j < b)\n\t\t\t\treturn;\n\t\t\tif (b >= i && e <= j) {\n\t\t\t\tsTree[node] += (e - b + 1) * val;\n\t\t\t\tlazy[node] += val;\n\t\t\t} else {\n\t\t\t\tint mid = b + e >> 1;\n\t\t\t\tpropagate(node, b, mid, e);\n\t\t\t\tupdate_range(node << 1, b, mid, i, j, val);\n\t\t\t\tupdate_range(node << 1 | 1, mid + 1, e, i, j, val);\n\t\t\t\tsTree[node] = sTree[node << 1] + sTree[node << 1 | 1];\n\t\t\t}\n\n\t\t}\n\n\t\tvoid propagate(int node, int b, int mid, int e) {\n\t\t\tlazy[node << 1] += lazy[node];\n\t\t\tlazy[node << 1 | 1] += lazy[node];\n\t\t\tsTree[node << 1] += (mid - b + 1) * lazy[node];\n\t\t\tsTree[node << 1 | 1] += (e - mid) * lazy[node];\n\t\t\tlazy[node] = 0;\n\t\t}\n\n\t\tint query(int i, int j) {\n\t\t\treturn query(1, 1, N, i, j);\n\t\t}\n\n\t\tint query(int node, int b, int e, int i, int j) // O(log n)\n\t\t{\n\t\t\tif (i > e || j < b)\n\t\t\t\treturn 0;\n\t\t\tif (b >= i && e <= j)\n\t\t\t\treturn sTree[node];\n\t\t\tint mid = b + e >> 1;\n\t\t\t// propagate(node, b, mid, e);\n\t\t\tint q1 = query(node << 1, b, mid, i, j);\n\t\t\tint q2 = query(node << 1 | 1, mid + 1, e, i, j);\n\t\t\treturn Math.max(q1, q2);\n\n\t\t}\n\t}\n\n\tstatic int memo[][];\n\n\n\tstatic class UnionFind {\n\t\tint[] p, rank, setSize;\n\t\tint numSets;\n\t\tint max[];\n\n\t\tpublic UnionFind(int N) {\n\t\t\tmax = new int[N];\n\t\t\tp = new int[numSets = N];\n\t\t\trank = new int[N];\n\t\t\tsetSize = new int[N];\n\t\t\tfor (int i = 0; i < N; i++) {\n\t\t\t\tp[i] = i;\n\t\t\t\tsetSize[i] = 1;\n\t\t\t\tmax[i] = i;\n\t\t\t}\n\t\t}\n\n\t\tpublic int findSet(int i) {\n\t\t\treturn p[i] == i ? i : (p[i] = findSet(p[i]));\n\t\t}\n\n\t\tpublic boolean isSameSet(int i, int j) {\n\t\t\treturn findSet(i) == findSet(j);\n\t\t}\n\n\t\tpublic void unionSet(int i, int j) {\n\t\t\tif (isSameSet(i, j))\n\t\t\t\treturn;\n\t\t\tnumSets--;\n\t\t\tint x = findSet(i), y = findSet(j);\n\t\t\tif (rank[x] > rank[y]) {\n\t\t\t\tp[y] = x;\n\t\t\t\tsetSize[x] += setSize[y];\n\t\t\t\tmax[x] = Math.max(max[x], max[y]);\n\n\t\t\t} else {\n\t\t\t\tp[x] = y;\n\t\t\t\tsetSize[y] += setSize[x];\n\t\t\t\tif (rank[x] == rank[y])\n\t\t\t\t\trank[y]++;\n\t\t\t\tmax[y] = Math.max(max[x], max[y]);\n\n\t\t\t}\n\t\t}\n\n\t\tprivate int getmax(int j) {\n\t\t\treturn max[findSet(j)];\n\t\t}\n\n\t\tpublic int numDisjointSets() {\n\t\t\treturn numSets;\n\t\t}\n\n\t\tpublic int sizeOfSet(int i) {\n\t\t\treturn setSize[findSet(i)];\n\t\t}\n\t}\n\n\t/**\n\t * private static void trace(int i, int time) { if(i==n) return;\n\t * \n\t * \n\t * long ans=dp(i,time);\n\t * if(time+a[i].t {\n\t\tint a;\n\t\tlong b;\n\t\tint idx;\n\n\t\tincpair(int a, long dirg, int i) {\n\t\t\tthis.a = a;\n\t\t\tb = dirg;\n\t\t\tidx = i;\n\t\t}\n\n\t\tpublic int compareTo(incpair e) {\n\t\t\treturn (int) (b - e.b);\n\t\t}\n\t}\n\n\tstatic class decpair implements Comparable {\n\t\tint a;\n\t\tlong b;\n\t\tint idx;\n\n\t\tdecpair(int a, long dirg, int i) {\n\t\t\tthis.a = a;\n\t\t\tb = dirg;\n\t\t\tidx = i;\n\t\t}\n\n\t\tpublic int compareTo(decpair e) {\n\t\t\treturn (int) (e.b - b);\n\t\t}\n\t}\n\n\tstatic long allpowers[];\n\n\tstatic class Quad implements Comparable {\n\t\tint u;\n\t\tint v;\n\t\tchar state;\n\t\tint turns;\n\n\t\tpublic Quad(int i, int j, char c, int k) {\n\t\t\tu = i;\n\t\t\tv = j;\n\t\t\tstate = c;\n\t\t\tturns = k;\n\t\t}\n\n\t\tpublic int compareTo(Quad e) {\n\t\t\treturn (int) (turns - e.turns);\n\t\t}\n\n\t}\n\n\tstatic long dirg[][];\n\tstatic Edge[] driver;\n\n\tstatic int n;\n\n\tstatic class Edge implements Comparable {\n\t\tint node;\n\t\tlong cost;\n\n\t\tEdge(int a, long dirg) {\n\t\t\tnode = a;\n\t\t\tcost = dirg;\n\t\t}\n\n\t\tpublic int compareTo(Edge e) {\n\t\t\treturn (int) (cost - e.cost);\n\t\t}\n\t}\n\n\tstatic long manhatandistance(long x, long x2, long y, long y2) {\n\t\treturn Math.abs(x - x2) + Math.abs(y - y2);\n\t}\n\n\tstatic long fib[];\n\n\tstatic long fib(int n) {\n\t\tif (n == 1 || n == 0) {\n\t\t\treturn 1;\n\t\t}\n\t\tif (fib[n] != -1) {\n\t\t\treturn fib[n];\n\t\t} else\n\t\t\treturn fib[n] = ((fib(n - 2) % mod + fib(n - 1) % mod) % mod);\n\t}\n\n\tstatic class Pair implements Comparable {\n\t\tint a, b;\n\n\t\tPair(int x, int y) {\n\t\t\ta = x;\n\t\t\tb = y;\n\t\t}\n\n\t\t@Override\n\t\tpublic int compareTo(Pair c) {\n\t\t\treturn b-c.b;\n\t\t}\n\n\t}\n\n\tstatic long[][] comb;\n\n\tstatic class Triple implements Comparable {\n\n\t\tint l;\n\t\tint r;\n\t\tlong cost;\n\t\tint idx;\n\n\t\tpublic Triple(int a, int b, long l1, int l2) {\n\t\t\tl = a;\n\t\t\tr = b;\n\t\t\tcost = l1;\n\t\t\tidx = l2;\n\t\t}\n\n\t\tpublic int compareTo(Triple x) {\n\t\t\tif (l != x.l || idx == x.idx)\n\t\t\t\treturn l - x.l;\n\t\t\treturn -idx;\n\t\t}\n\n\t}\n\n\tstatic TreeSet primeFactors(long N) // O(sqrt(N) / ln sqrt(N))\n\t{\n\t\tTreeSet factors = new TreeSet(); // take abs(N) in case of -ve integers\n\t\tint idx = 0, p = primes.get(idx);\n\n\t\twhile (p * p <= N) {\n\t\t\twhile (N % p == 0) {\n\t\t\t\tfactors.add((long) p);\n\t\t\t\tN /= p;\n\t\t\t}\n\t\t\tif (primes.size() > idx + 1)\n\t\t\t\tp = primes.get(++idx);\n\t\t\telse\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif (N != 1) // last prime factor may be > sqrt(N)\n\t\t\tfactors.add(N); // for integers whose largest prime factor has a power of 1\n\t\treturn factors;\n\t}\n\n\tstatic boolean visited[];\n\n\t/**\n\t * static int bfs(int s) { Queue q = new LinkedList();\n\t * q.add(s); int count=0; int maxcost=0; int dist[]=new int[n]; dist[s]=0;\n\t * while(!q.isEmpty()) {\n\t * \n\t * int u = q.remove(); if(dist[u]==k) { break; } for(Pair v: adj[u]) {\n\t * maxcost=Math.max(maxcost, v.cost);\n\t * \n\t * \n\t * \n\t * if(!visited[v.v]) {\n\t * \n\t * visited[v.v]=true; q.add(v.v); dist[v.v]=dist[u]+1; maxcost=Math.max(maxcost,\n\t * v.cost); } }\n\t * \n\t * } return maxcost; }\n\t **/\n\tpublic static boolean FindAllElements(int n, int k) {\n\t\tint sum = k;\n\t\tint[] A = new int[k];\n\t\tArrays.fill(A, 0, k, 1);\n\n\t\tfor (int i = k - 1; i >= 0; --i) {\n\n\t\t\twhile (sum + A[i] <= n) {\n\n\t\t\t\tsum += A[i];\n\t\t\t\tA[i] *= 2;\n\t\t\t}\n\t\t}\n\t\tif (sum == n) {\n\t\t\treturn true;\n\t\t} else\n\t\t\treturn false;\n\t}\n\n\tstatic boolean vis2[][];\n\n\tstatic boolean f2 = false;\n\n\tstatic long[][] matMul(long[][] a2, long[][] b, int p, int q, int r) // C(p x r) = A(p x q) x (q x r) -- O(p x q x\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// r)\n\t{\n\t\tlong[][] C = new long[p][r];\n\t\tfor (int i = 0; i < p; ++i) {\n\t\t\tfor (int j = 0; j < r; ++j) {\n\t\t\t\tfor (int k = 0; k < q; ++k) {\n\t\t\t\t\tC[i][j] = (C[i][j] + (a2[i][k] % mod * b[k][j] % mod)) % mod;\n\t\t\t\t\tC[i][j] %= mod;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t\treturn C;\n\t}\n\n\tstatic ArrayList a1[];\n\tstatic int memo1[];\n\n\tstatic boolean vis[];\n\tstatic TreeSet set = new TreeSet();\n\n\tstatic long modPow(long ways, long count, long mod) // O(log e)\n\t{\n\t\tways %= mod;\n\t\tlong res = 1;\n\t\twhile (count > 0) {\n\t\t\tif ((count & 1) == 1)\n\t\t\t\tres = (res * ways) % mod;\n\t\t\tways = (ways * ways) % mod;\n\t\t\tcount >>= 1;\n\t\t}\n\t\treturn res % mod;\n\t}\n\n\tstatic long gcd(long ans, long b) {\n\t\tif (b == 0) {\n\t\t\treturn ans;\n\t\t}\n\t\treturn gcd(b, ans % b);\n\t}\n\n\tstatic int[] isComposite;\n\tstatic int[] valid;\n\n\tstatic ArrayList primes;\n\tstatic ArrayList l1;\n\n\t\n\tstatic TreeSet primus = new TreeSet();\n\t\n\tstatic void sieveLinear(int N)\n\t{\n\t\tint[] lp = new int[N + 1];\t\t\t\t\t\t\t\t//lp[i] = least prime divisor of i\n\t\tfor(int i = 2; i <= N; ++i)\n\t\t{\n\t\t\tif(lp[i] == 0)\n\t\t\t{\n\t\t\t\tprimus.add(i);\n\t\t\t\tlp[i] = i;\n\t\t\t}\n\t\t\tint curLP = lp[i];\n\t\t\tfor(int p: primus)\n\t\t\t\tif(p > curLP || p * i > N)\n\t\t\t\t\tbreak;\n\t\t\t\telse\n\t\t\t\t\tlp[p * i] = i;\n\t\t}\n\t}\n\t\n\n\tpublic static long[] schuffle(long[] sad) {\n\t\tfor (int i = 0; i < sad.length; i++) {\n\t\t\tint x = (int) (Math.random() * sad.length);\n\t\t\tlong temp = sad[x];\n\t\t\tsad[x] = sad[i];\n\t\t\tsad[i] = temp;\n\t\t}\n\t\treturn sad;\n\t}\n\n\tstatic int V;\n\tstatic long INF = (long) 1E16;\n\n\tstatic class Edge2 {\n\t\tint node;\n\t\tlong cost;\n\t\tlong next;\n\n\t\tEdge2(int a, int c, Long long1) {\n\t\t\tnode = a;\n\t\t\tcost = long1;\n\t\t\tnext = c;\n\t\t}\n\n\t}\n\n\tstatic class Scanner {\n\t\tStringTokenizer st;\n\t\tBufferedReader br;\n\n\t\tpublic Scanner(InputStream system) {\n\t\t\tbr = new BufferedReader(new InputStreamReader(system));\n\t\t}\n\n\t\tpublic Scanner(String file) throws Exception {\n\t\t\tbr = new BufferedReader(new FileReader(file));\n\t\t}\n\n\t\tpublic String next() throws IOException {\n\t\t\twhile (st == null || !st.hasMoreTokens())\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tpublic String nextLine() throws IOException {\n\t\t\treturn br.readLine();\n\t\t}\n\n\t\tpublic int nextInt() throws IOException {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tpublic double nextDouble() throws IOException {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tpublic char nextChar() throws IOException {\n\t\t\treturn next().charAt(0);\n\t\t}\n\n\t\tpublic Long nextLong() throws IOException {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tpublic boolean ready() throws IOException {\n\t\t\treturn br.ready();\n\t\t}\n\n\t\tpublic void waitForInput() throws InterruptedException {\n\t\t\tThread.sleep(3000);\n\t\t}\n\n\t\tpublic int[] nxtArr(int n) throws IOException {\n\t\t\tint[] ans = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tans[i] = nextInt();\n\t\t\treturn ans;\n\t\t}\n\t}\n}", "language": "Java", "metadata": {"date": 1584666341, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02761.html", "problem_id": "p02761", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02761/input.txt", "sample_output_relpath": "derived/input_output/data/p02761/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02761/Java/s573644890.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s573644890", "user_id": "u962340318"}, "prompt_components": {"gold_output": "702\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.FileReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.io.ObjectInputStream.GetField;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.LinkedList;\nimport java.util.Map.Entry;\nimport java.util.PriorityQueue;\nimport java.util.Queue;\nimport java.util.Scanner;\nimport java.util.StringTokenizer;\nimport java.util.TreeMap;\nimport java.util.TreeSet;\n\npublic class Main {\n\tstatic ArrayList adj[];\n\tstatic PrintWriter out = new PrintWriter(System.out);\n\tpublic static long mod;\n\n\tstatic long notmemo[][][];\n\tstatic int k;\n\tstatic int a[];\n\tstatic int b[];\n\tstatic int m;\n\tstatic char c[];\n\n\n\tstatic int trace[];\n\tstatic int h;\n\tstatic int x;\n\tstatic int ans1;\n\tstatic int ans2;\n static char t[];\n\tstatic char l[];\n\tstatic char r[];\n public static void main(String args[]) throws IOException {\n\t\tScanner sc = new Scanner(System.in);\n int n=sc.nextInt();\n int m=sc.nextInt();\n TreeSet set=new TreeSet<>();\n int a[]=new int[n];\n while(m-->0) {\n \tint s=sc.nextInt();\n \tint c=sc.nextInt();\n \tif(set.contains(s)&&c!=a[s-1]) {\n \tSystem.out.println(-1);\n \treturn;\n \t}\n \telse\n \ta[s-1]=c;\n \tset.add(s);\n \t\n }\n boolean f=false;\n for (int i = 0; i < a.length&&n>1; i++) {\n\t\tif(a[i]==0&&!f) {\n\t\t\tSystem.out.println(-1);\n\t\t\treturn;\n\t\t}\n\t\telse if(a[i]!=0&&!f) {\n\t\t\tf=true;\n\t\t}\n\t}\n for(int x:a) {\n \tSystem.out.print(x);\n }\n }\n\tpublic static int solve(char m[]) {\n\t\tint count[]=new int[c.length+1];\n\t\tfor (int i = 1; i < count.length; i++) {\n\t\t\tcount[i]=count[i-1]+((m[i-1]==c[i-1])? 1:0);\n\t\t}\n\t\tint ans=(int) 1e9;\n\t\tfor (int i = 0; i 3) {\n\t\t\t return 0;\n\t\t }\n\t\t if(idx==h) {\n\t\t\t return 1;\n\t\t }\n\t\t if(notmemo[idx][count][state]!=-1) {\n\t\t\t return notmemo[idx][count][state];\n\t\t }\n\t\t //System.out.println(\"the sun will come out tommorow \"+count);\n\t\t long ans=0;\n\t\t for (int i = 0; i <=9; i++) {\n\t\t\tif(state==1&&i!=0) {\n\t\t\t\tans+=dp(idx+1, count+1, state);\n\t\t\t}\n\t\t\telse if(i==0&&(l[idx]!='0'||state==1)) {\n\t\t\t\tans+=dp(idx+1, count, 1);\t\t\n\t\t\t}\n\t\t\telse if(i==0&&(l[idx]=='0'&&state==0)) {\n\t\t\t\tans+=dp(idx+1, count, state);\t\t\n\t\t\t}\n\t\t\telse if(state==0&&i==(Integer.parseInt(\"\"+l[idx]))) {\n\t\t\t\tans+=dp(idx+1, count+1, state);\t\n\t\t\t}\n\t\t\n\t\t\telse if(state==0&&i<(Integer.parseInt(\"\"+l[idx]))) {\n\t\t\t\tans+=dp(idx+1, count+1,1);\t\t\t\t\t\n\t\t }\n\t\t \n\t\n }\t\n\n\treturn notmemo[idx][count][state]=ans;\n\t }\n\n\tstatic class book implements Comparable {\n\t\tint idx;\n\t\tlong score;\n\n\t\tpublic book(int i, long s) {\n\t\t\tidx = i;\n\t\t\tscore = s;\n\t\t}\n\n\t\tpublic int compareTo(book o) {\n\t\t\treturn (int) (o.score - score);\n\t\t}\n\t}\n\n\tstatic class library implements Comparable {\n\t\tint numofbooks;\n\t\tint signup;\n\t\tint shiprate;\n\t\tint idx;\n\n\t\tpublic library(int a, int b, int c, int idx) {\n\t\t\tnumofbooks = a;\n\t\t\tsignup = b;\n\t\t\tshiprate = c;\n\t\t\tthis.idx = idx;\n\t\t}\n\n\t\t@Override\n\t\tpublic int compareTo(library o) {\n\t\tif(signup==o.signup) {\n\t\t\t return o.numofbooks-numofbooks;\n\t\t}\n\t\treturn signup - o.signup;\n\t\t\n\t\t}\n\t}\n\n\n\t\n\tstatic boolean isPal(String s) {\n\t\tint j = s.length() - 1;\n\t\tc = s.toCharArray();\n\t\tArrays.sort(c);\n\t\tfor (int i = 0; i < c.length; i++) {\n\n\t\t}\n\t\treturn true;\n\t}\n\n\tstatic String s;\n\n\tstatic boolean isOn(int S, int j) {\n\t\treturn (S & 1 << j) != 0;\n\t}\n\n\tstatic int y, d;\n\n\tstatic void extendedEuclid(int a, int b) {\n\t\tif (b == 0) {\n\t\t\tx = 1;\n\t\t\ty = 0;\n\t\t\td = a;\n\t\t\treturn;\n\t\t}\n\t\textendedEuclid(b, a % b);\n\t\tint x1 = y;\n\t\tint y1 = x - a / b * y;\n\t\tx = x1;\n\t\ty = y1;\n\t}\n\n\tstatic boolean f = true;\n\n\tstatic class SegmentTree { // 1-based DS, OOP\n\n\t\tint N; // the number of elements in the array as a power of 2 (i.e. after padding)\n\t\tint[] array, sTree, lazy;\n\n\t\tSegmentTree(int[] in) {\n\t\t\tarray = in;\n\t\t\tN = in.length - 1;\n\t\t\tsTree = new int[N << 1]; // no. of nodes = 2*N - 1, we add one to cross out index zero\n\t\t\tlazy = new int[N << 1];\n\t\t\tbuild(1, 1, N);\n\t\t}\n\n\t\tvoid build(int node, int b, int e) // O(n)\n\t\t{\n\t\t\tif (b == e)\n\t\t\t\tsTree[node] = array[b];\n\t\t\telse {\n\t\t\t\tint mid = b + e >> 1;\n\t\t\t\tbuild(node << 1, b, mid);\n\t\t\t\tbuild(node << 1 | 1, mid + 1, e);\n\t\t\t\tsTree[node] = sTree[node << 1] + sTree[node << 1 | 1];\n\t\t\t}\n\t\t}\n\n\t\tvoid update_point(int index, int val) // O(log n)\n\t\t{\n\t\t\tindex += N - 1;\n\t\t\tsTree[index] += val;\n\t\t\twhile (index > 1) {\n\t\t\t\tindex >>= 1;\n\t\t\t\tsTree[index] = Math.max(sTree[index << 1], sTree[index << 1 | 1]);\n\t\t\t}\n\t\t}\n\n\t\tvoid update_range(int i, int j, int val) // O(log n)\n\t\t{\n\t\t\tupdate_range(1, 1, N, i, j, val);\n\t\t}\n\n\t\tvoid update_range(int node, int b, int e, int i, int j, int val) {\n\t\t\tif (i > e || j < b)\n\t\t\t\treturn;\n\t\t\tif (b >= i && e <= j) {\n\t\t\t\tsTree[node] += (e - b + 1) * val;\n\t\t\t\tlazy[node] += val;\n\t\t\t} else {\n\t\t\t\tint mid = b + e >> 1;\n\t\t\t\tpropagate(node, b, mid, e);\n\t\t\t\tupdate_range(node << 1, b, mid, i, j, val);\n\t\t\t\tupdate_range(node << 1 | 1, mid + 1, e, i, j, val);\n\t\t\t\tsTree[node] = sTree[node << 1] + sTree[node << 1 | 1];\n\t\t\t}\n\n\t\t}\n\n\t\tvoid propagate(int node, int b, int mid, int e) {\n\t\t\tlazy[node << 1] += lazy[node];\n\t\t\tlazy[node << 1 | 1] += lazy[node];\n\t\t\tsTree[node << 1] += (mid - b + 1) * lazy[node];\n\t\t\tsTree[node << 1 | 1] += (e - mid) * lazy[node];\n\t\t\tlazy[node] = 0;\n\t\t}\n\n\t\tint query(int i, int j) {\n\t\t\treturn query(1, 1, N, i, j);\n\t\t}\n\n\t\tint query(int node, int b, int e, int i, int j) // O(log n)\n\t\t{\n\t\t\tif (i > e || j < b)\n\t\t\t\treturn 0;\n\t\t\tif (b >= i && e <= j)\n\t\t\t\treturn sTree[node];\n\t\t\tint mid = b + e >> 1;\n\t\t\t// propagate(node, b, mid, e);\n\t\t\tint q1 = query(node << 1, b, mid, i, j);\n\t\t\tint q2 = query(node << 1 | 1, mid + 1, e, i, j);\n\t\t\treturn Math.max(q1, q2);\n\n\t\t}\n\t}\n\n\tstatic int memo[][];\n\n\n\tstatic class UnionFind {\n\t\tint[] p, rank, setSize;\n\t\tint numSets;\n\t\tint max[];\n\n\t\tpublic UnionFind(int N) {\n\t\t\tmax = new int[N];\n\t\t\tp = new int[numSets = N];\n\t\t\trank = new int[N];\n\t\t\tsetSize = new int[N];\n\t\t\tfor (int i = 0; i < N; i++) {\n\t\t\t\tp[i] = i;\n\t\t\t\tsetSize[i] = 1;\n\t\t\t\tmax[i] = i;\n\t\t\t}\n\t\t}\n\n\t\tpublic int findSet(int i) {\n\t\t\treturn p[i] == i ? i : (p[i] = findSet(p[i]));\n\t\t}\n\n\t\tpublic boolean isSameSet(int i, int j) {\n\t\t\treturn findSet(i) == findSet(j);\n\t\t}\n\n\t\tpublic void unionSet(int i, int j) {\n\t\t\tif (isSameSet(i, j))\n\t\t\t\treturn;\n\t\t\tnumSets--;\n\t\t\tint x = findSet(i), y = findSet(j);\n\t\t\tif (rank[x] > rank[y]) {\n\t\t\t\tp[y] = x;\n\t\t\t\tsetSize[x] += setSize[y];\n\t\t\t\tmax[x] = Math.max(max[x], max[y]);\n\n\t\t\t} else {\n\t\t\t\tp[x] = y;\n\t\t\t\tsetSize[y] += setSize[x];\n\t\t\t\tif (rank[x] == rank[y])\n\t\t\t\t\trank[y]++;\n\t\t\t\tmax[y] = Math.max(max[x], max[y]);\n\n\t\t\t}\n\t\t}\n\n\t\tprivate int getmax(int j) {\n\t\t\treturn max[findSet(j)];\n\t\t}\n\n\t\tpublic int numDisjointSets() {\n\t\t\treturn numSets;\n\t\t}\n\n\t\tpublic int sizeOfSet(int i) {\n\t\t\treturn setSize[findSet(i)];\n\t\t}\n\t}\n\n\t/**\n\t * private static void trace(int i, int time) { if(i==n) return;\n\t * \n\t * \n\t * long ans=dp(i,time);\n\t * if(time+a[i].t {\n\t\tint a;\n\t\tlong b;\n\t\tint idx;\n\n\t\tincpair(int a, long dirg, int i) {\n\t\t\tthis.a = a;\n\t\t\tb = dirg;\n\t\t\tidx = i;\n\t\t}\n\n\t\tpublic int compareTo(incpair e) {\n\t\t\treturn (int) (b - e.b);\n\t\t}\n\t}\n\n\tstatic class decpair implements Comparable {\n\t\tint a;\n\t\tlong b;\n\t\tint idx;\n\n\t\tdecpair(int a, long dirg, int i) {\n\t\t\tthis.a = a;\n\t\t\tb = dirg;\n\t\t\tidx = i;\n\t\t}\n\n\t\tpublic int compareTo(decpair e) {\n\t\t\treturn (int) (e.b - b);\n\t\t}\n\t}\n\n\tstatic long allpowers[];\n\n\tstatic class Quad implements Comparable {\n\t\tint u;\n\t\tint v;\n\t\tchar state;\n\t\tint turns;\n\n\t\tpublic Quad(int i, int j, char c, int k) {\n\t\t\tu = i;\n\t\t\tv = j;\n\t\t\tstate = c;\n\t\t\tturns = k;\n\t\t}\n\n\t\tpublic int compareTo(Quad e) {\n\t\t\treturn (int) (turns - e.turns);\n\t\t}\n\n\t}\n\n\tstatic long dirg[][];\n\tstatic Edge[] driver;\n\n\tstatic int n;\n\n\tstatic class Edge implements Comparable {\n\t\tint node;\n\t\tlong cost;\n\n\t\tEdge(int a, long dirg) {\n\t\t\tnode = a;\n\t\t\tcost = dirg;\n\t\t}\n\n\t\tpublic int compareTo(Edge e) {\n\t\t\treturn (int) (cost - e.cost);\n\t\t}\n\t}\n\n\tstatic long manhatandistance(long x, long x2, long y, long y2) {\n\t\treturn Math.abs(x - x2) + Math.abs(y - y2);\n\t}\n\n\tstatic long fib[];\n\n\tstatic long fib(int n) {\n\t\tif (n == 1 || n == 0) {\n\t\t\treturn 1;\n\t\t}\n\t\tif (fib[n] != -1) {\n\t\t\treturn fib[n];\n\t\t} else\n\t\t\treturn fib[n] = ((fib(n - 2) % mod + fib(n - 1) % mod) % mod);\n\t}\n\n\tstatic class Pair implements Comparable {\n\t\tint a, b;\n\n\t\tPair(int x, int y) {\n\t\t\ta = x;\n\t\t\tb = y;\n\t\t}\n\n\t\t@Override\n\t\tpublic int compareTo(Pair c) {\n\t\t\treturn b-c.b;\n\t\t}\n\n\t}\n\n\tstatic long[][] comb;\n\n\tstatic class Triple implements Comparable {\n\n\t\tint l;\n\t\tint r;\n\t\tlong cost;\n\t\tint idx;\n\n\t\tpublic Triple(int a, int b, long l1, int l2) {\n\t\t\tl = a;\n\t\t\tr = b;\n\t\t\tcost = l1;\n\t\t\tidx = l2;\n\t\t}\n\n\t\tpublic int compareTo(Triple x) {\n\t\t\tif (l != x.l || idx == x.idx)\n\t\t\t\treturn l - x.l;\n\t\t\treturn -idx;\n\t\t}\n\n\t}\n\n\tstatic TreeSet primeFactors(long N) // O(sqrt(N) / ln sqrt(N))\n\t{\n\t\tTreeSet factors = new TreeSet(); // take abs(N) in case of -ve integers\n\t\tint idx = 0, p = primes.get(idx);\n\n\t\twhile (p * p <= N) {\n\t\t\twhile (N % p == 0) {\n\t\t\t\tfactors.add((long) p);\n\t\t\t\tN /= p;\n\t\t\t}\n\t\t\tif (primes.size() > idx + 1)\n\t\t\t\tp = primes.get(++idx);\n\t\t\telse\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif (N != 1) // last prime factor may be > sqrt(N)\n\t\t\tfactors.add(N); // for integers whose largest prime factor has a power of 1\n\t\treturn factors;\n\t}\n\n\tstatic boolean visited[];\n\n\t/**\n\t * static int bfs(int s) { Queue q = new LinkedList();\n\t * q.add(s); int count=0; int maxcost=0; int dist[]=new int[n]; dist[s]=0;\n\t * while(!q.isEmpty()) {\n\t * \n\t * int u = q.remove(); if(dist[u]==k) { break; } for(Pair v: adj[u]) {\n\t * maxcost=Math.max(maxcost, v.cost);\n\t * \n\t * \n\t * \n\t * if(!visited[v.v]) {\n\t * \n\t * visited[v.v]=true; q.add(v.v); dist[v.v]=dist[u]+1; maxcost=Math.max(maxcost,\n\t * v.cost); } }\n\t * \n\t * } return maxcost; }\n\t **/\n\tpublic static boolean FindAllElements(int n, int k) {\n\t\tint sum = k;\n\t\tint[] A = new int[k];\n\t\tArrays.fill(A, 0, k, 1);\n\n\t\tfor (int i = k - 1; i >= 0; --i) {\n\n\t\t\twhile (sum + A[i] <= n) {\n\n\t\t\t\tsum += A[i];\n\t\t\t\tA[i] *= 2;\n\t\t\t}\n\t\t}\n\t\tif (sum == n) {\n\t\t\treturn true;\n\t\t} else\n\t\t\treturn false;\n\t}\n\n\tstatic boolean vis2[][];\n\n\tstatic boolean f2 = false;\n\n\tstatic long[][] matMul(long[][] a2, long[][] b, int p, int q, int r) // C(p x r) = A(p x q) x (q x r) -- O(p x q x\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// r)\n\t{\n\t\tlong[][] C = new long[p][r];\n\t\tfor (int i = 0; i < p; ++i) {\n\t\t\tfor (int j = 0; j < r; ++j) {\n\t\t\t\tfor (int k = 0; k < q; ++k) {\n\t\t\t\t\tC[i][j] = (C[i][j] + (a2[i][k] % mod * b[k][j] % mod)) % mod;\n\t\t\t\t\tC[i][j] %= mod;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t\treturn C;\n\t}\n\n\tstatic ArrayList a1[];\n\tstatic int memo1[];\n\n\tstatic boolean vis[];\n\tstatic TreeSet set = new TreeSet();\n\n\tstatic long modPow(long ways, long count, long mod) // O(log e)\n\t{\n\t\tways %= mod;\n\t\tlong res = 1;\n\t\twhile (count > 0) {\n\t\t\tif ((count & 1) == 1)\n\t\t\t\tres = (res * ways) % mod;\n\t\t\tways = (ways * ways) % mod;\n\t\t\tcount >>= 1;\n\t\t}\n\t\treturn res % mod;\n\t}\n\n\tstatic long gcd(long ans, long b) {\n\t\tif (b == 0) {\n\t\t\treturn ans;\n\t\t}\n\t\treturn gcd(b, ans % b);\n\t}\n\n\tstatic int[] isComposite;\n\tstatic int[] valid;\n\n\tstatic ArrayList primes;\n\tstatic ArrayList l1;\n\n\t\n\tstatic TreeSet primus = new TreeSet();\n\t\n\tstatic void sieveLinear(int N)\n\t{\n\t\tint[] lp = new int[N + 1];\t\t\t\t\t\t\t\t//lp[i] = least prime divisor of i\n\t\tfor(int i = 2; i <= N; ++i)\n\t\t{\n\t\t\tif(lp[i] == 0)\n\t\t\t{\n\t\t\t\tprimus.add(i);\n\t\t\t\tlp[i] = i;\n\t\t\t}\n\t\t\tint curLP = lp[i];\n\t\t\tfor(int p: primus)\n\t\t\t\tif(p > curLP || p * i > N)\n\t\t\t\t\tbreak;\n\t\t\t\telse\n\t\t\t\t\tlp[p * i] = i;\n\t\t}\n\t}\n\t\n\n\tpublic static long[] schuffle(long[] sad) {\n\t\tfor (int i = 0; i < sad.length; i++) {\n\t\t\tint x = (int) (Math.random() * sad.length);\n\t\t\tlong temp = sad[x];\n\t\t\tsad[x] = sad[i];\n\t\t\tsad[i] = temp;\n\t\t}\n\t\treturn sad;\n\t}\n\n\tstatic int V;\n\tstatic long INF = (long) 1E16;\n\n\tstatic class Edge2 {\n\t\tint node;\n\t\tlong cost;\n\t\tlong next;\n\n\t\tEdge2(int a, int c, Long long1) {\n\t\t\tnode = a;\n\t\t\tcost = long1;\n\t\t\tnext = c;\n\t\t}\n\n\t}\n\n\tstatic class Scanner {\n\t\tStringTokenizer st;\n\t\tBufferedReader br;\n\n\t\tpublic Scanner(InputStream system) {\n\t\t\tbr = new BufferedReader(new InputStreamReader(system));\n\t\t}\n\n\t\tpublic Scanner(String file) throws Exception {\n\t\t\tbr = new BufferedReader(new FileReader(file));\n\t\t}\n\n\t\tpublic String next() throws IOException {\n\t\t\twhile (st == null || !st.hasMoreTokens())\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tpublic String nextLine() throws IOException {\n\t\t\treturn br.readLine();\n\t\t}\n\n\t\tpublic int nextInt() throws IOException {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tpublic double nextDouble() throws IOException {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tpublic char nextChar() throws IOException {\n\t\t\treturn next().charAt(0);\n\t\t}\n\n\t\tpublic Long nextLong() throws IOException {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tpublic boolean ready() throws IOException {\n\t\t\treturn br.ready();\n\t\t}\n\n\t\tpublic void waitForInput() throws InterruptedException {\n\t\t\tThread.sleep(3000);\n\t\t}\n\n\t\tpublic int[] nxtArr(int n) throws IOException {\n\t\t\tint[] ans = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tans[i] = nextInt();\n\t\t\treturn ans;\n\t\t}\n\t}\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "sample_input": "3 3\n1 7\n3 2\n1 7\n"}, "reference_outputs": ["702\n"], "source_document_id": "p02761", "source_text": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 13531, "cpu_time_ms": 75, "memory_kb": 21204}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s555315828", "group_id": "codeNet:p02761", "input_text": "import java.io.BufferedReader;\nimport java.io.FileReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.io.ObjectInputStream.GetField;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.LinkedList;\nimport java.util.Map.Entry;\nimport java.util.PriorityQueue;\nimport java.util.Queue;\nimport java.util.Scanner;\nimport java.util.StringTokenizer;\nimport java.util.TreeMap;\nimport java.util.TreeSet;\n\npublic class Main {\n\tstatic ArrayList adj[];\n\tstatic PrintWriter out = new PrintWriter(System.out);\n\tpublic static long mod;\n\n\tstatic long notmemo[][][];\n\tstatic int k;\n\tstatic int a[];\n\tstatic int b[];\n\tstatic int m;\n\tstatic char c[];\n\n\n\tstatic int trace[];\n\tstatic int h;\n\tstatic int x;\n\tstatic int ans1;\n\tstatic int ans2;\n static char t[];\n\tstatic char l[];\n\tstatic char r[];\n public static void main(String args[]) throws IOException {\n\t\tScanner sc = new Scanner(System.in);\n int n=sc.nextInt();\n int m=sc.nextInt();\n TreeSet set=new TreeSet<>();\n int a[]=new int[n];\n while(m-->0) {\n \tint s=sc.nextInt();\n \tint c=sc.nextInt();\n \tif(set.contains(s)&&c!=a[s-1]) {\n \t\tSystem.out.println(-1);\n \t\treturn;\n \t}\n \tset.add(s);\n \t\n \ta[s-1]=c;\n \n }\n if(n==3&&a[2]==0) {\n \tSystem.out.println(-1);\n\t\treturn;\n\t\n }\n if(n==2&&a[1]==0)\n { \tSystem.out.println(-1);\n\treturn;\n }\n for(int x:a) {\n \tSystem.out.print(x);\n }\n }\n\tpublic static int solve(char m[]) {\n\t\tint count[]=new int[c.length+1];\n\t\tfor (int i = 1; i < count.length; i++) {\n\t\t\tcount[i]=count[i-1]+((m[i-1]==c[i-1])? 1:0);\n\t\t}\n\t\tint ans=(int) 1e9;\n\t\tfor (int i = 0; i 3) {\n\t\t\t return 0;\n\t\t }\n\t\t if(idx==h) {\n\t\t\t return 1;\n\t\t }\n\t\t if(notmemo[idx][count][state]!=-1) {\n\t\t\t return notmemo[idx][count][state];\n\t\t }\n\t\t //System.out.println(\"the sun will come out tommorow \"+count);\n\t\t long ans=0;\n\t\t for (int i = 0; i <=9; i++) {\n\t\t\tif(state==1&&i!=0) {\n\t\t\t\tans+=dp(idx+1, count+1, state);\n\t\t\t}\n\t\t\telse if(i==0&&(l[idx]!='0'||state==1)) {\n\t\t\t\tans+=dp(idx+1, count, 1);\t\t\n\t\t\t}\n\t\t\telse if(i==0&&(l[idx]=='0'&&state==0)) {\n\t\t\t\tans+=dp(idx+1, count, state);\t\t\n\t\t\t}\n\t\t\telse if(state==0&&i==(Integer.parseInt(\"\"+l[idx]))) {\n\t\t\t\tans+=dp(idx+1, count+1, state);\t\n\t\t\t}\n\t\t\n\t\t\telse if(state==0&&i<(Integer.parseInt(\"\"+l[idx]))) {\n\t\t\t\tans+=dp(idx+1, count+1,1);\t\t\t\t\t\n\t\t }\n\t\t \n\t\n }\t\n\n\treturn notmemo[idx][count][state]=ans;\n\t }\n\n\tstatic class book implements Comparable {\n\t\tint idx;\n\t\tlong score;\n\n\t\tpublic book(int i, long s) {\n\t\t\tidx = i;\n\t\t\tscore = s;\n\t\t}\n\n\t\tpublic int compareTo(book o) {\n\t\t\treturn (int) (o.score - score);\n\t\t}\n\t}\n\n\tstatic class library implements Comparable {\n\t\tint numofbooks;\n\t\tint signup;\n\t\tint shiprate;\n\t\tint idx;\n\n\t\tpublic library(int a, int b, int c, int idx) {\n\t\t\tnumofbooks = a;\n\t\t\tsignup = b;\n\t\t\tshiprate = c;\n\t\t\tthis.idx = idx;\n\t\t}\n\n\t\t@Override\n\t\tpublic int compareTo(library o) {\n\t\tif(signup==o.signup) {\n\t\t\t return o.numofbooks-numofbooks;\n\t\t}\n\t\treturn signup - o.signup;\n\t\t\n\t\t}\n\t}\n\n\n\t\n\tstatic boolean isPal(String s) {\n\t\tint j = s.length() - 1;\n\t\tc = s.toCharArray();\n\t\tArrays.sort(c);\n\t\tfor (int i = 0; i < c.length; i++) {\n\n\t\t}\n\t\treturn true;\n\t}\n\n\tstatic String s;\n\n\tstatic boolean isOn(int S, int j) {\n\t\treturn (S & 1 << j) != 0;\n\t}\n\n\tstatic int y, d;\n\n\tstatic void extendedEuclid(int a, int b) {\n\t\tif (b == 0) {\n\t\t\tx = 1;\n\t\t\ty = 0;\n\t\t\td = a;\n\t\t\treturn;\n\t\t}\n\t\textendedEuclid(b, a % b);\n\t\tint x1 = y;\n\t\tint y1 = x - a / b * y;\n\t\tx = x1;\n\t\ty = y1;\n\t}\n\n\tstatic boolean f = true;\n\n\tstatic class SegmentTree { // 1-based DS, OOP\n\n\t\tint N; // the number of elements in the array as a power of 2 (i.e. after padding)\n\t\tint[] array, sTree, lazy;\n\n\t\tSegmentTree(int[] in) {\n\t\t\tarray = in;\n\t\t\tN = in.length - 1;\n\t\t\tsTree = new int[N << 1]; // no. of nodes = 2*N - 1, we add one to cross out index zero\n\t\t\tlazy = new int[N << 1];\n\t\t\tbuild(1, 1, N);\n\t\t}\n\n\t\tvoid build(int node, int b, int e) // O(n)\n\t\t{\n\t\t\tif (b == e)\n\t\t\t\tsTree[node] = array[b];\n\t\t\telse {\n\t\t\t\tint mid = b + e >> 1;\n\t\t\t\tbuild(node << 1, b, mid);\n\t\t\t\tbuild(node << 1 | 1, mid + 1, e);\n\t\t\t\tsTree[node] = sTree[node << 1] + sTree[node << 1 | 1];\n\t\t\t}\n\t\t}\n\n\t\tvoid update_point(int index, int val) // O(log n)\n\t\t{\n\t\t\tindex += N - 1;\n\t\t\tsTree[index] += val;\n\t\t\twhile (index > 1) {\n\t\t\t\tindex >>= 1;\n\t\t\t\tsTree[index] = Math.max(sTree[index << 1], sTree[index << 1 | 1]);\n\t\t\t}\n\t\t}\n\n\t\tvoid update_range(int i, int j, int val) // O(log n)\n\t\t{\n\t\t\tupdate_range(1, 1, N, i, j, val);\n\t\t}\n\n\t\tvoid update_range(int node, int b, int e, int i, int j, int val) {\n\t\t\tif (i > e || j < b)\n\t\t\t\treturn;\n\t\t\tif (b >= i && e <= j) {\n\t\t\t\tsTree[node] += (e - b + 1) * val;\n\t\t\t\tlazy[node] += val;\n\t\t\t} else {\n\t\t\t\tint mid = b + e >> 1;\n\t\t\t\tpropagate(node, b, mid, e);\n\t\t\t\tupdate_range(node << 1, b, mid, i, j, val);\n\t\t\t\tupdate_range(node << 1 | 1, mid + 1, e, i, j, val);\n\t\t\t\tsTree[node] = sTree[node << 1] + sTree[node << 1 | 1];\n\t\t\t}\n\n\t\t}\n\n\t\tvoid propagate(int node, int b, int mid, int e) {\n\t\t\tlazy[node << 1] += lazy[node];\n\t\t\tlazy[node << 1 | 1] += lazy[node];\n\t\t\tsTree[node << 1] += (mid - b + 1) * lazy[node];\n\t\t\tsTree[node << 1 | 1] += (e - mid) * lazy[node];\n\t\t\tlazy[node] = 0;\n\t\t}\n\n\t\tint query(int i, int j) {\n\t\t\treturn query(1, 1, N, i, j);\n\t\t}\n\n\t\tint query(int node, int b, int e, int i, int j) // O(log n)\n\t\t{\n\t\t\tif (i > e || j < b)\n\t\t\t\treturn 0;\n\t\t\tif (b >= i && e <= j)\n\t\t\t\treturn sTree[node];\n\t\t\tint mid = b + e >> 1;\n\t\t\t// propagate(node, b, mid, e);\n\t\t\tint q1 = query(node << 1, b, mid, i, j);\n\t\t\tint q2 = query(node << 1 | 1, mid + 1, e, i, j);\n\t\t\treturn Math.max(q1, q2);\n\n\t\t}\n\t}\n\n\tstatic int memo[][];\n\n\n\tstatic class UnionFind {\n\t\tint[] p, rank, setSize;\n\t\tint numSets;\n\t\tint max[];\n\n\t\tpublic UnionFind(int N) {\n\t\t\tmax = new int[N];\n\t\t\tp = new int[numSets = N];\n\t\t\trank = new int[N];\n\t\t\tsetSize = new int[N];\n\t\t\tfor (int i = 0; i < N; i++) {\n\t\t\t\tp[i] = i;\n\t\t\t\tsetSize[i] = 1;\n\t\t\t\tmax[i] = i;\n\t\t\t}\n\t\t}\n\n\t\tpublic int findSet(int i) {\n\t\t\treturn p[i] == i ? i : (p[i] = findSet(p[i]));\n\t\t}\n\n\t\tpublic boolean isSameSet(int i, int j) {\n\t\t\treturn findSet(i) == findSet(j);\n\t\t}\n\n\t\tpublic void unionSet(int i, int j) {\n\t\t\tif (isSameSet(i, j))\n\t\t\t\treturn;\n\t\t\tnumSets--;\n\t\t\tint x = findSet(i), y = findSet(j);\n\t\t\tif (rank[x] > rank[y]) {\n\t\t\t\tp[y] = x;\n\t\t\t\tsetSize[x] += setSize[y];\n\t\t\t\tmax[x] = Math.max(max[x], max[y]);\n\n\t\t\t} else {\n\t\t\t\tp[x] = y;\n\t\t\t\tsetSize[y] += setSize[x];\n\t\t\t\tif (rank[x] == rank[y])\n\t\t\t\t\trank[y]++;\n\t\t\t\tmax[y] = Math.max(max[x], max[y]);\n\n\t\t\t}\n\t\t}\n\n\t\tprivate int getmax(int j) {\n\t\t\treturn max[findSet(j)];\n\t\t}\n\n\t\tpublic int numDisjointSets() {\n\t\t\treturn numSets;\n\t\t}\n\n\t\tpublic int sizeOfSet(int i) {\n\t\t\treturn setSize[findSet(i)];\n\t\t}\n\t}\n\n\t/**\n\t * private static void trace(int i, int time) { if(i==n) return;\n\t * \n\t * \n\t * long ans=dp(i,time);\n\t * if(time+a[i].t {\n\t\tint a;\n\t\tlong b;\n\t\tint idx;\n\n\t\tincpair(int a, long dirg, int i) {\n\t\t\tthis.a = a;\n\t\t\tb = dirg;\n\t\t\tidx = i;\n\t\t}\n\n\t\tpublic int compareTo(incpair e) {\n\t\t\treturn (int) (b - e.b);\n\t\t}\n\t}\n\n\tstatic class decpair implements Comparable {\n\t\tint a;\n\t\tlong b;\n\t\tint idx;\n\n\t\tdecpair(int a, long dirg, int i) {\n\t\t\tthis.a = a;\n\t\t\tb = dirg;\n\t\t\tidx = i;\n\t\t}\n\n\t\tpublic int compareTo(decpair e) {\n\t\t\treturn (int) (e.b - b);\n\t\t}\n\t}\n\n\tstatic long allpowers[];\n\n\tstatic class Quad implements Comparable {\n\t\tint u;\n\t\tint v;\n\t\tchar state;\n\t\tint turns;\n\n\t\tpublic Quad(int i, int j, char c, int k) {\n\t\t\tu = i;\n\t\t\tv = j;\n\t\t\tstate = c;\n\t\t\tturns = k;\n\t\t}\n\n\t\tpublic int compareTo(Quad e) {\n\t\t\treturn (int) (turns - e.turns);\n\t\t}\n\n\t}\n\n\tstatic long dirg[][];\n\tstatic Edge[] driver;\n\n\tstatic int n;\n\n\tstatic class Edge implements Comparable {\n\t\tint node;\n\t\tlong cost;\n\n\t\tEdge(int a, long dirg) {\n\t\t\tnode = a;\n\t\t\tcost = dirg;\n\t\t}\n\n\t\tpublic int compareTo(Edge e) {\n\t\t\treturn (int) (cost - e.cost);\n\t\t}\n\t}\n\n\tstatic long manhatandistance(long x, long x2, long y, long y2) {\n\t\treturn Math.abs(x - x2) + Math.abs(y - y2);\n\t}\n\n\tstatic long fib[];\n\n\tstatic long fib(int n) {\n\t\tif (n == 1 || n == 0) {\n\t\t\treturn 1;\n\t\t}\n\t\tif (fib[n] != -1) {\n\t\t\treturn fib[n];\n\t\t} else\n\t\t\treturn fib[n] = ((fib(n - 2) % mod + fib(n - 1) % mod) % mod);\n\t}\n\n\tstatic class Pair implements Comparable {\n\t\tint a, b;\n\n\t\tPair(int x, int y) {\n\t\t\ta = x;\n\t\t\tb = y;\n\t\t}\n\n\t\t@Override\n\t\tpublic int compareTo(Pair c) {\n\t\t\treturn b-c.b;\n\t\t}\n\n\t}\n\n\tstatic long[][] comb;\n\n\tstatic class Triple implements Comparable {\n\n\t\tint l;\n\t\tint r;\n\t\tlong cost;\n\t\tint idx;\n\n\t\tpublic Triple(int a, int b, long l1, int l2) {\n\t\t\tl = a;\n\t\t\tr = b;\n\t\t\tcost = l1;\n\t\t\tidx = l2;\n\t\t}\n\n\t\tpublic int compareTo(Triple x) {\n\t\t\tif (l != x.l || idx == x.idx)\n\t\t\t\treturn l - x.l;\n\t\t\treturn -idx;\n\t\t}\n\n\t}\n\n\tstatic TreeSet primeFactors(long N) // O(sqrt(N) / ln sqrt(N))\n\t{\n\t\tTreeSet factors = new TreeSet(); // take abs(N) in case of -ve integers\n\t\tint idx = 0, p = primes.get(idx);\n\n\t\twhile (p * p <= N) {\n\t\t\twhile (N % p == 0) {\n\t\t\t\tfactors.add((long) p);\n\t\t\t\tN /= p;\n\t\t\t}\n\t\t\tif (primes.size() > idx + 1)\n\t\t\t\tp = primes.get(++idx);\n\t\t\telse\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif (N != 1) // last prime factor may be > sqrt(N)\n\t\t\tfactors.add(N); // for integers whose largest prime factor has a power of 1\n\t\treturn factors;\n\t}\n\n\tstatic boolean visited[];\n\n\t/**\n\t * static int bfs(int s) { Queue q = new LinkedList();\n\t * q.add(s); int count=0; int maxcost=0; int dist[]=new int[n]; dist[s]=0;\n\t * while(!q.isEmpty()) {\n\t * \n\t * int u = q.remove(); if(dist[u]==k) { break; } for(Pair v: adj[u]) {\n\t * maxcost=Math.max(maxcost, v.cost);\n\t * \n\t * \n\t * \n\t * if(!visited[v.v]) {\n\t * \n\t * visited[v.v]=true; q.add(v.v); dist[v.v]=dist[u]+1; maxcost=Math.max(maxcost,\n\t * v.cost); } }\n\t * \n\t * } return maxcost; }\n\t **/\n\tpublic static boolean FindAllElements(int n, int k) {\n\t\tint sum = k;\n\t\tint[] A = new int[k];\n\t\tArrays.fill(A, 0, k, 1);\n\n\t\tfor (int i = k - 1; i >= 0; --i) {\n\n\t\t\twhile (sum + A[i] <= n) {\n\n\t\t\t\tsum += A[i];\n\t\t\t\tA[i] *= 2;\n\t\t\t}\n\t\t}\n\t\tif (sum == n) {\n\t\t\treturn true;\n\t\t} else\n\t\t\treturn false;\n\t}\n\n\tstatic boolean vis2[][];\n\n\tstatic boolean f2 = false;\n\n\tstatic long[][] matMul(long[][] a2, long[][] b, int p, int q, int r) // C(p x r) = A(p x q) x (q x r) -- O(p x q x\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// r)\n\t{\n\t\tlong[][] C = new long[p][r];\n\t\tfor (int i = 0; i < p; ++i) {\n\t\t\tfor (int j = 0; j < r; ++j) {\n\t\t\t\tfor (int k = 0; k < q; ++k) {\n\t\t\t\t\tC[i][j] = (C[i][j] + (a2[i][k] % mod * b[k][j] % mod)) % mod;\n\t\t\t\t\tC[i][j] %= mod;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t\treturn C;\n\t}\n\n\tstatic ArrayList a1[];\n\tstatic int memo1[];\n\n\tstatic boolean vis[];\n\tstatic TreeSet set = new TreeSet();\n\n\tstatic long modPow(long ways, long count, long mod) // O(log e)\n\t{\n\t\tways %= mod;\n\t\tlong res = 1;\n\t\twhile (count > 0) {\n\t\t\tif ((count & 1) == 1)\n\t\t\t\tres = (res * ways) % mod;\n\t\t\tways = (ways * ways) % mod;\n\t\t\tcount >>= 1;\n\t\t}\n\t\treturn res % mod;\n\t}\n\n\tstatic long gcd(long ans, long b) {\n\t\tif (b == 0) {\n\t\t\treturn ans;\n\t\t}\n\t\treturn gcd(b, ans % b);\n\t}\n\n\tstatic int[] isComposite;\n\tstatic int[] valid;\n\n\tstatic ArrayList primes;\n\tstatic ArrayList l1;\n\n\t\n\tstatic TreeSet primus = new TreeSet();\n\t\n\tstatic void sieveLinear(int N)\n\t{\n\t\tint[] lp = new int[N + 1];\t\t\t\t\t\t\t\t//lp[i] = least prime divisor of i\n\t\tfor(int i = 2; i <= N; ++i)\n\t\t{\n\t\t\tif(lp[i] == 0)\n\t\t\t{\n\t\t\t\tprimus.add(i);\n\t\t\t\tlp[i] = i;\n\t\t\t}\n\t\t\tint curLP = lp[i];\n\t\t\tfor(int p: primus)\n\t\t\t\tif(p > curLP || p * i > N)\n\t\t\t\t\tbreak;\n\t\t\t\telse\n\t\t\t\t\tlp[p * i] = i;\n\t\t}\n\t}\n\t\n\n\tpublic static long[] schuffle(long[] sad) {\n\t\tfor (int i = 0; i < sad.length; i++) {\n\t\t\tint x = (int) (Math.random() * sad.length);\n\t\t\tlong temp = sad[x];\n\t\t\tsad[x] = sad[i];\n\t\t\tsad[i] = temp;\n\t\t}\n\t\treturn sad;\n\t}\n\n\tstatic int V;\n\tstatic long INF = (long) 1E16;\n\n\tstatic class Edge2 {\n\t\tint node;\n\t\tlong cost;\n\t\tlong next;\n\n\t\tEdge2(int a, int c, Long long1) {\n\t\t\tnode = a;\n\t\t\tcost = long1;\n\t\t\tnext = c;\n\t\t}\n\n\t}\n\n\tstatic class Scanner {\n\t\tStringTokenizer st;\n\t\tBufferedReader br;\n\n\t\tpublic Scanner(InputStream system) {\n\t\t\tbr = new BufferedReader(new InputStreamReader(system));\n\t\t}\n\n\t\tpublic Scanner(String file) throws Exception {\n\t\t\tbr = new BufferedReader(new FileReader(file));\n\t\t}\n\n\t\tpublic String next() throws IOException {\n\t\t\twhile (st == null || !st.hasMoreTokens())\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tpublic String nextLine() throws IOException {\n\t\t\treturn br.readLine();\n\t\t}\n\n\t\tpublic int nextInt() throws IOException {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tpublic double nextDouble() throws IOException {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tpublic char nextChar() throws IOException {\n\t\t\treturn next().charAt(0);\n\t\t}\n\n\t\tpublic Long nextLong() throws IOException {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tpublic boolean ready() throws IOException {\n\t\t\treturn br.ready();\n\t\t}\n\n\t\tpublic void waitForInput() throws InterruptedException {\n\t\t\tThread.sleep(3000);\n\t\t}\n\n\t\tpublic int[] nxtArr(int n) throws IOException {\n\t\t\tint[] ans = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tans[i] = nextInt();\n\t\t\treturn ans;\n\t\t}\n\t}\n}", "language": "Java", "metadata": {"date": 1584663619, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02761.html", "problem_id": "p02761", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02761/input.txt", "sample_output_relpath": "derived/input_output/data/p02761/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02761/Java/s555315828.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s555315828", "user_id": "u962340318"}, "prompt_components": {"gold_output": "702\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.FileReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.io.ObjectInputStream.GetField;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.LinkedList;\nimport java.util.Map.Entry;\nimport java.util.PriorityQueue;\nimport java.util.Queue;\nimport java.util.Scanner;\nimport java.util.StringTokenizer;\nimport java.util.TreeMap;\nimport java.util.TreeSet;\n\npublic class Main {\n\tstatic ArrayList adj[];\n\tstatic PrintWriter out = new PrintWriter(System.out);\n\tpublic static long mod;\n\n\tstatic long notmemo[][][];\n\tstatic int k;\n\tstatic int a[];\n\tstatic int b[];\n\tstatic int m;\n\tstatic char c[];\n\n\n\tstatic int trace[];\n\tstatic int h;\n\tstatic int x;\n\tstatic int ans1;\n\tstatic int ans2;\n static char t[];\n\tstatic char l[];\n\tstatic char r[];\n public static void main(String args[]) throws IOException {\n\t\tScanner sc = new Scanner(System.in);\n int n=sc.nextInt();\n int m=sc.nextInt();\n TreeSet set=new TreeSet<>();\n int a[]=new int[n];\n while(m-->0) {\n \tint s=sc.nextInt();\n \tint c=sc.nextInt();\n \tif(set.contains(s)&&c!=a[s-1]) {\n \t\tSystem.out.println(-1);\n \t\treturn;\n \t}\n \tset.add(s);\n \t\n \ta[s-1]=c;\n \n }\n if(n==3&&a[2]==0) {\n \tSystem.out.println(-1);\n\t\treturn;\n\t\n }\n if(n==2&&a[1]==0)\n { \tSystem.out.println(-1);\n\treturn;\n }\n for(int x:a) {\n \tSystem.out.print(x);\n }\n }\n\tpublic static int solve(char m[]) {\n\t\tint count[]=new int[c.length+1];\n\t\tfor (int i = 1; i < count.length; i++) {\n\t\t\tcount[i]=count[i-1]+((m[i-1]==c[i-1])? 1:0);\n\t\t}\n\t\tint ans=(int) 1e9;\n\t\tfor (int i = 0; i 3) {\n\t\t\t return 0;\n\t\t }\n\t\t if(idx==h) {\n\t\t\t return 1;\n\t\t }\n\t\t if(notmemo[idx][count][state]!=-1) {\n\t\t\t return notmemo[idx][count][state];\n\t\t }\n\t\t //System.out.println(\"the sun will come out tommorow \"+count);\n\t\t long ans=0;\n\t\t for (int i = 0; i <=9; i++) {\n\t\t\tif(state==1&&i!=0) {\n\t\t\t\tans+=dp(idx+1, count+1, state);\n\t\t\t}\n\t\t\telse if(i==0&&(l[idx]!='0'||state==1)) {\n\t\t\t\tans+=dp(idx+1, count, 1);\t\t\n\t\t\t}\n\t\t\telse if(i==0&&(l[idx]=='0'&&state==0)) {\n\t\t\t\tans+=dp(idx+1, count, state);\t\t\n\t\t\t}\n\t\t\telse if(state==0&&i==(Integer.parseInt(\"\"+l[idx]))) {\n\t\t\t\tans+=dp(idx+1, count+1, state);\t\n\t\t\t}\n\t\t\n\t\t\telse if(state==0&&i<(Integer.parseInt(\"\"+l[idx]))) {\n\t\t\t\tans+=dp(idx+1, count+1,1);\t\t\t\t\t\n\t\t }\n\t\t \n\t\n }\t\n\n\treturn notmemo[idx][count][state]=ans;\n\t }\n\n\tstatic class book implements Comparable {\n\t\tint idx;\n\t\tlong score;\n\n\t\tpublic book(int i, long s) {\n\t\t\tidx = i;\n\t\t\tscore = s;\n\t\t}\n\n\t\tpublic int compareTo(book o) {\n\t\t\treturn (int) (o.score - score);\n\t\t}\n\t}\n\n\tstatic class library implements Comparable {\n\t\tint numofbooks;\n\t\tint signup;\n\t\tint shiprate;\n\t\tint idx;\n\n\t\tpublic library(int a, int b, int c, int idx) {\n\t\t\tnumofbooks = a;\n\t\t\tsignup = b;\n\t\t\tshiprate = c;\n\t\t\tthis.idx = idx;\n\t\t}\n\n\t\t@Override\n\t\tpublic int compareTo(library o) {\n\t\tif(signup==o.signup) {\n\t\t\t return o.numofbooks-numofbooks;\n\t\t}\n\t\treturn signup - o.signup;\n\t\t\n\t\t}\n\t}\n\n\n\t\n\tstatic boolean isPal(String s) {\n\t\tint j = s.length() - 1;\n\t\tc = s.toCharArray();\n\t\tArrays.sort(c);\n\t\tfor (int i = 0; i < c.length; i++) {\n\n\t\t}\n\t\treturn true;\n\t}\n\n\tstatic String s;\n\n\tstatic boolean isOn(int S, int j) {\n\t\treturn (S & 1 << j) != 0;\n\t}\n\n\tstatic int y, d;\n\n\tstatic void extendedEuclid(int a, int b) {\n\t\tif (b == 0) {\n\t\t\tx = 1;\n\t\t\ty = 0;\n\t\t\td = a;\n\t\t\treturn;\n\t\t}\n\t\textendedEuclid(b, a % b);\n\t\tint x1 = y;\n\t\tint y1 = x - a / b * y;\n\t\tx = x1;\n\t\ty = y1;\n\t}\n\n\tstatic boolean f = true;\n\n\tstatic class SegmentTree { // 1-based DS, OOP\n\n\t\tint N; // the number of elements in the array as a power of 2 (i.e. after padding)\n\t\tint[] array, sTree, lazy;\n\n\t\tSegmentTree(int[] in) {\n\t\t\tarray = in;\n\t\t\tN = in.length - 1;\n\t\t\tsTree = new int[N << 1]; // no. of nodes = 2*N - 1, we add one to cross out index zero\n\t\t\tlazy = new int[N << 1];\n\t\t\tbuild(1, 1, N);\n\t\t}\n\n\t\tvoid build(int node, int b, int e) // O(n)\n\t\t{\n\t\t\tif (b == e)\n\t\t\t\tsTree[node] = array[b];\n\t\t\telse {\n\t\t\t\tint mid = b + e >> 1;\n\t\t\t\tbuild(node << 1, b, mid);\n\t\t\t\tbuild(node << 1 | 1, mid + 1, e);\n\t\t\t\tsTree[node] = sTree[node << 1] + sTree[node << 1 | 1];\n\t\t\t}\n\t\t}\n\n\t\tvoid update_point(int index, int val) // O(log n)\n\t\t{\n\t\t\tindex += N - 1;\n\t\t\tsTree[index] += val;\n\t\t\twhile (index > 1) {\n\t\t\t\tindex >>= 1;\n\t\t\t\tsTree[index] = Math.max(sTree[index << 1], sTree[index << 1 | 1]);\n\t\t\t}\n\t\t}\n\n\t\tvoid update_range(int i, int j, int val) // O(log n)\n\t\t{\n\t\t\tupdate_range(1, 1, N, i, j, val);\n\t\t}\n\n\t\tvoid update_range(int node, int b, int e, int i, int j, int val) {\n\t\t\tif (i > e || j < b)\n\t\t\t\treturn;\n\t\t\tif (b >= i && e <= j) {\n\t\t\t\tsTree[node] += (e - b + 1) * val;\n\t\t\t\tlazy[node] += val;\n\t\t\t} else {\n\t\t\t\tint mid = b + e >> 1;\n\t\t\t\tpropagate(node, b, mid, e);\n\t\t\t\tupdate_range(node << 1, b, mid, i, j, val);\n\t\t\t\tupdate_range(node << 1 | 1, mid + 1, e, i, j, val);\n\t\t\t\tsTree[node] = sTree[node << 1] + sTree[node << 1 | 1];\n\t\t\t}\n\n\t\t}\n\n\t\tvoid propagate(int node, int b, int mid, int e) {\n\t\t\tlazy[node << 1] += lazy[node];\n\t\t\tlazy[node << 1 | 1] += lazy[node];\n\t\t\tsTree[node << 1] += (mid - b + 1) * lazy[node];\n\t\t\tsTree[node << 1 | 1] += (e - mid) * lazy[node];\n\t\t\tlazy[node] = 0;\n\t\t}\n\n\t\tint query(int i, int j) {\n\t\t\treturn query(1, 1, N, i, j);\n\t\t}\n\n\t\tint query(int node, int b, int e, int i, int j) // O(log n)\n\t\t{\n\t\t\tif (i > e || j < b)\n\t\t\t\treturn 0;\n\t\t\tif (b >= i && e <= j)\n\t\t\t\treturn sTree[node];\n\t\t\tint mid = b + e >> 1;\n\t\t\t// propagate(node, b, mid, e);\n\t\t\tint q1 = query(node << 1, b, mid, i, j);\n\t\t\tint q2 = query(node << 1 | 1, mid + 1, e, i, j);\n\t\t\treturn Math.max(q1, q2);\n\n\t\t}\n\t}\n\n\tstatic int memo[][];\n\n\n\tstatic class UnionFind {\n\t\tint[] p, rank, setSize;\n\t\tint numSets;\n\t\tint max[];\n\n\t\tpublic UnionFind(int N) {\n\t\t\tmax = new int[N];\n\t\t\tp = new int[numSets = N];\n\t\t\trank = new int[N];\n\t\t\tsetSize = new int[N];\n\t\t\tfor (int i = 0; i < N; i++) {\n\t\t\t\tp[i] = i;\n\t\t\t\tsetSize[i] = 1;\n\t\t\t\tmax[i] = i;\n\t\t\t}\n\t\t}\n\n\t\tpublic int findSet(int i) {\n\t\t\treturn p[i] == i ? i : (p[i] = findSet(p[i]));\n\t\t}\n\n\t\tpublic boolean isSameSet(int i, int j) {\n\t\t\treturn findSet(i) == findSet(j);\n\t\t}\n\n\t\tpublic void unionSet(int i, int j) {\n\t\t\tif (isSameSet(i, j))\n\t\t\t\treturn;\n\t\t\tnumSets--;\n\t\t\tint x = findSet(i), y = findSet(j);\n\t\t\tif (rank[x] > rank[y]) {\n\t\t\t\tp[y] = x;\n\t\t\t\tsetSize[x] += setSize[y];\n\t\t\t\tmax[x] = Math.max(max[x], max[y]);\n\n\t\t\t} else {\n\t\t\t\tp[x] = y;\n\t\t\t\tsetSize[y] += setSize[x];\n\t\t\t\tif (rank[x] == rank[y])\n\t\t\t\t\trank[y]++;\n\t\t\t\tmax[y] = Math.max(max[x], max[y]);\n\n\t\t\t}\n\t\t}\n\n\t\tprivate int getmax(int j) {\n\t\t\treturn max[findSet(j)];\n\t\t}\n\n\t\tpublic int numDisjointSets() {\n\t\t\treturn numSets;\n\t\t}\n\n\t\tpublic int sizeOfSet(int i) {\n\t\t\treturn setSize[findSet(i)];\n\t\t}\n\t}\n\n\t/**\n\t * private static void trace(int i, int time) { if(i==n) return;\n\t * \n\t * \n\t * long ans=dp(i,time);\n\t * if(time+a[i].t {\n\t\tint a;\n\t\tlong b;\n\t\tint idx;\n\n\t\tincpair(int a, long dirg, int i) {\n\t\t\tthis.a = a;\n\t\t\tb = dirg;\n\t\t\tidx = i;\n\t\t}\n\n\t\tpublic int compareTo(incpair e) {\n\t\t\treturn (int) (b - e.b);\n\t\t}\n\t}\n\n\tstatic class decpair implements Comparable {\n\t\tint a;\n\t\tlong b;\n\t\tint idx;\n\n\t\tdecpair(int a, long dirg, int i) {\n\t\t\tthis.a = a;\n\t\t\tb = dirg;\n\t\t\tidx = i;\n\t\t}\n\n\t\tpublic int compareTo(decpair e) {\n\t\t\treturn (int) (e.b - b);\n\t\t}\n\t}\n\n\tstatic long allpowers[];\n\n\tstatic class Quad implements Comparable {\n\t\tint u;\n\t\tint v;\n\t\tchar state;\n\t\tint turns;\n\n\t\tpublic Quad(int i, int j, char c, int k) {\n\t\t\tu = i;\n\t\t\tv = j;\n\t\t\tstate = c;\n\t\t\tturns = k;\n\t\t}\n\n\t\tpublic int compareTo(Quad e) {\n\t\t\treturn (int) (turns - e.turns);\n\t\t}\n\n\t}\n\n\tstatic long dirg[][];\n\tstatic Edge[] driver;\n\n\tstatic int n;\n\n\tstatic class Edge implements Comparable {\n\t\tint node;\n\t\tlong cost;\n\n\t\tEdge(int a, long dirg) {\n\t\t\tnode = a;\n\t\t\tcost = dirg;\n\t\t}\n\n\t\tpublic int compareTo(Edge e) {\n\t\t\treturn (int) (cost - e.cost);\n\t\t}\n\t}\n\n\tstatic long manhatandistance(long x, long x2, long y, long y2) {\n\t\treturn Math.abs(x - x2) + Math.abs(y - y2);\n\t}\n\n\tstatic long fib[];\n\n\tstatic long fib(int n) {\n\t\tif (n == 1 || n == 0) {\n\t\t\treturn 1;\n\t\t}\n\t\tif (fib[n] != -1) {\n\t\t\treturn fib[n];\n\t\t} else\n\t\t\treturn fib[n] = ((fib(n - 2) % mod + fib(n - 1) % mod) % mod);\n\t}\n\n\tstatic class Pair implements Comparable {\n\t\tint a, b;\n\n\t\tPair(int x, int y) {\n\t\t\ta = x;\n\t\t\tb = y;\n\t\t}\n\n\t\t@Override\n\t\tpublic int compareTo(Pair c) {\n\t\t\treturn b-c.b;\n\t\t}\n\n\t}\n\n\tstatic long[][] comb;\n\n\tstatic class Triple implements Comparable {\n\n\t\tint l;\n\t\tint r;\n\t\tlong cost;\n\t\tint idx;\n\n\t\tpublic Triple(int a, int b, long l1, int l2) {\n\t\t\tl = a;\n\t\t\tr = b;\n\t\t\tcost = l1;\n\t\t\tidx = l2;\n\t\t}\n\n\t\tpublic int compareTo(Triple x) {\n\t\t\tif (l != x.l || idx == x.idx)\n\t\t\t\treturn l - x.l;\n\t\t\treturn -idx;\n\t\t}\n\n\t}\n\n\tstatic TreeSet primeFactors(long N) // O(sqrt(N) / ln sqrt(N))\n\t{\n\t\tTreeSet factors = new TreeSet(); // take abs(N) in case of -ve integers\n\t\tint idx = 0, p = primes.get(idx);\n\n\t\twhile (p * p <= N) {\n\t\t\twhile (N % p == 0) {\n\t\t\t\tfactors.add((long) p);\n\t\t\t\tN /= p;\n\t\t\t}\n\t\t\tif (primes.size() > idx + 1)\n\t\t\t\tp = primes.get(++idx);\n\t\t\telse\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif (N != 1) // last prime factor may be > sqrt(N)\n\t\t\tfactors.add(N); // for integers whose largest prime factor has a power of 1\n\t\treturn factors;\n\t}\n\n\tstatic boolean visited[];\n\n\t/**\n\t * static int bfs(int s) { Queue q = new LinkedList();\n\t * q.add(s); int count=0; int maxcost=0; int dist[]=new int[n]; dist[s]=0;\n\t * while(!q.isEmpty()) {\n\t * \n\t * int u = q.remove(); if(dist[u]==k) { break; } for(Pair v: adj[u]) {\n\t * maxcost=Math.max(maxcost, v.cost);\n\t * \n\t * \n\t * \n\t * if(!visited[v.v]) {\n\t * \n\t * visited[v.v]=true; q.add(v.v); dist[v.v]=dist[u]+1; maxcost=Math.max(maxcost,\n\t * v.cost); } }\n\t * \n\t * } return maxcost; }\n\t **/\n\tpublic static boolean FindAllElements(int n, int k) {\n\t\tint sum = k;\n\t\tint[] A = new int[k];\n\t\tArrays.fill(A, 0, k, 1);\n\n\t\tfor (int i = k - 1; i >= 0; --i) {\n\n\t\t\twhile (sum + A[i] <= n) {\n\n\t\t\t\tsum += A[i];\n\t\t\t\tA[i] *= 2;\n\t\t\t}\n\t\t}\n\t\tif (sum == n) {\n\t\t\treturn true;\n\t\t} else\n\t\t\treturn false;\n\t}\n\n\tstatic boolean vis2[][];\n\n\tstatic boolean f2 = false;\n\n\tstatic long[][] matMul(long[][] a2, long[][] b, int p, int q, int r) // C(p x r) = A(p x q) x (q x r) -- O(p x q x\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// r)\n\t{\n\t\tlong[][] C = new long[p][r];\n\t\tfor (int i = 0; i < p; ++i) {\n\t\t\tfor (int j = 0; j < r; ++j) {\n\t\t\t\tfor (int k = 0; k < q; ++k) {\n\t\t\t\t\tC[i][j] = (C[i][j] + (a2[i][k] % mod * b[k][j] % mod)) % mod;\n\t\t\t\t\tC[i][j] %= mod;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t\treturn C;\n\t}\n\n\tstatic ArrayList a1[];\n\tstatic int memo1[];\n\n\tstatic boolean vis[];\n\tstatic TreeSet set = new TreeSet();\n\n\tstatic long modPow(long ways, long count, long mod) // O(log e)\n\t{\n\t\tways %= mod;\n\t\tlong res = 1;\n\t\twhile (count > 0) {\n\t\t\tif ((count & 1) == 1)\n\t\t\t\tres = (res * ways) % mod;\n\t\t\tways = (ways * ways) % mod;\n\t\t\tcount >>= 1;\n\t\t}\n\t\treturn res % mod;\n\t}\n\n\tstatic long gcd(long ans, long b) {\n\t\tif (b == 0) {\n\t\t\treturn ans;\n\t\t}\n\t\treturn gcd(b, ans % b);\n\t}\n\n\tstatic int[] isComposite;\n\tstatic int[] valid;\n\n\tstatic ArrayList primes;\n\tstatic ArrayList l1;\n\n\t\n\tstatic TreeSet primus = new TreeSet();\n\t\n\tstatic void sieveLinear(int N)\n\t{\n\t\tint[] lp = new int[N + 1];\t\t\t\t\t\t\t\t//lp[i] = least prime divisor of i\n\t\tfor(int i = 2; i <= N; ++i)\n\t\t{\n\t\t\tif(lp[i] == 0)\n\t\t\t{\n\t\t\t\tprimus.add(i);\n\t\t\t\tlp[i] = i;\n\t\t\t}\n\t\t\tint curLP = lp[i];\n\t\t\tfor(int p: primus)\n\t\t\t\tif(p > curLP || p * i > N)\n\t\t\t\t\tbreak;\n\t\t\t\telse\n\t\t\t\t\tlp[p * i] = i;\n\t\t}\n\t}\n\t\n\n\tpublic static long[] schuffle(long[] sad) {\n\t\tfor (int i = 0; i < sad.length; i++) {\n\t\t\tint x = (int) (Math.random() * sad.length);\n\t\t\tlong temp = sad[x];\n\t\t\tsad[x] = sad[i];\n\t\t\tsad[i] = temp;\n\t\t}\n\t\treturn sad;\n\t}\n\n\tstatic int V;\n\tstatic long INF = (long) 1E16;\n\n\tstatic class Edge2 {\n\t\tint node;\n\t\tlong cost;\n\t\tlong next;\n\n\t\tEdge2(int a, int c, Long long1) {\n\t\t\tnode = a;\n\t\t\tcost = long1;\n\t\t\tnext = c;\n\t\t}\n\n\t}\n\n\tstatic class Scanner {\n\t\tStringTokenizer st;\n\t\tBufferedReader br;\n\n\t\tpublic Scanner(InputStream system) {\n\t\t\tbr = new BufferedReader(new InputStreamReader(system));\n\t\t}\n\n\t\tpublic Scanner(String file) throws Exception {\n\t\t\tbr = new BufferedReader(new FileReader(file));\n\t\t}\n\n\t\tpublic String next() throws IOException {\n\t\t\twhile (st == null || !st.hasMoreTokens())\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tpublic String nextLine() throws IOException {\n\t\t\treturn br.readLine();\n\t\t}\n\n\t\tpublic int nextInt() throws IOException {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tpublic double nextDouble() throws IOException {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tpublic char nextChar() throws IOException {\n\t\t\treturn next().charAt(0);\n\t\t}\n\n\t\tpublic Long nextLong() throws IOException {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tpublic boolean ready() throws IOException {\n\t\t\treturn br.ready();\n\t\t}\n\n\t\tpublic void waitForInput() throws InterruptedException {\n\t\t\tThread.sleep(3000);\n\t\t}\n\n\t\tpublic int[] nxtArr(int n) throws IOException {\n\t\t\tint[] ans = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tans[i] = nextInt();\n\t\t\treturn ans;\n\t\t}\n\t}\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "sample_input": "3 3\n1 7\n3 2\n1 7\n"}, "reference_outputs": ["702\n"], "source_document_id": "p02761", "source_text": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 13496, "cpu_time_ms": 80, "memory_kb": 21332}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s224642443", "group_id": "codeNet:p02761", "input_text": "import java.util.Scanner;\nimport java.util.Map;\nimport java.util.HashMap;\n\npublic class Main {\n\n public static void main(String[] args) {\n\n // 入力データの取得\n Scanner scanner = new Scanner(System.in);\n int digitNum = scanner.nextInt();\n int checkNum = scanner.nextInt();\n Map resultMap = new HashMap<>();\n for (int count = 0; count < checkNum; count++) {\n int checkDigitNumber = scanner.nextInt();\n int displayDigitNumber = scanner.nextInt();\n if (!resultMap.isEmpty() && resultMap.get(checkDigitNumber) != null && resultMap.get(checkDigitNumber) != displayDigitNumber) {\n System.out.println(\"-1\");\n scanner.close();\n return;\n } else {\n resultMap.put(checkDigitNumber, displayDigitNumber);\n }\n }\n scanner.close();\n\n // 結果の出力\n StringBuilder displayBuilder = new StringBuilder();\n if (resultMap.get(1) != null && resultMap.get(1) == 0) {\n System.out.println(\"-1\");\n return;\n } else {\n if (digitNum == 0) {\n if (resultMap.get(1) == null) {\n displayBuilder.append(0);\n } else {\n displayBuilder.append(resultMap.get(1));\n }\n } else {\n for (int count = 1; count <= digitNum; count++) {\n if (count != 1 && resultMap.get(count) == null) {\n displayBuilder.append(0);\n } else if (count == 1 && resultMap.get(count) == null) {\n displayBuilder.append(1);\n } else {\n displayBuilder.append(resultMap.get(count));\n }\n }\n }\n System.out.println(displayBuilder.toString());\n }\n\n }\n\n}", "language": "Java", "metadata": {"date": 1584557172, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02761.html", "problem_id": "p02761", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02761/input.txt", "sample_output_relpath": "derived/input_output/data/p02761/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02761/Java/s224642443.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s224642443", "user_id": "u119310692"}, "prompt_components": {"gold_output": "702\n", "input_to_evaluate": "import java.util.Scanner;\nimport java.util.Map;\nimport java.util.HashMap;\n\npublic class Main {\n\n public static void main(String[] args) {\n\n // 入力データの取得\n Scanner scanner = new Scanner(System.in);\n int digitNum = scanner.nextInt();\n int checkNum = scanner.nextInt();\n Map resultMap = new HashMap<>();\n for (int count = 0; count < checkNum; count++) {\n int checkDigitNumber = scanner.nextInt();\n int displayDigitNumber = scanner.nextInt();\n if (!resultMap.isEmpty() && resultMap.get(checkDigitNumber) != null && resultMap.get(checkDigitNumber) != displayDigitNumber) {\n System.out.println(\"-1\");\n scanner.close();\n return;\n } else {\n resultMap.put(checkDigitNumber, displayDigitNumber);\n }\n }\n scanner.close();\n\n // 結果の出力\n StringBuilder displayBuilder = new StringBuilder();\n if (resultMap.get(1) != null && resultMap.get(1) == 0) {\n System.out.println(\"-1\");\n return;\n } else {\n if (digitNum == 0) {\n if (resultMap.get(1) == null) {\n displayBuilder.append(0);\n } else {\n displayBuilder.append(resultMap.get(1));\n }\n } else {\n for (int count = 1; count <= digitNum; count++) {\n if (count != 1 && resultMap.get(count) == null) {\n displayBuilder.append(0);\n } else if (count == 1 && resultMap.get(count) == null) {\n displayBuilder.append(1);\n } else {\n displayBuilder.append(resultMap.get(count));\n }\n }\n }\n System.out.println(displayBuilder.toString());\n }\n\n }\n\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "sample_input": "3 3\n1 7\n3 2\n1 7\n"}, "reference_outputs": ["702\n"], "source_document_id": "p02761", "source_text": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1939, "cpu_time_ms": 95, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s387712773", "group_id": "codeNet:p02761", "input_text": "import java.util.*;\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int M = sc.nextInt();\n int flg = 0;\n if(N == 1 && M == 0){\n System.out.println(\"0\");\n flg = 1;\n }\n int[] n = new int[N];\n int[] flg2 = new int[N];\n for(int i = 0; i < M; i++){\n int s = sc.nextInt();\n int c = sc.nextInt();\n if(N == 1 && M == 1){\n System.out.println(c);\n flg = 1;\n break;\n } else if(s == 1 && c == 0){\n System.out.println(\"-1\");\n flg = 1;\n break;\n } else if(n[s - 1] == 0 || n[s - 1] == c || flg2[s - 1] == 0){\n n[s - 1] = c;\n flg2[s - 1] = 1;\n } else {\n System.out.println(\"-1\");\n flg = 1;\n break;\n }\n }\n if(N != 1 && n[0] == 0){\n n[0] = 1;\n }\n if(flg == 0){\n for(int i = 0; i < N; i++){\n System.out.print(n[i]);\n }\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1583474584, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02761.html", "problem_id": "p02761", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02761/input.txt", "sample_output_relpath": "derived/input_output/data/p02761/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02761/Java/s387712773.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s387712773", "user_id": "u229120147"}, "prompt_components": {"gold_output": "702\n", "input_to_evaluate": "import java.util.*;\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int M = sc.nextInt();\n int flg = 0;\n if(N == 1 && M == 0){\n System.out.println(\"0\");\n flg = 1;\n }\n int[] n = new int[N];\n int[] flg2 = new int[N];\n for(int i = 0; i < M; i++){\n int s = sc.nextInt();\n int c = sc.nextInt();\n if(N == 1 && M == 1){\n System.out.println(c);\n flg = 1;\n break;\n } else if(s == 1 && c == 0){\n System.out.println(\"-1\");\n flg = 1;\n break;\n } else if(n[s - 1] == 0 || n[s - 1] == c || flg2[s - 1] == 0){\n n[s - 1] = c;\n flg2[s - 1] = 1;\n } else {\n System.out.println(\"-1\");\n flg = 1;\n break;\n }\n }\n if(N != 1 && n[0] == 0){\n n[0] = 1;\n }\n if(flg == 0){\n for(int i = 0; i < N; i++){\n System.out.print(n[i]);\n }\n }\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "sample_input": "3 3\n1 7\n3 2\n1 7\n"}, "reference_outputs": ["702\n"], "source_document_id": "p02761", "source_text": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 974, "cpu_time_ms": 94, "memory_kb": 23380}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s832450035", "group_id": "codeNet:p02761", "input_text": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int m = sc.nextInt();\n int[] num = new int[n];\n for (int i = 0; i < n; i++) {\n num[i] = -1;\n }\n for (int i = 0; i < m; i++) {\n int s = sc.nextInt();\n int c = sc.nextInt();\n if (n!=1 &&s == 1 && c == 0) {\n System.out.println(-1);\n return;\n } else if (num[s - 1] > -1 && num[s - 1] != c) {\n System.out.println(-1);\n return;\n } else {\n num[s - 1] = c;\n }\n }\n int ans = 0, digit = 1;\n if(n == 3 && num[0] == -1) num[0] = 1;\n if(n == 2 && num[0] == -1) num[0] = 1;\n for (int i = n - 1; i >= 0; i--) {\n// if(n-1==i && num[n-i-1] == -1) num[n-i-1] = 1;\n if (num[i] == -1) num[i] = 0;\n\n ans += num[i] * digit;\n digit *= 10;\n }\n System.out.println(ans < 0? -1: ans);\n }\n}", "language": "Java", "metadata": {"date": 1583459146, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02761.html", "problem_id": "p02761", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02761/input.txt", "sample_output_relpath": "derived/input_output/data/p02761/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02761/Java/s832450035.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s832450035", "user_id": "u423952743"}, "prompt_components": {"gold_output": "702\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int m = sc.nextInt();\n int[] num = new int[n];\n for (int i = 0; i < n; i++) {\n num[i] = -1;\n }\n for (int i = 0; i < m; i++) {\n int s = sc.nextInt();\n int c = sc.nextInt();\n if (n!=1 &&s == 1 && c == 0) {\n System.out.println(-1);\n return;\n } else if (num[s - 1] > -1 && num[s - 1] != c) {\n System.out.println(-1);\n return;\n } else {\n num[s - 1] = c;\n }\n }\n int ans = 0, digit = 1;\n if(n == 3 && num[0] == -1) num[0] = 1;\n if(n == 2 && num[0] == -1) num[0] = 1;\n for (int i = n - 1; i >= 0; i--) {\n// if(n-1==i && num[n-i-1] == -1) num[n-i-1] = 1;\n if (num[i] == -1) num[i] = 0;\n\n ans += num[i] * digit;\n digit *= 10;\n }\n System.out.println(ans < 0? -1: ans);\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "sample_input": "3 3\n1 7\n3 2\n1 7\n"}, "reference_outputs": ["702\n"], "source_document_id": "p02761", "source_text": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1113, "cpu_time_ms": 97, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s975219650", "group_id": "codeNet:p02761", "input_text": "import java.util.Map;\nimport java.util.Scanner;\nimport java.util.TreeMap;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tint M = sc.nextInt();\n\t\tMap map = new TreeMap<>();\n\t\tfor(int i = 0;i < M;i++){\n\t\t\tint s = sc.nextInt();\n\t\t\tint c = sc.nextInt();\n\t\t\tif(map.containsKey(s-1)){\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}else{\n\t\t\t\tmap.put(s-1, c);\n\t\t\t}\n\t\t}\n\t\tsc.close();\n\t\tif(N>=2){\n\t\t\tfor(int i = 0;i < N;i++){\n\t\t\t\tif(!map.containsKey(i)){\n\t\t\t\t\tmap.put(i, 0);\n\t\t\t\t\tif(i == N-1){\n\t\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(Map.Entry ent : map.entrySet()){\n\t\t\t\tSystem.out.print(ent.getValue());\n\t\t\t}\n\t\t}else{\n\t\t\tSystem.out.println(0);\n\t\t}\n\t}\n}", "language": "Java", "metadata": {"date": 1583455775, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02761.html", "problem_id": "p02761", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02761/input.txt", "sample_output_relpath": "derived/input_output/data/p02761/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02761/Java/s975219650.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s975219650", "user_id": "u137938820"}, "prompt_components": {"gold_output": "702\n", "input_to_evaluate": "import java.util.Map;\nimport java.util.Scanner;\nimport java.util.TreeMap;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tint M = sc.nextInt();\n\t\tMap map = new TreeMap<>();\n\t\tfor(int i = 0;i < M;i++){\n\t\t\tint s = sc.nextInt();\n\t\t\tint c = sc.nextInt();\n\t\t\tif(map.containsKey(s-1)){\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}else{\n\t\t\t\tmap.put(s-1, c);\n\t\t\t}\n\t\t}\n\t\tsc.close();\n\t\tif(N>=2){\n\t\t\tfor(int i = 0;i < N;i++){\n\t\t\t\tif(!map.containsKey(i)){\n\t\t\t\t\tmap.put(i, 0);\n\t\t\t\t\tif(i == N-1){\n\t\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(Map.Entry ent : map.entrySet()){\n\t\t\t\tSystem.out.print(ent.getValue());\n\t\t\t}\n\t\t}else{\n\t\t\tSystem.out.println(0);\n\t\t}\n\t}\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "sample_input": "3 3\n1 7\n3 2\n1 7\n"}, "reference_outputs": ["702\n"], "source_document_id": "p02761", "source_text": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 787, "cpu_time_ms": 114, "memory_kb": 23636}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s435302224", "group_id": "codeNet:p02761", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\n\t\tScanner scan = new Scanner(System.in);\n\t\tint anser = -1;\n\n\t\tint n = scan.nextInt();\n\t\tint m = scan.nextInt();\n\n\t\tint[] s = new int[m];\n\t\tint[] c = new int[m];\n\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\ts[i] = scan.nextInt();\n\t\t\tc[i] = scan.nextInt();\n\t\t}\n\n\t\tif(m == 0) {\n\t\t\tif(n == 1) {\n\t\t\t\tanser = 0;\n\t\t\t}\n\t\t\tif(n == 2) {\n\t\t\t\tanser = 10;\n\t\t\t}\n\t\t\tif(n == 3) {\n\t\t\t\tanser = 100;\n\t\t\t}\n\t\t}\n\n\t\tif (n == 1) {\n\t\t\tout_of_loop: for (int i = 0; i <= 9; i++) {\n\t\t\t\tfor (int j = 0; j < m; j++) {\n\t\t\t\t\tif (i != c[j]) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif (j == m - 1) {\n\t\t\t\t\t\tanser = i;\n\t\t\t\t\t\tbreak out_of_loop;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (n == 2) {\n\t\t\tout_of_loop: for (int i = 10; i <= 99; i++) {\n\t\t\t\tfor (int j = 0; j < m; j++) {\n\t\t\t\t\tif (s[j] == 1) {\n\t\t\t\t\t\tif (i / 10 != c[j]||c[j] == 0) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (s[j] == 2) {\n\t\t\t\t\t\tif (i % 10 != c[j]) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (j == m - 1) {\n\t\t\t\t\t\tanser = i;\n\t\t\t\t\t\tbreak out_of_loop;\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (n == 3) {\n\t\t\tout_of_loop: for (int i = 100; i <= 999; i++) {\n\t\t\t\tfor (int j = 0; j < m; j++) {\n\t\t\t\t\tif (s[j] == 1) {\n\t\t\t\t\t\tif (i / 100 != c[j] || c[j] == 0) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (s[j] == 2) {\n\t\t\t\t\t\tif (i / 10 % 10 != c[j]) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (s[j] == 3) {\n\t\t\t\t\t\tif (i % 10 != c[j]) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (j == m - 1) {\n\t\t\t\t\t\tanser = i;\n\t\t\t\t\t\tbreak out_of_loop;\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(anser);\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1583288593, "filename_ext": "java", "original_language": "Java7 (OpenJDK 1.7.0)", "problem_description_relpath": "problem_descriptions/p02761.html", "problem_id": "p02761", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02761/input.txt", "sample_output_relpath": "derived/input_output/data/p02761/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02761/Java/s435302224.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s435302224", "user_id": "u162241493"}, "prompt_components": {"gold_output": "702\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\n\t\tScanner scan = new Scanner(System.in);\n\t\tint anser = -1;\n\n\t\tint n = scan.nextInt();\n\t\tint m = scan.nextInt();\n\n\t\tint[] s = new int[m];\n\t\tint[] c = new int[m];\n\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\ts[i] = scan.nextInt();\n\t\t\tc[i] = scan.nextInt();\n\t\t}\n\n\t\tif(m == 0) {\n\t\t\tif(n == 1) {\n\t\t\t\tanser = 0;\n\t\t\t}\n\t\t\tif(n == 2) {\n\t\t\t\tanser = 10;\n\t\t\t}\n\t\t\tif(n == 3) {\n\t\t\t\tanser = 100;\n\t\t\t}\n\t\t}\n\n\t\tif (n == 1) {\n\t\t\tout_of_loop: for (int i = 0; i <= 9; i++) {\n\t\t\t\tfor (int j = 0; j < m; j++) {\n\t\t\t\t\tif (i != c[j]) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif (j == m - 1) {\n\t\t\t\t\t\tanser = i;\n\t\t\t\t\t\tbreak out_of_loop;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (n == 2) {\n\t\t\tout_of_loop: for (int i = 10; i <= 99; i++) {\n\t\t\t\tfor (int j = 0; j < m; j++) {\n\t\t\t\t\tif (s[j] == 1) {\n\t\t\t\t\t\tif (i / 10 != c[j]||c[j] == 0) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (s[j] == 2) {\n\t\t\t\t\t\tif (i % 10 != c[j]) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (j == m - 1) {\n\t\t\t\t\t\tanser = i;\n\t\t\t\t\t\tbreak out_of_loop;\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (n == 3) {\n\t\t\tout_of_loop: for (int i = 100; i <= 999; i++) {\n\t\t\t\tfor (int j = 0; j < m; j++) {\n\t\t\t\t\tif (s[j] == 1) {\n\t\t\t\t\t\tif (i / 100 != c[j] || c[j] == 0) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (s[j] == 2) {\n\t\t\t\t\t\tif (i / 10 % 10 != c[j]) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (s[j] == 3) {\n\t\t\t\t\t\tif (i % 10 != c[j]) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (j == m - 1) {\n\t\t\t\t\t\tanser = i;\n\t\t\t\t\t\tbreak out_of_loop;\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(anser);\n\t}\n\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "sample_input": "3 3\n1 7\n3 2\n1 7\n"}, "reference_outputs": ["702\n"], "source_document_id": "p02761", "source_text": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1538, "cpu_time_ms": 107, "memory_kb": 22868}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s309511447", "group_id": "codeNet:p02761", "input_text": "\nimport java.util.ArrayList;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tMain main = new Main();\n\t\tmain.run();\n\t}\n\n\tclass P{\n\t\tint s;\n\t\tint c;\n\t\tP(int s, int c){\n\t\t\tthis.s=s;\n\t\t\tthis.c=c;\n\t\t}\n\t}\n\n\tpublic void run() {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\tint m=sc.nextInt();\n\n\t\tArrayList

p = new ArrayList

();\n\t\tfor(int i=0; i d = new ArrayList();\n\t\t\td.add(i%10);\n\t\t\tint ni = i/10;\n\t\t\tint keta=1;\n\t\t\twhile(ni>0) {\n\t\t\t\td.add(0,ni%10);\n\t\t\t\tni /= 10;\n\t\t\t\tketa++;\n\t\t\t}\n\t\t\tif(keta != n) continue;\n\n\t\t\tboolean ok = true;\n\t\t\tfor(int j=0 ;j p = new ArrayList

();\n\t\tfor(int i=0; i d = new ArrayList();\n\t\t\td.add(i%10);\n\t\t\tint ni = i/10;\n\t\t\tint keta=1;\n\t\t\twhile(ni>0) {\n\t\t\t\td.add(0,ni%10);\n\t\t\t\tni /= 10;\n\t\t\t\tketa++;\n\t\t\t}\n\t\t\tif(keta != n) continue;\n\n\t\t\tboolean ok = true;\n\t\t\tfor(int j=0 ;j sc_map = new HashMap();\n\t\tboolean isUnique = true;\n\t\tboolean isExist = true;\n\n\t\t// 重複を取る、重複に矛盾があればその場でエラーとする\n\t\tfor (int i=0; i sc_map = new HashMap();\n\t\tboolean isUnique = true;\n\t\tboolean isExist = true;\n\n\t\t// 重複を取る、重複に矛盾があればその場でエラーとする\n\t\tfor (int i=0; i sici = new HashMap<>();\n\t\tfor(int i = 0; i < m; i++) {\n\t\t\tint s = sc.nextInt();\n\t\t\tint c = sc.nextInt();\n\t\t\tif(s == 1 && c == 0) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t\tif(sici.containsKey(s)) {\n\t\t\t\tif(sici.get(s) != c) {\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\tSystem.exit(0);\n\t\t\t\t}\n\t\t\t}\n\t\t\tsici.put(s, c);\n\t\t\tseisu[s - 1] = c;\n\t\t}\n\n\t\tif(!sici.containsKey(1)) {\n\t\t\tseisu[0] = 1;\n\t\t}\n\n\t\tfor(int value : seisu) {\n\t\t\tSystem.out.print(value);\n\t\t}\n\n\t\tsc.close();\n\t}\n}", "language": "Java", "metadata": {"date": 1583118370, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02761.html", "problem_id": "p02761", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02761/input.txt", "sample_output_relpath": "derived/input_output/data/p02761/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02761/Java/s308006284.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s308006284", "user_id": "u910987127"}, "prompt_components": {"gold_output": "702\n", "input_to_evaluate": "import java.util.HashMap;\nimport java.util.Map;\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint m = sc.nextInt();\n\t\tint[] seisu = new int[n];\n\t\tMap sici = new HashMap<>();\n\t\tfor(int i = 0; i < m; i++) {\n\t\t\tint s = sc.nextInt();\n\t\t\tint c = sc.nextInt();\n\t\t\tif(s == 1 && c == 0) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t\tif(sici.containsKey(s)) {\n\t\t\t\tif(sici.get(s) != c) {\n\t\t\t\t\tSystem.out.println(-1);\n\t\t\t\t\tSystem.exit(0);\n\t\t\t\t}\n\t\t\t}\n\t\t\tsici.put(s, c);\n\t\t\tseisu[s - 1] = c;\n\t\t}\n\n\t\tif(!sici.containsKey(1)) {\n\t\t\tseisu[0] = 1;\n\t\t}\n\n\t\tfor(int value : seisu) {\n\t\t\tSystem.out.print(value);\n\t\t}\n\n\t\tsc.close();\n\t}\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "sample_input": "3 3\n1 7\n3 2\n1 7\n"}, "reference_outputs": ["702\n"], "source_document_id": "p02761", "source_text": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 751, "cpu_time_ms": 96, "memory_kb": 23380}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s452602361", "group_id": "codeNet:p02761", "input_text": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int ketasu = sc.nextInt();\n int m = sc.nextInt();\n HashMap map = new HashMap<>();\n boolean judge = true;\n int maxKetasu = 0;\n for(int i = 0; i < m; i++){\n int a = sc.nextInt();\n int b = sc.nextInt();\n if(map.containsKey(a) && b != map.get(a)){\n judge = false;\n break;\n }else{\n map.put(a, b);\n }\n if(maxKetasu < a)\n maxKetasu = a;\n }\n if(judge == false)\n System.out.println(-1);\n else if(!map.containsKey(1))\n System.out.println(-1);\n else if(map.get(1) == 0)\n System.out.print(-1);\n else{\n for(int i = 1; i <= ketasu; i++){\n if(!map.containsKey(i))\n System.out.print(0);\n else\n System.out.print(map.get(i));\n }\n }\n System.out.println();\n }\n}\n", "language": "Java", "metadata": {"date": 1583117802, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02761.html", "problem_id": "p02761", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02761/input.txt", "sample_output_relpath": "derived/input_output/data/p02761/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02761/Java/s452602361.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s452602361", "user_id": "u579583524"}, "prompt_components": {"gold_output": "702\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int ketasu = sc.nextInt();\n int m = sc.nextInt();\n HashMap map = new HashMap<>();\n boolean judge = true;\n int maxKetasu = 0;\n for(int i = 0; i < m; i++){\n int a = sc.nextInt();\n int b = sc.nextInt();\n if(map.containsKey(a) && b != map.get(a)){\n judge = false;\n break;\n }else{\n map.put(a, b);\n }\n if(maxKetasu < a)\n maxKetasu = a;\n }\n if(judge == false)\n System.out.println(-1);\n else if(!map.containsKey(1))\n System.out.println(-1);\n else if(map.get(1) == 0)\n System.out.print(-1);\n else{\n for(int i = 1; i <= ketasu; i++){\n if(!map.containsKey(i))\n System.out.print(0);\n else\n System.out.print(map.get(i));\n }\n }\n System.out.println();\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "sample_input": "3 3\n1 7\n3 2\n1 7\n"}, "reference_outputs": ["702\n"], "source_document_id": "p02761", "source_text": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1077, "cpu_time_ms": 94, "memory_kb": 22996}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s247100672", "group_id": "codeNet:p02761", "input_text": "import java.util.*;\nimport java.math.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int m = sc.nextInt();\n\n int[] s = new int[m];\n int[] c = new int[m];\n\n\n for (int i = 0; i < m; i++) {\n s[i] = sc.nextInt();\n c[i] = sc.nextInt();\n }\n\n TreeMap mp = new TreeMap();\n\n for (int i = 0; i < m; i++) {\n if (mp.containsKey(s[i])) {\n int k = mp.get(s[i]);\n if (k != c[i]) {\n System.out.println(-1);\n return;\n }\n }\n mp.put(s[i],c[i]);\n }\n\n String h = \"\";\n\n for (int i = 1; i <= n; i++) {\n Integer x = mp.get(i);\n if (x == null) {\n h += \"0\";\n } else {\n h += String.valueOf(x);\n }\n }\n\n if (h.charAt(n-1) == '0') {\n System.out.println(-1);\n } else {\n System.out.println(h);\n }\n\n }\n}\n", "language": "Java", "metadata": {"date": 1583117748, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02761.html", "problem_id": "p02761", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02761/input.txt", "sample_output_relpath": "derived/input_output/data/p02761/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02761/Java/s247100672.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s247100672", "user_id": "u387775763"}, "prompt_components": {"gold_output": "702\n", "input_to_evaluate": "import java.util.*;\nimport java.math.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int m = sc.nextInt();\n\n int[] s = new int[m];\n int[] c = new int[m];\n\n\n for (int i = 0; i < m; i++) {\n s[i] = sc.nextInt();\n c[i] = sc.nextInt();\n }\n\n TreeMap mp = new TreeMap();\n\n for (int i = 0; i < m; i++) {\n if (mp.containsKey(s[i])) {\n int k = mp.get(s[i]);\n if (k != c[i]) {\n System.out.println(-1);\n return;\n }\n }\n mp.put(s[i],c[i]);\n }\n\n String h = \"\";\n\n for (int i = 1; i <= n; i++) {\n Integer x = mp.get(i);\n if (x == null) {\n h += \"0\";\n } else {\n h += String.valueOf(x);\n }\n }\n\n if (h.charAt(n-1) == '0') {\n System.out.println(-1);\n } else {\n System.out.println(h);\n }\n\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "sample_input": "3 3\n1 7\n3 2\n1 7\n"}, "reference_outputs": ["702\n"], "source_document_id": "p02761", "source_text": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 97, "memory_kb": 22100}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s050955786", "group_id": "codeNet:p02761", "input_text": "import java.util.*;\n \npublic class Main {\n \n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n\t int digit = in.nextInt();\n \tint inputs = in.nextInt();\n \n \tif (inputs == 0) {\n \tSystem.out.println(-1); \n \treturn; \n }\n \n int[] array = new int[digit];\n\t\tfor (int i = 0; i < inputs; i++) {\n \tint pos = in.nextInt(); \n \tint val = in.nextInt();\n \tif (val < 0) {\n System.out.println(-1); \n return; \n }\n \tarray[pos - 1] = val;\n } \n \n \tif (array.length > 1 && array[0] == 0) {\n \tSystem.out.println(-1); \n \treturn; \n }\n \n \tStringBuilder sb = new StringBuilder();\n\t\tfor (int i = 0; i < array.length; i++) {\n \tsb.append(array[i]); \n }\n \n \tSystem.out.println(sb.toString());\n }\n \n}", "language": "Java", "metadata": {"date": 1583117575, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02761.html", "problem_id": "p02761", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02761/input.txt", "sample_output_relpath": "derived/input_output/data/p02761/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02761/Java/s050955786.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s050955786", "user_id": "u610795346"}, "prompt_components": {"gold_output": "702\n", "input_to_evaluate": "import java.util.*;\n \npublic class Main {\n \n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n\t int digit = in.nextInt();\n \tint inputs = in.nextInt();\n \n \tif (inputs == 0) {\n \tSystem.out.println(-1); \n \treturn; \n }\n \n int[] array = new int[digit];\n\t\tfor (int i = 0; i < inputs; i++) {\n \tint pos = in.nextInt(); \n \tint val = in.nextInt();\n \tif (val < 0) {\n System.out.println(-1); \n return; \n }\n \tarray[pos - 1] = val;\n } \n \n \tif (array.length > 1 && array[0] == 0) {\n \tSystem.out.println(-1); \n \treturn; \n }\n \n \tStringBuilder sb = new StringBuilder();\n\t\tfor (int i = 0; i < array.length; i++) {\n \tsb.append(array[i]); \n }\n \n \tSystem.out.println(sb.toString());\n }\n \n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "sample_input": "3 3\n1 7\n3 2\n1 7\n"}, "reference_outputs": ["702\n"], "source_document_id": "p02761", "source_text": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 976, "cpu_time_ms": 102, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s970052467", "group_id": "codeNet:p02761", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint n = Integer.parseInt(sc.next());\n\t\tint m = Integer.parseInt(sc.next());\n\n\t\tint[] s = new int[n];\n\t\tfor(int i = 0 ; i < n ; i++) {\n\t\t\ts[i] = -1;\n\n\n\t\t}\n\n\t\tint ans = 0;\n\t\tfor(int i = 0 ; i < m ; i++) {\n\t\t\tint temp1 = Integer.parseInt(sc.next()) -1;\n\t\t\tint temp2 = Integer.parseInt(sc.next());\n\n\t\t\tif(s[temp1] == -1) {\n\t\t\t\ts[temp1] = temp2;\n\t\t\t}else if(s[temp1] != temp2) {\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t}\n\n\n\t\tfor(int i = 0 ; i < n ; i++) {\n\t\t\tif(s[i] == -1) {\n\t\t\t\tif(i == 0 || n == 1) {\n\t\t\t\t\ts[i] = 1;\n\t\t\t\t}else {\n\t\t\t\t\ts[i] = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif(n != 1 && s[0] == 0) {\n\t\t\tans = -1;\n\t\t}\n\n\t\tif(ans != -1) {\n\t\t\tString tmp = \"\";\n\t\t\tfor(int i = 0 ; i < n ; i++ ) {\n\t\t\t\ttmp += \"\" + s[i];\n\t\t\t}\n\t\t\t\n\t\t\tans = Integer.parseInt(tmp);\n\t\t}\t\n\n\t\tSystem.out.println(ans);\n\t}\n}", "language": "Java", "metadata": {"date": 1583117329, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02761.html", "problem_id": "p02761", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02761/input.txt", "sample_output_relpath": "derived/input_output/data/p02761/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02761/Java/s970052467.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s970052467", "user_id": "u917343765"}, "prompt_components": {"gold_output": "702\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint n = Integer.parseInt(sc.next());\n\t\tint m = Integer.parseInt(sc.next());\n\n\t\tint[] s = new int[n];\n\t\tfor(int i = 0 ; i < n ; i++) {\n\t\t\ts[i] = -1;\n\n\n\t\t}\n\n\t\tint ans = 0;\n\t\tfor(int i = 0 ; i < m ; i++) {\n\t\t\tint temp1 = Integer.parseInt(sc.next()) -1;\n\t\t\tint temp2 = Integer.parseInt(sc.next());\n\n\t\t\tif(s[temp1] == -1) {\n\t\t\t\ts[temp1] = temp2;\n\t\t\t}else if(s[temp1] != temp2) {\n\t\t\t\tans = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t}\n\n\n\t\tfor(int i = 0 ; i < n ; i++) {\n\t\t\tif(s[i] == -1) {\n\t\t\t\tif(i == 0 || n == 1) {\n\t\t\t\t\ts[i] = 1;\n\t\t\t\t}else {\n\t\t\t\t\ts[i] = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif(n != 1 && s[0] == 0) {\n\t\t\tans = -1;\n\t\t}\n\n\t\tif(ans != -1) {\n\t\t\tString tmp = \"\";\n\t\t\tfor(int i = 0 ; i < n ; i++ ) {\n\t\t\t\ttmp += \"\" + s[i];\n\t\t\t}\n\t\t\t\n\t\t\tans = Integer.parseInt(tmp);\n\t\t}\t\n\n\t\tSystem.out.println(ans);\n\t}\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "sample_input": "3 3\n1 7\n3 2\n1 7\n"}, "reference_outputs": ["702\n"], "source_document_id": "p02761", "source_text": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 902, "cpu_time_ms": 92, "memory_kb": 22996}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s056273418", "group_id": "codeNet:p02761", "input_text": "import java.util.*;\nimport java.util.stream.Collectors;\nimport java.io.*;\nimport java.nio.charset.StandardCharsets;\n\npublic class Main {\n\tint N, M;\n\tint[] s, c;\n\tint[] buf;\n\tboolean enable = true;\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tInputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);\n\t\tBufferedReader in = new BufferedReader(reader);\n\t\tMain ins = new Main(in);\n\t\tins.calc();\n\t\tins.showResult();\n\t}\n\n\tMain(BufferedReader in) throws IOException {\n\t\tString[] tokens = in.readLine().split(\" \");\n\t\tN = Integer.parseInt(tokens[0]);\n\t\tM = Integer.parseInt(tokens[1]);\n\t\ts = new int[M];\n\t\tc = new int[M];\n\t\tfor (int i = 0; i < M; ++i) {\n\t\t\ttokens = in.readLine().split(\" \");\n\t\t\ts[i] = Integer.parseInt(tokens[0]) - 1;\n\t\t\tc[i] = Integer.parseInt(tokens[1]);\n\t\t}\n\t\tthis.buf = new int[N];\n\t\tArrays.fill(buf, -1);\n\t}\n\n\tvoid calc() {\n\t\tfor (int i = 0; i < M; ++i) {\n\t\t\tif (buf[s[i]] < 0 || buf[s[i]] == c[i]) {\n\t\t\t\t// 未初期化,埋められる\n\t\t\t\tbuf[s[i]] = c[i];\n\t\t\t} else {\n\t\t\t\t// 既存と違う: NG\n\t\t\t\tenable = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (!enable) {\n\t\t\treturn;\n\t\t}\n\t\t// 残りを埋める\n\t\tif (N == 1) {\n\t\t\tif (buf[0] < 0) {\n\t\t\t\tbuf[0] = 0;\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tif (buf[0] == 0) {\n\t\t\tif (N != 1) {\n\t\t\t\tenable = false;\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tbuf[0] = buf[0] < 0 ? 1 : buf[0];\n\t\tfor (int i = 1; i < N; ++i) {\n\t\t\tif (buf[i] < 0) {\n\t\t\t\tbuf[i] = 0;\n\t\t\t}\n\t\t}\n\t}\n\n\tvoid showBuf() {\n\t\tfor (int i = 0; i < buf.length; ++i) {\n\t\t\tSystem.out.print(buf[i] + \" \");\n\t\t}\n\t\tSystem.out.println();\n\t}\n\n\tvoid showResult() {\n\t\t// showBuf();\n\t\tif (enable) {\n\t\t\tStringBuilder strBuilder = new StringBuilder();\n\t\t\tfor (int i = 0; i < N; ++i) {\n\t\t\t\tstrBuilder.append(Integer.toString(buf[i]));\n\t\t\t}\n\t\t\tSystem.out.println(strBuilder.toString());\n\t\t} else {\n\t\t\tSystem.out.println(-1);\n\t\t}\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1583116743, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02761.html", "problem_id": "p02761", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02761/input.txt", "sample_output_relpath": "derived/input_output/data/p02761/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02761/Java/s056273418.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s056273418", "user_id": "u655125439"}, "prompt_components": {"gold_output": "702\n", "input_to_evaluate": "import java.util.*;\nimport java.util.stream.Collectors;\nimport java.io.*;\nimport java.nio.charset.StandardCharsets;\n\npublic class Main {\n\tint N, M;\n\tint[] s, c;\n\tint[] buf;\n\tboolean enable = true;\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tInputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);\n\t\tBufferedReader in = new BufferedReader(reader);\n\t\tMain ins = new Main(in);\n\t\tins.calc();\n\t\tins.showResult();\n\t}\n\n\tMain(BufferedReader in) throws IOException {\n\t\tString[] tokens = in.readLine().split(\" \");\n\t\tN = Integer.parseInt(tokens[0]);\n\t\tM = Integer.parseInt(tokens[1]);\n\t\ts = new int[M];\n\t\tc = new int[M];\n\t\tfor (int i = 0; i < M; ++i) {\n\t\t\ttokens = in.readLine().split(\" \");\n\t\t\ts[i] = Integer.parseInt(tokens[0]) - 1;\n\t\t\tc[i] = Integer.parseInt(tokens[1]);\n\t\t}\n\t\tthis.buf = new int[N];\n\t\tArrays.fill(buf, -1);\n\t}\n\n\tvoid calc() {\n\t\tfor (int i = 0; i < M; ++i) {\n\t\t\tif (buf[s[i]] < 0 || buf[s[i]] == c[i]) {\n\t\t\t\t// 未初期化,埋められる\n\t\t\t\tbuf[s[i]] = c[i];\n\t\t\t} else {\n\t\t\t\t// 既存と違う: NG\n\t\t\t\tenable = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (!enable) {\n\t\t\treturn;\n\t\t}\n\t\t// 残りを埋める\n\t\tif (N == 1) {\n\t\t\tif (buf[0] < 0) {\n\t\t\t\tbuf[0] = 0;\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tif (buf[0] == 0) {\n\t\t\tif (N != 1) {\n\t\t\t\tenable = false;\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tbuf[0] = buf[0] < 0 ? 1 : buf[0];\n\t\tfor (int i = 1; i < N; ++i) {\n\t\t\tif (buf[i] < 0) {\n\t\t\t\tbuf[i] = 0;\n\t\t\t}\n\t\t}\n\t}\n\n\tvoid showBuf() {\n\t\tfor (int i = 0; i < buf.length; ++i) {\n\t\t\tSystem.out.print(buf[i] + \" \");\n\t\t}\n\t\tSystem.out.println();\n\t}\n\n\tvoid showResult() {\n\t\t// showBuf();\n\t\tif (enable) {\n\t\t\tStringBuilder strBuilder = new StringBuilder();\n\t\t\tfor (int i = 0; i < N; ++i) {\n\t\t\t\tstrBuilder.append(Integer.toString(buf[i]));\n\t\t\t}\n\t\t\tSystem.out.println(strBuilder.toString());\n\t\t} else {\n\t\t\tSystem.out.println(-1);\n\t\t}\n\t}\n\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "sample_input": "3 3\n1 7\n3 2\n1 7\n"}, "reference_outputs": ["702\n"], "source_document_id": "p02761", "source_text": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1835, "cpu_time_ms": 73, "memory_kb": 21204}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s985526786", "group_id": "codeNet:p02761", "input_text": "import java.util.*;\n\npublic class Main{\n static int p = 1000000007;\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n String[] S = sc.nextLine().split(\" \");\n int N = Integer.parseInt(S[0]);\n int M = Integer.parseInt(S[1]);\n int[] ans = new int[N];\n Arrays.fill(ans, -1);\n for(int i = 0; i < M; i++){\n S = sc.nextLine().split(\" \");\n int a = Integer.parseInt(S[0])-1;\n int b = Integer.parseInt(S[1]);\n \n if((a+1 > N) || (ans[a] != -1 && ans[a] != b)){\n System.out.println(-1);\n return;\n }\n ans[a] = b;\n }\n \n boolean f = false;\n for(int n : ans){\n if(n == -1){\n n = 1;\n }\n if(N != 1 && n == 0 && !f){\n System.out.println(-1);\n return;\n }\n f = true;\n System.out.print(n);\n }\n System.out.println();\n }\n}", "language": "Java", "metadata": {"date": 1583115994, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02761.html", "problem_id": "p02761", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02761/input.txt", "sample_output_relpath": "derived/input_output/data/p02761/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02761/Java/s985526786.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s985526786", "user_id": "u489316980"}, "prompt_components": {"gold_output": "702\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main{\n static int p = 1000000007;\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n String[] S = sc.nextLine().split(\" \");\n int N = Integer.parseInt(S[0]);\n int M = Integer.parseInt(S[1]);\n int[] ans = new int[N];\n Arrays.fill(ans, -1);\n for(int i = 0; i < M; i++){\n S = sc.nextLine().split(\" \");\n int a = Integer.parseInt(S[0])-1;\n int b = Integer.parseInt(S[1]);\n \n if((a+1 > N) || (ans[a] != -1 && ans[a] != b)){\n System.out.println(-1);\n return;\n }\n ans[a] = b;\n }\n \n boolean f = false;\n for(int n : ans){\n if(n == -1){\n n = 1;\n }\n if(N != 1 && n == 0 && !f){\n System.out.println(-1);\n return;\n }\n f = true;\n System.out.print(n);\n }\n System.out.println();\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "sample_input": "3 3\n1 7\n3 2\n1 7\n"}, "reference_outputs": ["702\n"], "source_document_id": "p02761", "source_text": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 95, "memory_kb": 21588}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s633994419", "group_id": "codeNet:p02761", "input_text": "import java.util.*;\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tint M = sc.nextInt();\n\t\tif(M == 0) {\n\t\t\tSystem.out.print(1);\n\t\t\tfor(int i = 1; i < N; i++)\n\t\t\t\tSystem.out.print(0);\n\t\t\treturn;\n\t\t}\n\t\tint[] ans = new int[N];\n\t\tboolean[] used = new boolean[N];\n\t\tfor(int i = 0; i < M; i++) {\n\t\t\tint s = sc.nextInt();\n\t\t\tint c = sc.nextInt();\n\t\t\tif(used[s-1] && ans[s-1] != c) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tans[s-1] = c;\n\t\t\tused[s-1] = true;\n\t\t}\n\t\tif(used[0] && ans[0] == 0) {\n\t\t\tif(N == 1)\n\t\t\t\tSystem.out.println(0);\n\t\t\telse\n\t\t\t\tSystem.out.println(-1);\n\t\t\treturn;\n\t\t}\n\t\telse if(ans[0] == 0)\n\t\t\tans[0] = 1;\n\t\tfor(int i = 0; i < N; i++)\n\t\t\tSystem.out.print(ans[i]);\n\n\t}\n\n}", "language": "Java", "metadata": {"date": 1583115955, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02761.html", "problem_id": "p02761", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02761/input.txt", "sample_output_relpath": "derived/input_output/data/p02761/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02761/Java/s633994419.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s633994419", "user_id": "u912599273"}, "prompt_components": {"gold_output": "702\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tint M = sc.nextInt();\n\t\tif(M == 0) {\n\t\t\tSystem.out.print(1);\n\t\t\tfor(int i = 1; i < N; i++)\n\t\t\t\tSystem.out.print(0);\n\t\t\treturn;\n\t\t}\n\t\tint[] ans = new int[N];\n\t\tboolean[] used = new boolean[N];\n\t\tfor(int i = 0; i < M; i++) {\n\t\t\tint s = sc.nextInt();\n\t\t\tint c = sc.nextInt();\n\t\t\tif(used[s-1] && ans[s-1] != c) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tans[s-1] = c;\n\t\t\tused[s-1] = true;\n\t\t}\n\t\tif(used[0] && ans[0] == 0) {\n\t\t\tif(N == 1)\n\t\t\t\tSystem.out.println(0);\n\t\t\telse\n\t\t\t\tSystem.out.println(-1);\n\t\t\treturn;\n\t\t}\n\t\telse if(ans[0] == 0)\n\t\t\tans[0] = 1;\n\t\tfor(int i = 0; i < N; i++)\n\t\t\tSystem.out.print(ans[i]);\n\n\t}\n\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "sample_input": "3 3\n1 7\n3 2\n1 7\n"}, "reference_outputs": ["702\n"], "source_document_id": "p02761", "source_text": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 769, "cpu_time_ms": 95, "memory_kb": 23892}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s203860722", "group_id": "codeNet:p02761", "input_text": "import java.util.*;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint N = sc.nextInt();\n\t\tint M = sc.nextInt();\n\t\tint[] v = new int[N];\n\t\tArrays.fill(v, -1);\n\t\t\n\t\tfor(int i=0; i1 && v[0]==0) {\n\t\t\tSystem.out.println(-1);\n\t\t\tsc.close();\n\t\t\treturn;\n\t\t}\n\t\tfor(int i=0; i=0 ? v[i] : (i==0 ? (N==1 ? 0 : 1) : 0));\n\t\t}\n\t\tSystem.out.println();\n\t\tsc.close();\n\t}\n}\n", "language": "Java", "metadata": {"date": 1583115692, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02761.html", "problem_id": "p02761", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02761/input.txt", "sample_output_relpath": "derived/input_output/data/p02761/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02761/Java/s203860722.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s203860722", "user_id": "u061996193"}, "prompt_components": {"gold_output": "702\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint N = sc.nextInt();\n\t\tint M = sc.nextInt();\n\t\tint[] v = new int[N];\n\t\tArrays.fill(v, -1);\n\t\t\n\t\tfor(int i=0; i1 && v[0]==0) {\n\t\t\tSystem.out.println(-1);\n\t\t\tsc.close();\n\t\t\treturn;\n\t\t}\n\t\tfor(int i=0; i=0 ? v[i] : (i==0 ? (N==1 ? 0 : 1) : 0));\n\t\t}\n\t\tSystem.out.println();\n\t\tsc.close();\n\t}\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "sample_input": "3 3\n1 7\n3 2\n1 7\n"}, "reference_outputs": ["702\n"], "source_document_id": "p02761", "source_text": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 645, "cpu_time_ms": 110, "memory_kb": 22868}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s785625488", "group_id": "codeNet:p02761", "input_text": "import java.io.InputStream;\nimport java.io.IOException;\nimport java.io.PrintStream;\nimport java.math.*;\nimport java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n solve(System.in, System.out);\n }\n\n static void solve(InputStream is, PrintStream os) {\n Scanner sc = new Scanner(is);\n\n /* read */\n int n = sc.nextInt();\n int m = sc.nextInt();\n\n Integer[] values = new Integer[n];\n\n for (int i = 0; i < n; i++) {\n values[i] = null;\n }\n\n for (int i = 0; i < m; i++) {\n int s = sc.nextInt() - 1;\n int c = sc.nextInt();\n if (values[s] != null && c != values[s]) {\n os.println(-1);\n return;\n }\n values[s] = c;\n }\n String ans = \"\";\n if (values[0] != null) {\n if (values[0] == 0) {\n os.println(-1);\n return;\n } else {\n ans += values[0];\n }\n } else {\n ans += \"1\";\n }\n\n for (int i = 1; i < n; i++) {\n if (values[i] != null) {\n ans += String.valueOf(values[i]);\n } else {\n ans += \"0\";\n }\n }\n os.println(ans);\n }\n\n private static long gcd(long m, long n) {\n if (m < n) {\n return gcd(n, m);\n }\n if (n == 0) {\n return m;\n }\n return gcd(n, m % n);\n }\n\n private static long lcm(long m, long n) {\n return m / gcd(m, n) * n;\n }\n\n private static class Modular {\n\n private final long mod;\n\n private Modular(long mod) {\n this.mod = mod;\n }\n\n private long inverse(long n) {\n return pow(n, mod - 2) % mod;\n }\n\n private long pow(long x, long n) {\n /*\n long ans = 1;\n while (n > 0) {\n if ((n & 1) == 1) {\n ans = ans * x % mod;\n }\n x = x * x % mod;\n n >>= 1;\n }\n return ans;\n */\n if (n == 0) {\n return 1;\n }\n return n % 2 == 0 ?\n pow(x * x % mod, n / 2) % mod :\n x % mod * pow(x, n - 1) % mod;\n }\n }\n\n private static class ModularNFixedCombination {\n\n private final Modular modular;\n private final long[] comb;\n private final long N;\n\n public ModularNFixedCombination(long N, int size, long mod) {\n this.modular = new Modular(mod);\n this.comb = new long[size + 1];\n this.N = N;\n\n comb[0] = 1;\n\n for (int i = 1; i <= size; i++) {\n comb[i] = ((comb[i - 1] * (N - (i - 1))) % mod * modular.inverse(i)) % mod;\n }\n }\n\n long combination(int n, int k) {\n if (n != N) {\n throw new IllegalStateException();\n }\n return comb[k];\n }\n\n long repeatedCombination(int n, int k) {\n return combination(n + k - 1, k);\n }\n }\n\n private static class ModularCombination {\n\n private final long fact[];\n private final long mod;\n private final Modular modular;\n\n public ModularCombination(int size, long mod) {\n this.fact = new long[size + 1];\n this.mod = mod;\n this.modular = new Modular(mod);\n\n this.fact[0] = 1;\n for (int i = 1; i <= size; i++) {\n fact[i] = (fact[i - 1] * i) % mod;\n }\n }\n\n private long factorial(int n) {\n return fact[n];\n }\n\n long combination(int n, int k) {\n return\n (\n (\n (\n factorial(n) * modular.inverse(factorial(n - k))\n ) % mod\n ) * modular.inverse(factorial(k))\n ) % mod;\n }\n\n long repeatedCombination(int n, int k) {\n return combination(n + k - 1, k);\n }\n }\n\n private static class Scanner {\n\n private final InputStream is;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n Scanner(InputStream is) {\n this.is = is;\n }\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = is.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte()) {\n return buffer[ptr++];\n } else {\n return -1;\n }\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr])) {\n ptr++;\n }\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {\n throw new NumberFormatException();\n }\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1583115553, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02761.html", "problem_id": "p02761", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02761/input.txt", "sample_output_relpath": "derived/input_output/data/p02761/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02761/Java/s785625488.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s785625488", "user_id": "u482226328"}, "prompt_components": {"gold_output": "702\n", "input_to_evaluate": "import java.io.InputStream;\nimport java.io.IOException;\nimport java.io.PrintStream;\nimport java.math.*;\nimport java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n solve(System.in, System.out);\n }\n\n static void solve(InputStream is, PrintStream os) {\n Scanner sc = new Scanner(is);\n\n /* read */\n int n = sc.nextInt();\n int m = sc.nextInt();\n\n Integer[] values = new Integer[n];\n\n for (int i = 0; i < n; i++) {\n values[i] = null;\n }\n\n for (int i = 0; i < m; i++) {\n int s = sc.nextInt() - 1;\n int c = sc.nextInt();\n if (values[s] != null && c != values[s]) {\n os.println(-1);\n return;\n }\n values[s] = c;\n }\n String ans = \"\";\n if (values[0] != null) {\n if (values[0] == 0) {\n os.println(-1);\n return;\n } else {\n ans += values[0];\n }\n } else {\n ans += \"1\";\n }\n\n for (int i = 1; i < n; i++) {\n if (values[i] != null) {\n ans += String.valueOf(values[i]);\n } else {\n ans += \"0\";\n }\n }\n os.println(ans);\n }\n\n private static long gcd(long m, long n) {\n if (m < n) {\n return gcd(n, m);\n }\n if (n == 0) {\n return m;\n }\n return gcd(n, m % n);\n }\n\n private static long lcm(long m, long n) {\n return m / gcd(m, n) * n;\n }\n\n private static class Modular {\n\n private final long mod;\n\n private Modular(long mod) {\n this.mod = mod;\n }\n\n private long inverse(long n) {\n return pow(n, mod - 2) % mod;\n }\n\n private long pow(long x, long n) {\n /*\n long ans = 1;\n while (n > 0) {\n if ((n & 1) == 1) {\n ans = ans * x % mod;\n }\n x = x * x % mod;\n n >>= 1;\n }\n return ans;\n */\n if (n == 0) {\n return 1;\n }\n return n % 2 == 0 ?\n pow(x * x % mod, n / 2) % mod :\n x % mod * pow(x, n - 1) % mod;\n }\n }\n\n private static class ModularNFixedCombination {\n\n private final Modular modular;\n private final long[] comb;\n private final long N;\n\n public ModularNFixedCombination(long N, int size, long mod) {\n this.modular = new Modular(mod);\n this.comb = new long[size + 1];\n this.N = N;\n\n comb[0] = 1;\n\n for (int i = 1; i <= size; i++) {\n comb[i] = ((comb[i - 1] * (N - (i - 1))) % mod * modular.inverse(i)) % mod;\n }\n }\n\n long combination(int n, int k) {\n if (n != N) {\n throw new IllegalStateException();\n }\n return comb[k];\n }\n\n long repeatedCombination(int n, int k) {\n return combination(n + k - 1, k);\n }\n }\n\n private static class ModularCombination {\n\n private final long fact[];\n private final long mod;\n private final Modular modular;\n\n public ModularCombination(int size, long mod) {\n this.fact = new long[size + 1];\n this.mod = mod;\n this.modular = new Modular(mod);\n\n this.fact[0] = 1;\n for (int i = 1; i <= size; i++) {\n fact[i] = (fact[i - 1] * i) % mod;\n }\n }\n\n private long factorial(int n) {\n return fact[n];\n }\n\n long combination(int n, int k) {\n return\n (\n (\n (\n factorial(n) * modular.inverse(factorial(n - k))\n ) % mod\n ) * modular.inverse(factorial(k))\n ) % mod;\n }\n\n long repeatedCombination(int n, int k) {\n return combination(n + k - 1, k);\n }\n }\n\n private static class Scanner {\n\n private final InputStream is;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n Scanner(InputStream is) {\n this.is = is;\n }\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = is.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte()) {\n return buffer[ptr++];\n } else {\n return -1;\n }\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr])) {\n ptr++;\n }\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {\n throw new NumberFormatException();\n }\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "sample_input": "3 3\n1 7\n3 2\n1 7\n"}, "reference_outputs": ["702\n"], "source_document_id": "p02761", "source_text": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 5652, "cpu_time_ms": 71, "memory_kb": 23124}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s385519080", "group_id": "codeNet:p02761", "input_text": "import java.util.*;\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tint M = sc.nextInt();\n\t\tint[] ans = new int[N];\n\t\tboolean[] used = new boolean[N];\n\t\tfor(int i = 0; i < M; i++) {\n\t\t\tint s = sc.nextInt();\n\t\t\tint c = sc.nextInt();\n\t\t\tif(used[s-1] && ans[s-1] != c) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tans[s-1] = c;\n\t\t\tused[s-1] = true;\n\t\t}\n\t\tif(used[0] && ans[0] == 0) {\n\t\t\tSystem.out.println(-1);\n\t\t\treturn;\n\t\t}\n\t\tans[0] = 1;\n\t\tfor(int i = 0; i < N; i++)\n\t\t\tSystem.out.print(ans[i]);\n\n\t}\n\n}", "language": "Java", "metadata": {"date": 1583115375, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02761.html", "problem_id": "p02761", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02761/input.txt", "sample_output_relpath": "derived/input_output/data/p02761/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02761/Java/s385519080.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s385519080", "user_id": "u912599273"}, "prompt_components": {"gold_output": "702\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tint M = sc.nextInt();\n\t\tint[] ans = new int[N];\n\t\tboolean[] used = new boolean[N];\n\t\tfor(int i = 0; i < M; i++) {\n\t\t\tint s = sc.nextInt();\n\t\t\tint c = sc.nextInt();\n\t\t\tif(used[s-1] && ans[s-1] != c) {\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tans[s-1] = c;\n\t\t\tused[s-1] = true;\n\t\t}\n\t\tif(used[0] && ans[0] == 0) {\n\t\t\tSystem.out.println(-1);\n\t\t\treturn;\n\t\t}\n\t\tans[0] = 1;\n\t\tfor(int i = 0; i < N; i++)\n\t\t\tSystem.out.print(ans[i]);\n\n\t}\n\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "sample_input": "3 3\n1 7\n3 2\n1 7\n"}, "reference_outputs": ["702\n"], "source_document_id": "p02761", "source_text": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 586, "cpu_time_ms": 95, "memory_kb": 21972}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s976305873", "group_id": "codeNet:p02761", "input_text": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n\n int N = scanner.nextInt();\n int M = scanner.nextInt();\n int[] digits = new int[N];\n Arrays.fill(digits, -1);\n for (int i = 0; i < M; i++) {\n int s = scanner.nextInt() - 1;\n int c = scanner.nextInt();\n if (digits[s] >= 0 && digits[s] != c) {\n System.out.println(-1);\n return;\n }\n digits[s] = c;\n }\n if (digits[0] == 0 && N != 1) {\n System.out.println(-1);\n return;\n }\n\n StringBuilder sb = new StringBuilder();\n for (int i = 0; i < N; i++) {\n if (digits[i] >= 0) sb.append(digits[i]);\n else {\n if (i == 0) sb.append(N == 1 ? \"0\" : \"1\");\n else sb.append(\"0\");\n }\n }\n System.out.println(sb.toString());\n }\n}\n", "language": "Java", "metadata": {"date": 1583115135, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02761.html", "problem_id": "p02761", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02761/input.txt", "sample_output_relpath": "derived/input_output/data/p02761/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02761/Java/s976305873.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s976305873", "user_id": "u189832798"}, "prompt_components": {"gold_output": "702\n", "input_to_evaluate": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n\n int N = scanner.nextInt();\n int M = scanner.nextInt();\n int[] digits = new int[N];\n Arrays.fill(digits, -1);\n for (int i = 0; i < M; i++) {\n int s = scanner.nextInt() - 1;\n int c = scanner.nextInt();\n if (digits[s] >= 0 && digits[s] != c) {\n System.out.println(-1);\n return;\n }\n digits[s] = c;\n }\n if (digits[0] == 0 && N != 1) {\n System.out.println(-1);\n return;\n }\n\n StringBuilder sb = new StringBuilder();\n for (int i = 0; i < N; i++) {\n if (digits[i] >= 0) sb.append(digits[i]);\n else {\n if (i == 0) sb.append(N == 1 ? \"0\" : \"1\");\n else sb.append(\"0\");\n }\n }\n System.out.println(sb.toString());\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "sample_input": "3 3\n1 7\n3 2\n1 7\n"}, "reference_outputs": ["702\n"], "source_document_id": "p02761", "source_text": "Score : 300 points\n\nProblem Statement\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n\nThe integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n\nThe s_i-th digit from the left is c_i. \\left(i = 1, 2, \\cdots, M\\right)\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3\n\n0 \\leq M \\leq 5\n\n1 \\leq s_i \\leq N\n\n0 \\leq c_i \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\ns_1 c_1\n\\vdots\ns_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n1 7\n3 2\n1 7\n\nSample Output 1\n\n702\n\n702 satisfies the conditions - its 1-st and 3-rd digits are 7 and 2, respectively - while no non-negative integer less than 702 satisfies them.\n\nSample Input 2\n\n3 2\n2 1\n2 3\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n3 1\n1 0\n\nSample Output 3\n\n-1", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 882, "cpu_time_ms": 111, "memory_kb": 23892}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s565680406", "group_id": "codeNet:p02774", "input_text": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n\tstatic int n;\n\tstatic long k;\n\tstatic long a[];\n\tstatic void solve() {\n\t\tn = ni(); k = nl();\n\t\ta = new long[n];\n\t\tfor(int i=0;i 1) {\n\t\t\tlong c = (l + r)/2;\n\t\t\tif(isMoreK(c))r = c;\n\t\t\telse l = c;\n\t\t}\n\n\t\tout.println(r);\n\t}\n\n\t//c以下の値が、k個以上の時、true\n\tprivate static boolean isMoreK(long c) {\n\t\tlong num = 0;//c以下の値の数を数える\n\t\tfor(int i=0;i 1) {\n\t\t\t\tint m = (l+r)/2;\n\t\t\t\tif(a[i]>=0){\n\t\t\t\t\tif(a[i]*a[m] <= c)l=m;\n\t\t\t\t\telse r = m;\n\t\t\t\t}\n\t\t\t\telse {\t\n\t\t\t\t\tif(a[i]*a[m] <= c)r=m;\n\t\t\t\t\telse l = m;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(a[i]>=0) {\n\t\t\t\tnum += r;\n\t\t\t\tif(i<=l)num--;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tnum += n - r;\n\t\t\t\tif(i>l)num--;\n\t\t\t}\n\t\t}\n\t\treturn num/2 >= k;\n\t}\n\n\t//constant\n\tstatic final long mod = (long) 1e9 + 7;\n\tstatic final int dx[] = { -1, 0, 1, 0 }, dy[] = { 0, -1, 0, 1 };\n\tstatic final int[] dx8 = { -1, -1, -1, 0, 0, 1, 1, 1 }, dy8 = { -1, 0, 1, -1, 1, -1, 0, 1 };\n\tstatic final int inf = Integer.MAX_VALUE / 3;\n\tstatic final long linf = Long.MAX_VALUE / 3;\n\tstatic final double dinf = Double.MAX_VALUE / 3;\n\tstatic final double eps = 1e-10;\n\tstatic final double pi = Math.PI;\n\tstatic StringBuilder sb = new StringBuilder();\n\tstatic InputStream is;\n\tstatic PrintWriter out;\n\tstatic String INPUT = \"\";\n\n\t//libraries\n\tstatic void reverse(int ar[]) {\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tint t = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = t;\n\t\t}\n\t}\n\n\tstatic void reverse(long ar[]) {\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tlong t = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = t;\n\t\t}\n\t}\n\n\tstatic void reverse(double ar[]) {\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tdouble t = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = t;\n\t\t}\n\t}\n\n\tstatic void reverse(char ar[]) {\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tchar t = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = t;\n\t\t}\n\t}\n\n\tstatic String getReverse(String s) {\n\t\tchar c[] = s.toCharArray();\n\t\treverse(c);\n\t\ts = String.valueOf(c);\n\t\treturn s;\n\t}\n\n\tstatic void reverse(List ls) {\n\t\tint sz = ls.size();\n\t\tfor (int i = 0; i < sz / 2; i++) {\n\t\t\tT t = ls.get(i);\n\t\t\tls.set(i, ls.get(sz - 1 - i));\n\t\t\tls.set(sz - 1 - i, t);\n\t\t}\n\t}\n\n\tstatic void reverse(T[] ar) {\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tT t = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = t;\n\t\t}\n\t}\n\n\tstatic void sbnl() {//StringBuilderに改行文字をappendする\n\t\tsb.append(\"\\n\");\n\t}\n\n\tstatic int lowerBound(int[] a, int x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] < x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int upperBound(int[] a, int x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] <= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rlowerBound(int[] a, int x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] > x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rupperBound(int[] a, int x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] >= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int lowerBound(long[] a, long x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] < x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int upperBound(long[] a, long x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] <= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rlowerBound(long[] a, long x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] > x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rupperBound(long[] a, long x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] >= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int lowerBound(double[] a, double x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] < x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int upperBound(double[] a, double x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] <= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rlowerBound(double[] a, double x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] > x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rupperBound(double[] a, double x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] >= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int lowerBound(char[] a, char x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] < x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int upperBound(char[] a, char x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] <= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rlowerBound(char[] a, char x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] > x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rupperBound(char[] a, char x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] >= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int lowerBound(List ls, T x) throws RuntimeException {\n\t\tif (ls.size() == 0)\n\t\t\treturn -1;\n\t\tif (ls.get(0) instanceof Integer) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) >= 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Long) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) >= 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Double) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) >= 0 ? 1 : -1);\n\t\t} else {\n\t\t\tSystem.err.println(\n\t\t\t\t\tString.format(\"%s:数値でないリストを二分探索しています。\", Thread.currentThread().getStackTrace()[1].getMethodName()));\n\t\t\tthrow new RuntimeException();\n\t\t}\n\t}\n\n\tstatic int upperBound(List ls, T x) throws RuntimeException {\n\t\tif (ls.size() == 0)\n\t\t\treturn -1;\n\t\tif (ls.get(0) instanceof Integer) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) > 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Long) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) > 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Double) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) > 0 ? 1 : -1);\n\t\t} else {\n\t\t\tSystem.err.println(\n\t\t\t\t\tString.format(\"%s:数値でないリストを二分探索しています。\", Thread.currentThread().getStackTrace()[1].getMethodName()));\n\t\t\tthrow new RuntimeException();\n\t\t}\n\t}\n\n\tstatic int rupperBound(List ls, T x) throws RuntimeException {\n\t\tif (ls.size() == 0)\n\t\t\treturn -1;\n\t\tif (ls.get(0) instanceof Integer) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) < 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Long) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) < 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Double) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) < 0 ? 1 : -1);\n\t\t} else {\n\t\t\tSystem.err.println(\n\t\t\t\t\tString.format(\"%s:数値でないリストを二分探索しています。\", Thread.currentThread().getStackTrace()[1].getMethodName()));\n\t\t\tthrow new RuntimeException();\n\t\t}\n\t}\n\n\tstatic int rlowerBound(List ls, T x) {\n\t\tif (ls.size() == 0)\n\t\t\treturn -1;\n\t\tif (ls.get(0) instanceof Integer) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) <= 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Long) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) <= 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Double) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) <= 0 ? 1 : -1);\n\t\t} else {\n\t\t\tSystem.err.println(\n\t\t\t\t\tString.format(\"%s:数値でないリストを二分探索しています。\", Thread.currentThread().getStackTrace()[1].getMethodName()));\n\t\t\tthrow new RuntimeException();\n\t\t}\n\t}\n\n\tstatic int[] concat(int x, int arr[]) {\n\t\tint ret[] = new int[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 1, ret.length - 1);\n\t\tret[0] = x;\n\t\treturn ret;\n\t}\n\n\tstatic int[] concat(int arr[], int x) {\n\t\tint ret[] = new int[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 0, ret.length - 1);\n\t\tret[ret.length - 1] = x;\n\t\treturn ret;\n\t}\n\n\tstatic long[] concat(long x, long arr[]) {\n\t\tlong ret[] = new long[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 1, ret.length - 1);\n\t\tret[0] = x;\n\t\treturn ret;\n\t}\n\n\tstatic long[] concat(long arr[], long x) {\n\t\tlong ret[] = new long[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 0, ret.length - 1);\n\t\tret[ret.length - 1] = x;\n\t\treturn ret;\n\t}\n\n\tstatic int max(int x, int y) {\n\t\treturn Math.max(x, y);\n\t}\n\n\tstatic int min(int x, int y) {\n\t\treturn Math.min(x, y);\n\t}\n\n\tstatic int max(int x, int y, int z) {\n\t\tx = Math.max(x, y);\n\t\tx = Math.max(x, z);\n\t\treturn x;\n\t}\n\n\tstatic int min(int x, int y, int z) {\n\t\tx = Math.min(x, y);\n\t\tx = Math.min(x, z);\n\t\treturn x;\n\t}\n\n\tstatic long max(long x, long y) {\n\t\treturn Math.max(x, y);\n\t}\n\n\tstatic long min(long x, long y) {\n\t\treturn Math.min(x, y);\n\t}\n\n\tstatic long max(long x, long y, long z) {\n\t\tx = Math.max(x, y);\n\t\tx = Math.max(x, z);\n\t\treturn x;\n\t}\n\n\tstatic long min(long x, long y, long z) {\n\t\tx = Math.min(x, y);\n\t\tx = Math.min(x, z);\n\t\treturn x;\n\t}\n\n\tstatic double max(double x, double y) {\n\t\treturn Math.max(x, y);\n\t}\n\n\tstatic double min(double x, double y) {\n\t\treturn Math.min(x, y);\n\t}\n\n\tstatic double max(double x, double y, double z) {\n\t\tx = Math.max(x, y);\n\t\tx = Math.max(x, z);\n\t\treturn x;\n\t}\n\n\tstatic double min(double x, double y, double z) {\n\t\tx = Math.min(x, y);\n\t\tx = Math.min(x, z);\n\t\treturn x;\n\t}\n\n\tstatic void sort(int[] ar) {\n\t\tArrays.sort(ar);\n\t}\n\n\tstatic void sort(long[] ar) {\n\t\tArrays.sort(ar);\n\t}\n\n\tstatic void sort(double[] ar) {\n\t\tArrays.sort(ar);\n\t}\n\n\tstatic void sort(char[] ar) {\n\t\tArrays.sort(ar);\n\t}\n\n\tstatic void rsort(int[] ar) {\n\t\tArrays.sort(ar);\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tint tmp = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = tmp;\n\t\t}\n\t}\n\n\tstatic void rsort(long[] ar) {\n\t\tArrays.sort(ar);\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tlong tmp = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = tmp;\n\t\t}\n\t}\n\n\tstatic void rsort(double[] ar) {\n\t\tArrays.sort(ar);\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tdouble tmp = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = tmp;\n\t\t}\n\t}\n\n\tstatic void rsort(char[] ar) {\n\t\tArrays.sort(ar);\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tchar tmp = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = tmp;\n\t\t}\n\t}\n\n\tstatic void fill(int arr[], int x) {\n\t\tArrays.fill(arr, x);\n\t}\n\n\tstatic void fill(long arr[], long x) {\n\t\tArrays.fill(arr, x);\n\t}\n\n\tstatic void fill(boolean arr[], boolean x) {\n\t\tArrays.fill(arr, x);\n\t}\n\n\tstatic void fill(double arr[], double x) {\n\t\tArrays.fill(arr, x);\n\t}\n\n\tstatic void fill(int arr[][], int x) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tArrays.fill(arr[i], x);\n\t}\n\n\tstatic void fill(long arr[][], long x) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tArrays.fill(arr[i], x);\n\t}\n\n\tstatic void fill(double arr[][], double x) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tArrays.fill(arr[i], x);\n\t}\n\n\tstatic void fill(boolean arr[][], boolean x) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tArrays.fill(arr[i], x);\n\t}\n\n\t//MOD culc\n\tstatic long plus(long x, long y) {\n\t\tlong res = (x + y) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\n\tstatic long sub(long x, long y) {\n\t\tlong res = (x - y) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\n\tstatic long mul(long x, long y) {\n\t\tlong res = (x * y) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\n\tstatic long div(long x, long y) {\n\t\tlong res = x * pow(y, mod - 2) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\n\tstatic long pow(long x, long y) {\n\t\tif (y < 0)\n\t\t\treturn 0;\n\t\tif (y == 0)\n\t\t\treturn 1;\n\t\tif (y % 2 == 1)\n\t\t\treturn (x * pow(x, y - 1)) % mod;\n\t\tlong root = pow(x, y / 2);\n\t\treturn root * root % mod;\n\t}\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tis = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());\n\t\tout = new PrintWriter(System.out);\n\t\tsolve();\n\t\tout.flush();\n\t}\n\n\t//input\n\tprivate static byte[] inbuf = new byte[1024];\n\tstatic int lenbuf = 0, ptrbuf = 0;\n\n\tprivate static int readByte() {\n\t\tif (lenbuf == -1)\n\t\t\tthrow new InputMismatchException();\n\t\tif (ptrbuf >= lenbuf) {\n\t\t\tptrbuf = 0;\n\t\t\ttry {\n\t\t\t\tlenbuf = is.read(inbuf);\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new InputMismatchException();\n\t\t\t}\n\t\t\tif (lenbuf <= 0)\n\t\t\t\treturn -1;\n\t\t}\n\t\treturn inbuf[ptrbuf++];\n\t}\n\n\tprivate static boolean isSpaceChar(int c) {\n\t\treturn !(c >= 33 && c <= 126);\n\t}\n\n\tprivate static int skip() {\n\t\tint b;\n\t\twhile ((b = readByte()) != -1 && isSpaceChar(b))\n\t\t\t;\n\t\treturn b;\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate static double nd() {\n\t\treturn Double.parseDouble(ns());\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate static char nc() {\n\t\treturn (char) skip();\n\t}\n\n\tprivate static String ns() {\n\t\tint b = skip();\n\t\tStringBuilder sb = new StringBuilder();\n\t\twhile (!(isSpaceChar(b))) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\n\tprivate static char[] ns(int n) {\n\t\tchar[] buf = new char[n];\n\t\tint b = skip(), p = 0;\n\t\twhile (p < n && !(isSpaceChar(b))) {\n\t\t\tbuf[p++] = (char) b;\n\t\t\tb = readByte();\n\t\t}\n\t\treturn n == p ? buf : Arrays.copyOf(buf, p);\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate static char[][] nm(int n, int m) {\n\t\tchar[][] map = new char[n][];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tmap[i] = ns(m);\n\t\treturn map;\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate static int[] na(int n) {\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = ni();\n\t\treturn a;\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate static long[] nla(int n) {\n\t\tlong[] a = new long[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = nl();\n\t\treturn a;\n\t}\n\n\tprivate static int ni() {\n\t\tint num = 0, b;\n\t\tboolean minus = false;\n\t\twhile ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))\n\t\t\t;\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\n\t\twhile (true) {\n\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t} else {\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate static long nl() {\n\t\tlong num = 0;\n\t\tint b;\n\t\tboolean minus = false;\n\t\twhile ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))\n\t\t\t;\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\n\t\twhile (true) {\n\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t} else {\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1588363261, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02774.html", "problem_id": "p02774", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02774/input.txt", "sample_output_relpath": "derived/input_output/data/p02774/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02774/Java/s565680406.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s565680406", "user_id": "u881359256"}, "prompt_components": {"gold_output": "-6\n", "input_to_evaluate": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n\tstatic int n;\n\tstatic long k;\n\tstatic long a[];\n\tstatic void solve() {\n\t\tn = ni(); k = nl();\n\t\ta = new long[n];\n\t\tfor(int i=0;i 1) {\n\t\t\tlong c = (l + r)/2;\n\t\t\tif(isMoreK(c))r = c;\n\t\t\telse l = c;\n\t\t}\n\n\t\tout.println(r);\n\t}\n\n\t//c以下の値が、k個以上の時、true\n\tprivate static boolean isMoreK(long c) {\n\t\tlong num = 0;//c以下の値の数を数える\n\t\tfor(int i=0;i 1) {\n\t\t\t\tint m = (l+r)/2;\n\t\t\t\tif(a[i]>=0){\n\t\t\t\t\tif(a[i]*a[m] <= c)l=m;\n\t\t\t\t\telse r = m;\n\t\t\t\t}\n\t\t\t\telse {\t\n\t\t\t\t\tif(a[i]*a[m] <= c)r=m;\n\t\t\t\t\telse l = m;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(a[i]>=0) {\n\t\t\t\tnum += r;\n\t\t\t\tif(i<=l)num--;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tnum += n - r;\n\t\t\t\tif(i>l)num--;\n\t\t\t}\n\t\t}\n\t\treturn num/2 >= k;\n\t}\n\n\t//constant\n\tstatic final long mod = (long) 1e9 + 7;\n\tstatic final int dx[] = { -1, 0, 1, 0 }, dy[] = { 0, -1, 0, 1 };\n\tstatic final int[] dx8 = { -1, -1, -1, 0, 0, 1, 1, 1 }, dy8 = { -1, 0, 1, -1, 1, -1, 0, 1 };\n\tstatic final int inf = Integer.MAX_VALUE / 3;\n\tstatic final long linf = Long.MAX_VALUE / 3;\n\tstatic final double dinf = Double.MAX_VALUE / 3;\n\tstatic final double eps = 1e-10;\n\tstatic final double pi = Math.PI;\n\tstatic StringBuilder sb = new StringBuilder();\n\tstatic InputStream is;\n\tstatic PrintWriter out;\n\tstatic String INPUT = \"\";\n\n\t//libraries\n\tstatic void reverse(int ar[]) {\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tint t = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = t;\n\t\t}\n\t}\n\n\tstatic void reverse(long ar[]) {\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tlong t = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = t;\n\t\t}\n\t}\n\n\tstatic void reverse(double ar[]) {\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tdouble t = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = t;\n\t\t}\n\t}\n\n\tstatic void reverse(char ar[]) {\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tchar t = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = t;\n\t\t}\n\t}\n\n\tstatic String getReverse(String s) {\n\t\tchar c[] = s.toCharArray();\n\t\treverse(c);\n\t\ts = String.valueOf(c);\n\t\treturn s;\n\t}\n\n\tstatic void reverse(List ls) {\n\t\tint sz = ls.size();\n\t\tfor (int i = 0; i < sz / 2; i++) {\n\t\t\tT t = ls.get(i);\n\t\t\tls.set(i, ls.get(sz - 1 - i));\n\t\t\tls.set(sz - 1 - i, t);\n\t\t}\n\t}\n\n\tstatic void reverse(T[] ar) {\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tT t = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = t;\n\t\t}\n\t}\n\n\tstatic void sbnl() {//StringBuilderに改行文字をappendする\n\t\tsb.append(\"\\n\");\n\t}\n\n\tstatic int lowerBound(int[] a, int x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] < x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int upperBound(int[] a, int x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] <= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rlowerBound(int[] a, int x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] > x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rupperBound(int[] a, int x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] >= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int lowerBound(long[] a, long x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] < x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int upperBound(long[] a, long x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] <= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rlowerBound(long[] a, long x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] > x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rupperBound(long[] a, long x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] >= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int lowerBound(double[] a, double x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] < x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int upperBound(double[] a, double x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] <= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rlowerBound(double[] a, double x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] > x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rupperBound(double[] a, double x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] >= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int lowerBound(char[] a, char x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] < x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int upperBound(char[] a, char x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] <= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rlowerBound(char[] a, char x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] > x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rupperBound(char[] a, char x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] >= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int lowerBound(List ls, T x) throws RuntimeException {\n\t\tif (ls.size() == 0)\n\t\t\treturn -1;\n\t\tif (ls.get(0) instanceof Integer) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) >= 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Long) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) >= 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Double) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) >= 0 ? 1 : -1);\n\t\t} else {\n\t\t\tSystem.err.println(\n\t\t\t\t\tString.format(\"%s:数値でないリストを二分探索しています。\", Thread.currentThread().getStackTrace()[1].getMethodName()));\n\t\t\tthrow new RuntimeException();\n\t\t}\n\t}\n\n\tstatic int upperBound(List ls, T x) throws RuntimeException {\n\t\tif (ls.size() == 0)\n\t\t\treturn -1;\n\t\tif (ls.get(0) instanceof Integer) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) > 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Long) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) > 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Double) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) > 0 ? 1 : -1);\n\t\t} else {\n\t\t\tSystem.err.println(\n\t\t\t\t\tString.format(\"%s:数値でないリストを二分探索しています。\", Thread.currentThread().getStackTrace()[1].getMethodName()));\n\t\t\tthrow new RuntimeException();\n\t\t}\n\t}\n\n\tstatic int rupperBound(List ls, T x) throws RuntimeException {\n\t\tif (ls.size() == 0)\n\t\t\treturn -1;\n\t\tif (ls.get(0) instanceof Integer) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) < 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Long) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) < 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Double) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) < 0 ? 1 : -1);\n\t\t} else {\n\t\t\tSystem.err.println(\n\t\t\t\t\tString.format(\"%s:数値でないリストを二分探索しています。\", Thread.currentThread().getStackTrace()[1].getMethodName()));\n\t\t\tthrow new RuntimeException();\n\t\t}\n\t}\n\n\tstatic int rlowerBound(List ls, T x) {\n\t\tif (ls.size() == 0)\n\t\t\treturn -1;\n\t\tif (ls.get(0) instanceof Integer) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) <= 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Long) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) <= 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Double) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) <= 0 ? 1 : -1);\n\t\t} else {\n\t\t\tSystem.err.println(\n\t\t\t\t\tString.format(\"%s:数値でないリストを二分探索しています。\", Thread.currentThread().getStackTrace()[1].getMethodName()));\n\t\t\tthrow new RuntimeException();\n\t\t}\n\t}\n\n\tstatic int[] concat(int x, int arr[]) {\n\t\tint ret[] = new int[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 1, ret.length - 1);\n\t\tret[0] = x;\n\t\treturn ret;\n\t}\n\n\tstatic int[] concat(int arr[], int x) {\n\t\tint ret[] = new int[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 0, ret.length - 1);\n\t\tret[ret.length - 1] = x;\n\t\treturn ret;\n\t}\n\n\tstatic long[] concat(long x, long arr[]) {\n\t\tlong ret[] = new long[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 1, ret.length - 1);\n\t\tret[0] = x;\n\t\treturn ret;\n\t}\n\n\tstatic long[] concat(long arr[], long x) {\n\t\tlong ret[] = new long[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 0, ret.length - 1);\n\t\tret[ret.length - 1] = x;\n\t\treturn ret;\n\t}\n\n\tstatic int max(int x, int y) {\n\t\treturn Math.max(x, y);\n\t}\n\n\tstatic int min(int x, int y) {\n\t\treturn Math.min(x, y);\n\t}\n\n\tstatic int max(int x, int y, int z) {\n\t\tx = Math.max(x, y);\n\t\tx = Math.max(x, z);\n\t\treturn x;\n\t}\n\n\tstatic int min(int x, int y, int z) {\n\t\tx = Math.min(x, y);\n\t\tx = Math.min(x, z);\n\t\treturn x;\n\t}\n\n\tstatic long max(long x, long y) {\n\t\treturn Math.max(x, y);\n\t}\n\n\tstatic long min(long x, long y) {\n\t\treturn Math.min(x, y);\n\t}\n\n\tstatic long max(long x, long y, long z) {\n\t\tx = Math.max(x, y);\n\t\tx = Math.max(x, z);\n\t\treturn x;\n\t}\n\n\tstatic long min(long x, long y, long z) {\n\t\tx = Math.min(x, y);\n\t\tx = Math.min(x, z);\n\t\treturn x;\n\t}\n\n\tstatic double max(double x, double y) {\n\t\treturn Math.max(x, y);\n\t}\n\n\tstatic double min(double x, double y) {\n\t\treturn Math.min(x, y);\n\t}\n\n\tstatic double max(double x, double y, double z) {\n\t\tx = Math.max(x, y);\n\t\tx = Math.max(x, z);\n\t\treturn x;\n\t}\n\n\tstatic double min(double x, double y, double z) {\n\t\tx = Math.min(x, y);\n\t\tx = Math.min(x, z);\n\t\treturn x;\n\t}\n\n\tstatic void sort(int[] ar) {\n\t\tArrays.sort(ar);\n\t}\n\n\tstatic void sort(long[] ar) {\n\t\tArrays.sort(ar);\n\t}\n\n\tstatic void sort(double[] ar) {\n\t\tArrays.sort(ar);\n\t}\n\n\tstatic void sort(char[] ar) {\n\t\tArrays.sort(ar);\n\t}\n\n\tstatic void rsort(int[] ar) {\n\t\tArrays.sort(ar);\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tint tmp = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = tmp;\n\t\t}\n\t}\n\n\tstatic void rsort(long[] ar) {\n\t\tArrays.sort(ar);\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tlong tmp = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = tmp;\n\t\t}\n\t}\n\n\tstatic void rsort(double[] ar) {\n\t\tArrays.sort(ar);\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tdouble tmp = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = tmp;\n\t\t}\n\t}\n\n\tstatic void rsort(char[] ar) {\n\t\tArrays.sort(ar);\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tchar tmp = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = tmp;\n\t\t}\n\t}\n\n\tstatic void fill(int arr[], int x) {\n\t\tArrays.fill(arr, x);\n\t}\n\n\tstatic void fill(long arr[], long x) {\n\t\tArrays.fill(arr, x);\n\t}\n\n\tstatic void fill(boolean arr[], boolean x) {\n\t\tArrays.fill(arr, x);\n\t}\n\n\tstatic void fill(double arr[], double x) {\n\t\tArrays.fill(arr, x);\n\t}\n\n\tstatic void fill(int arr[][], int x) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tArrays.fill(arr[i], x);\n\t}\n\n\tstatic void fill(long arr[][], long x) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tArrays.fill(arr[i], x);\n\t}\n\n\tstatic void fill(double arr[][], double x) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tArrays.fill(arr[i], x);\n\t}\n\n\tstatic void fill(boolean arr[][], boolean x) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tArrays.fill(arr[i], x);\n\t}\n\n\t//MOD culc\n\tstatic long plus(long x, long y) {\n\t\tlong res = (x + y) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\n\tstatic long sub(long x, long y) {\n\t\tlong res = (x - y) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\n\tstatic long mul(long x, long y) {\n\t\tlong res = (x * y) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\n\tstatic long div(long x, long y) {\n\t\tlong res = x * pow(y, mod - 2) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\n\tstatic long pow(long x, long y) {\n\t\tif (y < 0)\n\t\t\treturn 0;\n\t\tif (y == 0)\n\t\t\treturn 1;\n\t\tif (y % 2 == 1)\n\t\t\treturn (x * pow(x, y - 1)) % mod;\n\t\tlong root = pow(x, y / 2);\n\t\treturn root * root % mod;\n\t}\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tis = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());\n\t\tout = new PrintWriter(System.out);\n\t\tsolve();\n\t\tout.flush();\n\t}\n\n\t//input\n\tprivate static byte[] inbuf = new byte[1024];\n\tstatic int lenbuf = 0, ptrbuf = 0;\n\n\tprivate static int readByte() {\n\t\tif (lenbuf == -1)\n\t\t\tthrow new InputMismatchException();\n\t\tif (ptrbuf >= lenbuf) {\n\t\t\tptrbuf = 0;\n\t\t\ttry {\n\t\t\t\tlenbuf = is.read(inbuf);\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new InputMismatchException();\n\t\t\t}\n\t\t\tif (lenbuf <= 0)\n\t\t\t\treturn -1;\n\t\t}\n\t\treturn inbuf[ptrbuf++];\n\t}\n\n\tprivate static boolean isSpaceChar(int c) {\n\t\treturn !(c >= 33 && c <= 126);\n\t}\n\n\tprivate static int skip() {\n\t\tint b;\n\t\twhile ((b = readByte()) != -1 && isSpaceChar(b))\n\t\t\t;\n\t\treturn b;\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate static double nd() {\n\t\treturn Double.parseDouble(ns());\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate static char nc() {\n\t\treturn (char) skip();\n\t}\n\n\tprivate static String ns() {\n\t\tint b = skip();\n\t\tStringBuilder sb = new StringBuilder();\n\t\twhile (!(isSpaceChar(b))) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\n\tprivate static char[] ns(int n) {\n\t\tchar[] buf = new char[n];\n\t\tint b = skip(), p = 0;\n\t\twhile (p < n && !(isSpaceChar(b))) {\n\t\t\tbuf[p++] = (char) b;\n\t\t\tb = readByte();\n\t\t}\n\t\treturn n == p ? buf : Arrays.copyOf(buf, p);\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate static char[][] nm(int n, int m) {\n\t\tchar[][] map = new char[n][];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tmap[i] = ns(m);\n\t\treturn map;\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate static int[] na(int n) {\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = ni();\n\t\treturn a;\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate static long[] nla(int n) {\n\t\tlong[] a = new long[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = nl();\n\t\treturn a;\n\t}\n\n\tprivate static int ni() {\n\t\tint num = 0, b;\n\t\tboolean minus = false;\n\t\twhile ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))\n\t\t\t;\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\n\t\twhile (true) {\n\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t} else {\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate static long nl() {\n\t\tlong num = 0;\n\t\tint b;\n\t\tboolean minus = false;\n\t\twhile ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))\n\t\t\t;\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\n\t\twhile (true) {\n\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t} else {\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n}\n", "problem_context": "Score: 400 points\n\nProblem Statement\n\nWe have N integers A_1, A_2, ..., A_N.\n\nThere are \\frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq K \\leq \\frac{N(N-1)}{2}\n\n-10^9 \\leq A_i \\leq 10^9\\ (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n4 3\n3 3 -4 -2\n\nSample Output 1\n\n-6\n\nThere are six ways to form a pair. The products of those pairs are 9, -12, -6, -12, -6, 8.\n\nSorting those numbers in ascending order, we have -12, -12, -6, -6, 8, 9. The third number in this list is -6.\n\nSample Input 2\n\n10 40\n5 4 3 2 -1 0 0 0 0 0\n\nSample Output 2\n\n6\n\nSample Input 3\n\n30 413\n-170202098 -268409015 537203564 983211703 21608710 -443999067 -937727165 -97596546 -372334013 398994917 -972141167 798607104 -949068442 -959948616 37909651 0 886627544 -20098238 0 -948955241 0 -214720580 277222296 -18897162 834475626 0 -425610555 110117526 663621752 0\n\nSample Output 3\n\n448283280358331064", "sample_input": "4 3\n3 3 -4 -2\n"}, "reference_outputs": ["-6\n"], "source_document_id": "p02774", "source_text": "Score: 400 points\n\nProblem Statement\n\nWe have N integers A_1, A_2, ..., A_N.\n\nThere are \\frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq K \\leq \\frac{N(N-1)}{2}\n\n-10^9 \\leq A_i \\leq 10^9\\ (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n4 3\n3 3 -4 -2\n\nSample Output 1\n\n-6\n\nThere are six ways to form a pair. The products of those pairs are 9, -12, -6, -12, -6, 8.\n\nSorting those numbers in ascending order, we have -12, -12, -6, -6, 8, 9. The third number in this list is -6.\n\nSample Input 2\n\n10 40\n5 4 3 2 -1 0 0 0 0 0\n\nSample Output 2\n\n6\n\nSample Input 3\n\n30 413\n-170202098 -268409015 537203564 983211703 21608710 -443999067 -937727165 -97596546 -372334013 398994917 -972141167 798607104 -949068442 -959948616 37909651 0 886627544 -20098238 0 -948955241 0 -214720580 277222296 -18897162 834475626 0 -425610555 110117526 663621752 0\n\nSample Output 3\n\n448283280358331064", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 15644, "cpu_time_ms": 983, "memory_kb": 26744}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s884510867", "group_id": "codeNet:p02774", "input_text": "import java.util.*;\nimport java.util.Collections;\n/**\n * Main\n */\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\t// 整数の入力\n\t\tint N = sc.nextInt();\n\t\tint K = sc.nextInt();\n\t\tLong X;\n\t\tArrayList list = new ArrayList<>();\n\t\tArrayList List = new ArrayList<>();\n\t\tfor(int i = 0;i0){\n\t\t\t\tfor(int j = 0; j < list.size(); j++){\n\t\t\t\t\tList.add(X*list.get(j));\n\t\t\t\t}\n\t\t\t}\n\t\t\tlist.add(X);\n\t\t}\n\t\tCollections.sort(List);\n\t\tSystem.out.println(List.get(K-1));\n\t\tsc.close();\n\t}\n};\n", "language": "Java", "metadata": {"date": 1585851315, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02774.html", "problem_id": "p02774", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02774/input.txt", "sample_output_relpath": "derived/input_output/data/p02774/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02774/Java/s884510867.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s884510867", "user_id": "u645614197"}, "prompt_components": {"gold_output": "-6\n", "input_to_evaluate": "import java.util.*;\nimport java.util.Collections;\n/**\n * Main\n */\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\t// 整数の入力\n\t\tint N = sc.nextInt();\n\t\tint K = sc.nextInt();\n\t\tLong X;\n\t\tArrayList list = new ArrayList<>();\n\t\tArrayList List = new ArrayList<>();\n\t\tfor(int i = 0;i0){\n\t\t\t\tfor(int j = 0; j < list.size(); j++){\n\t\t\t\t\tList.add(X*list.get(j));\n\t\t\t\t}\n\t\t\t}\n\t\t\tlist.add(X);\n\t\t}\n\t\tCollections.sort(List);\n\t\tSystem.out.println(List.get(K-1));\n\t\tsc.close();\n\t}\n};\n", "problem_context": "Score: 400 points\n\nProblem Statement\n\nWe have N integers A_1, A_2, ..., A_N.\n\nThere are \\frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq K \\leq \\frac{N(N-1)}{2}\n\n-10^9 \\leq A_i \\leq 10^9\\ (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n4 3\n3 3 -4 -2\n\nSample Output 1\n\n-6\n\nThere are six ways to form a pair. The products of those pairs are 9, -12, -6, -12, -6, 8.\n\nSorting those numbers in ascending order, we have -12, -12, -6, -6, 8, 9. The third number in this list is -6.\n\nSample Input 2\n\n10 40\n5 4 3 2 -1 0 0 0 0 0\n\nSample Output 2\n\n6\n\nSample Input 3\n\n30 413\n-170202098 -268409015 537203564 983211703 21608710 -443999067 -937727165 -97596546 -372334013 398994917 -972141167 798607104 -949068442 -959948616 37909651 0 886627544 -20098238 0 -948955241 0 -214720580 277222296 -18897162 834475626 0 -425610555 110117526 663621752 0\n\nSample Output 3\n\n448283280358331064", "sample_input": "4 3\n3 3 -4 -2\n"}, "reference_outputs": ["-6\n"], "source_document_id": "p02774", "source_text": "Score: 400 points\n\nProblem Statement\n\nWe have N integers A_1, A_2, ..., A_N.\n\nThere are \\frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq K \\leq \\frac{N(N-1)}{2}\n\n-10^9 \\leq A_i \\leq 10^9\\ (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n4 3\n3 3 -4 -2\n\nSample Output 1\n\n-6\n\nThere are six ways to form a pair. The products of those pairs are 9, -12, -6, -12, -6, 8.\n\nSorting those numbers in ascending order, we have -12, -12, -6, -6, 8, 9. The third number in this list is -6.\n\nSample Input 2\n\n10 40\n5 4 3 2 -1 0 0 0 0 0\n\nSample Output 2\n\n6\n\nSample Input 3\n\n30 413\n-170202098 -268409015 537203564 983211703 21608710 -443999067 -937727165 -97596546 -372334013 398994917 -972141167 798607104 -949068442 -959948616 37909651 0 886627544 -20098238 0 -948955241 0 -214720580 277222296 -18897162 834475626 0 -425610555 110117526 663621752 0\n\nSample Output 3\n\n448283280358331064", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 590, "cpu_time_ms": 2113, "memory_kb": 471360}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s437944155", "group_id": "codeNet:p02774", "input_text": "import java.util.Arrays;\nimport java.util.Scanner;\n\n// ref. https://atcoder.jp/contests/abc155/submissions/10152895\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long K = sc.nextLong();\n long[] A = new long[N];\n for (int i = 0; i < N; i++) {\n A[i] = sc.nextInt();\n }\n Arrays.sort(A);\n\n long l = -1000_000_000_000_000_000L;\n long r = 1000_000_000_000_000_000L;\n // long l = -20;\n // long r = 20;\n while (l + 1 < r) {\n long kThProd = (l + r) / 2;\n long cnt = countPairLessThan(kThProd, A);\n if (cnt < K) { // Find 'cnt == K -1', then 'kThProd' is K-th smallest product.\n l = kThProd; // l:ok.\n } else {\n r = kThProd; // r:ng.\n }\n }\n System.out.println(l);\n }\n\n private static long countPairLessThan(long m, long[] A) {\n long tot = 0;\n for (long a : A) {\n int l = -1, r = A.length;\n if (a > 0) {\n while (l + 1 < r) {\n int c = (l + r) / 2;\n if (a * A[c] < m) l = c; // l:ok, r:ng\n else r = c;\n }\n tot += l + 1; // Because index starts with 0. OK count is (l+1).\n } else {\n while (l + 1 < r) {\n int c = (l + r) / 2;\n if (a * A[c] < m) r = c; // l:ng, r:ok\n else l = c;\n }\n tot +=\n A.length - (l + 1); // Remove NG count. Because index starts with 0. NG count is (l+1).\n }\n if (a * a < m) tot--;\n }\n\n return tot / 2;\n }\n}\n\n// i < j\n// Search m, where count(a*x <= m) equals K\n// -----------------\n// condition of a | count where | count\n// -----------------\n// a > 0: x <= m/a | |\n// a== 0: | | num-zero * x\n// a < 0: x >= m/a | | N- count(x < m/a) <=> N-count(x <= m/a -1)\n// ref: 3/(-2) => -1\n", "language": "Java", "metadata": {"date": 1582512242, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02774.html", "problem_id": "p02774", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02774/input.txt", "sample_output_relpath": "derived/input_output/data/p02774/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02774/Java/s437944155.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s437944155", "user_id": "u915981080"}, "prompt_components": {"gold_output": "-6\n", "input_to_evaluate": "import java.util.Arrays;\nimport java.util.Scanner;\n\n// ref. https://atcoder.jp/contests/abc155/submissions/10152895\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long K = sc.nextLong();\n long[] A = new long[N];\n for (int i = 0; i < N; i++) {\n A[i] = sc.nextInt();\n }\n Arrays.sort(A);\n\n long l = -1000_000_000_000_000_000L;\n long r = 1000_000_000_000_000_000L;\n // long l = -20;\n // long r = 20;\n while (l + 1 < r) {\n long kThProd = (l + r) / 2;\n long cnt = countPairLessThan(kThProd, A);\n if (cnt < K) { // Find 'cnt == K -1', then 'kThProd' is K-th smallest product.\n l = kThProd; // l:ok.\n } else {\n r = kThProd; // r:ng.\n }\n }\n System.out.println(l);\n }\n\n private static long countPairLessThan(long m, long[] A) {\n long tot = 0;\n for (long a : A) {\n int l = -1, r = A.length;\n if (a > 0) {\n while (l + 1 < r) {\n int c = (l + r) / 2;\n if (a * A[c] < m) l = c; // l:ok, r:ng\n else r = c;\n }\n tot += l + 1; // Because index starts with 0. OK count is (l+1).\n } else {\n while (l + 1 < r) {\n int c = (l + r) / 2;\n if (a * A[c] < m) r = c; // l:ng, r:ok\n else l = c;\n }\n tot +=\n A.length - (l + 1); // Remove NG count. Because index starts with 0. NG count is (l+1).\n }\n if (a * a < m) tot--;\n }\n\n return tot / 2;\n }\n}\n\n// i < j\n// Search m, where count(a*x <= m) equals K\n// -----------------\n// condition of a | count where | count\n// -----------------\n// a > 0: x <= m/a | |\n// a== 0: | | num-zero * x\n// a < 0: x >= m/a | | N- count(x < m/a) <=> N-count(x <= m/a -1)\n// ref: 3/(-2) => -1\n", "problem_context": "Score: 400 points\n\nProblem Statement\n\nWe have N integers A_1, A_2, ..., A_N.\n\nThere are \\frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq K \\leq \\frac{N(N-1)}{2}\n\n-10^9 \\leq A_i \\leq 10^9\\ (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n4 3\n3 3 -4 -2\n\nSample Output 1\n\n-6\n\nThere are six ways to form a pair. The products of those pairs are 9, -12, -6, -12, -6, 8.\n\nSorting those numbers in ascending order, we have -12, -12, -6, -6, 8, 9. The third number in this list is -6.\n\nSample Input 2\n\n10 40\n5 4 3 2 -1 0 0 0 0 0\n\nSample Output 2\n\n6\n\nSample Input 3\n\n30 413\n-170202098 -268409015 537203564 983211703 21608710 -443999067 -937727165 -97596546 -372334013 398994917 -972141167 798607104 -949068442 -959948616 37909651 0 886627544 -20098238 0 -948955241 0 -214720580 277222296 -18897162 834475626 0 -425610555 110117526 663621752 0\n\nSample Output 3\n\n448283280358331064", "sample_input": "4 3\n3 3 -4 -2\n"}, "reference_outputs": ["-6\n"], "source_document_id": "p02774", "source_text": "Score: 400 points\n\nProblem Statement\n\nWe have N integers A_1, A_2, ..., A_N.\n\nThere are \\frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq K \\leq \\frac{N(N-1)}{2}\n\n-10^9 \\leq A_i \\leq 10^9\\ (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n4 3\n3 3 -4 -2\n\nSample Output 1\n\n-6\n\nThere are six ways to form a pair. The products of those pairs are 9, -12, -6, -12, -6, 8.\n\nSorting those numbers in ascending order, we have -12, -12, -6, -6, 8, 9. The third number in this list is -6.\n\nSample Input 2\n\n10 40\n5 4 3 2 -1 0 0 0 0 0\n\nSample Output 2\n\n6\n\nSample Input 3\n\n30 413\n-170202098 -268409015 537203564 983211703 21608710 -443999067 -937727165 -97596546 -372334013 398994917 -972141167 798607104 -949068442 -959948616 37909651 0 886627544 -20098238 0 -948955241 0 -214720580 277222296 -18897162 834475626 0 -425610555 110117526 663621752 0\n\nSample Output 3\n\n448283280358331064", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1818, "cpu_time_ms": 1415, "memory_kb": 90484}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s986975245", "group_id": "codeNet:p02774", "input_text": "import java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Scanner;\n\n//System.out.println();\npublic class Main { //クラス名はMain\n public static void main(String[] args) {\n //コード\n Scanner sc = new Scanner(System.in);\n int n = Integer.parseInt(sc.next());\n int k = Integer.parseInt(sc.next());\n ArrayList ori = new ArrayList();\n ArrayList re = new ArrayList();\n\n for(int i=0; i ori = new ArrayList();\n ArrayList re = new ArrayList();\n\n for(int i=0; i ps , long x){\n\t\tif(ps.isEmpty()){\n\t\t\treturn 0;\n\t\t}\n\t\tif(ps.get(0) >= x){\n\t\t\treturn 0;\n\t\t}\n\t\tif(ps.get(ps.size() - 1) < x){\n\t\t\treturn ps.size();\n\t\t}\n\t\tint left = 0;\n\t\tint right = ps.size() - 1;\n\t\twhile(right - left > 1){\n\t\t\tint mid = (left + right) / 2;\n\t\t\tlong v = ps.get(mid);\n\t\t\tif(v < x){\n\t\t\t\tleft = mid;\n\t\t\t}else{\n\t\t\t\tright = mid;\n\t\t\t}\n\t\t}\n\t\treturn right;\n\t}\n\t// x 以下の数値が何個あるか計算する (xはマイナスとする)\n\tstatic long f(List negs , List poss , long x){\n\t\tlong ret = 0;\n\t\tfor(long n : negs){ //n -3 x -81\n\t\t\tlong m = (- x + (- n - 1)) /(- n);\n\t\t\t// x以下となるのは m が 26以上のとき\n\t\t\tint cnt = bsearch(poss, m);\n\t\t\tret += poss.size() - cnt;\n\t\t}\n\t\treturn ret;\n\t}\n\tstatic long g(List poss , long x){\n\t\tlong ret = 0;\n\t\tint N = poss.size();\n\t\tfor(int i = 0 ; i < poss.size() - 1; ++i){\n\t\t\tlong pi = poss.get(i);\n\t\t\tlong m = x / pi;\n\t\t\tint left = i + 1;\n\t\t\tint right = N - 1;\n\t\t\tif(poss.get(left) > m){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif(poss.get(right) <= m){\n\t\t\t\tret += N - i - 1;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\twhile(right - left > 1){\n\t\t\t\tint mid = (left + right) / 2;\n\t\t\t\tif(poss.get(mid) <= m){\n\t\t\t\t\tleft = mid;\n\t\t\t\t}else{\n\t\t\t\t\tright = mid;\n\t\t\t\t}\n\t\t\t}\n\t\t\tret += (left) - i;\t\t\t\n\t\t}\n\t\treturn ret;\n\t}\n\t\n\tstatic long solve(long A[] , long K){\n\t\tList neg = new ArrayList();\n\t\tList neg2 = new ArrayList();\n\t\tList pos = new ArrayList();\n\t\tList zero = new ArrayList();\n\t\tfor(long a : A){\n\t\t\tif(a < 0){\n\t\t\t\tneg.add(a);\n\t\t\t\tneg2.add(- a);\n\t\t\t}else if(a == 0){\n\t\t\t\tzero.add(a);\n\t\t\t}else{\n\t\t\t\tpos.add(a);\n\t\t\t}\t\t\t\n\t\t}\n\t\tCollections.sort(neg);\n\t\tCollections.sort(neg2);\n\t\tCollections.sort(pos);\n\t\tCollections.sort(zero);\n\t\tlong neg_num = neg.size() * pos.size();\n\t\tlong zero_num = zero.size() * (pos.size() + neg.size()) + (zero.size() * (zero.size() - 1)) / 2;\n\t\tif(K > neg_num && K <= neg_num + zero_num){\n\t\t\treturn 0;\n\t\t}else{\n\t\t\tif(K <= neg_num){\n\t\t\t\tlong left = - (1000000000L * 1000000000L) - 1;\n\t\t\t\tlong right = 0;\n\t\t\t\twhile(right - left > 1){\n\t\t\t\t\tlong mid = (left + right) / 2;\n\t\t\t\t\tlong f = f(neg, pos , mid);\n\t\t\t\t\tif(K <= f){\n\t\t\t\t\t\tright = mid;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tleft = mid;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn right;\n\t\t\t}else{\n\t\t\t\tlong left = 0;\n\t\t\t\tlong right = (1000000000L * 1000000000L) + 1;\n\t\t\t\twhile(right - left > 1){\n\t\t\t\t\tlong mid = (left + right) / 2;\n\t\t\t\t\tlong f = g(neg2, mid) + g(pos , mid) + neg_num + zero_num;\n\t\t\t\t\tif(K <= f){\n\t\t\t\t\t\tright = mid;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tleft = mid;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn right;\n\t\t\t}\n\t\t}\n\t}\n\tstatic long solveNaive(long A[] , int K){\n\t\tList lst = new ArrayList();\n\t\tint N = A.length;\n\t\tfor(int i = 0 ; i < N ; ++i){\n\t\t\tfor(int j = i +1 ; j < N ; ++j){\n\t\t\t\tlst.add(A[i] * A[j]);\n\t\t\t}\n\t\t}\n\t\tCollections.sort(lst);\n\t\treturn lst.get(K - 1);\n\t}\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tlong K = sc.nextLong();\n\t\tlong A[] = new long[N];\n\t\tfor(int i = 0 ; i < N ; ++i){\n\t\t\tlong a = sc.nextLong();\n\t\t\tA[i] = a;\n\t\t}\n\t\tSystem.out.println(solve(A, K));\n\t}\n}\n", "language": "Java", "metadata": {"date": 1581890358, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02774.html", "problem_id": "p02774", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02774/input.txt", "sample_output_relpath": "derived/input_output/data/p02774/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02774/Java/s394604363.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s394604363", "user_id": "u745266708"}, "prompt_components": {"gold_output": "-6\n", "input_to_evaluate": "\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Random;\nimport java.util.Scanner;\n\npublic class Main {\n\tstatic int bsearch(List ps , long x){\n\t\tif(ps.isEmpty()){\n\t\t\treturn 0;\n\t\t}\n\t\tif(ps.get(0) >= x){\n\t\t\treturn 0;\n\t\t}\n\t\tif(ps.get(ps.size() - 1) < x){\n\t\t\treturn ps.size();\n\t\t}\n\t\tint left = 0;\n\t\tint right = ps.size() - 1;\n\t\twhile(right - left > 1){\n\t\t\tint mid = (left + right) / 2;\n\t\t\tlong v = ps.get(mid);\n\t\t\tif(v < x){\n\t\t\t\tleft = mid;\n\t\t\t}else{\n\t\t\t\tright = mid;\n\t\t\t}\n\t\t}\n\t\treturn right;\n\t}\n\t// x 以下の数値が何個あるか計算する (xはマイナスとする)\n\tstatic long f(List negs , List poss , long x){\n\t\tlong ret = 0;\n\t\tfor(long n : negs){ //n -3 x -81\n\t\t\tlong m = (- x + (- n - 1)) /(- n);\n\t\t\t// x以下となるのは m が 26以上のとき\n\t\t\tint cnt = bsearch(poss, m);\n\t\t\tret += poss.size() - cnt;\n\t\t}\n\t\treturn ret;\n\t}\n\tstatic long g(List poss , long x){\n\t\tlong ret = 0;\n\t\tint N = poss.size();\n\t\tfor(int i = 0 ; i < poss.size() - 1; ++i){\n\t\t\tlong pi = poss.get(i);\n\t\t\tlong m = x / pi;\n\t\t\tint left = i + 1;\n\t\t\tint right = N - 1;\n\t\t\tif(poss.get(left) > m){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif(poss.get(right) <= m){\n\t\t\t\tret += N - i - 1;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\twhile(right - left > 1){\n\t\t\t\tint mid = (left + right) / 2;\n\t\t\t\tif(poss.get(mid) <= m){\n\t\t\t\t\tleft = mid;\n\t\t\t\t}else{\n\t\t\t\t\tright = mid;\n\t\t\t\t}\n\t\t\t}\n\t\t\tret += (left) - i;\t\t\t\n\t\t}\n\t\treturn ret;\n\t}\n\t\n\tstatic long solve(long A[] , long K){\n\t\tList neg = new ArrayList();\n\t\tList neg2 = new ArrayList();\n\t\tList pos = new ArrayList();\n\t\tList zero = new ArrayList();\n\t\tfor(long a : A){\n\t\t\tif(a < 0){\n\t\t\t\tneg.add(a);\n\t\t\t\tneg2.add(- a);\n\t\t\t}else if(a == 0){\n\t\t\t\tzero.add(a);\n\t\t\t}else{\n\t\t\t\tpos.add(a);\n\t\t\t}\t\t\t\n\t\t}\n\t\tCollections.sort(neg);\n\t\tCollections.sort(neg2);\n\t\tCollections.sort(pos);\n\t\tCollections.sort(zero);\n\t\tlong neg_num = neg.size() * pos.size();\n\t\tlong zero_num = zero.size() * (pos.size() + neg.size()) + (zero.size() * (zero.size() - 1)) / 2;\n\t\tif(K > neg_num && K <= neg_num + zero_num){\n\t\t\treturn 0;\n\t\t}else{\n\t\t\tif(K <= neg_num){\n\t\t\t\tlong left = - (1000000000L * 1000000000L) - 1;\n\t\t\t\tlong right = 0;\n\t\t\t\twhile(right - left > 1){\n\t\t\t\t\tlong mid = (left + right) / 2;\n\t\t\t\t\tlong f = f(neg, pos , mid);\n\t\t\t\t\tif(K <= f){\n\t\t\t\t\t\tright = mid;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tleft = mid;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn right;\n\t\t\t}else{\n\t\t\t\tlong left = 0;\n\t\t\t\tlong right = (1000000000L * 1000000000L) + 1;\n\t\t\t\twhile(right - left > 1){\n\t\t\t\t\tlong mid = (left + right) / 2;\n\t\t\t\t\tlong f = g(neg2, mid) + g(pos , mid) + neg_num + zero_num;\n\t\t\t\t\tif(K <= f){\n\t\t\t\t\t\tright = mid;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tleft = mid;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn right;\n\t\t\t}\n\t\t}\n\t}\n\tstatic long solveNaive(long A[] , int K){\n\t\tList lst = new ArrayList();\n\t\tint N = A.length;\n\t\tfor(int i = 0 ; i < N ; ++i){\n\t\t\tfor(int j = i +1 ; j < N ; ++j){\n\t\t\t\tlst.add(A[i] * A[j]);\n\t\t\t}\n\t\t}\n\t\tCollections.sort(lst);\n\t\treturn lst.get(K - 1);\n\t}\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tlong K = sc.nextLong();\n\t\tlong A[] = new long[N];\n\t\tfor(int i = 0 ; i < N ; ++i){\n\t\t\tlong a = sc.nextLong();\n\t\t\tA[i] = a;\n\t\t}\n\t\tSystem.out.println(solve(A, K));\n\t}\n}\n", "problem_context": "Score: 400 points\n\nProblem Statement\n\nWe have N integers A_1, A_2, ..., A_N.\n\nThere are \\frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq K \\leq \\frac{N(N-1)}{2}\n\n-10^9 \\leq A_i \\leq 10^9\\ (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n4 3\n3 3 -4 -2\n\nSample Output 1\n\n-6\n\nThere are six ways to form a pair. The products of those pairs are 9, -12, -6, -12, -6, 8.\n\nSorting those numbers in ascending order, we have -12, -12, -6, -6, 8, 9. The third number in this list is -6.\n\nSample Input 2\n\n10 40\n5 4 3 2 -1 0 0 0 0 0\n\nSample Output 2\n\n6\n\nSample Input 3\n\n30 413\n-170202098 -268409015 537203564 983211703 21608710 -443999067 -937727165 -97596546 -372334013 398994917 -972141167 798607104 -949068442 -959948616 37909651 0 886627544 -20098238 0 -948955241 0 -214720580 277222296 -18897162 834475626 0 -425610555 110117526 663621752 0\n\nSample Output 3\n\n448283280358331064", "sample_input": "4 3\n3 3 -4 -2\n"}, "reference_outputs": ["-6\n"], "source_document_id": "p02774", "source_text": "Score: 400 points\n\nProblem Statement\n\nWe have N integers A_1, A_2, ..., A_N.\n\nThere are \\frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq K \\leq \\frac{N(N-1)}{2}\n\n-10^9 \\leq A_i \\leq 10^9\\ (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n4 3\n3 3 -4 -2\n\nSample Output 1\n\n-6\n\nThere are six ways to form a pair. The products of those pairs are 9, -12, -6, -12, -6, 8.\n\nSorting those numbers in ascending order, we have -12, -12, -6, -6, 8, 9. The third number in this list is -6.\n\nSample Input 2\n\n10 40\n5 4 3 2 -1 0 0 0 0 0\n\nSample Output 2\n\n6\n\nSample Input 3\n\n30 413\n-170202098 -268409015 537203564 983211703 21608710 -443999067 -937727165 -97596546 -372334013 398994917 -972141167 798607104 -949068442 -959948616 37909651 0 886627544 -20098238 0 -948955241 0 -214720580 277222296 -18897162 834475626 0 -425610555 110117526 663621752 0\n\nSample Output 3\n\n448283280358331064", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3265, "cpu_time_ms": 1532, "memory_kb": 94408}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s542930818", "group_id": "codeNet:p02774", "input_text": "import java.io.*;\nimport java.util.*;\n\npublic class Main implements Runnable {\n\tboolean judge = true;\n\tFastReader scn;\n\tPrintWriter out;\n\tString INPUT = \"\";\n\n\tvoid solve() {\n\t\tint n = scn.nextInt();\n\t\tlong k = scn.nextLong();\n\t\tlong[] arr = scn.nextLongArray(n);\n\t\tArrays.parallelSort(arr);\n\n\t\tlong[] pos = new long[n], neg = new long[n];\n\t\tint p = 0, q = 0, z = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (arr[i] > 0) {\n\t\t\t\tpos[p++] = arr[i];\n\t\t\t} else if (arr[i] < 0) {\n\t\t\t\tneg[q++] = -arr[i];\n\t\t\t} else {\n\t\t\t\tz++;\n\t\t\t}\n\t\t}\n\n\t\tpos = Arrays.copyOf(pos, p);\n\t\tneg = Arrays.copyOf(neg, q);\n\n\t\tArrays.parallelSort(pos);\n\t\tArrays.parallelSort(neg);\n\n\t\tlong l = -(long) 1e18, r = (long) 1e18, ans = (long) 2e18;\n\t\twhile (l <= r) {\n\t\t\tlong m = (l + r) >> 1;\n\t\t\tlong small = smaller(pos, neg, z, m);\n\t\t\tif (small >= k) {\n\t\t\t\tr = m - 1;\n\t\t\t\tans = m;\n\t\t\t} else {\n\t\t\t\tl = m + 1;\n\t\t\t}\n\t\t}\n\n\t\tout.println(ans);\n\t}\n\n\tlong smaller(long[] pos, long[] neg, long z, long x) {\n\t\tlong rv = 0;\n\t\tif (x >= 0) {\n\t\t\tfor (int i = 0; i < pos.length; i++) {\n\t\t\t\tlong y = x / pos[i];\n\t\t\t\tif (x % pos[i] == 0) {\n\t\t\t\t\ty++;\n\t\t\t\t}\n\t\t\t\tint l = i + 1, r = pos.length - 1, ind = pos.length;\n\t\t\t\twhile (l <= r) {\n\t\t\t\t\tint m = (l + r) >> 1;\n\t\t\t\t\tif (pos[m] > y) {\n\t\t\t\t\t\tind = m;\n\t\t\t\t\t\tr = m - 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tl = m + 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\trv += ind - (i + 1);\n\t\t\t}\n\t\t\tfor (int i = 0; i < neg.length; i++) {\n\t\t\t\tlong y = x / neg[i];\n\t\t\t\tif (x % neg[i] == 0) {\n\t\t\t\t\ty++;\n\t\t\t\t}\n\t\t\t\tint l = i + 1, r = neg.length - 1, ind = neg.length;\n\t\t\t\twhile (l <= r) {\n\t\t\t\t\tint m = (l + r) >> 1;\n\t\t\t\t\tif (neg[m] > y) {\n\t\t\t\t\t\tind = m;\n\t\t\t\t\t\tr = m - 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tl = m + 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\trv += ind - (i + 1);\n\t\t\t}\n\t\t\trv += pos.length * 1L * neg.length;\n\t\t\trv += z * (z - 1) / 2;\n\t\t\trv += pos.length * z;\n\t\t\trv += neg.length * z;\n\t\t} else {\n\t\t\tx = -x;\n\t\t\tfor (int i = 0; i < pos.length; i++) {\n\t\t\t\tlong y = x / pos[i];\n\t\t\t\tif (x % pos[i] != 0) {\n\t\t\t\t\ty++;\n\t\t\t\t}\n\t\t\t\tint l = 0, r = neg.length - 1, ind = neg.length;\n\t\t\t\twhile (l <= r) {\n\t\t\t\t\tint m = (l + r) >> 1;\n\t\t\t\t\tif (neg[m] >= y) {\n\t\t\t\t\t\tind = m;\n\t\t\t\t\t\tr = m - 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tl = m + 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\trv += neg.length - ind;\n\t\t\t}\n\t\t}\n\n\t\treturn rv;\n\t}\n\n\tpublic void run() {\n\t\tlong time = System.currentTimeMillis();\n\t\tboolean oj = System.getProperty(\"ONLINE_JUDGE\") != null || judge;\n\t\tout = new PrintWriter(System.out);\n\t\tscn = new FastReader(oj);\n\t\tsolve();\n\t\tout.flush();\n\t\tif (!oj) {\n\t\t\tSystem.out.println(Arrays.deepToString(new Object[] { System.currentTimeMillis() - time + \" ms\" }));\n\t\t}\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tnew Thread(null, new Main(), \"Main\", 1 << 26).start();\n\t}\n\n\tclass FastReader {\n\t\tInputStream is;\n\n\t\tpublic FastReader(boolean onlineJudge) {\n\t\t\tis = onlineJudge ? System.in : new ByteArrayInputStream(INPUT.getBytes());\n\t\t}\n\n\t\tbyte[] inbuf = new byte[1024];\n\t\tpublic int lenbuf = 0, ptrbuf = 0;\n\n\t\tint readByte() {\n\t\t\tif (lenbuf == -1)\n\t\t\t\tthrow new InputMismatchException();\n\t\t\tif (ptrbuf >= lenbuf) {\n\t\t\t\tptrbuf = 0;\n\t\t\t\ttry {\n\t\t\t\t\tlenbuf = is.read(inbuf);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t\tif (lenbuf <= 0)\n\t\t\t\t\treturn -1;\n\t\t\t}\n\t\t\treturn inbuf[ptrbuf++];\n\t\t}\n\n\t\tboolean isSpaceChar(int c) {\n\t\t\treturn !(c >= 33 && c <= 126);\n\t\t}\n\n\t\tint skip() {\n\t\t\tint b;\n\t\t\twhile ((b = readByte()) != -1 && isSpaceChar(b))\n\t\t\t\t;\n\t\t\treturn b;\n\t\t}\n\n\t\tdouble nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tchar nextChar() {\n\t\t\treturn (char) skip();\n\t\t}\n\n\t\tString next() {\n\t\t\tint b = skip();\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\twhile (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\treturn sb.toString();\n\t\t}\n\n\t\tString nextLine() {\n\t\t\tint b = skip();\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\twhile ((!isSpaceChar(b) || b == ' ')) { // when nextLine, (isSpaceChar(b) && b != ' ')\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\treturn sb.toString();\n\t\t}\n\n\t\tchar[] next(int n) {\n\t\t\tchar[] buf = new char[n];\n\t\t\tint b = skip(), p = 0;\n\t\t\twhile (p < n && !(isSpaceChar(b))) {\n\t\t\t\tbuf[p++] = (char) b;\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\treturn n == p ? buf : Arrays.copyOf(buf, p);\n\t\t}\n\n\t\tint nextInt() {\n\t\t\tint num = 0, b;\n\t\t\tboolean minus = false;\n\t\t\twhile ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))\n\t\t\t\t;\n\t\t\tif (b == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tb = readByte();\n\t\t\t}\n\n\t\t\twhile (true) {\n\t\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t\t} else {\n\t\t\t\t\treturn minus ? -num : num;\n\t\t\t\t}\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t}\n\n\t\tlong nextLong() {\n\t\t\tlong num = 0;\n\t\t\tint b;\n\t\t\tboolean minus = false;\n\t\t\twhile ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))\n\t\t\t\t;\n\t\t\tif (b == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tb = readByte();\n\t\t\t}\n\n\t\t\twhile (true) {\n\t\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t\t} else {\n\t\t\t\t\treturn minus ? -num : num;\n\t\t\t\t}\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t}\n\n\t\tchar[][] nextMatrix(int n, int m) {\n\t\t\tchar[][] map = new char[n][];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tmap[i] = next(m);\n\t\t\treturn map;\n\t\t}\n\n\t\tint[] nextIntArray(int n) {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}\n\n\t\tlong[] nextLongArray(int n) {\n\t\t\tlong[] a = new long[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();\n\t\t\treturn a;\n\t\t}\n\n\t\tint[][] next2DInt(int n, int m) {\n\t\t\tint[][] arr = new int[n][];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tarr[i] = nextIntArray(m);\n\t\t\t}\n\t\t\treturn arr;\n\t\t}\n\n\t\tlong[][] next2DLong(int n, int m) {\n\t\t\tlong[][] arr = new long[n][];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tarr[i] = nextLongArray(m);\n\t\t\t}\n\t\t\treturn arr;\n\t\t}\n\n\t\tint[] shuffle(int[] arr) {\n\t\t\tRandom r = new Random();\n\t\t\tfor (int i = 1, j; i < arr.length; i++) {\n\t\t\t\tj = r.nextInt(i);\n\t\t\t\tint c = arr[i];\n\t\t\t\tarr[i] = arr[j];\n\t\t\t\tarr[j] = c;\n\t\t\t}\n\t\t\treturn arr;\n\t\t}\n\n\t\tlong[] shuffle(long[] arr) {\n\t\t\tRandom r = new Random();\n\t\t\tfor (int i = 1, j; i < arr.length; i++) {\n\t\t\t\tj = r.nextInt(i);\n\t\t\t\tlong c = arr[i];\n\t\t\t\tarr[i] = arr[j];\n\t\t\t\tarr[j] = c;\n\t\t\t}\n\t\t\treturn arr;\n\t\t}\n\n\t\tint[] uniq(int[] arr) {\n\t\t\tarr = scn.shuffle(arr);\n\t\t\tArrays.sort(arr);\n\t\t\tint[] rv = new int[arr.length];\n\t\t\tint pos = 0;\n\t\t\trv[pos++] = arr[0];\n\t\t\tfor (int i = 1; i < arr.length; i++) {\n\t\t\t\tif (arr[i] != arr[i - 1]) {\n\t\t\t\t\trv[pos++] = arr[i];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn Arrays.copyOf(rv, pos);\n\t\t}\n\n\t\tlong[] uniq(long[] arr) {\n\t\t\tarr = scn.shuffle(arr);\n\t\t\tArrays.sort(arr);\n\t\t\tlong[] rv = new long[arr.length];\n\t\t\tint pos = 0;\n\t\t\trv[pos++] = arr[0];\n\t\t\tfor (int i = 1; i < arr.length; i++) {\n\t\t\t\tif (arr[i] != arr[i - 1]) {\n\t\t\t\t\trv[pos++] = arr[i];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn Arrays.copyOf(rv, pos);\n\t\t}\n\n\t\tint[] reverse(int[] arr) {\n\t\t\tint l = 0, r = arr.length - 1;\n\t\t\twhile (l < r) {\n\t\t\t\tarr[l] = arr[l] ^ arr[r];\n\t\t\t\tarr[r] = arr[l] ^ arr[r];\n\t\t\t\tarr[l] = arr[l] ^ arr[r];\n\t\t\t\tl++;\n\t\t\t\tr--;\n\t\t\t}\n\t\t\treturn arr;\n\t\t}\n\n\t\tlong[] reverse(long[] arr) {\n\t\t\tint l = 0, r = arr.length - 1;\n\t\t\twhile (l < r) {\n\t\t\t\tarr[l] = arr[l] ^ arr[r];\n\t\t\t\tarr[r] = arr[l] ^ arr[r];\n\t\t\t\tarr[l] = arr[l] ^ arr[r];\n\t\t\t\tl++;\n\t\t\t\tr--;\n\t\t\t}\n\t\t\treturn arr;\n\t\t}\n\n\t\tint[] compress(int[] arr) {\n\t\t\tint n = arr.length;\n\t\t\tint[] rv = Arrays.copyOf(arr, n);\n\t\t\trv = uniq(rv);\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tarr[i] = Arrays.binarySearch(rv, arr[i]);\n\t\t\t}\n\t\t\treturn arr;\n\t\t}\n\n\t\tlong[] compress(long[] arr) {\n\t\t\tint n = arr.length;\n\t\t\tlong[] rv = Arrays.copyOf(arr, n);\n\t\t\trv = uniq(rv);\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tarr[i] = Arrays.binarySearch(rv, arr[i]);\n\t\t\t}\n\t\t\treturn arr;\n\t\t}\n\t}\n}", "language": "Java", "metadata": {"date": 1581887143, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02774.html", "problem_id": "p02774", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02774/input.txt", "sample_output_relpath": "derived/input_output/data/p02774/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02774/Java/s542930818.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s542930818", "user_id": "u228818634"}, "prompt_components": {"gold_output": "-6\n", "input_to_evaluate": "import java.io.*;\nimport java.util.*;\n\npublic class Main implements Runnable {\n\tboolean judge = true;\n\tFastReader scn;\n\tPrintWriter out;\n\tString INPUT = \"\";\n\n\tvoid solve() {\n\t\tint n = scn.nextInt();\n\t\tlong k = scn.nextLong();\n\t\tlong[] arr = scn.nextLongArray(n);\n\t\tArrays.parallelSort(arr);\n\n\t\tlong[] pos = new long[n], neg = new long[n];\n\t\tint p = 0, q = 0, z = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tif (arr[i] > 0) {\n\t\t\t\tpos[p++] = arr[i];\n\t\t\t} else if (arr[i] < 0) {\n\t\t\t\tneg[q++] = -arr[i];\n\t\t\t} else {\n\t\t\t\tz++;\n\t\t\t}\n\t\t}\n\n\t\tpos = Arrays.copyOf(pos, p);\n\t\tneg = Arrays.copyOf(neg, q);\n\n\t\tArrays.parallelSort(pos);\n\t\tArrays.parallelSort(neg);\n\n\t\tlong l = -(long) 1e18, r = (long) 1e18, ans = (long) 2e18;\n\t\twhile (l <= r) {\n\t\t\tlong m = (l + r) >> 1;\n\t\t\tlong small = smaller(pos, neg, z, m);\n\t\t\tif (small >= k) {\n\t\t\t\tr = m - 1;\n\t\t\t\tans = m;\n\t\t\t} else {\n\t\t\t\tl = m + 1;\n\t\t\t}\n\t\t}\n\n\t\tout.println(ans);\n\t}\n\n\tlong smaller(long[] pos, long[] neg, long z, long x) {\n\t\tlong rv = 0;\n\t\tif (x >= 0) {\n\t\t\tfor (int i = 0; i < pos.length; i++) {\n\t\t\t\tlong y = x / pos[i];\n\t\t\t\tif (x % pos[i] == 0) {\n\t\t\t\t\ty++;\n\t\t\t\t}\n\t\t\t\tint l = i + 1, r = pos.length - 1, ind = pos.length;\n\t\t\t\twhile (l <= r) {\n\t\t\t\t\tint m = (l + r) >> 1;\n\t\t\t\t\tif (pos[m] > y) {\n\t\t\t\t\t\tind = m;\n\t\t\t\t\t\tr = m - 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tl = m + 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\trv += ind - (i + 1);\n\t\t\t}\n\t\t\tfor (int i = 0; i < neg.length; i++) {\n\t\t\t\tlong y = x / neg[i];\n\t\t\t\tif (x % neg[i] == 0) {\n\t\t\t\t\ty++;\n\t\t\t\t}\n\t\t\t\tint l = i + 1, r = neg.length - 1, ind = neg.length;\n\t\t\t\twhile (l <= r) {\n\t\t\t\t\tint m = (l + r) >> 1;\n\t\t\t\t\tif (neg[m] > y) {\n\t\t\t\t\t\tind = m;\n\t\t\t\t\t\tr = m - 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tl = m + 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\trv += ind - (i + 1);\n\t\t\t}\n\t\t\trv += pos.length * 1L * neg.length;\n\t\t\trv += z * (z - 1) / 2;\n\t\t\trv += pos.length * z;\n\t\t\trv += neg.length * z;\n\t\t} else {\n\t\t\tx = -x;\n\t\t\tfor (int i = 0; i < pos.length; i++) {\n\t\t\t\tlong y = x / pos[i];\n\t\t\t\tif (x % pos[i] != 0) {\n\t\t\t\t\ty++;\n\t\t\t\t}\n\t\t\t\tint l = 0, r = neg.length - 1, ind = neg.length;\n\t\t\t\twhile (l <= r) {\n\t\t\t\t\tint m = (l + r) >> 1;\n\t\t\t\t\tif (neg[m] >= y) {\n\t\t\t\t\t\tind = m;\n\t\t\t\t\t\tr = m - 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tl = m + 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\trv += neg.length - ind;\n\t\t\t}\n\t\t}\n\n\t\treturn rv;\n\t}\n\n\tpublic void run() {\n\t\tlong time = System.currentTimeMillis();\n\t\tboolean oj = System.getProperty(\"ONLINE_JUDGE\") != null || judge;\n\t\tout = new PrintWriter(System.out);\n\t\tscn = new FastReader(oj);\n\t\tsolve();\n\t\tout.flush();\n\t\tif (!oj) {\n\t\t\tSystem.out.println(Arrays.deepToString(new Object[] { System.currentTimeMillis() - time + \" ms\" }));\n\t\t}\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tnew Thread(null, new Main(), \"Main\", 1 << 26).start();\n\t}\n\n\tclass FastReader {\n\t\tInputStream is;\n\n\t\tpublic FastReader(boolean onlineJudge) {\n\t\t\tis = onlineJudge ? System.in : new ByteArrayInputStream(INPUT.getBytes());\n\t\t}\n\n\t\tbyte[] inbuf = new byte[1024];\n\t\tpublic int lenbuf = 0, ptrbuf = 0;\n\n\t\tint readByte() {\n\t\t\tif (lenbuf == -1)\n\t\t\t\tthrow new InputMismatchException();\n\t\t\tif (ptrbuf >= lenbuf) {\n\t\t\t\tptrbuf = 0;\n\t\t\t\ttry {\n\t\t\t\t\tlenbuf = is.read(inbuf);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t\tif (lenbuf <= 0)\n\t\t\t\t\treturn -1;\n\t\t\t}\n\t\t\treturn inbuf[ptrbuf++];\n\t\t}\n\n\t\tboolean isSpaceChar(int c) {\n\t\t\treturn !(c >= 33 && c <= 126);\n\t\t}\n\n\t\tint skip() {\n\t\t\tint b;\n\t\t\twhile ((b = readByte()) != -1 && isSpaceChar(b))\n\t\t\t\t;\n\t\t\treturn b;\n\t\t}\n\n\t\tdouble nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tchar nextChar() {\n\t\t\treturn (char) skip();\n\t\t}\n\n\t\tString next() {\n\t\t\tint b = skip();\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\twhile (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\treturn sb.toString();\n\t\t}\n\n\t\tString nextLine() {\n\t\t\tint b = skip();\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\twhile ((!isSpaceChar(b) || b == ' ')) { // when nextLine, (isSpaceChar(b) && b != ' ')\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\treturn sb.toString();\n\t\t}\n\n\t\tchar[] next(int n) {\n\t\t\tchar[] buf = new char[n];\n\t\t\tint b = skip(), p = 0;\n\t\t\twhile (p < n && !(isSpaceChar(b))) {\n\t\t\t\tbuf[p++] = (char) b;\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\treturn n == p ? buf : Arrays.copyOf(buf, p);\n\t\t}\n\n\t\tint nextInt() {\n\t\t\tint num = 0, b;\n\t\t\tboolean minus = false;\n\t\t\twhile ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))\n\t\t\t\t;\n\t\t\tif (b == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tb = readByte();\n\t\t\t}\n\n\t\t\twhile (true) {\n\t\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t\t} else {\n\t\t\t\t\treturn minus ? -num : num;\n\t\t\t\t}\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t}\n\n\t\tlong nextLong() {\n\t\t\tlong num = 0;\n\t\t\tint b;\n\t\t\tboolean minus = false;\n\t\t\twhile ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))\n\t\t\t\t;\n\t\t\tif (b == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tb = readByte();\n\t\t\t}\n\n\t\t\twhile (true) {\n\t\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t\t} else {\n\t\t\t\t\treturn minus ? -num : num;\n\t\t\t\t}\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t}\n\n\t\tchar[][] nextMatrix(int n, int m) {\n\t\t\tchar[][] map = new char[n][];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tmap[i] = next(m);\n\t\t\treturn map;\n\t\t}\n\n\t\tint[] nextIntArray(int n) {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}\n\n\t\tlong[] nextLongArray(int n) {\n\t\t\tlong[] a = new long[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();\n\t\t\treturn a;\n\t\t}\n\n\t\tint[][] next2DInt(int n, int m) {\n\t\t\tint[][] arr = new int[n][];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tarr[i] = nextIntArray(m);\n\t\t\t}\n\t\t\treturn arr;\n\t\t}\n\n\t\tlong[][] next2DLong(int n, int m) {\n\t\t\tlong[][] arr = new long[n][];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tarr[i] = nextLongArray(m);\n\t\t\t}\n\t\t\treturn arr;\n\t\t}\n\n\t\tint[] shuffle(int[] arr) {\n\t\t\tRandom r = new Random();\n\t\t\tfor (int i = 1, j; i < arr.length; i++) {\n\t\t\t\tj = r.nextInt(i);\n\t\t\t\tint c = arr[i];\n\t\t\t\tarr[i] = arr[j];\n\t\t\t\tarr[j] = c;\n\t\t\t}\n\t\t\treturn arr;\n\t\t}\n\n\t\tlong[] shuffle(long[] arr) {\n\t\t\tRandom r = new Random();\n\t\t\tfor (int i = 1, j; i < arr.length; i++) {\n\t\t\t\tj = r.nextInt(i);\n\t\t\t\tlong c = arr[i];\n\t\t\t\tarr[i] = arr[j];\n\t\t\t\tarr[j] = c;\n\t\t\t}\n\t\t\treturn arr;\n\t\t}\n\n\t\tint[] uniq(int[] arr) {\n\t\t\tarr = scn.shuffle(arr);\n\t\t\tArrays.sort(arr);\n\t\t\tint[] rv = new int[arr.length];\n\t\t\tint pos = 0;\n\t\t\trv[pos++] = arr[0];\n\t\t\tfor (int i = 1; i < arr.length; i++) {\n\t\t\t\tif (arr[i] != arr[i - 1]) {\n\t\t\t\t\trv[pos++] = arr[i];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn Arrays.copyOf(rv, pos);\n\t\t}\n\n\t\tlong[] uniq(long[] arr) {\n\t\t\tarr = scn.shuffle(arr);\n\t\t\tArrays.sort(arr);\n\t\t\tlong[] rv = new long[arr.length];\n\t\t\tint pos = 0;\n\t\t\trv[pos++] = arr[0];\n\t\t\tfor (int i = 1; i < arr.length; i++) {\n\t\t\t\tif (arr[i] != arr[i - 1]) {\n\t\t\t\t\trv[pos++] = arr[i];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn Arrays.copyOf(rv, pos);\n\t\t}\n\n\t\tint[] reverse(int[] arr) {\n\t\t\tint l = 0, r = arr.length - 1;\n\t\t\twhile (l < r) {\n\t\t\t\tarr[l] = arr[l] ^ arr[r];\n\t\t\t\tarr[r] = arr[l] ^ arr[r];\n\t\t\t\tarr[l] = arr[l] ^ arr[r];\n\t\t\t\tl++;\n\t\t\t\tr--;\n\t\t\t}\n\t\t\treturn arr;\n\t\t}\n\n\t\tlong[] reverse(long[] arr) {\n\t\t\tint l = 0, r = arr.length - 1;\n\t\t\twhile (l < r) {\n\t\t\t\tarr[l] = arr[l] ^ arr[r];\n\t\t\t\tarr[r] = arr[l] ^ arr[r];\n\t\t\t\tarr[l] = arr[l] ^ arr[r];\n\t\t\t\tl++;\n\t\t\t\tr--;\n\t\t\t}\n\t\t\treturn arr;\n\t\t}\n\n\t\tint[] compress(int[] arr) {\n\t\t\tint n = arr.length;\n\t\t\tint[] rv = Arrays.copyOf(arr, n);\n\t\t\trv = uniq(rv);\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tarr[i] = Arrays.binarySearch(rv, arr[i]);\n\t\t\t}\n\t\t\treturn arr;\n\t\t}\n\n\t\tlong[] compress(long[] arr) {\n\t\t\tint n = arr.length;\n\t\t\tlong[] rv = Arrays.copyOf(arr, n);\n\t\t\trv = uniq(rv);\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tarr[i] = Arrays.binarySearch(rv, arr[i]);\n\t\t\t}\n\t\t\treturn arr;\n\t\t}\n\t}\n}", "problem_context": "Score: 400 points\n\nProblem Statement\n\nWe have N integers A_1, A_2, ..., A_N.\n\nThere are \\frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq K \\leq \\frac{N(N-1)}{2}\n\n-10^9 \\leq A_i \\leq 10^9\\ (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n4 3\n3 3 -4 -2\n\nSample Output 1\n\n-6\n\nThere are six ways to form a pair. The products of those pairs are 9, -12, -6, -12, -6, 8.\n\nSorting those numbers in ascending order, we have -12, -12, -6, -6, 8, 9. The third number in this list is -6.\n\nSample Input 2\n\n10 40\n5 4 3 2 -1 0 0 0 0 0\n\nSample Output 2\n\n6\n\nSample Input 3\n\n30 413\n-170202098 -268409015 537203564 983211703 21608710 -443999067 -937727165 -97596546 -372334013 398994917 -972141167 798607104 -949068442 -959948616 37909651 0 886627544 -20098238 0 -948955241 0 -214720580 277222296 -18897162 834475626 0 -425610555 110117526 663621752 0\n\nSample Output 3\n\n448283280358331064", "sample_input": "4 3\n3 3 -4 -2\n"}, "reference_outputs": ["-6\n"], "source_document_id": "p02774", "source_text": "Score: 400 points\n\nProblem Statement\n\nWe have N integers A_1, A_2, ..., A_N.\n\nThere are \\frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq K \\leq \\frac{N(N-1)}{2}\n\n-10^9 \\leq A_i \\leq 10^9\\ (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n4 3\n3 3 -4 -2\n\nSample Output 1\n\n-6\n\nThere are six ways to form a pair. The products of those pairs are 9, -12, -6, -12, -6, 8.\n\nSorting those numbers in ascending order, we have -12, -12, -6, -6, 8, 9. The third number in this list is -6.\n\nSample Input 2\n\n10 40\n5 4 3 2 -1 0 0 0 0 0\n\nSample Output 2\n\n6\n\nSample Input 3\n\n30 413\n-170202098 -268409015 537203564 983211703 21608710 -443999067 -937727165 -97596546 -372334013 398994917 -972141167 798607104 -949068442 -959948616 37909651 0 886627544 -20098238 0 -948955241 0 -214720580 277222296 -18897162 834475626 0 -425610555 110117526 663621752 0\n\nSample Output 3\n\n448283280358331064", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 7529, "cpu_time_ms": 729, "memory_kb": 33620}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s180064118", "group_id": "codeNet:p02774", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n\tstatic void quick_sort(long[] d, int left, int right) {\n\t\tif (left >= right) {\n\t\t\treturn;\n\t\t}\n\t\tlong p = d[(left + right) / 2];\n\t\tint l = left, r = right;\n\t\tlong tmp;\n\t\twhile (l <= r) {\n\t\t\twhile (d[l] < p) {\n\t\t\t\tl++;\n\t\t\t}\n\t\t\twhile (d[r] > p) {\n\t\t\t\tr--;\n\t\t\t}\n\t\t\tif (l <= r) {\n\t\t\t\ttmp = d[l];\n\t\t\t\td[l] = d[r];\n\t\t\t\td[r] = tmp;\n\t\t\t\tl++;\n\t\t\t\tr--;\n\t\t\t}\n\t\t}\n\t\tquick_sort(d, left, r); // ピボットより左側をクイックソート\n\t\tquick_sort(d, l, right); // ピボットより右側をクイックソート\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tint K = sc.nextInt();\n\t\tint c = N * (N - 1) / 2;\n\t\tlong set[] = new long[c];\n\t\tlong number[] = new long[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tnumber[i] = sc.nextLong();\n\t\t}\n\t\tint k = 0;\n\t\tfor (int i = 0; i < N - 1; i++) {\n\t\t\tfor (int j = i + 1; j < N; j++) {\n\t\t\t\tif (i != j) {\n\t\t\t\t\tset[k] = number[i] * number[j];\n\t\t\t\t\tk++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tquick_sort(set, 0, c - 1);\n\n\t\tSystem.out.println(set[K - 1]);\n\n\t}\n}\n", "language": "Java", "metadata": {"date": 1581886879, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02774.html", "problem_id": "p02774", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02774/input.txt", "sample_output_relpath": "derived/input_output/data/p02774/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02774/Java/s180064118.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s180064118", "user_id": "u349409589"}, "prompt_components": {"gold_output": "-6\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n\tstatic void quick_sort(long[] d, int left, int right) {\n\t\tif (left >= right) {\n\t\t\treturn;\n\t\t}\n\t\tlong p = d[(left + right) / 2];\n\t\tint l = left, r = right;\n\t\tlong tmp;\n\t\twhile (l <= r) {\n\t\t\twhile (d[l] < p) {\n\t\t\t\tl++;\n\t\t\t}\n\t\t\twhile (d[r] > p) {\n\t\t\t\tr--;\n\t\t\t}\n\t\t\tif (l <= r) {\n\t\t\t\ttmp = d[l];\n\t\t\t\td[l] = d[r];\n\t\t\t\td[r] = tmp;\n\t\t\t\tl++;\n\t\t\t\tr--;\n\t\t\t}\n\t\t}\n\t\tquick_sort(d, left, r); // ピボットより左側をクイックソート\n\t\tquick_sort(d, l, right); // ピボットより右側をクイックソート\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tint K = sc.nextInt();\n\t\tint c = N * (N - 1) / 2;\n\t\tlong set[] = new long[c];\n\t\tlong number[] = new long[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tnumber[i] = sc.nextLong();\n\t\t}\n\t\tint k = 0;\n\t\tfor (int i = 0; i < N - 1; i++) {\n\t\t\tfor (int j = i + 1; j < N; j++) {\n\t\t\t\tif (i != j) {\n\t\t\t\t\tset[k] = number[i] * number[j];\n\t\t\t\t\tk++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tquick_sort(set, 0, c - 1);\n\n\t\tSystem.out.println(set[K - 1]);\n\n\t}\n}\n", "problem_context": "Score: 400 points\n\nProblem Statement\n\nWe have N integers A_1, A_2, ..., A_N.\n\nThere are \\frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq K \\leq \\frac{N(N-1)}{2}\n\n-10^9 \\leq A_i \\leq 10^9\\ (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n4 3\n3 3 -4 -2\n\nSample Output 1\n\n-6\n\nThere are six ways to form a pair. The products of those pairs are 9, -12, -6, -12, -6, 8.\n\nSorting those numbers in ascending order, we have -12, -12, -6, -6, 8, 9. The third number in this list is -6.\n\nSample Input 2\n\n10 40\n5 4 3 2 -1 0 0 0 0 0\n\nSample Output 2\n\n6\n\nSample Input 3\n\n30 413\n-170202098 -268409015 537203564 983211703 21608710 -443999067 -937727165 -97596546 -372334013 398994917 -972141167 798607104 -949068442 -959948616 37909651 0 886627544 -20098238 0 -948955241 0 -214720580 277222296 -18897162 834475626 0 -425610555 110117526 663621752 0\n\nSample Output 3\n\n448283280358331064", "sample_input": "4 3\n3 3 -4 -2\n"}, "reference_outputs": ["-6\n"], "source_document_id": "p02774", "source_text": "Score: 400 points\n\nProblem Statement\n\nWe have N integers A_1, A_2, ..., A_N.\n\nThere are \\frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq K \\leq \\frac{N(N-1)}{2}\n\n-10^9 \\leq A_i \\leq 10^9\\ (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n4 3\n3 3 -4 -2\n\nSample Output 1\n\n-6\n\nThere are six ways to form a pair. The products of those pairs are 9, -12, -6, -12, -6, 8.\n\nSorting those numbers in ascending order, we have -12, -12, -6, -6, 8, 9. The third number in this list is -6.\n\nSample Input 2\n\n10 40\n5 4 3 2 -1 0 0 0 0 0\n\nSample Output 2\n\n6\n\nSample Input 3\n\n30 413\n-170202098 -268409015 537203564 983211703 21608710 -443999067 -937727165 -97596546 -372334013 398994917 -972141167 798607104 -949068442 -959948616 37909651 0 886627544 -20098238 0 -948955241 0 -214720580 277222296 -18897162 834475626 0 -425610555 110117526 663621752 0\n\nSample Output 3\n\n448283280358331064", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1079, "cpu_time_ms": 2111, "memory_kb": 506988}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s307297532", "group_id": "codeNet:p02879", "input_text": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n \tScanner sc = new Scanner(System.in);\n \tint a = sc.nextInt();\n \tint b = sc.nextInt();\n \tif(a < 10 && b < 10) {\n System.out.println(a * b);\n } else {\n System.out.println(-1);\n }\n }\n}", "language": "Java", "metadata": {"date": 1587958479, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02879.html", "problem_id": "p02879", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02879/input.txt", "sample_output_relpath": "derived/input_output/data/p02879/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02879/Java/s307297532.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s307297532", "user_id": "u073606136"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n \tScanner sc = new Scanner(System.in);\n \tint a = sc.nextInt();\n \tint b = sc.nextInt();\n \tif(a < 10 && b < 10) {\n System.out.println(a * b);\n } else {\n System.out.println(-1);\n }\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together. He cannot do any other calculation.\n\nGiven are two integers A and B.\n\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1 instead.\n\nConstraints\n\n1 \\leq A \\leq 20\n\n1 \\leq B \\leq 20\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\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\n2 \\times 5 = 10.\n\nSample Input 2\n\n5 10\n\nSample Output 2\n\n-1\n\n5\\times 10 = 50, but Takahashi cannot do this calculation, so print -1 instead.\n\nSample Input 3\n\n9 9\n\nSample Output 3\n\n81", "sample_input": "2 5\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02879", "source_text": "Score : 100 points\n\nProblem Statement\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together. He cannot do any other calculation.\n\nGiven are two integers A and B.\n\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1 instead.\n\nConstraints\n\n1 \\leq A \\leq 20\n\n1 \\leq B \\leq 20\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\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\n2 \\times 5 = 10.\n\nSample Input 2\n\n5 10\n\nSample Output 2\n\n-1\n\n5\\times 10 = 50, but Takahashi cannot do this calculation, so print -1 instead.\n\nSample Input 3\n\n9 9\n\nSample Output 3\n\n81", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 97, "memory_kb": 22612}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s357829598", "group_id": "codeNet:p02879", "input_text": "import java.util.*;\n\npublic class Main {\n public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n int A = sc.nextInt();\n int B = sc.nextInt();\n sc.close();\n \n if (1 <= A && A <= 9 && 1 <= B && B <= 9) {\n System.out.println(A * B);\n } else {\n System.out.println(-1);\n }\n }\n}", "language": "Java", "metadata": {"date": 1584284683, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02879.html", "problem_id": "p02879", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02879/input.txt", "sample_output_relpath": "derived/input_output/data/p02879/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02879/Java/s357829598.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s357829598", "user_id": "u585510378"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n int A = sc.nextInt();\n int B = sc.nextInt();\n sc.close();\n \n if (1 <= A && A <= 9 && 1 <= B && B <= 9) {\n System.out.println(A * B);\n } else {\n System.out.println(-1);\n }\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together. He cannot do any other calculation.\n\nGiven are two integers A and B.\n\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1 instead.\n\nConstraints\n\n1 \\leq A \\leq 20\n\n1 \\leq B \\leq 20\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\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\n2 \\times 5 = 10.\n\nSample Input 2\n\n5 10\n\nSample Output 2\n\n-1\n\n5\\times 10 = 50, but Takahashi cannot do this calculation, so print -1 instead.\n\nSample Input 3\n\n9 9\n\nSample Output 3\n\n81", "sample_input": "2 5\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02879", "source_text": "Score : 100 points\n\nProblem Statement\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together. He cannot do any other calculation.\n\nGiven are two integers A and B.\n\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1 instead.\n\nConstraints\n\n1 \\leq A \\leq 20\n\n1 \\leq B \\leq 20\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\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\n2 \\times 5 = 10.\n\nSample Input 2\n\n5 10\n\nSample Output 2\n\n-1\n\n5\\times 10 = 50, but Takahashi cannot do this calculation, so print -1 instead.\n\nSample Input 3\n\n9 9\n\nSample Output 3\n\n81", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 333, "cpu_time_ms": 114, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s386153584", "group_id": "codeNet:p02879", "input_text": "import java.util.*;\n \npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n \n int a = sc.nextInt();\n int b = sc.nextInt();\n\n if (a <= 9 && b <= 9) {\n System.out.println(a * b);\n } else {\n System.out.println(-1);\n }\n\t}\n}\n", "language": "Java", "metadata": {"date": 1576034625, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02879.html", "problem_id": "p02879", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02879/input.txt", "sample_output_relpath": "derived/input_output/data/p02879/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02879/Java/s386153584.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s386153584", "user_id": "u979498839"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "import java.util.*;\n \npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n \n int a = sc.nextInt();\n int b = sc.nextInt();\n\n if (a <= 9 && b <= 9) {\n System.out.println(a * b);\n } else {\n System.out.println(-1);\n }\n\t}\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together. He cannot do any other calculation.\n\nGiven are two integers A and B.\n\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1 instead.\n\nConstraints\n\n1 \\leq A \\leq 20\n\n1 \\leq B \\leq 20\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\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\n2 \\times 5 = 10.\n\nSample Input 2\n\n5 10\n\nSample Output 2\n\n-1\n\n5\\times 10 = 50, but Takahashi cannot do this calculation, so print -1 instead.\n\nSample Input 3\n\n9 9\n\nSample Output 3\n\n81", "sample_input": "2 5\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02879", "source_text": "Score : 100 points\n\nProblem Statement\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together. He cannot do any other calculation.\n\nGiven are two integers A and B.\n\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1 instead.\n\nConstraints\n\n1 \\leq A \\leq 20\n\n1 \\leq B \\leq 20\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\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\n2 \\times 5 = 10.\n\nSample Input 2\n\n5 10\n\nSample Output 2\n\n-1\n\n5\\times 10 = 50, but Takahashi cannot do this calculation, so print -1 instead.\n\nSample Input 3\n\n9 9\n\nSample Output 3\n\n81", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 97, "memory_kb": 23764}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s740182495", "group_id": "codeNet:p02879", "input_text": "import java.util.Scanner;\n\n/**\n *\n * @author C0117177\n */\npublic class Main {\n\n /**\n * @param args the command line arguments\n */\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n \n int a = sc.nextInt();\n int b = sc.nextInt();\n \n if(a <= 9 && b<= 9){\n System.out.println(a * b);\n }else{\n System.out.println(-1);\n }\n sc.close(); \n } \n}", "language": "Java", "metadata": {"date": 1573498760, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02879.html", "problem_id": "p02879", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02879/input.txt", "sample_output_relpath": "derived/input_output/data/p02879/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02879/Java/s740182495.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s740182495", "user_id": "u644300340"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "import java.util.Scanner;\n\n/**\n *\n * @author C0117177\n */\npublic class Main {\n\n /**\n * @param args the command line arguments\n */\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n \n int a = sc.nextInt();\n int b = sc.nextInt();\n \n if(a <= 9 && b<= 9){\n System.out.println(a * b);\n }else{\n System.out.println(-1);\n }\n sc.close(); \n } \n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together. He cannot do any other calculation.\n\nGiven are two integers A and B.\n\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1 instead.\n\nConstraints\n\n1 \\leq A \\leq 20\n\n1 \\leq B \\leq 20\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\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\n2 \\times 5 = 10.\n\nSample Input 2\n\n5 10\n\nSample Output 2\n\n-1\n\n5\\times 10 = 50, but Takahashi cannot do this calculation, so print -1 instead.\n\nSample Input 3\n\n9 9\n\nSample Output 3\n\n81", "sample_input": "2 5\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02879", "source_text": "Score : 100 points\n\nProblem Statement\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together. He cannot do any other calculation.\n\nGiven are two integers A and B.\n\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1 instead.\n\nConstraints\n\n1 \\leq A \\leq 20\n\n1 \\leq B \\leq 20\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\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\n2 \\times 5 = 10.\n\nSample Input 2\n\n5 10\n\nSample Output 2\n\n-1\n\n5\\times 10 = 50, but Takahashi cannot do this calculation, so print -1 instead.\n\nSample Input 3\n\n9 9\n\nSample Output 3\n\n81", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 93, "memory_kb": 23764}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s272620536", "group_id": "codeNet:p02879", "input_text": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n int a = scan.nextInt();\n int b = scan.nextInt();\n int seki = a*b;\n System.out.println(seki);\n }\n}", "language": "Java", "metadata": {"date": 1573350291, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02879.html", "problem_id": "p02879", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02879/input.txt", "sample_output_relpath": "derived/input_output/data/p02879/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02879/Java/s272620536.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s272620536", "user_id": "u815341111"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n int a = scan.nextInt();\n int b = scan.nextInt();\n int seki = a*b;\n System.out.println(seki);\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together. He cannot do any other calculation.\n\nGiven are two integers A and B.\n\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1 instead.\n\nConstraints\n\n1 \\leq A \\leq 20\n\n1 \\leq B \\leq 20\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\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\n2 \\times 5 = 10.\n\nSample Input 2\n\n5 10\n\nSample Output 2\n\n-1\n\n5\\times 10 = 50, but Takahashi cannot do this calculation, so print -1 instead.\n\nSample Input 3\n\n9 9\n\nSample Output 3\n\n81", "sample_input": "2 5\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02879", "source_text": "Score : 100 points\n\nProblem Statement\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together. He cannot do any other calculation.\n\nGiven are two integers A and B.\n\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1 instead.\n\nConstraints\n\n1 \\leq A \\leq 20\n\n1 \\leq B \\leq 20\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\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\n2 \\times 5 = 10.\n\nSample Input 2\n\n5 10\n\nSample Output 2\n\n-1\n\n5\\times 10 = 50, but Takahashi cannot do this calculation, so print -1 instead.\n\nSample Input 3\n\n9 9\n\nSample Output 3\n\n81", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 94, "memory_kb": 23764}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s742371385", "group_id": "codeNet:p02879", "input_text": "import java.util.*;\n\nclass Main{\npublic static void main(String[] args) {\n\tScanner scan = new Scanner(System.in);\n\t int a = scan.nextInt();\n\t int b = scan.nextInt();\n\tif(1<=a && a<=20 && 1<=b && b<=20) {\n\t\tSystem.out.println(a * b);\n\t}else {\n\t\tSystem.out.println(-1);\n\t}\n }\n}", "language": "Java", "metadata": {"date": 1572893807, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02879.html", "problem_id": "p02879", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02879/input.txt", "sample_output_relpath": "derived/input_output/data/p02879/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02879/Java/s742371385.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s742371385", "user_id": "u594620232"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "import java.util.*;\n\nclass Main{\npublic static void main(String[] args) {\n\tScanner scan = new Scanner(System.in);\n\t int a = scan.nextInt();\n\t int b = scan.nextInt();\n\tif(1<=a && a<=20 && 1<=b && b<=20) {\n\t\tSystem.out.println(a * b);\n\t}else {\n\t\tSystem.out.println(-1);\n\t}\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together. He cannot do any other calculation.\n\nGiven are two integers A and B.\n\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1 instead.\n\nConstraints\n\n1 \\leq A \\leq 20\n\n1 \\leq B \\leq 20\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\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\n2 \\times 5 = 10.\n\nSample Input 2\n\n5 10\n\nSample Output 2\n\n-1\n\n5\\times 10 = 50, but Takahashi cannot do this calculation, so print -1 instead.\n\nSample Input 3\n\n9 9\n\nSample Output 3\n\n81", "sample_input": "2 5\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02879", "source_text": "Score : 100 points\n\nProblem Statement\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together. He cannot do any other calculation.\n\nGiven are two integers A and B.\n\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1 instead.\n\nConstraints\n\n1 \\leq A \\leq 20\n\n1 \\leq B \\leq 20\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\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\n2 \\times 5 = 10.\n\nSample Input 2\n\n5 10\n\nSample Output 2\n\n-1\n\n5\\times 10 = 50, but Takahashi cannot do this calculation, so print -1 instead.\n\nSample Input 3\n\n9 9\n\nSample Output 3\n\n81", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 94, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s552601431", "group_id": "codeNet:p02879", "input_text": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\npublic class Main {\n public static void main(String[] args) {\n FastReader sc = new FastReader();\n int A = sc.nextInt(), B = sc.nextInt();\n if (A>9 || B>9) {\n System.out.println(-1);\n } else {\n System.out.println(A*B);\n }\n }\n static class FastReader {\n BufferedReader br;\n StringTokenizer st;\n\n public FastReader() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n String nextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1572237109, "filename_ext": "java", "original_language": "Java7 (OpenJDK 1.7.0)", "problem_description_relpath": "problem_descriptions/p02879.html", "problem_id": "p02879", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02879/input.txt", "sample_output_relpath": "derived/input_output/data/p02879/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02879/Java/s552601431.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s552601431", "user_id": "u126434371"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\npublic class Main {\n public static void main(String[] args) {\n FastReader sc = new FastReader();\n int A = sc.nextInt(), B = sc.nextInt();\n if (A>9 || B>9) {\n System.out.println(-1);\n } else {\n System.out.println(A*B);\n }\n }\n static class FastReader {\n BufferedReader br;\n StringTokenizer st;\n\n public FastReader() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n String nextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together. He cannot do any other calculation.\n\nGiven are two integers A and B.\n\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1 instead.\n\nConstraints\n\n1 \\leq A \\leq 20\n\n1 \\leq B \\leq 20\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\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\n2 \\times 5 = 10.\n\nSample Input 2\n\n5 10\n\nSample Output 2\n\n-1\n\n5\\times 10 = 50, but Takahashi cannot do this calculation, so print -1 instead.\n\nSample Input 3\n\n9 9\n\nSample Output 3\n\n81", "sample_input": "2 5\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02879", "source_text": "Score : 100 points\n\nProblem Statement\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together. He cannot do any other calculation.\n\nGiven are two integers A and B.\n\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1 instead.\n\nConstraints\n\n1 \\leq A \\leq 20\n\n1 \\leq B \\leq 20\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\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\n2 \\times 5 = 10.\n\nSample Input 2\n\n5 10\n\nSample Output 2\n\n-1\n\n5\\times 10 = 50, but Takahashi cannot do this calculation, so print -1 instead.\n\nSample Input 3\n\n9 9\n\nSample Output 3\n\n81", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1430, "cpu_time_ms": 78, "memory_kb": 22484}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s038463332", "group_id": "codeNet:p02879", "input_text": "import java.io.*;\nimport java.util.*;\n class Main\n{\npublic static void main(String arg[])\n{\nScanner s=new Scanner(System.in);\nint a=s.nextInt();\nint b=s.nextInt();\nif(a>=1 && a<=9 && b>=1 && b<=9)\nSystem.out.println(a*b);\nelse\nSystem.out.println(\"-1\");}}", "language": "Java", "metadata": {"date": 1572228349, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02879.html", "problem_id": "p02879", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02879/input.txt", "sample_output_relpath": "derived/input_output/data/p02879/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02879/Java/s038463332.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s038463332", "user_id": "u342700492"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "import java.io.*;\nimport java.util.*;\n class Main\n{\npublic static void main(String arg[])\n{\nScanner s=new Scanner(System.in);\nint a=s.nextInt();\nint b=s.nextInt();\nif(a>=1 && a<=9 && b>=1 && b<=9)\nSystem.out.println(a*b);\nelse\nSystem.out.println(\"-1\");}}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together. He cannot do any other calculation.\n\nGiven are two integers A and B.\n\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1 instead.\n\nConstraints\n\n1 \\leq A \\leq 20\n\n1 \\leq B \\leq 20\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\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\n2 \\times 5 = 10.\n\nSample Input 2\n\n5 10\n\nSample Output 2\n\n-1\n\n5\\times 10 = 50, but Takahashi cannot do this calculation, so print -1 instead.\n\nSample Input 3\n\n9 9\n\nSample Output 3\n\n81", "sample_input": "2 5\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02879", "source_text": "Score : 100 points\n\nProblem Statement\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together. He cannot do any other calculation.\n\nGiven are two integers A and B.\n\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1 instead.\n\nConstraints\n\n1 \\leq A \\leq 20\n\n1 \\leq B \\leq 20\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\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\n2 \\times 5 = 10.\n\nSample Input 2\n\n5 10\n\nSample Output 2\n\n-1\n\n5\\times 10 = 50, but Takahashi cannot do this calculation, so print -1 instead.\n\nSample Input 3\n\n9 9\n\nSample Output 3\n\n81", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 101, "memory_kb": 25044}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s689520074", "group_id": "codeNet:p02879", "input_text": "import java.util.*;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint A = sc.nextInt();\n\t\tint B = sc.nextInt();\n\t\t\t\n\t\tif (A >= 1 && A <= 9 && B >= 1 && B <= 9) {\n\t\t\tSystem.out.println(A * B);\n\t\t} else {\n\t\t\tSystem.out.println(-1);\n\t\t}\n\t\t\n\t}\n\n}\n\n\n\n\n", "language": "Java", "metadata": {"date": 1572224612, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02879.html", "problem_id": "p02879", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02879/input.txt", "sample_output_relpath": "derived/input_output/data/p02879/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02879/Java/s689520074.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s689520074", "user_id": "u316069805"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint A = sc.nextInt();\n\t\tint B = sc.nextInt();\n\t\t\t\n\t\tif (A >= 1 && A <= 9 && B >= 1 && B <= 9) {\n\t\t\tSystem.out.println(A * B);\n\t\t} else {\n\t\t\tSystem.out.println(-1);\n\t\t}\n\t\t\n\t}\n\n}\n\n\n\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together. He cannot do any other calculation.\n\nGiven are two integers A and B.\n\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1 instead.\n\nConstraints\n\n1 \\leq A \\leq 20\n\n1 \\leq B \\leq 20\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\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\n2 \\times 5 = 10.\n\nSample Input 2\n\n5 10\n\nSample Output 2\n\n-1\n\n5\\times 10 = 50, but Takahashi cannot do this calculation, so print -1 instead.\n\nSample Input 3\n\n9 9\n\nSample Output 3\n\n81", "sample_input": "2 5\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02879", "source_text": "Score : 100 points\n\nProblem Statement\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together. He cannot do any other calculation.\n\nGiven are two integers A and B.\n\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1 instead.\n\nConstraints\n\n1 \\leq A \\leq 20\n\n1 \\leq B \\leq 20\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\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\n2 \\times 5 = 10.\n\nSample Input 2\n\n5 10\n\nSample Output 2\n\n-1\n\n5\\times 10 = 50, but Takahashi cannot do this calculation, so print -1 instead.\n\nSample Input 3\n\n9 9\n\nSample Output 3\n\n81", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 125, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s481617185", "group_id": "codeNet:p02879", "input_text": "import java.util.*;\npublic class Main {\n public static void main(String args[]) {\n Scanner sc=new Scanner(System.in);\n int a=sc.nextInt();\n int b=sc.nextInt();\n if(a>=1&&b<=9)\n System.out.println((a*b));\n else\n System.out.println(\"-1\");\n }\n}", "language": "Java", "metadata": {"date": 1572224545, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02879.html", "problem_id": "p02879", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02879/input.txt", "sample_output_relpath": "derived/input_output/data/p02879/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02879/Java/s481617185.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s481617185", "user_id": "u412564676"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n public static void main(String args[]) {\n Scanner sc=new Scanner(System.in);\n int a=sc.nextInt();\n int b=sc.nextInt();\n if(a>=1&&b<=9)\n System.out.println((a*b));\n else\n System.out.println(\"-1\");\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together. He cannot do any other calculation.\n\nGiven are two integers A and B.\n\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1 instead.\n\nConstraints\n\n1 \\leq A \\leq 20\n\n1 \\leq B \\leq 20\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\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\n2 \\times 5 = 10.\n\nSample Input 2\n\n5 10\n\nSample Output 2\n\n-1\n\n5\\times 10 = 50, but Takahashi cannot do this calculation, so print -1 instead.\n\nSample Input 3\n\n9 9\n\nSample Output 3\n\n81", "sample_input": "2 5\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02879", "source_text": "Score : 100 points\n\nProblem Statement\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together. He cannot do any other calculation.\n\nGiven are two integers A and B.\n\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1 instead.\n\nConstraints\n\n1 \\leq A \\leq 20\n\n1 \\leq B \\leq 20\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\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\n2 \\times 5 = 10.\n\nSample Input 2\n\n5 10\n\nSample Output 2\n\n-1\n\n5\\times 10 = 50, but Takahashi cannot do this calculation, so print -1 instead.\n\nSample Input 3\n\n9 9\n\nSample Output 3\n\n81", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 282, "cpu_time_ms": 116, "memory_kb": 21716}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s309068739", "group_id": "codeNet:p02879", "input_text": "import java.util.*;\n\npublic class Main{\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int a = Integer.parseInt(sc.next());\n int b = Integer.parseInt(sc.next());\n\n if(a<10 && b<10){\n System.out.println(a*b);\n }\n else{\n System.out.println(\"-1\");\n }\n\n }\n}\n", "language": "Java", "metadata": {"date": 1572224507, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02879.html", "problem_id": "p02879", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02879/input.txt", "sample_output_relpath": "derived/input_output/data/p02879/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02879/Java/s309068739.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s309068739", "user_id": "u409962311"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main{\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int a = Integer.parseInt(sc.next());\n int b = Integer.parseInt(sc.next());\n\n if(a<10 && b<10){\n System.out.println(a*b);\n }\n else{\n System.out.println(\"-1\");\n }\n\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together. He cannot do any other calculation.\n\nGiven are two integers A and B.\n\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1 instead.\n\nConstraints\n\n1 \\leq A \\leq 20\n\n1 \\leq B \\leq 20\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\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\n2 \\times 5 = 10.\n\nSample Input 2\n\n5 10\n\nSample Output 2\n\n-1\n\n5\\times 10 = 50, but Takahashi cannot do this calculation, so print -1 instead.\n\nSample Input 3\n\n9 9\n\nSample Output 3\n\n81", "sample_input": "2 5\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02879", "source_text": "Score : 100 points\n\nProblem Statement\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together. He cannot do any other calculation.\n\nGiven are two integers A and B.\n\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1 instead.\n\nConstraints\n\n1 \\leq A \\leq 20\n\n1 \\leq B \\leq 20\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\nIf Takahashi can calculate A \\times B, print the result; if he cannot, print -1.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\n2 \\times 5 = 10.\n\nSample Input 2\n\n5 10\n\nSample Output 2\n\n-1\n\n5\\times 10 = 50, but Takahashi cannot do this calculation, so print -1 instead.\n\nSample Input 3\n\n9 9\n\nSample Output 3\n\n81", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 118, "memory_kb": 23764}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s463365070", "group_id": "codeNet:p02891", "input_text": "\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tchar[] str = sc.next().toCharArray();\n\t\tint k = sc.nextInt();;\n\n\t\tif(str.length == 1){\n\t\t\tSystem.out.println(k/2);\n\t\t\treturn;\n\t\t}\n\t\tint changeCount = 0;\n\t\tfor(int i = 1; i < str.length; i++){\n\t\t\tif(str[i] == str[i - 1]){\n\t\t\t\tchangeCount++;\n\t\t\t\tstr[i] = 'A';\n\t\t\t}\n\t\t}\n//\t\tSystem.out.println(changeCount);\n\t\tlong result = (long)k*changeCount;\n\n\t\tif(str[0] == str[str.length - 1]){\n\t\t\tresult += k - 1;\n\t\t}\n\t\tSystem.out.println(result);\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1594606374, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02891.html", "problem_id": "p02891", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02891/input.txt", "sample_output_relpath": "derived/input_output/data/p02891/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02891/Java/s463365070.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s463365070", "user_id": "u918391323"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tchar[] str = sc.next().toCharArray();\n\t\tint k = sc.nextInt();;\n\n\t\tif(str.length == 1){\n\t\t\tSystem.out.println(k/2);\n\t\t\treturn;\n\t\t}\n\t\tint changeCount = 0;\n\t\tfor(int i = 1; i < str.length; i++){\n\t\t\tif(str[i] == str[i - 1]){\n\t\t\t\tchangeCount++;\n\t\t\t\tstr[i] = 'A';\n\t\t\t}\n\t\t}\n//\t\tSystem.out.println(changeCount);\n\t\tlong result = (long)k*changeCount;\n\n\t\tif(str[0] == str[str.length - 1]){\n\t\t\tresult += k - 1;\n\t\t}\n\t\tSystem.out.println(result);\n\t}\n\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven is a string S. Let T be the concatenation of K copies of S.\nWe can repeatedly perform the following operation: choose a character in T and replace it with a different character.\nFind the minimum number of operations required to satisfy the following condition: any two adjacent characters in T are different.\n\nConstraints\n\n1 \\leq |S| \\leq 100\n\nS consists of lowercase English letters.\n\n1 \\leq K \\leq 10^9\n\nK is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nK\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\nissii\n2\n\nSample Output 1\n\n4\n\nT is issiiissii. For example, we can rewrite it into ispiqisyhi, and now any two adjacent characters are different.\n\nSample Input 2\n\nqq\n81\n\nSample Output 2\n\n81\n\nSample Input 3\n\ncooooooooonteeeeeeeeeest\n999993333\n\nSample Output 3\n\n8999939997", "sample_input": "issii\n2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02891", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven is a string S. Let T be the concatenation of K copies of S.\nWe can repeatedly perform the following operation: choose a character in T and replace it with a different character.\nFind the minimum number of operations required to satisfy the following condition: any two adjacent characters in T are different.\n\nConstraints\n\n1 \\leq |S| \\leq 100\n\nS consists of lowercase English letters.\n\n1 \\leq K \\leq 10^9\n\nK is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nK\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\nissii\n2\n\nSample Output 1\n\n4\n\nT is issiiissii. For example, we can rewrite it into ispiqisyhi, and now any two adjacent characters are different.\n\nSample Input 2\n\nqq\n81\n\nSample Output 2\n\n81\n\nSample Input 3\n\ncooooooooonteeeeeeeeeest\n999993333\n\nSample Output 3\n\n8999939997", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 572, "cpu_time_ms": 110, "memory_kb": 26932}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s127589993", "group_id": "codeNet:p02891", "input_text": "import java.util.Scanner;\nimport java.util.Arrays;\nimport java.util.ArrayList;\n\nclass Main{\n \n \tstatic int check = -1;\n\tpublic static void main(String[] args){\n \tScanner sc = new Scanner(System.in);\n \tString line = sc.nextLine();\n \tlong n = sc.nextLong();\n \n \t\n \tlong count;\n \tlong c = 0l;\n \tif(line.length() > 1){\n count = count(line);\n c = count2(line);\n \t System.out.println(count*n + c*(n-1));\n }else{\n if(n == 1){\n System.out.println(0);\n }else{\n String l = line;\n for(int i = 0; i < n-1; i++) l += line;\n count = count(l);\n c = count2(l);\n System.out.println(count+c);\n }\n }\n }\n \n \tstatic long count(String line){\n \tlong count = 0;\n \tint i = 1;\n \twhile(i <= line.length()-1){\n System.out.println(i);\n \t\tif(line.charAt(i) == line.charAt(i-1)){\n count++;\n i += 2;\n check = i;\n }else{\n i++;\n }\n \t}\n \treturn count;\n }\n \n \tstatic long count2(String line){\n \treturn (line.length() > 2 && \n (check == line.length()) &&\n line.charAt(0) == line.charAt(line.length()-1)) ? 1: 0;\n }\n}", "language": "Java", "metadata": {"date": 1572749229, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02891.html", "problem_id": "p02891", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02891/input.txt", "sample_output_relpath": "derived/input_output/data/p02891/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02891/Java/s127589993.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s127589993", "user_id": "u852798899"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "import java.util.Scanner;\nimport java.util.Arrays;\nimport java.util.ArrayList;\n\nclass Main{\n \n \tstatic int check = -1;\n\tpublic static void main(String[] args){\n \tScanner sc = new Scanner(System.in);\n \tString line = sc.nextLine();\n \tlong n = sc.nextLong();\n \n \t\n \tlong count;\n \tlong c = 0l;\n \tif(line.length() > 1){\n count = count(line);\n c = count2(line);\n \t System.out.println(count*n + c*(n-1));\n }else{\n if(n == 1){\n System.out.println(0);\n }else{\n String l = line;\n for(int i = 0; i < n-1; i++) l += line;\n count = count(l);\n c = count2(l);\n System.out.println(count+c);\n }\n }\n }\n \n \tstatic long count(String line){\n \tlong count = 0;\n \tint i = 1;\n \twhile(i <= line.length()-1){\n System.out.println(i);\n \t\tif(line.charAt(i) == line.charAt(i-1)){\n count++;\n i += 2;\n check = i;\n }else{\n i++;\n }\n \t}\n \treturn count;\n }\n \n \tstatic long count2(String line){\n \treturn (line.length() > 2 && \n (check == line.length()) &&\n line.charAt(0) == line.charAt(line.length()-1)) ? 1: 0;\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven is a string S. Let T be the concatenation of K copies of S.\nWe can repeatedly perform the following operation: choose a character in T and replace it with a different character.\nFind the minimum number of operations required to satisfy the following condition: any two adjacent characters in T are different.\n\nConstraints\n\n1 \\leq |S| \\leq 100\n\nS consists of lowercase English letters.\n\n1 \\leq K \\leq 10^9\n\nK is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nK\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\nissii\n2\n\nSample Output 1\n\n4\n\nT is issiiissii. For example, we can rewrite it into ispiqisyhi, and now any two adjacent characters are different.\n\nSample Input 2\n\nqq\n81\n\nSample Output 2\n\n81\n\nSample Input 3\n\ncooooooooonteeeeeeeeeest\n999993333\n\nSample Output 3\n\n8999939997", "sample_input": "issii\n2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02891", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven is a string S. Let T be the concatenation of K copies of S.\nWe can repeatedly perform the following operation: choose a character in T and replace it with a different character.\nFind the minimum number of operations required to satisfy the following condition: any two adjacent characters in T are different.\n\nConstraints\n\n1 \\leq |S| \\leq 100\n\nS consists of lowercase English letters.\n\n1 \\leq K \\leq 10^9\n\nK is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nK\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\nissii\n2\n\nSample Output 1\n\n4\n\nT is issiiissii. For example, we can rewrite it into ispiqisyhi, and now any two adjacent characters are different.\n\nSample Input 2\n\nqq\n81\n\nSample Output 2\n\n81\n\nSample Input 3\n\ncooooooooonteeeeeeeeeest\n999993333\n\nSample Output 3\n\n8999939997", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1305, "cpu_time_ms": 101, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s394763293", "group_id": "codeNet:p02891", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString S = sc.next();\n\t\tlong K = sc.nextLong();\n\t\tlong count = 0;\n\t\tlong check = 1;\n\t\tint l = S.length();\n\t\tint first = 1;\n\t\tint last = 1;\n\t\tint oddCheck = 1;\n\t\tif(l > 2 && S.substring(0,1).equals(S.substring(l-1,l))) {\n\t\t\tfor(int i = 0; i < l-1; i++) {\n\t\t\t\tif(S.substring(i,i+1).equals(S.substring(i+1,i+2))) {\n\t\t\t\t\tfirst++;\n\t\t\t\t}else {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(int i = l; i > 1; i--) {\n\t\t\t\tif(S.substring(i-1,i).equals(S.substring(i-2,i-1))) {\n\t\t\t\t\tlast++;\n\t\t\t\t}else {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(int i = first; i <= l-last-1; i++) {\n\t\t\t\tif(S.substring(i, i+1).equals(S.substring(i+1, i+2))) {\n\t\t\t\t\tcheck++;\n\t\t\t\t}else {\n\t\t\t\t\tcount += (int)(check / 2) * K;\n\t\t\t\t\tcheck = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcount += (first + last)/2 * K;\n\t\t\tfor(int i = 0; i < l-1; i++) {\n\t\t\t\tif(S.substring(i,i+1).equals(S.substring(i+1,i+2))) {\n\t\t\t\t\toddCheck++;\n\t\t\t\t}else\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(oddCheck == l) {\n\t\t\t\tcount = l*K / 2;\n\t\t\t}\n\t\t}else if(l > 2 && !(S.substring(0,1).equals(S.substring(l-1,l)))) {\n\t\t\tfor(int i = 0; i < l-1; i++) {\n\t\t\t\tif(S.substring(i,i+1).equals(S.substring(i+1,i+2))) {\n\t\t\t\t\tfirst++;\n\t\t\t\t}else {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(int i = l; i > 1; i--) {\n\t\t\t\tif(S.substring(i-1,i).equals(S.substring(i-2,i-1))) {\n\t\t\t\t\tlast++;\n\t\t\t\t}else {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(int i = first; i <= l-last-1; i++) {\n\t\t\t\tif(S.substring(i, i+1).equals(S.substring(i+1, i+2))) {\n\t\t\t\t\tcheck++;\n\t\t\t\t}else {\n\t\t\t\t\tcount += (int)(check / 2) * K;\n\t\t\t\t\tcheck = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcount += (first + last)/2 * K;\n\t\t}else if(l == 2 && S.substring(0,1).equals(S.substring(1,2))) {\n\t\t\tcount += K;\n\t\t}else if(l == 2 && !(S.substring(0,1).equals(S.substring(1,2)))) {\n\t\t\tcount = 0;\n\t\t}else{\t//|S|=1\n\t\t\tcount += K /2 ;\n\t\t}\n\t\tSystem.out.println(count);\n\t\tsc.close();\n\t}\n\n}", "language": "Java", "metadata": {"date": 1572478031, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02891.html", "problem_id": "p02891", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02891/input.txt", "sample_output_relpath": "derived/input_output/data/p02891/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02891/Java/s394763293.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s394763293", "user_id": "u685346012"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString S = sc.next();\n\t\tlong K = sc.nextLong();\n\t\tlong count = 0;\n\t\tlong check = 1;\n\t\tint l = S.length();\n\t\tint first = 1;\n\t\tint last = 1;\n\t\tint oddCheck = 1;\n\t\tif(l > 2 && S.substring(0,1).equals(S.substring(l-1,l))) {\n\t\t\tfor(int i = 0; i < l-1; i++) {\n\t\t\t\tif(S.substring(i,i+1).equals(S.substring(i+1,i+2))) {\n\t\t\t\t\tfirst++;\n\t\t\t\t}else {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(int i = l; i > 1; i--) {\n\t\t\t\tif(S.substring(i-1,i).equals(S.substring(i-2,i-1))) {\n\t\t\t\t\tlast++;\n\t\t\t\t}else {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(int i = first; i <= l-last-1; i++) {\n\t\t\t\tif(S.substring(i, i+1).equals(S.substring(i+1, i+2))) {\n\t\t\t\t\tcheck++;\n\t\t\t\t}else {\n\t\t\t\t\tcount += (int)(check / 2) * K;\n\t\t\t\t\tcheck = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcount += (first + last)/2 * K;\n\t\t\tfor(int i = 0; i < l-1; i++) {\n\t\t\t\tif(S.substring(i,i+1).equals(S.substring(i+1,i+2))) {\n\t\t\t\t\toddCheck++;\n\t\t\t\t}else\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(oddCheck == l) {\n\t\t\t\tcount = l*K / 2;\n\t\t\t}\n\t\t}else if(l > 2 && !(S.substring(0,1).equals(S.substring(l-1,l)))) {\n\t\t\tfor(int i = 0; i < l-1; i++) {\n\t\t\t\tif(S.substring(i,i+1).equals(S.substring(i+1,i+2))) {\n\t\t\t\t\tfirst++;\n\t\t\t\t}else {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(int i = l; i > 1; i--) {\n\t\t\t\tif(S.substring(i-1,i).equals(S.substring(i-2,i-1))) {\n\t\t\t\t\tlast++;\n\t\t\t\t}else {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(int i = first; i <= l-last-1; i++) {\n\t\t\t\tif(S.substring(i, i+1).equals(S.substring(i+1, i+2))) {\n\t\t\t\t\tcheck++;\n\t\t\t\t}else {\n\t\t\t\t\tcount += (int)(check / 2) * K;\n\t\t\t\t\tcheck = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcount += (first + last)/2 * K;\n\t\t}else if(l == 2 && S.substring(0,1).equals(S.substring(1,2))) {\n\t\t\tcount += K;\n\t\t}else if(l == 2 && !(S.substring(0,1).equals(S.substring(1,2)))) {\n\t\t\tcount = 0;\n\t\t}else{\t//|S|=1\n\t\t\tcount += K /2 ;\n\t\t}\n\t\tSystem.out.println(count);\n\t\tsc.close();\n\t}\n\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven is a string S. Let T be the concatenation of K copies of S.\nWe can repeatedly perform the following operation: choose a character in T and replace it with a different character.\nFind the minimum number of operations required to satisfy the following condition: any two adjacent characters in T are different.\n\nConstraints\n\n1 \\leq |S| \\leq 100\n\nS consists of lowercase English letters.\n\n1 \\leq K \\leq 10^9\n\nK is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nK\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\nissii\n2\n\nSample Output 1\n\n4\n\nT is issiiissii. For example, we can rewrite it into ispiqisyhi, and now any two adjacent characters are different.\n\nSample Input 2\n\nqq\n81\n\nSample Output 2\n\n81\n\nSample Input 3\n\ncooooooooonteeeeeeeeeest\n999993333\n\nSample Output 3\n\n8999939997", "sample_input": "issii\n2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02891", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven is a string S. Let T be the concatenation of K copies of S.\nWe can repeatedly perform the following operation: choose a character in T and replace it with a different character.\nFind the minimum number of operations required to satisfy the following condition: any two adjacent characters in T are different.\n\nConstraints\n\n1 \\leq |S| \\leq 100\n\nS consists of lowercase English letters.\n\n1 \\leq K \\leq 10^9\n\nK is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nK\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\nissii\n2\n\nSample Output 1\n\n4\n\nT is issiiissii. For example, we can rewrite it into ispiqisyhi, and now any two adjacent characters are different.\n\nSample Input 2\n\nqq\n81\n\nSample Output 2\n\n81\n\nSample Input 3\n\ncooooooooonteeeeeeeeeest\n999993333\n\nSample Output 3\n\n8999939997", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1869, "cpu_time_ms": 100, "memory_kb": 23124}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s346991292", "group_id": "codeNet:p02891", "input_text": "// @uthor -: puneet\n// TimeStamp -: 5:29 PM - 5/10/19\n\nimport java.io.*;\nimport java.math.BigInteger;\nimport java.util.*;\n\npublic class Main implements Runnable {\n\n\n public void solve(){\n int n=in.ni();\n ArrayList[] lists=new ArrayList[n];\n for(int i=0;i();\n }\n\n for(int i=0;i[] adj,int node) {\n\n Deque queue=new ArrayDeque<>();\n queue.add(node);\n boolean [] vis=new boolean[201];\n int step=0;\n vis[node]=true;\n while (!queue.isEmpty()){\n\n int temp=-1;\n while(!queue.isEmpty()) {\n int i=queue.pollFirst();\n if(temp==i){\n queue.addLast(temp);\n break;\n }\n vis[i]=true;\n for (int j : adj[i]) {\n if (!vis[j]) {\n queue.addLast(j);\n if(temp==-1)\n temp=j;\n }\n }\n }\n\n step++;\n }\n\n return step;\n }\n\n\n int[] dist=new int[201];\n boolean isOdd=false;\n\n private void isOddCycle(ArrayList[] lists, int node,int par,int dis) {\n\n dist[node]=dis;\n\n for(int j:lists[node]){\n if(par==j)\n continue;\n if(dist[j]!=-1 && Math.abs(dist[j]-dist[node])%2==0){\n isOdd=true;\n break;\n }else if(dist[j]==-1)\n isOddCycle(lists,j,node,dis+1);\n\n }\n\n }\n\n /* -------------------- Templates and Input Classes -------------------------------*/\n\n @Override\n public void run() {\n try {\n init();\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n solve();\n out.flush();\n }\n\n private FastInput in;\n private PrintWriter out;\n\n public static void main(String[] args) throws Exception {\n new Thread(null, new Main(), \"Main\", 1 << 27).start();\n }\n\n private void init() throws FileNotFoundException {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n out = new PrintWriter(outputStream);\n in = new FastInput(inputStream);\n }\n\n private void sort(int[] arr) {\n List list = new ArrayList<>();\n for (int object : arr) list.add(object);\n Collections.sort(list);\n for (int i = 0; i < list.size(); ++i) arr[i] = list.get(i);\n }\n\n private void sort(long[] arr) {\n List list = new ArrayList<>();\n for (long object : arr) list.add(object);\n Collections.sort(list);\n for (int i = 0; i < list.size(); ++i) arr[i] = list.get(i);\n }\n\n public long ModPow(long x, long y, long MOD) {\n long res = 1L;\n x = x % MOD;\n while (y >= 1) {\n if ((y & 1) > 0) res = (res * x) % MOD;\n x = (x * x) % MOD;\n y >>= 1;\n }\n return res;\n }\n\n public int gcd(int a, int b) {\n if (a == 0) return b;\n return gcd(b % a, a);\n }\n\n public long gcd(long a, long b) {\n if (a == 0) return b;\n return gcd(b % a, a);\n }\n\n static class FastInput {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private SpaceCharFilter filter;\n\n public FastInput(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public int peek() {\n if (numChars == -1) {\n return -1;\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n return -1;\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar];\n }\n\n public int ni() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public long nl() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public String ns() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n StringBuilder res = new StringBuilder();\n do {\n if (Character.isValidCodePoint(c)) {\n res.appendCodePoint(c);\n }\n c = read();\n } while (!isSpaceChar(c));\n return res.toString();\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }\n\n public boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n private String readLine0() {\n StringBuilder buf = new StringBuilder();\n int c = read();\n while (c != '\\n' && c != -1) {\n if (c != '\\r') {\n buf.appendCodePoint(c);\n }\n c = read();\n }\n return buf.toString();\n }\n\n public String readLine() {\n String s = readLine0();\n while (s.trim().length() == 0) {\n s = readLine0();\n }\n return s;\n }\n\n public String readLine(boolean ignoreEmptyLines) {\n if (ignoreEmptyLines) {\n return readLine();\n } else {\n return readLine0();\n }\n }\n\n public BigInteger readBigInteger() {\n try {\n return new BigInteger(ns());\n } catch (NumberFormatException e) {\n throw new InputMismatchException();\n }\n }\n\n public char nc() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n return (char) c;\n }\n\n public double nd() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n double res = 0;\n while (!isSpaceChar(c) && c != '.') {\n if (c == 'e' || c == 'E') {\n return res * Math.pow(10, ni());\n }\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n }\n if (c == '.') {\n c = read();\n double m = 1;\n while (!isSpaceChar(c)) {\n if (c == 'e' || c == 'E') {\n return res * Math.pow(10, ni());\n }\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n m /= 10;\n res += (c - '0') * m;\n c = read();\n }\n }\n return res * sgn;\n }\n\n\n public String next() {\n return ns();\n }\n\n public SpaceCharFilter getFilter() {\n return filter;\n }\n\n public void setFilter(SpaceCharFilter filter) {\n this.filter = filter;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n\n public int[] intarr(int n) {\n int arr[] = new int[n];\n for (int i = 0; i < n; i++) {\n arr[i] = ni();\n }\n return arr;\n }\n\n public double[] doublearr(int n) {\n double arr[] = new double[n];\n for (int i = 0; i < n; i++) {\n arr[i] = nd();\n }\n return arr;\n }\n\n public double[][] doublearr(int n, int m) {\n double[][] arr = new double[n][m];\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n arr[i][j] = nd();\n }\n }\n return arr;\n }\n\n public int[][] intarr(int n, int m) {\n int[][] arr = new int[n][m];\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n arr[i][j] = ni();\n }\n }\n return arr;\n }\n\n\n public long[][] longarr(int n, int m) {\n long[][] arr = new long[n][m];\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n arr[i][j] = nl();\n }\n }\n return arr;\n }\n\n public long[] longarr(int n) {\n long arr[] = new long[n];\n for (int i = 0; i < n; i++) {\n arr[i] = nl();\n }\n return arr;\n }\n\n }\n\n}", "language": "Java", "metadata": {"date": 1570332563, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02891.html", "problem_id": "p02891", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02891/input.txt", "sample_output_relpath": "derived/input_output/data/p02891/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02891/Java/s346991292.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s346991292", "user_id": "u594480399"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "// @uthor -: puneet\n// TimeStamp -: 5:29 PM - 5/10/19\n\nimport java.io.*;\nimport java.math.BigInteger;\nimport java.util.*;\n\npublic class Main implements Runnable {\n\n\n public void solve(){\n int n=in.ni();\n ArrayList[] lists=new ArrayList[n];\n for(int i=0;i();\n }\n\n for(int i=0;i[] adj,int node) {\n\n Deque queue=new ArrayDeque<>();\n queue.add(node);\n boolean [] vis=new boolean[201];\n int step=0;\n vis[node]=true;\n while (!queue.isEmpty()){\n\n int temp=-1;\n while(!queue.isEmpty()) {\n int i=queue.pollFirst();\n if(temp==i){\n queue.addLast(temp);\n break;\n }\n vis[i]=true;\n for (int j : adj[i]) {\n if (!vis[j]) {\n queue.addLast(j);\n if(temp==-1)\n temp=j;\n }\n }\n }\n\n step++;\n }\n\n return step;\n }\n\n\n int[] dist=new int[201];\n boolean isOdd=false;\n\n private void isOddCycle(ArrayList[] lists, int node,int par,int dis) {\n\n dist[node]=dis;\n\n for(int j:lists[node]){\n if(par==j)\n continue;\n if(dist[j]!=-1 && Math.abs(dist[j]-dist[node])%2==0){\n isOdd=true;\n break;\n }else if(dist[j]==-1)\n isOddCycle(lists,j,node,dis+1);\n\n }\n\n }\n\n /* -------------------- Templates and Input Classes -------------------------------*/\n\n @Override\n public void run() {\n try {\n init();\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n solve();\n out.flush();\n }\n\n private FastInput in;\n private PrintWriter out;\n\n public static void main(String[] args) throws Exception {\n new Thread(null, new Main(), \"Main\", 1 << 27).start();\n }\n\n private void init() throws FileNotFoundException {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n out = new PrintWriter(outputStream);\n in = new FastInput(inputStream);\n }\n\n private void sort(int[] arr) {\n List list = new ArrayList<>();\n for (int object : arr) list.add(object);\n Collections.sort(list);\n for (int i = 0; i < list.size(); ++i) arr[i] = list.get(i);\n }\n\n private void sort(long[] arr) {\n List list = new ArrayList<>();\n for (long object : arr) list.add(object);\n Collections.sort(list);\n for (int i = 0; i < list.size(); ++i) arr[i] = list.get(i);\n }\n\n public long ModPow(long x, long y, long MOD) {\n long res = 1L;\n x = x % MOD;\n while (y >= 1) {\n if ((y & 1) > 0) res = (res * x) % MOD;\n x = (x * x) % MOD;\n y >>= 1;\n }\n return res;\n }\n\n public int gcd(int a, int b) {\n if (a == 0) return b;\n return gcd(b % a, a);\n }\n\n public long gcd(long a, long b) {\n if (a == 0) return b;\n return gcd(b % a, a);\n }\n\n static class FastInput {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private SpaceCharFilter filter;\n\n public FastInput(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public int peek() {\n if (numChars == -1) {\n return -1;\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n return -1;\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar];\n }\n\n public int ni() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public long nl() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public String ns() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n StringBuilder res = new StringBuilder();\n do {\n if (Character.isValidCodePoint(c)) {\n res.appendCodePoint(c);\n }\n c = read();\n } while (!isSpaceChar(c));\n return res.toString();\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }\n\n public boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n private String readLine0() {\n StringBuilder buf = new StringBuilder();\n int c = read();\n while (c != '\\n' && c != -1) {\n if (c != '\\r') {\n buf.appendCodePoint(c);\n }\n c = read();\n }\n return buf.toString();\n }\n\n public String readLine() {\n String s = readLine0();\n while (s.trim().length() == 0) {\n s = readLine0();\n }\n return s;\n }\n\n public String readLine(boolean ignoreEmptyLines) {\n if (ignoreEmptyLines) {\n return readLine();\n } else {\n return readLine0();\n }\n }\n\n public BigInteger readBigInteger() {\n try {\n return new BigInteger(ns());\n } catch (NumberFormatException e) {\n throw new InputMismatchException();\n }\n }\n\n public char nc() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n return (char) c;\n }\n\n public double nd() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n double res = 0;\n while (!isSpaceChar(c) && c != '.') {\n if (c == 'e' || c == 'E') {\n return res * Math.pow(10, ni());\n }\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n }\n if (c == '.') {\n c = read();\n double m = 1;\n while (!isSpaceChar(c)) {\n if (c == 'e' || c == 'E') {\n return res * Math.pow(10, ni());\n }\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n m /= 10;\n res += (c - '0') * m;\n c = read();\n }\n }\n return res * sgn;\n }\n\n\n public String next() {\n return ns();\n }\n\n public SpaceCharFilter getFilter() {\n return filter;\n }\n\n public void setFilter(SpaceCharFilter filter) {\n this.filter = filter;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n\n public int[] intarr(int n) {\n int arr[] = new int[n];\n for (int i = 0; i < n; i++) {\n arr[i] = ni();\n }\n return arr;\n }\n\n public double[] doublearr(int n) {\n double arr[] = new double[n];\n for (int i = 0; i < n; i++) {\n arr[i] = nd();\n }\n return arr;\n }\n\n public double[][] doublearr(int n, int m) {\n double[][] arr = new double[n][m];\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n arr[i][j] = nd();\n }\n }\n return arr;\n }\n\n public int[][] intarr(int n, int m) {\n int[][] arr = new int[n][m];\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n arr[i][j] = ni();\n }\n }\n return arr;\n }\n\n\n public long[][] longarr(int n, int m) {\n long[][] arr = new long[n][m];\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n arr[i][j] = nl();\n }\n }\n return arr;\n }\n\n public long[] longarr(int n) {\n long arr[] = new long[n];\n for (int i = 0; i < n; i++) {\n arr[i] = nl();\n }\n return arr;\n }\n\n }\n\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven is a string S. Let T be the concatenation of K copies of S.\nWe can repeatedly perform the following operation: choose a character in T and replace it with a different character.\nFind the minimum number of operations required to satisfy the following condition: any two adjacent characters in T are different.\n\nConstraints\n\n1 \\leq |S| \\leq 100\n\nS consists of lowercase English letters.\n\n1 \\leq K \\leq 10^9\n\nK is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nK\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\nissii\n2\n\nSample Output 1\n\n4\n\nT is issiiissii. For example, we can rewrite it into ispiqisyhi, and now any two adjacent characters are different.\n\nSample Input 2\n\nqq\n81\n\nSample Output 2\n\n81\n\nSample Input 3\n\ncooooooooonteeeeeeeeeest\n999993333\n\nSample Output 3\n\n8999939997", "sample_input": "issii\n2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02891", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven is a string S. Let T be the concatenation of K copies of S.\nWe can repeatedly perform the following operation: choose a character in T and replace it with a different character.\nFind the minimum number of operations required to satisfy the following condition: any two adjacent characters in T are different.\n\nConstraints\n\n1 \\leq |S| \\leq 100\n\nS consists of lowercase English letters.\n\n1 \\leq K \\leq 10^9\n\nK is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nK\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\nissii\n2\n\nSample Output 1\n\n4\n\nT is issiiissii. For example, we can rewrite it into ispiqisyhi, and now any two adjacent characters are different.\n\nSample Input 2\n\nqq\n81\n\nSample Output 2\n\n81\n\nSample Input 3\n\ncooooooooonteeeeeeeeeest\n999993333\n\nSample Output 3\n\n8999939997", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 11209, "cpu_time_ms": 80, "memory_kb": 23508}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s527115833", "group_id": "codeNet:p02891", "input_text": "\nimport java.util.Scanner;\n\n\npublic class Main {\n\n\t/*\n\t * 余りの最大値を求める。\n\t */\n\tpublic static void main(String[] args) {\n\n\t\t/*\n\t\t * Scannerで値取得。\n\t\t */\n\t\tScanner sint = new Scanner(System.in);\n\t\tScanner sStr = new Scanner(System.in);\n\n\t\t//値取得\n\t\tString str = sStr.next();\n\t\tint number = sint.nextInt();\n\n\n\t\tsint.close();\n\t\tsStr.close();\n\n\t\tStringBuilder strSum = new StringBuilder();\n\n\t\tfor(int i = 0; i < number; i++) {\n\t\t\tstrSum.append(str);\n\t\t}\n\n\t\tString stringSum = strSum.toString();\n\n\t\tString[] strs = stringSum.split(\"\");\n\n\t\tint var = 0;\n\t\tfor(int i =0; i < strs.length -1 ; i++) {\n\t\t\tif(strs[i].equals(strs[i+1])) {\n\t\t\t\tstrs[i+1]= \"AA\";\n\t\t\t\tvar++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(var);\n\n\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1570331532, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02891.html", "problem_id": "p02891", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02891/input.txt", "sample_output_relpath": "derived/input_output/data/p02891/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02891/Java/s527115833.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s527115833", "user_id": "u795990458"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "\nimport java.util.Scanner;\n\n\npublic class Main {\n\n\t/*\n\t * 余りの最大値を求める。\n\t */\n\tpublic static void main(String[] args) {\n\n\t\t/*\n\t\t * Scannerで値取得。\n\t\t */\n\t\tScanner sint = new Scanner(System.in);\n\t\tScanner sStr = new Scanner(System.in);\n\n\t\t//値取得\n\t\tString str = sStr.next();\n\t\tint number = sint.nextInt();\n\n\n\t\tsint.close();\n\t\tsStr.close();\n\n\t\tStringBuilder strSum = new StringBuilder();\n\n\t\tfor(int i = 0; i < number; i++) {\n\t\t\tstrSum.append(str);\n\t\t}\n\n\t\tString stringSum = strSum.toString();\n\n\t\tString[] strs = stringSum.split(\"\");\n\n\t\tint var = 0;\n\t\tfor(int i =0; i < strs.length -1 ; i++) {\n\t\t\tif(strs[i].equals(strs[i+1])) {\n\t\t\t\tstrs[i+1]= \"AA\";\n\t\t\t\tvar++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(var);\n\n\n\t}\n\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven is a string S. Let T be the concatenation of K copies of S.\nWe can repeatedly perform the following operation: choose a character in T and replace it with a different character.\nFind the minimum number of operations required to satisfy the following condition: any two adjacent characters in T are different.\n\nConstraints\n\n1 \\leq |S| \\leq 100\n\nS consists of lowercase English letters.\n\n1 \\leq K \\leq 10^9\n\nK is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nK\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\nissii\n2\n\nSample Output 1\n\n4\n\nT is issiiissii. For example, we can rewrite it into ispiqisyhi, and now any two adjacent characters are different.\n\nSample Input 2\n\nqq\n81\n\nSample Output 2\n\n81\n\nSample Input 3\n\ncooooooooonteeeeeeeeeest\n999993333\n\nSample Output 3\n\n8999939997", "sample_input": "issii\n2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02891", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven is a string S. Let T be the concatenation of K copies of S.\nWe can repeatedly perform the following operation: choose a character in T and replace it with a different character.\nFind the minimum number of operations required to satisfy the following condition: any two adjacent characters in T are different.\n\nConstraints\n\n1 \\leq |S| \\leq 100\n\nS consists of lowercase English letters.\n\n1 \\leq K \\leq 10^9\n\nK is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nK\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\nissii\n2\n\nSample Output 1\n\n4\n\nT is issiiissii. For example, we can rewrite it into ispiqisyhi, and now any two adjacent characters are different.\n\nSample Input 2\n\nqq\n81\n\nSample Output 2\n\n81\n\nSample Input 3\n\ncooooooooonteeeeeeeeeest\n999993333\n\nSample Output 3\n\n8999939997", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 732, "cpu_time_ms": 95, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s031406669", "group_id": "codeNet:p02891", "input_text": "import java.util.*;\n\nclass Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String S = sc.next();\n int K = sc.nextInt();\n\n //先頭の文字格納\n char fstStr = S.charAt(0);\n //末尾の文字格納\n char endStr = S.charAt(S.length()-1);\n\n //最後の文字が変わらない時true\n Boolean endFlag = true;\n\n //全て同じ文字の時True\n Boolean sameFlag = true;\n\n int count = 0;\n int result = 0;\n\n //比較\n for(int i=1;i2&&A[1]!=A[2]&&A[0]==A[1]){\n\t\t\t\tans--;\n\t\t\t\tans*=K;\n\t\t\t\t\n\t\t\t}\n\t\t\telse{\n\t\t\t\tans*=K;\n\t\t\t\tans--;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t\tans*=K;\n\t\tif(fes)\n\t\t\tans=(K*S.length())/2;\n\t\tSystem.out.println(ans);\n\t}\n}\n", "language": "Java", "metadata": {"date": 1570327807, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02891.html", "problem_id": "p02891", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02891/input.txt", "sample_output_relpath": "derived/input_output/data/p02891/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02891/Java/s315827266.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s315827266", "user_id": "u253726906"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "import java.util.Scanner;\npublic class Main {\n\tpublic static void main(String[] args)throws Exception{\n\t\tScanner stdIn=new Scanner(System.in);\n\t\tString S=stdIn.next();\n\t\tchar A[]=new char[S.length()];\n\t\tlong K=stdIn.nextInt();\n\t\tlong ans=0;\n\t\tboolean fes=true;\n\t\tboolean key=false;\n\t\tfor(int i=0;i2&&A[1]!=A[2]&&A[0]==A[1]){\n\t\t\t\tans--;\n\t\t\t\tans*=K;\n\t\t\t\t\n\t\t\t}\n\t\t\telse{\n\t\t\t\tans*=K;\n\t\t\t\tans--;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t\tans*=K;\n\t\tif(fes)\n\t\t\tans=(K*S.length())/2;\n\t\tSystem.out.println(ans);\n\t}\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven is a string S. Let T be the concatenation of K copies of S.\nWe can repeatedly perform the following operation: choose a character in T and replace it with a different character.\nFind the minimum number of operations required to satisfy the following condition: any two adjacent characters in T are different.\n\nConstraints\n\n1 \\leq |S| \\leq 100\n\nS consists of lowercase English letters.\n\n1 \\leq K \\leq 10^9\n\nK is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nK\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\nissii\n2\n\nSample Output 1\n\n4\n\nT is issiiissii. For example, we can rewrite it into ispiqisyhi, and now any two adjacent characters are different.\n\nSample Input 2\n\nqq\n81\n\nSample Output 2\n\n81\n\nSample Input 3\n\ncooooooooonteeeeeeeeeest\n999993333\n\nSample Output 3\n\n8999939997", "sample_input": "issii\n2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02891", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven is a string S. Let T be the concatenation of K copies of S.\nWe can repeatedly perform the following operation: choose a character in T and replace it with a different character.\nFind the minimum number of operations required to satisfy the following condition: any two adjacent characters in T are different.\n\nConstraints\n\n1 \\leq |S| \\leq 100\n\nS consists of lowercase English letters.\n\n1 \\leq K \\leq 10^9\n\nK is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nK\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\nissii\n2\n\nSample Output 1\n\n4\n\nT is issiiissii. For example, we can rewrite it into ispiqisyhi, and now any two adjacent characters are different.\n\nSample Input 2\n\nqq\n81\n\nSample Output 2\n\n81\n\nSample Input 3\n\ncooooooooonteeeeeeeeeest\n999993333\n\nSample Output 3\n\n8999939997", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 876, "cpu_time_ms": 96, "memory_kb": 21972}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s438320936", "group_id": "codeNet:p02891", "input_text": "import java.util.*;\n\npublic class Main{\n public static void main(String[]args){\n Scanner sc = new Scanner(System.in);\n String S = sc.next();\n char[] C = S.toCharArray();\n long N = Long.parseLong(sc.next());\n int s = S.length();\n int count = 0;\n for(int i = 1; i < s; i++){\n if(C[i-1] == C[i]){\n C[i] = '-';\n count++;\n }\n }\n boolean f = false;\n if(C[0] == C[s-1]){\n count++;\n f = true;\n }\n long ans = 0;\n if(count == s-1 && s > 2){\n if(N%2==0){\n ans = count*(N/2) + (count-1)*(N/2);\n }else{\n ans = count*(N/2) + (count-1)*((N/2)+1);\n }\n }else{\n ans = count * N;\n if(f){\n ans--;\n }\n }\n \n \n if(s == 1){\n ans = N/2;\n }\n System.out.println(ans);\n }\n}\n", "language": "Java", "metadata": {"date": 1570326857, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02891.html", "problem_id": "p02891", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02891/input.txt", "sample_output_relpath": "derived/input_output/data/p02891/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02891/Java/s438320936.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s438320936", "user_id": "u489316980"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main{\n public static void main(String[]args){\n Scanner sc = new Scanner(System.in);\n String S = sc.next();\n char[] C = S.toCharArray();\n long N = Long.parseLong(sc.next());\n int s = S.length();\n int count = 0;\n for(int i = 1; i < s; i++){\n if(C[i-1] == C[i]){\n C[i] = '-';\n count++;\n }\n }\n boolean f = false;\n if(C[0] == C[s-1]){\n count++;\n f = true;\n }\n long ans = 0;\n if(count == s-1 && s > 2){\n if(N%2==0){\n ans = count*(N/2) + (count-1)*(N/2);\n }else{\n ans = count*(N/2) + (count-1)*((N/2)+1);\n }\n }else{\n ans = count * N;\n if(f){\n ans--;\n }\n }\n \n \n if(s == 1){\n ans = N/2;\n }\n System.out.println(ans);\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven is a string S. Let T be the concatenation of K copies of S.\nWe can repeatedly perform the following operation: choose a character in T and replace it with a different character.\nFind the minimum number of operations required to satisfy the following condition: any two adjacent characters in T are different.\n\nConstraints\n\n1 \\leq |S| \\leq 100\n\nS consists of lowercase English letters.\n\n1 \\leq K \\leq 10^9\n\nK is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nK\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\nissii\n2\n\nSample Output 1\n\n4\n\nT is issiiissii. For example, we can rewrite it into ispiqisyhi, and now any two adjacent characters are different.\n\nSample Input 2\n\nqq\n81\n\nSample Output 2\n\n81\n\nSample Input 3\n\ncooooooooonteeeeeeeeeest\n999993333\n\nSample Output 3\n\n8999939997", "sample_input": "issii\n2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02891", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven is a string S. Let T be the concatenation of K copies of S.\nWe can repeatedly perform the following operation: choose a character in T and replace it with a different character.\nFind the minimum number of operations required to satisfy the following condition: any two adjacent characters in T are different.\n\nConstraints\n\n1 \\leq |S| \\leq 100\n\nS consists of lowercase English letters.\n\n1 \\leq K \\leq 10^9\n\nK is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nK\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\nissii\n2\n\nSample Output 1\n\n4\n\nT is issiiissii. For example, we can rewrite it into ispiqisyhi, and now any two adjacent characters are different.\n\nSample Input 2\n\nqq\n81\n\nSample Output 2\n\n81\n\nSample Input 3\n\ncooooooooonteeeeeeeeeest\n999993333\n\nSample Output 3\n\n8999939997", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 798, "cpu_time_ms": 109, "memory_kb": 23764}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s959483892", "group_id": "codeNet:p02891", "input_text": "import java.io.*;\nimport java.util.*;\npublic class Main{\n \n static class BI{\n final private int BUFFER_SIZE = 1 << 16;\n private DataInputStream dis;\n private byte[] buffer;\n private int bufferPointer, bytesRead;\n \n //********Constructors*********\\\\\n \n public BI() {\n dis = new DataInputStream(System.in);\n buffer = new byte[BUFFER_SIZE];\n bufferPointer = bytesRead = 0;\n }\n public BI(String file_name) throws IOException {\n dis = new DataInputStream(new FileInputStream(file_name));\n buffer = new byte[BUFFER_SIZE];\n bufferPointer = bytesRead = 0;\n }\n \n //*******Reads a line until new line character************\\\\\n \n public String readLine() throws IOException {\n byte[] buf = new byte[1<<25];\n int cnt = 0, c;\n while ((c = read()) != -1) {\n if (c == '\\n') break;\n buf[cnt++] = (byte) c;\n }\n return new String(buf, 0, cnt);\n }\n \n //*******Reads a string Until First Space************\\\\\n \n public String nextString() throws IOException {\n // Skip all whitespace characters from the stream\n byte c = read();\n while(Character.isWhitespace(c)){\n c = read();\n }\n StringBuilder builder = new StringBuilder();\n builder.append((char)c);\n c = read();\n while(!Character.isWhitespace(c)){\n builder.append((char)c);\n c = read();\n }\n return builder.toString();\n }\n \n //*******Reads a Integer************\\\\\n \n public int nextInt() throws IOException {\n int ret = 0;\n byte c = read();\n while (c <= ' ')\n c = read();\n boolean neg = (c == '-');\n if (neg)\n c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (neg)\n return -ret;\n return ret;\n }\n \n //*******Reads a Integer************\\\\\n \n public long nextLong() throws IOException {\n long ret = 0;\n byte c = read();\n while (c <= ' ')\n c = read();\n boolean neg = (c == '-');\n if (neg)\n c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (neg)\n return -ret;\n return ret;\n }\n \n //*******Reads a Char************\\\\\n \n public char nextChar() throws IOException{\n byte c = read();\n while(Character.isWhitespace(c)){\n c = read();\n }\n return (char) c;\n }\n \n //*******Reads a Double************\\\\\n \n public double nextDouble() throws IOException {\n double ret = 0, div = 1;\n byte c = read();\n while (c <= ' ')\n c = read();\n boolean neg = (c == '-');\n if (neg)\n c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (c == '.') {\n while ((c = read()) >= '0' && c <= '9') {\n ret += (c - '0') / (div *= 10);\n }\n }\n if (neg)\n\t\t\treturn -ret;\n\t\t\treturn ret;\n }\n \n //*******Reads an array of double values************\\\\\n \n public double[] nextDoubleArray(int n) throws IOException {\n double arr[] = new double[n];\n for(int i = 0; i < n; i++){\n arr[i] = nextDouble();\n }\n return arr;\n }\n \n //*******Reads an array of long integers************\\\\\n \n public long[] nextLongArray(int n) throws IOException {\n long arr[] = new long[n];\n for(int i = 0; i < n; i++){\n arr[i] = nextLong();\n }\n return arr;\n }\n \n //*******Reads an array of Integers************\\\\\n \n public int[] nextIntArray(int n) throws IOException {\n int arr[] = new int[n];\n for(int i = 0; i < n; i++){\n arr[i] = nextInt();\n }\n return arr;\n }\n \n //*******Fills the buffer from input stream************\\\\\n \n private void fillBuffer() throws IOException {\n bytesRead = dis.read(buffer, bufferPointer = 0, BUFFER_SIZE);\n if (bytesRead == -1)\n buffer[0] = -1;\n }\n private byte read() throws IOException {\n if (bufferPointer == bytesRead)\n fillBuffer();\n return buffer[bufferPointer++];\n }\n public void close() throws IOException {\n if (dis == null) return;\n dis.close();\n }\n \n }\n \n //**********************CODE IS HERE*****************************\\\\\n \n static long gcd(long a, long b){ return (b==0) ? a : gcd(b, a%b); }\n static int gcd(int a, int b){ return (b==0) ? a : gcd(b, a%b); }\n public static int rev(int a)\n {\n int tmp=0;\n while(a>0)\n {\n tmp = (tmp*10)+(a%10);\n a=a/10;\n }\n return tmp;\n }\n public static void main(String args[])throws IOException{\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));//bw.write(\"Shubham Pandey\\n\");\n \n BI in=new BI();\n // int a=in.nextInt();\n // long b=in.nextLong();\n // char c=in.nextChar();\n // double d=in.nextDouble();\n // int arr[]=in.nextIntArray(3);\n // double drr[]=in.nextDoubleArray(6);\n // long lrr[]=in.nextLongArray(4);\n // String str=in.readLine();//line\n // String ptr=in.nextString();//word\n int big = (int)1e7;\n String str = in.readLine();\n int k = in.nextInt();\n int n = str.length();\n if(n==1){ int tp = k/2; bw.write(tp+\"\");}\n else\n {\n char ch[] = str.toCharArray();\n long count=0l;\n if(k>1)\n {\n for(int i=0;i= '0' && c <= '9');\n if (neg)\n return -ret;\n return ret;\n }\n \n //*******Reads a Integer************\\\\\n \n public long nextLong() throws IOException {\n long ret = 0;\n byte c = read();\n while (c <= ' ')\n c = read();\n boolean neg = (c == '-');\n if (neg)\n c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (neg)\n return -ret;\n return ret;\n }\n \n //*******Reads a Char************\\\\\n \n public char nextChar() throws IOException{\n byte c = read();\n while(Character.isWhitespace(c)){\n c = read();\n }\n return (char) c;\n }\n \n //*******Reads a Double************\\\\\n \n public double nextDouble() throws IOException {\n double ret = 0, div = 1;\n byte c = read();\n while (c <= ' ')\n c = read();\n boolean neg = (c == '-');\n if (neg)\n c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (c == '.') {\n while ((c = read()) >= '0' && c <= '9') {\n ret += (c - '0') / (div *= 10);\n }\n }\n if (neg)\n\t\t\treturn -ret;\n\t\t\treturn ret;\n }\n \n //*******Reads an array of double values************\\\\\n \n public double[] nextDoubleArray(int n) throws IOException {\n double arr[] = new double[n];\n for(int i = 0; i < n; i++){\n arr[i] = nextDouble();\n }\n return arr;\n }\n \n //*******Reads an array of long integers************\\\\\n \n public long[] nextLongArray(int n) throws IOException {\n long arr[] = new long[n];\n for(int i = 0; i < n; i++){\n arr[i] = nextLong();\n }\n return arr;\n }\n \n //*******Reads an array of Integers************\\\\\n \n public int[] nextIntArray(int n) throws IOException {\n int arr[] = new int[n];\n for(int i = 0; i < n; i++){\n arr[i] = nextInt();\n }\n return arr;\n }\n \n //*******Fills the buffer from input stream************\\\\\n \n private void fillBuffer() throws IOException {\n bytesRead = dis.read(buffer, bufferPointer = 0, BUFFER_SIZE);\n if (bytesRead == -1)\n buffer[0] = -1;\n }\n private byte read() throws IOException {\n if (bufferPointer == bytesRead)\n fillBuffer();\n return buffer[bufferPointer++];\n }\n public void close() throws IOException {\n if (dis == null) return;\n dis.close();\n }\n \n }\n \n //**********************CODE IS HERE*****************************\\\\\n \n static long gcd(long a, long b){ return (b==0) ? a : gcd(b, a%b); }\n static int gcd(int a, int b){ return (b==0) ? a : gcd(b, a%b); }\n public static int rev(int a)\n {\n int tmp=0;\n while(a>0)\n {\n tmp = (tmp*10)+(a%10);\n a=a/10;\n }\n return tmp;\n }\n public static void main(String args[])throws IOException{\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));//bw.write(\"Shubham Pandey\\n\");\n \n BI in=new BI();\n // int a=in.nextInt();\n // long b=in.nextLong();\n // char c=in.nextChar();\n // double d=in.nextDouble();\n // int arr[]=in.nextIntArray(3);\n // double drr[]=in.nextDoubleArray(6);\n // long lrr[]=in.nextLongArray(4);\n // String str=in.readLine();//line\n // String ptr=in.nextString();//word\n int big = (int)1e7;\n String str = in.readLine();\n int k = in.nextInt();\n int n = str.length();\n if(n==1){ int tp = k/2; bw.write(tp+\"\");}\n else\n {\n char ch[] = str.toCharArray();\n long count=0l;\n if(k>1)\n {\n for(int i=0;i= S.length())\n\t\t\t\t\tbreak;\n\t\t\t\tc = S.charAt(i);\n\t\t\t}\n\t\t\tlong ans = count * K;\n\t\t\tSystem.out.println(K*count);\n\t\t\t//}\n\t}\n}", "language": "Java", "metadata": {"date": 1570324892, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02891.html", "problem_id": "p02891", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02891/input.txt", "sample_output_relpath": "derived/input_output/data/p02891/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02891/Java/s726618483.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s726618483", "user_id": "u316069805"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tString S = sc.next();\n\t\tlong K = sc.nextLong();\n\t\tint count = 0;\n\n\t\tchar c = ' ';\n\t\t//if (S.charAt(0) != S.charAt(S.length()-1)) {\n\t\t\tfor (int i = 0; i < S.length(); i++) {\n\t\t\t\tif (S.charAt(i) == c) {\n\t\t\t\t\tcount++;\n\t\t\t\t\ti++;\n\t\t\t\t}\n\t\t\t\tif (i >= S.length())\n\t\t\t\t\tbreak;\n\t\t\t\tc = S.charAt(i);\n\t\t\t}\n\t\t\tlong ans = count * K;\n\t\t\tSystem.out.println(K*count);\n\t\t\t//}\n\t}\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven is a string S. Let T be the concatenation of K copies of S.\nWe can repeatedly perform the following operation: choose a character in T and replace it with a different character.\nFind the minimum number of operations required to satisfy the following condition: any two adjacent characters in T are different.\n\nConstraints\n\n1 \\leq |S| \\leq 100\n\nS consists of lowercase English letters.\n\n1 \\leq K \\leq 10^9\n\nK is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nK\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\nissii\n2\n\nSample Output 1\n\n4\n\nT is issiiissii. For example, we can rewrite it into ispiqisyhi, and now any two adjacent characters are different.\n\nSample Input 2\n\nqq\n81\n\nSample Output 2\n\n81\n\nSample Input 3\n\ncooooooooonteeeeeeeeeest\n999993333\n\nSample Output 3\n\n8999939997", "sample_input": "issii\n2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02891", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven is a string S. Let T be the concatenation of K copies of S.\nWe can repeatedly perform the following operation: choose a character in T and replace it with a different character.\nFind the minimum number of operations required to satisfy the following condition: any two adjacent characters in T are different.\n\nConstraints\n\n1 \\leq |S| \\leq 100\n\nS consists of lowercase English letters.\n\n1 \\leq K \\leq 10^9\n\nK is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nK\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\nissii\n2\n\nSample Output 1\n\n4\n\nT is issiiissii. For example, we can rewrite it into ispiqisyhi, and now any two adjacent characters are different.\n\nSample Input 2\n\nqq\n81\n\nSample Output 2\n\n81\n\nSample Input 3\n\ncooooooooonteeeeeeeeeest\n999993333\n\nSample Output 3\n\n8999939997", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 95, "memory_kb": 23764}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s916430550", "group_id": "codeNet:p02912", "input_text": "import java.math.BigInteger;\nimport java.util.*;\nimport java.util.stream.Collectors;\n\npublic class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int m = sc.nextInt();\n List a = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n a.add(sc.nextLong());\n }\n if (n == 1) {\n long p = a.get(0);\n for (int i = 0; i < m; i++) {\n p = p / 2;\n }\n System.out.println(p);\n return;\n }\n a.sort(Comparator.reverseOrder());\n for (int i = 0; i < m; i++) {\n Long aLong = a.get(0);\n long newLong = aLong / 2;\n a.set(0, newLong);\n if (newLong < a.get(1)) {\n a.sort(Comparator.reverseOrder());\n }\n }\n System.out.println(a.stream().reduce(0L, Long::sum));\n }\n}\n", "language": "Java", "metadata": {"date": 1598045832, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02912.html", "problem_id": "p02912", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02912/input.txt", "sample_output_relpath": "derived/input_output/data/p02912/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02912/Java/s916430550.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s916430550", "user_id": "u324739185"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "import java.math.BigInteger;\nimport java.util.*;\nimport java.util.stream.Collectors;\n\npublic class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int m = sc.nextInt();\n List a = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n a.add(sc.nextLong());\n }\n if (n == 1) {\n long p = a.get(0);\n for (int i = 0; i < m; i++) {\n p = p / 2;\n }\n System.out.println(p);\n return;\n }\n a.sort(Comparator.reverseOrder());\n for (int i = 0; i < m; i++) {\n Long aLong = a.get(0);\n long newLong = aLong / 2;\n a.set(0, newLong);\n if (newLong < a.get(1)) {\n a.sort(Comparator.reverseOrder());\n }\n }\n System.out.println(a.stream().reduce(0L, Long::sum));\n }\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nTakahashi is going to buy N items one by one.\n\nThe price of the i-th item he buys is A_i yen (the currency of Japan).\n\nHe has M discount tickets, and he can use any number of them when buying an item.\n\nIf Y tickets are used when buying an item priced X yen, he can get the item for \\frac{X}{2^Y} (rounded down to the nearest integer) yen.\n\nWhat is the minimum amount of money required to buy all the items?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\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 amount of money required to buy all the items.\n\nSample Input 1\n\n3 3\n2 13 8\n\nSample Output 1\n\n9\n\nWe can buy all the items for 9 yen, as follows:\n\nBuy the 1-st item for 2 yen without tickets.\n\nBuy the 2-nd item for 3 yen with 2 tickets.\n\nBuy the 3-rd item for 4 yen with 1 ticket.\n\nSample Input 2\n\n4 4\n1 9 3 5\n\nSample Output 2\n\n6\n\nSample Input 3\n\n1 100000\n1000000000\n\nSample Output 3\n\n0\n\nWe can buy the item priced 1000000000 yen for 0 yen with 100000 tickets.\n\nSample Input 4\n\n10 1\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 4\n\n9500000000", "sample_input": "3 3\n2 13 8\n"}, "reference_outputs": ["9\n"], "source_document_id": "p02912", "source_text": "Score : 400 points\n\nProblem Statement\n\nTakahashi is going to buy N items one by one.\n\nThe price of the i-th item he buys is A_i yen (the currency of Japan).\n\nHe has M discount tickets, and he can use any number of them when buying an item.\n\nIf Y tickets are used when buying an item priced X yen, he can get the item for \\frac{X}{2^Y} (rounded down to the nearest integer) yen.\n\nWhat is the minimum amount of money required to buy all the items?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\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 amount of money required to buy all the items.\n\nSample Input 1\n\n3 3\n2 13 8\n\nSample Output 1\n\n9\n\nWe can buy all the items for 9 yen, as follows:\n\nBuy the 1-st item for 2 yen without tickets.\n\nBuy the 2-nd item for 3 yen with 2 tickets.\n\nBuy the 3-rd item for 4 yen with 1 ticket.\n\nSample Input 2\n\n4 4\n1 9 3 5\n\nSample Output 2\n\n6\n\nSample Input 3\n\n1 100000\n1000000000\n\nSample Output 3\n\n0\n\nWe can buy the item priced 1000000000 yen for 0 yen with 100000 tickets.\n\nSample Input 4\n\n10 1\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 4\n\n9500000000", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 814, "cpu_time_ms": 2207, "memory_kb": 54636}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s633651715", "group_id": "codeNet:p02912", "input_text": "//package com.company;\nimport java.io.*;\nimport java.util.*;\nimport java.lang.*;\npublic class Main{\n public static class FastReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private SpaceCharFilter filter;\n public FastReader(InputStream stream) {\n this.stream = stream;\n }\n public int read() {\n if (numChars==-1)\n throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n }\n catch (IOException e) {\n throw new InputMismatchException();\n }\n if(numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n public String nextLine() {\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n String str = \"\";\n try {\n str = br.readLine();\n }\n catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n public int nextInt() {\n int c = read();\n while(isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if(c<'0'||c>'9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n }\n while (!isSpaceChar(c));\n return res * sgn;\n }\n public long nextLong() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n }\n while (!isSpaceChar(c));\n return res * sgn;\n }\n public double nextDouble() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n double res = 0;\n while (!isSpaceChar(c) && c != '.') {\n if (c == 'e' || c == 'E')\n return res * Math.pow(10, nextInt());\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n }\n if (c == '.') {\n c = read();\n double m = 1;\n while (!isSpaceChar(c))\n {\n if (c == 'e' || c == 'E')\n return res * Math.pow(10, nextInt());\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n m /= 10;\n res += (c - '0') * m;\n c = read();\n }\n }\n return res * sgn;\n }\n public char nextChar() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n return (char)c;\n }\n public String next() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = read();\n }\n while (!isSpaceChar(c));\n return res.toString();\n }\n public boolean isSpaceChar(int c) {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n }\n static int gcd(int a, int b){ \n if (a == 0) \n return b; \n return gcd(b % a, a); \n } \n static int lcm(int a, int b) {\n return (a*b)/gcd(a, b); \n } \n public static void main(String args[]){\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastReader in = new FastReader(inputStream);\n PrintWriter w = new PrintWriter(outputStream);\n int n,m,q,i,j;\n long sum=0;\n n=in.nextInt();\n m=in.nextInt();\n long arr[]=new long[n];\n PriorityQueue pq=new PriorityQueue<>(Collections.reverseOrder());\n for(i=0;i0&&arr[n-2]>0){\n \n long x=pq.poll();\n long y=pq.poll();\n if(x==y){\n m--;\n x=x/2;\n //continue;\n }else{\n int temp=(int)(Math.log((int)Math.ceil((double)x/y))/(double)(Math.log(2)));\n m-=temp;\n x=x/(long)Math.pow(2,temp);\n //w.println(arr[n-1]);\n }\n pq.add(x);\n pq.add(y);\n }\n }\n while(!pq.isEmpty())\n {\n sum+=pq.poll();\n }\n w.println(sum);\n w.close();\n }\n \n}", "language": "Java", "metadata": {"date": 1578804930, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02912.html", "problem_id": "p02912", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02912/input.txt", "sample_output_relpath": "derived/input_output/data/p02912/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02912/Java/s633651715.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s633651715", "user_id": "u484102234"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "//package com.company;\nimport java.io.*;\nimport java.util.*;\nimport java.lang.*;\npublic class Main{\n public static class FastReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private SpaceCharFilter filter;\n public FastReader(InputStream stream) {\n this.stream = stream;\n }\n public int read() {\n if (numChars==-1)\n throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n }\n catch (IOException e) {\n throw new InputMismatchException();\n }\n if(numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n public String nextLine() {\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n String str = \"\";\n try {\n str = br.readLine();\n }\n catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n public int nextInt() {\n int c = read();\n while(isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if(c<'0'||c>'9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n }\n while (!isSpaceChar(c));\n return res * sgn;\n }\n public long nextLong() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n }\n while (!isSpaceChar(c));\n return res * sgn;\n }\n public double nextDouble() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n double res = 0;\n while (!isSpaceChar(c) && c != '.') {\n if (c == 'e' || c == 'E')\n return res * Math.pow(10, nextInt());\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n }\n if (c == '.') {\n c = read();\n double m = 1;\n while (!isSpaceChar(c))\n {\n if (c == 'e' || c == 'E')\n return res * Math.pow(10, nextInt());\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n m /= 10;\n res += (c - '0') * m;\n c = read();\n }\n }\n return res * sgn;\n }\n public char nextChar() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n return (char)c;\n }\n public String next() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = read();\n }\n while (!isSpaceChar(c));\n return res.toString();\n }\n public boolean isSpaceChar(int c) {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n }\n }\n static int gcd(int a, int b){ \n if (a == 0) \n return b; \n return gcd(b % a, a); \n } \n static int lcm(int a, int b) {\n return (a*b)/gcd(a, b); \n } \n public static void main(String args[]){\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastReader in = new FastReader(inputStream);\n PrintWriter w = new PrintWriter(outputStream);\n int n,m,q,i,j;\n long sum=0;\n n=in.nextInt();\n m=in.nextInt();\n long arr[]=new long[n];\n PriorityQueue pq=new PriorityQueue<>(Collections.reverseOrder());\n for(i=0;i0&&arr[n-2]>0){\n \n long x=pq.poll();\n long y=pq.poll();\n if(x==y){\n m--;\n x=x/2;\n //continue;\n }else{\n int temp=(int)(Math.log((int)Math.ceil((double)x/y))/(double)(Math.log(2)));\n m-=temp;\n x=x/(long)Math.pow(2,temp);\n //w.println(arr[n-1]);\n }\n pq.add(x);\n pq.add(y);\n }\n }\n while(!pq.isEmpty())\n {\n sum+=pq.poll();\n }\n w.println(sum);\n w.close();\n }\n \n}", "problem_context": "Score : 400 points\n\nProblem Statement\n\nTakahashi is going to buy N items one by one.\n\nThe price of the i-th item he buys is A_i yen (the currency of Japan).\n\nHe has M discount tickets, and he can use any number of them when buying an item.\n\nIf Y tickets are used when buying an item priced X yen, he can get the item for \\frac{X}{2^Y} (rounded down to the nearest integer) yen.\n\nWhat is the minimum amount of money required to buy all the items?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\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 amount of money required to buy all the items.\n\nSample Input 1\n\n3 3\n2 13 8\n\nSample Output 1\n\n9\n\nWe can buy all the items for 9 yen, as follows:\n\nBuy the 1-st item for 2 yen without tickets.\n\nBuy the 2-nd item for 3 yen with 2 tickets.\n\nBuy the 3-rd item for 4 yen with 1 ticket.\n\nSample Input 2\n\n4 4\n1 9 3 5\n\nSample Output 2\n\n6\n\nSample Input 3\n\n1 100000\n1000000000\n\nSample Output 3\n\n0\n\nWe can buy the item priced 1000000000 yen for 0 yen with 100000 tickets.\n\nSample Input 4\n\n10 1\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 4\n\n9500000000", "sample_input": "3 3\n2 13 8\n"}, "reference_outputs": ["9\n"], "source_document_id": "p02912", "source_text": "Score : 400 points\n\nProblem Statement\n\nTakahashi is going to buy N items one by one.\n\nThe price of the i-th item he buys is A_i yen (the currency of Japan).\n\nHe has M discount tickets, and he can use any number of them when buying an item.\n\nIf Y tickets are used when buying an item priced X yen, he can get the item for \\frac{X}{2^Y} (rounded down to the nearest integer) yen.\n\nWhat is the minimum amount of money required to buy all the items?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\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 amount of money required to buy all the items.\n\nSample Input 1\n\n3 3\n2 13 8\n\nSample Output 1\n\n9\n\nWe can buy all the items for 9 yen, as follows:\n\nBuy the 1-st item for 2 yen without tickets.\n\nBuy the 2-nd item for 3 yen with 2 tickets.\n\nBuy the 3-rd item for 4 yen with 1 ticket.\n\nSample Input 2\n\n4 4\n1 9 3 5\n\nSample Output 2\n\n6\n\nSample Input 3\n\n1 100000\n1000000000\n\nSample Output 3\n\n0\n\nWe can buy the item priced 1000000000 yen for 0 yen with 100000 tickets.\n\nSample Input 4\n\n10 1\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 4\n\n9500000000", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 5807, "cpu_time_ms": 295, "memory_kb": 32844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s608983749", "group_id": "codeNet:p02912", "input_text": "import java.io.*;\nimport java.util.*;\n\nclass FastScanner {\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n }else{\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}\n private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}\n public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}\n public String next() {\n if (!hasNext()) throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while(isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n public long nextLong() {\n if (!hasNext()) throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while(true){\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n }else if(b == -1 || !isPrintableChar(b)){\n return minus ? -n : n;\n }else{\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }\n public double nextDouble() { return Double.parseDouble(next());}\n}\n\nclass Main{\n public static void main(String[] args){ new Main().solve();}\n \n static FastScanner scan = new FastScanner();\n static final int MOD = 1_000_000_007;\n static final int INF = 2147483647;\n static final long LINF = 9223372036854775807L;\n\n // Scanner\n int ni(){return scan.nextInt();}\n int[] ni(int n){int[] a = new int[n]; for(int i = 0; i < n; i++){a[i] = ni();} return a;}\n int[][] ni(int y, int x){int[][] a = new int[y][x];\n for(int i = 0; i < y; i++){for(int j = 0; j < x; j++){a[i][j] = ni();}} return a;}\n long nl(){return scan.nextLong();}\n long[] nl(int n){long[] a = new long[n]; for(int i = 0; i < n; i++){a[i] = nl();} return a;}\n long[][] nl(int y, int x){long[][] a = new long[y][x];\n for(int i = 0; i < y; i++){for(int j = 0; j < x; j++){a[i][j] = nl();}} return a;}\n String ns(){return scan.next();}\n String[] ns(int n){String[] a = new String[n]; for(int i = 0; i < n; i++){a[i] = ns();} return a;}\n String[][] ns(int y, int x){String[][] a = new String[y][x];\n for(int i = 0; i < y; i++){for(int j = 0; j < x; j++){a[i][j] = ns();}} return a;}\n\n // Math\n int max(int a, int b){return Math.max(a, b);}\n long max(long a, long b){return Math.max(a, b);}\n double max(double a, double b){return Math.max(a, b);}\n int max(int[] a){int max = a[0]; for(int value:a){max = max(max,value);} return max;}\n long max(long[] a){long max = a[0]; for(long value:a){max = max(max,value);} return max;}\n double max(double[] a){double max = a[0]; for(double value:a){max = max(max,value);} return max;}\n int min(int a, int b){return Math.min(a, b);}\n long min(long a, long b){return Math.min(a, b);}\n double min(double a, double b){return Math.min(a, b);}\n int min(int[] a){int min = a[0]; for(int value:a){min = min(min,value);} return min;}\n long min(long[] a){long min = a[0]; for(long value:a){min = min(min,value);} return min;}\n double min(double[] a){double min = a[0]; for(double value:a){min = min(min,value);} return min;}\n long sum(int[] a){long sum = 0; for(int value:a){sum += value;} return sum;}\n long sum(long[] a){long sum = 0; for(long value:a){sum += value;} return sum;}\n double sum(double[] a){double sum = 0; for(double value:a){sum += value;} return sum;}\n int gcd(int a, int b){return b == 0 ? a : gcd(b, a % b);}\n long gcd(long a, long b){return b == 0 ? a : gcd(b, a % b);}\n int lcm(int a, int b){return a / gcd(a, b) * b;}\n long lcm(long a, long b){return a / gcd(a, b) * b;}\n\n // Array\n void sort(int[] a){ Arrays.sort(a);}\n void sort(long[] a){ Arrays.sort(a);}\n void sort(double[] a){ Arrays.sort(a);}\n void sort(String[] a){ Arrays.sort(a);}\n int[] reverse(int[] a){\n int[] reversed = new int[a.length];\n for(int i = 0; i < a.length; i++){\n reversed[a.length - i - 1] = a[i];\n }\n return reversed;\n }\n long[] reverse(long[] a){\n long[] reversed = new long[a.length];\n for(int i = 0; i < a.length; i++){\n reversed[a.length - i - 1] = a[i];\n }\n return reversed;\n }\n double[] reverse(double[] a){\n double[] reversed = new double[a.length];\n for(int i = 0; i < a.length; i++){\n reversed[a.length - i - 1] = a[i];\n }\n return reversed;\n }\n String[] reverse(String[] a){\n String[] reversed = new String[a.length];\n for(int i = 0; i < a.length; i++){\n reversed[a.length - i - 1] = a[i];\n }\n return reversed;\n }\n boolean[] reverse(boolean[] a){\n boolean[] reversed = new boolean[a.length];\n for(int i = 0; i < a.length; i++){\n reversed[a.length - i - 1] = a[i];\n }\n return reversed;\n }\n void fill(int[] array, int x) { Arrays.fill(array, x); }\n void fill(long[] array, long x) { Arrays.fill(array, x); }\n void fill(double[] array, double x) { Arrays.fill(array, x); }\n void fill(boolean[] array, boolean x) { Arrays.fill(array, x); }\n void fill(int[][] array, int x) { for(int a[] : array) { fill(a, x); } }\n void fill(long[][] array, long x) { for(long a[] : array) { fill(a, x); } }\n void fill(double[][] array, double x) { for(double a[] : array) { fill(a, x); } }\n void fill(boolean[][] array, boolean x) { for(boolean a[] : array) { fill(a, x); } }\n\n\n\n public void solve(){\n int n = ni();\n int m = ni();\n long[] a = nl(n);\n\n while(m > 0){\n sort(a);\n a[n-1] /= 2;\n m--;\n }\n\n System.out.println(sum(a));\n \n }\n}", "language": "Java", "metadata": {"date": 1576194485, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02912.html", "problem_id": "p02912", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02912/input.txt", "sample_output_relpath": "derived/input_output/data/p02912/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02912/Java/s608983749.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s608983749", "user_id": "u581625805"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "import java.io.*;\nimport java.util.*;\n\nclass FastScanner {\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n }else{\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}\n private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}\n public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}\n public String next() {\n if (!hasNext()) throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while(isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n public long nextLong() {\n if (!hasNext()) throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while(true){\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n }else if(b == -1 || !isPrintableChar(b)){\n return minus ? -n : n;\n }else{\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }\n public double nextDouble() { return Double.parseDouble(next());}\n}\n\nclass Main{\n public static void main(String[] args){ new Main().solve();}\n \n static FastScanner scan = new FastScanner();\n static final int MOD = 1_000_000_007;\n static final int INF = 2147483647;\n static final long LINF = 9223372036854775807L;\n\n // Scanner\n int ni(){return scan.nextInt();}\n int[] ni(int n){int[] a = new int[n]; for(int i = 0; i < n; i++){a[i] = ni();} return a;}\n int[][] ni(int y, int x){int[][] a = new int[y][x];\n for(int i = 0; i < y; i++){for(int j = 0; j < x; j++){a[i][j] = ni();}} return a;}\n long nl(){return scan.nextLong();}\n long[] nl(int n){long[] a = new long[n]; for(int i = 0; i < n; i++){a[i] = nl();} return a;}\n long[][] nl(int y, int x){long[][] a = new long[y][x];\n for(int i = 0; i < y; i++){for(int j = 0; j < x; j++){a[i][j] = nl();}} return a;}\n String ns(){return scan.next();}\n String[] ns(int n){String[] a = new String[n]; for(int i = 0; i < n; i++){a[i] = ns();} return a;}\n String[][] ns(int y, int x){String[][] a = new String[y][x];\n for(int i = 0; i < y; i++){for(int j = 0; j < x; j++){a[i][j] = ns();}} return a;}\n\n // Math\n int max(int a, int b){return Math.max(a, b);}\n long max(long a, long b){return Math.max(a, b);}\n double max(double a, double b){return Math.max(a, b);}\n int max(int[] a){int max = a[0]; for(int value:a){max = max(max,value);} return max;}\n long max(long[] a){long max = a[0]; for(long value:a){max = max(max,value);} return max;}\n double max(double[] a){double max = a[0]; for(double value:a){max = max(max,value);} return max;}\n int min(int a, int b){return Math.min(a, b);}\n long min(long a, long b){return Math.min(a, b);}\n double min(double a, double b){return Math.min(a, b);}\n int min(int[] a){int min = a[0]; for(int value:a){min = min(min,value);} return min;}\n long min(long[] a){long min = a[0]; for(long value:a){min = min(min,value);} return min;}\n double min(double[] a){double min = a[0]; for(double value:a){min = min(min,value);} return min;}\n long sum(int[] a){long sum = 0; for(int value:a){sum += value;} return sum;}\n long sum(long[] a){long sum = 0; for(long value:a){sum += value;} return sum;}\n double sum(double[] a){double sum = 0; for(double value:a){sum += value;} return sum;}\n int gcd(int a, int b){return b == 0 ? a : gcd(b, a % b);}\n long gcd(long a, long b){return b == 0 ? a : gcd(b, a % b);}\n int lcm(int a, int b){return a / gcd(a, b) * b;}\n long lcm(long a, long b){return a / gcd(a, b) * b;}\n\n // Array\n void sort(int[] a){ Arrays.sort(a);}\n void sort(long[] a){ Arrays.sort(a);}\n void sort(double[] a){ Arrays.sort(a);}\n void sort(String[] a){ Arrays.sort(a);}\n int[] reverse(int[] a){\n int[] reversed = new int[a.length];\n for(int i = 0; i < a.length; i++){\n reversed[a.length - i - 1] = a[i];\n }\n return reversed;\n }\n long[] reverse(long[] a){\n long[] reversed = new long[a.length];\n for(int i = 0; i < a.length; i++){\n reversed[a.length - i - 1] = a[i];\n }\n return reversed;\n }\n double[] reverse(double[] a){\n double[] reversed = new double[a.length];\n for(int i = 0; i < a.length; i++){\n reversed[a.length - i - 1] = a[i];\n }\n return reversed;\n }\n String[] reverse(String[] a){\n String[] reversed = new String[a.length];\n for(int i = 0; i < a.length; i++){\n reversed[a.length - i - 1] = a[i];\n }\n return reversed;\n }\n boolean[] reverse(boolean[] a){\n boolean[] reversed = new boolean[a.length];\n for(int i = 0; i < a.length; i++){\n reversed[a.length - i - 1] = a[i];\n }\n return reversed;\n }\n void fill(int[] array, int x) { Arrays.fill(array, x); }\n void fill(long[] array, long x) { Arrays.fill(array, x); }\n void fill(double[] array, double x) { Arrays.fill(array, x); }\n void fill(boolean[] array, boolean x) { Arrays.fill(array, x); }\n void fill(int[][] array, int x) { for(int a[] : array) { fill(a, x); } }\n void fill(long[][] array, long x) { for(long a[] : array) { fill(a, x); } }\n void fill(double[][] array, double x) { for(double a[] : array) { fill(a, x); } }\n void fill(boolean[][] array, boolean x) { for(boolean a[] : array) { fill(a, x); } }\n\n\n\n public void solve(){\n int n = ni();\n int m = ni();\n long[] a = nl(n);\n\n while(m > 0){\n sort(a);\n a[n-1] /= 2;\n m--;\n }\n\n System.out.println(sum(a));\n \n }\n}", "problem_context": "Score : 400 points\n\nProblem Statement\n\nTakahashi is going to buy N items one by one.\n\nThe price of the i-th item he buys is A_i yen (the currency of Japan).\n\nHe has M discount tickets, and he can use any number of them when buying an item.\n\nIf Y tickets are used when buying an item priced X yen, he can get the item for \\frac{X}{2^Y} (rounded down to the nearest integer) yen.\n\nWhat is the minimum amount of money required to buy all the items?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\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 amount of money required to buy all the items.\n\nSample Input 1\n\n3 3\n2 13 8\n\nSample Output 1\n\n9\n\nWe can buy all the items for 9 yen, as follows:\n\nBuy the 1-st item for 2 yen without tickets.\n\nBuy the 2-nd item for 3 yen with 2 tickets.\n\nBuy the 3-rd item for 4 yen with 1 ticket.\n\nSample Input 2\n\n4 4\n1 9 3 5\n\nSample Output 2\n\n6\n\nSample Input 3\n\n1 100000\n1000000000\n\nSample Output 3\n\n0\n\nWe can buy the item priced 1000000000 yen for 0 yen with 100000 tickets.\n\nSample Input 4\n\n10 1\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 4\n\n9500000000", "sample_input": "3 3\n2 13 8\n"}, "reference_outputs": ["9\n"], "source_document_id": "p02912", "source_text": "Score : 400 points\n\nProblem Statement\n\nTakahashi is going to buy N items one by one.\n\nThe price of the i-th item he buys is A_i yen (the currency of Japan).\n\nHe has M discount tickets, and he can use any number of them when buying an item.\n\nIf Y tickets are used when buying an item priced X yen, he can get the item for \\frac{X}{2^Y} (rounded down to the nearest integer) yen.\n\nWhat is the minimum amount of money required to buy all the items?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\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 amount of money required to buy all the items.\n\nSample Input 1\n\n3 3\n2 13 8\n\nSample Output 1\n\n9\n\nWe can buy all the items for 9 yen, as follows:\n\nBuy the 1-st item for 2 yen without tickets.\n\nBuy the 2-nd item for 3 yen with 2 tickets.\n\nBuy the 3-rd item for 4 yen with 1 ticket.\n\nSample Input 2\n\n4 4\n1 9 3 5\n\nSample Output 2\n\n6\n\nSample Input 3\n\n1 100000\n1000000000\n\nSample Output 3\n\n0\n\nWe can buy the item priced 1000000000 yen for 0 yen with 100000 tickets.\n\nSample Input 4\n\n10 1\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 4\n\n9500000000", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 6748, "cpu_time_ms": 2110, "memory_kb": 346800}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s206749737", "group_id": "codeNet:p02912", "input_text": "import java.util.*;\nimport java.io.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n // Your code here!\n \n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n String[] stdR1 = br.readLine().split(\" \");\n int N = Integer.parseInt(stdR1[0]);\n int M = Integer.parseInt(stdR1[1]);\n \n String[] stdR2 = br.readLine().split(\" \");\n PowerfulDiscountTickets pdt = new PowerfulDiscountTickets(N, M);\n \n for(int i = 0; i < N; i++){\n pdt.goods[i] = Integer.parseInt(stdR2[i]);\n }\n \n System.out.println(pdt.binarySearch());\n }\n}\n\nclass PowerfulDiscountTickets{\n int N;\n int M;\n int[] goods;\n \n public PowerfulDiscountTickets(int N, int M){\n this.N = N;\n this.M = M;\n goods = new int[N];\n }\n \n public long binarySearch(){\n long left = -1;\n long right = 100_000_000_000_000L;\n \n while(right - left > 1){\n long mid = (left + right) / 2;\n if(isOK(mid)){\n right = mid;\n }else{\n left = mid;\n }\n }\n \n return right;\n }\n \n private boolean isOK(long price){\n \n int[] goods2 = goods.clone();\n Arrays.sort(goods2);\n \n long sum = 0;\n for(int i = 0; i < N; i++){\n sum += goods2[i];\n }\n \n for(int i = 0; i < M; i++){\n int before = goods2[N-1];\n goods2[N-1] /= 2;\n sum = sum - before + goods2[N-1];\n if( sum <= price ) break;\n Arrays.sort(goods2);\n }\n \n return sum <= price;\n }\n \n\n}\n\n\n", "language": "Java", "metadata": {"date": 1572992220, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02912.html", "problem_id": "p02912", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02912/input.txt", "sample_output_relpath": "derived/input_output/data/p02912/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02912/Java/s206749737.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s206749737", "user_id": "u428922728"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n // Your code here!\n \n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n String[] stdR1 = br.readLine().split(\" \");\n int N = Integer.parseInt(stdR1[0]);\n int M = Integer.parseInt(stdR1[1]);\n \n String[] stdR2 = br.readLine().split(\" \");\n PowerfulDiscountTickets pdt = new PowerfulDiscountTickets(N, M);\n \n for(int i = 0; i < N; i++){\n pdt.goods[i] = Integer.parseInt(stdR2[i]);\n }\n \n System.out.println(pdt.binarySearch());\n }\n}\n\nclass PowerfulDiscountTickets{\n int N;\n int M;\n int[] goods;\n \n public PowerfulDiscountTickets(int N, int M){\n this.N = N;\n this.M = M;\n goods = new int[N];\n }\n \n public long binarySearch(){\n long left = -1;\n long right = 100_000_000_000_000L;\n \n while(right - left > 1){\n long mid = (left + right) / 2;\n if(isOK(mid)){\n right = mid;\n }else{\n left = mid;\n }\n }\n \n return right;\n }\n \n private boolean isOK(long price){\n \n int[] goods2 = goods.clone();\n Arrays.sort(goods2);\n \n long sum = 0;\n for(int i = 0; i < N; i++){\n sum += goods2[i];\n }\n \n for(int i = 0; i < M; i++){\n int before = goods2[N-1];\n goods2[N-1] /= 2;\n sum = sum - before + goods2[N-1];\n if( sum <= price ) break;\n Arrays.sort(goods2);\n }\n \n return sum <= price;\n }\n \n\n}\n\n\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nTakahashi is going to buy N items one by one.\n\nThe price of the i-th item he buys is A_i yen (the currency of Japan).\n\nHe has M discount tickets, and he can use any number of them when buying an item.\n\nIf Y tickets are used when buying an item priced X yen, he can get the item for \\frac{X}{2^Y} (rounded down to the nearest integer) yen.\n\nWhat is the minimum amount of money required to buy all the items?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\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 amount of money required to buy all the items.\n\nSample Input 1\n\n3 3\n2 13 8\n\nSample Output 1\n\n9\n\nWe can buy all the items for 9 yen, as follows:\n\nBuy the 1-st item for 2 yen without tickets.\n\nBuy the 2-nd item for 3 yen with 2 tickets.\n\nBuy the 3-rd item for 4 yen with 1 ticket.\n\nSample Input 2\n\n4 4\n1 9 3 5\n\nSample Output 2\n\n6\n\nSample Input 3\n\n1 100000\n1000000000\n\nSample Output 3\n\n0\n\nWe can buy the item priced 1000000000 yen for 0 yen with 100000 tickets.\n\nSample Input 4\n\n10 1\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 4\n\n9500000000", "sample_input": "3 3\n2 13 8\n"}, "reference_outputs": ["9\n"], "source_document_id": "p02912", "source_text": "Score : 400 points\n\nProblem Statement\n\nTakahashi is going to buy N items one by one.\n\nThe price of the i-th item he buys is A_i yen (the currency of Japan).\n\nHe has M discount tickets, and he can use any number of them when buying an item.\n\nIf Y tickets are used when buying an item priced X yen, he can get the item for \\frac{X}{2^Y} (rounded down to the nearest integer) yen.\n\nWhat is the minimum amount of money required to buy all the items?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\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 amount of money required to buy all the items.\n\nSample Input 1\n\n3 3\n2 13 8\n\nSample Output 1\n\n9\n\nWe can buy all the items for 9 yen, as follows:\n\nBuy the 1-st item for 2 yen without tickets.\n\nBuy the 2-nd item for 3 yen with 2 tickets.\n\nBuy the 3-rd item for 4 yen with 1 ticket.\n\nSample Input 2\n\n4 4\n1 9 3 5\n\nSample Output 2\n\n6\n\nSample Input 3\n\n1 100000\n1000000000\n\nSample Output 3\n\n0\n\nWe can buy the item priced 1000000000 yen for 0 yen with 100000 tickets.\n\nSample Input 4\n\n10 1\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 4\n\n9500000000", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1759, "cpu_time_ms": 2110, "memory_kb": 347884}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s508415340", "group_id": "codeNet:p02912", "input_text": "import java.util.Scanner;\n\n/**\n *\n * @author cs18097\n */\npublic class Main {\n //abc141 d\n\n /**\n * @param args the command line arguments\n */\n public static void main(String[] args) {\n // TODO code application logic here\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int num = sc.nextInt();\n int ary[] = new int[n];\n for(int i = 0;i < ary.length;i++) ary[i] = sc.nextInt();\n while(num > 0){\n int k = 0;\n int max = -1;\n for(int j = 0;j 0){\n int k = 0;\n int max = -1;\n for(int j = 0;j A = new PriorityQueue<>(Comparator.reverseOrder());\n for(int i = 0 ; i < N ; i++){\n A.add(sc.nextInt());\n }\n solve(N, M, A);\n }\n\n static void solve(long N, long M, PriorityQueue A){\n for (int i = 0; i < M; i++) {\n int max = A.poll();\n A.offer(max/2);\n }\n long ans = 0;\n for (int i : A) {\n ans += i;\n }\n System.out.println(ans);\n }\n}\n", "language": "Java", "metadata": {"date": 1569276941, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02912.html", "problem_id": "p02912", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02912/input.txt", "sample_output_relpath": "derived/input_output/data/p02912/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02912/Java/s565016344.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s565016344", "user_id": "u302684639"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "import java.io.*;\nimport java.util.*;\n\n@SuppressWarnings(\"unused\")\nclass Main {\n\n // Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\n public static void main(String[] args) throws Exception {\n final Scanner sc = new Scanner(System.in);\n long N;\n N = sc.nextLong();\n long M;\n M = sc.nextLong();\n\n PriorityQueue A = new PriorityQueue<>(Comparator.reverseOrder());\n for(int i = 0 ; i < N ; i++){\n A.add(sc.nextInt());\n }\n solve(N, M, A);\n }\n\n static void solve(long N, long M, PriorityQueue A){\n for (int i = 0; i < M; i++) {\n int max = A.poll();\n A.offer(max/2);\n }\n long ans = 0;\n for (int i : A) {\n ans += i;\n }\n System.out.println(ans);\n }\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nTakahashi is going to buy N items one by one.\n\nThe price of the i-th item he buys is A_i yen (the currency of Japan).\n\nHe has M discount tickets, and he can use any number of them when buying an item.\n\nIf Y tickets are used when buying an item priced X yen, he can get the item for \\frac{X}{2^Y} (rounded down to the nearest integer) yen.\n\nWhat is the minimum amount of money required to buy all the items?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\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 amount of money required to buy all the items.\n\nSample Input 1\n\n3 3\n2 13 8\n\nSample Output 1\n\n9\n\nWe can buy all the items for 9 yen, as follows:\n\nBuy the 1-st item for 2 yen without tickets.\n\nBuy the 2-nd item for 3 yen with 2 tickets.\n\nBuy the 3-rd item for 4 yen with 1 ticket.\n\nSample Input 2\n\n4 4\n1 9 3 5\n\nSample Output 2\n\n6\n\nSample Input 3\n\n1 100000\n1000000000\n\nSample Output 3\n\n0\n\nWe can buy the item priced 1000000000 yen for 0 yen with 100000 tickets.\n\nSample Input 4\n\n10 1\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 4\n\n9500000000", "sample_input": "3 3\n2 13 8\n"}, "reference_outputs": ["9\n"], "source_document_id": "p02912", "source_text": "Score : 400 points\n\nProblem Statement\n\nTakahashi is going to buy N items one by one.\n\nThe price of the i-th item he buys is A_i yen (the currency of Japan).\n\nHe has M discount tickets, and he can use any number of them when buying an item.\n\nIf Y tickets are used when buying an item priced X yen, he can get the item for \\frac{X}{2^Y} (rounded down to the nearest integer) yen.\n\nWhat is the minimum amount of money required to buy all the items?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\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 amount of money required to buy all the items.\n\nSample Input 1\n\n3 3\n2 13 8\n\nSample Output 1\n\n9\n\nWe can buy all the items for 9 yen, as follows:\n\nBuy the 1-st item for 2 yen without tickets.\n\nBuy the 2-nd item for 3 yen with 2 tickets.\n\nBuy the 3-rd item for 4 yen with 1 ticket.\n\nSample Input 2\n\n4 4\n1 9 3 5\n\nSample Output 2\n\n6\n\nSample Input 3\n\n1 100000\n1000000000\n\nSample Output 3\n\n0\n\nWe can buy the item priced 1000000000 yen for 0 yen with 100000 tickets.\n\nSample Input 4\n\n10 1\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 4\n\n9500000000", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 941, "cpu_time_ms": 552, "memory_kb": 51464}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s093550494", "group_id": "codeNet:p02912", "input_text": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.Collections;\nimport java.util.PriorityQueue;\nimport java.util.StringTokenizer;\n\nclass Main {\n static Scanner sc = new Scanner();\n\n public static void main(final String[] args) throws IOException {\n int n = sc.nextInt();\n int m = sc.nextInt();\n PriorityQueue pq = new PriorityQueue<>(Collections.reverseOrder());\n\n for (int i = 0; i < n; i++) {\n pq.add(sc.nextInt());\n }\n for (int i = 0; i < m; i++) {\n int first = (int) pq.poll();\n first = first/2;\n pq.add(first);\n }\n int ans = 0;\n for (int i = 0; i < n; i++) {\n ans += (int)pq.poll();\n }\n System.out.println(ans);\n }\n\n static class Scanner {\n BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);\n StringTokenizer tokenizer;\n String next() throws IOException {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n tokenizer = new StringTokenizer(reader.readLine());\n }\n return tokenizer.nextToken();\n }\n int nextInt() throws IOException {\n return Integer.parseInt(next());\n }\n long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1568755368, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02912.html", "problem_id": "p02912", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02912/input.txt", "sample_output_relpath": "derived/input_output/data/p02912/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02912/Java/s093550494.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s093550494", "user_id": "u087831989"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.Collections;\nimport java.util.PriorityQueue;\nimport java.util.StringTokenizer;\n\nclass Main {\n static Scanner sc = new Scanner();\n\n public static void main(final String[] args) throws IOException {\n int n = sc.nextInt();\n int m = sc.nextInt();\n PriorityQueue pq = new PriorityQueue<>(Collections.reverseOrder());\n\n for (int i = 0; i < n; i++) {\n pq.add(sc.nextInt());\n }\n for (int i = 0; i < m; i++) {\n int first = (int) pq.poll();\n first = first/2;\n pq.add(first);\n }\n int ans = 0;\n for (int i = 0; i < n; i++) {\n ans += (int)pq.poll();\n }\n System.out.println(ans);\n }\n\n static class Scanner {\n BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);\n StringTokenizer tokenizer;\n String next() throws IOException {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n tokenizer = new StringTokenizer(reader.readLine());\n }\n return tokenizer.nextToken();\n }\n int nextInt() throws IOException {\n return Integer.parseInt(next());\n }\n long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n }\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nTakahashi is going to buy N items one by one.\n\nThe price of the i-th item he buys is A_i yen (the currency of Japan).\n\nHe has M discount tickets, and he can use any number of them when buying an item.\n\nIf Y tickets are used when buying an item priced X yen, he can get the item for \\frac{X}{2^Y} (rounded down to the nearest integer) yen.\n\nWhat is the minimum amount of money required to buy all the items?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\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 amount of money required to buy all the items.\n\nSample Input 1\n\n3 3\n2 13 8\n\nSample Output 1\n\n9\n\nWe can buy all the items for 9 yen, as follows:\n\nBuy the 1-st item for 2 yen without tickets.\n\nBuy the 2-nd item for 3 yen with 2 tickets.\n\nBuy the 3-rd item for 4 yen with 1 ticket.\n\nSample Input 2\n\n4 4\n1 9 3 5\n\nSample Output 2\n\n6\n\nSample Input 3\n\n1 100000\n1000000000\n\nSample Output 3\n\n0\n\nWe can buy the item priced 1000000000 yen for 0 yen with 100000 tickets.\n\nSample Input 4\n\n10 1\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 4\n\n9500000000", "sample_input": "3 3\n2 13 8\n"}, "reference_outputs": ["9\n"], "source_document_id": "p02912", "source_text": "Score : 400 points\n\nProblem Statement\n\nTakahashi is going to buy N items one by one.\n\nThe price of the i-th item he buys is A_i yen (the currency of Japan).\n\nHe has M discount tickets, and he can use any number of them when buying an item.\n\nIf Y tickets are used when buying an item priced X yen, he can get the item for \\frac{X}{2^Y} (rounded down to the nearest integer) yen.\n\nWhat is the minimum amount of money required to buy all the items?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\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 amount of money required to buy all the items.\n\nSample Input 1\n\n3 3\n2 13 8\n\nSample Output 1\n\n9\n\nWe can buy all the items for 9 yen, as follows:\n\nBuy the 1-st item for 2 yen without tickets.\n\nBuy the 2-nd item for 3 yen with 2 tickets.\n\nBuy the 3-rd item for 4 yen with 1 ticket.\n\nSample Input 2\n\n4 4\n1 9 3 5\n\nSample Output 2\n\n6\n\nSample Input 3\n\n1 100000\n1000000000\n\nSample Output 3\n\n0\n\nWe can buy the item priced 1000000000 yen for 0 yen with 100000 tickets.\n\nSample Input 4\n\n10 1\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 4\n\n9500000000", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1427, "cpu_time_ms": 300, "memory_kb": 45376}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s420956631", "group_id": "codeNet:p02912", "input_text": "import java.util.*;\npublic class Main {\n\tpublic static void main(String args[]) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tint M = sc.nextInt();\n\t\tint A[] = new int[N];\n\t\tPriorityQueue pq = new PriorityQueue(Collections.reverseOrder());;\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tA[i] = sc.nextInt();\n\t\t\tpq.add((double)A[i]);\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < M; i++) {\n\t\t\tdouble temp = pq.poll();\n\t\t\ttemp = temp / 2;\n\t\t\tpq.add(temp);\n\t\t}\n\t\t\n\t\tlong ans = 0;\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tans += Math.floor(pq.poll());\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}\n", "language": "Java", "metadata": {"date": 1568686033, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02912.html", "problem_id": "p02912", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02912/input.txt", "sample_output_relpath": "derived/input_output/data/p02912/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02912/Java/s420956631.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s420956631", "user_id": "u861755736"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n\tpublic static void main(String args[]) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tint M = sc.nextInt();\n\t\tint A[] = new int[N];\n\t\tPriorityQueue pq = new PriorityQueue(Collections.reverseOrder());;\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tA[i] = sc.nextInt();\n\t\t\tpq.add((double)A[i]);\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < M; i++) {\n\t\t\tdouble temp = pq.poll();\n\t\t\ttemp = temp / 2;\n\t\t\tpq.add(temp);\n\t\t}\n\t\t\n\t\tlong ans = 0;\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tans += Math.floor(pq.poll());\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nTakahashi is going to buy N items one by one.\n\nThe price of the i-th item he buys is A_i yen (the currency of Japan).\n\nHe has M discount tickets, and he can use any number of them when buying an item.\n\nIf Y tickets are used when buying an item priced X yen, he can get the item for \\frac{X}{2^Y} (rounded down to the nearest integer) yen.\n\nWhat is the minimum amount of money required to buy all the items?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\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 amount of money required to buy all the items.\n\nSample Input 1\n\n3 3\n2 13 8\n\nSample Output 1\n\n9\n\nWe can buy all the items for 9 yen, as follows:\n\nBuy the 1-st item for 2 yen without tickets.\n\nBuy the 2-nd item for 3 yen with 2 tickets.\n\nBuy the 3-rd item for 4 yen with 1 ticket.\n\nSample Input 2\n\n4 4\n1 9 3 5\n\nSample Output 2\n\n6\n\nSample Input 3\n\n1 100000\n1000000000\n\nSample Output 3\n\n0\n\nWe can buy the item priced 1000000000 yen for 0 yen with 100000 tickets.\n\nSample Input 4\n\n10 1\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 4\n\n9500000000", "sample_input": "3 3\n2 13 8\n"}, "reference_outputs": ["9\n"], "source_document_id": "p02912", "source_text": "Score : 400 points\n\nProblem Statement\n\nTakahashi is going to buy N items one by one.\n\nThe price of the i-th item he buys is A_i yen (the currency of Japan).\n\nHe has M discount tickets, and he can use any number of them when buying an item.\n\nIf Y tickets are used when buying an item priced X yen, he can get the item for \\frac{X}{2^Y} (rounded down to the nearest integer) yen.\n\nWhat is the minimum amount of money required to buy all the items?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\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 amount of money required to buy all the items.\n\nSample Input 1\n\n3 3\n2 13 8\n\nSample Output 1\n\n9\n\nWe can buy all the items for 9 yen, as follows:\n\nBuy the 1-st item for 2 yen without tickets.\n\nBuy the 2-nd item for 3 yen with 2 tickets.\n\nBuy the 3-rd item for 4 yen with 1 ticket.\n\nSample Input 2\n\n4 4\n1 9 3 5\n\nSample Output 2\n\n6\n\nSample Input 3\n\n1 100000\n1000000000\n\nSample Output 3\n\n0\n\nWe can buy the item priced 1000000000 yen for 0 yen with 100000 tickets.\n\nSample Input 4\n\n10 1\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 4\n\n9500000000", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 652, "memory_kb": 62236}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s304852501", "group_id": "codeNet:p02912", "input_text": "import java.util.*;\n\npublic class Main {\n\n\tpublic static void main (String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint m = sc.nextInt();\n\t\tPriorityQueue queue = new PriorityQueue(new Comparator() {\n\t\tpublic int compare(Integer i1, Integer i2) {\n\t\t\treturn i2.intValue() - i1.intValue();\n\t\t}\n\t\t});\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tqueue.add(sc.nextInt());\n\t\t}\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tint x = queue.poll();\n\t\t\tqueue.add(x / 2);\n\t\t}\n\t\tlong total = 0;\n\t\twhile (queue.size() > 0) {\n\t\t\ttotal += queue.poll();\n\t\t}\n\t\tSystem.out.println(total);\n\t}\n}\n", "language": "Java", "metadata": {"date": 1568673280, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02912.html", "problem_id": "p02912", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02912/input.txt", "sample_output_relpath": "derived/input_output/data/p02912/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02912/Java/s304852501.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s304852501", "user_id": "u575909439"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n\n\tpublic static void main (String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint m = sc.nextInt();\n\t\tPriorityQueue queue = new PriorityQueue(new Comparator() {\n\t\tpublic int compare(Integer i1, Integer i2) {\n\t\t\treturn i2.intValue() - i1.intValue();\n\t\t}\n\t\t});\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tqueue.add(sc.nextInt());\n\t\t}\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tint x = queue.poll();\n\t\t\tqueue.add(x / 2);\n\t\t}\n\t\tlong total = 0;\n\t\twhile (queue.size() > 0) {\n\t\t\ttotal += queue.poll();\n\t\t}\n\t\tSystem.out.println(total);\n\t}\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nTakahashi is going to buy N items one by one.\n\nThe price of the i-th item he buys is A_i yen (the currency of Japan).\n\nHe has M discount tickets, and he can use any number of them when buying an item.\n\nIf Y tickets are used when buying an item priced X yen, he can get the item for \\frac{X}{2^Y} (rounded down to the nearest integer) yen.\n\nWhat is the minimum amount of money required to buy all the items?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\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 amount of money required to buy all the items.\n\nSample Input 1\n\n3 3\n2 13 8\n\nSample Output 1\n\n9\n\nWe can buy all the items for 9 yen, as follows:\n\nBuy the 1-st item for 2 yen without tickets.\n\nBuy the 2-nd item for 3 yen with 2 tickets.\n\nBuy the 3-rd item for 4 yen with 1 ticket.\n\nSample Input 2\n\n4 4\n1 9 3 5\n\nSample Output 2\n\n6\n\nSample Input 3\n\n1 100000\n1000000000\n\nSample Output 3\n\n0\n\nWe can buy the item priced 1000000000 yen for 0 yen with 100000 tickets.\n\nSample Input 4\n\n10 1\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 4\n\n9500000000", "sample_input": "3 3\n2 13 8\n"}, "reference_outputs": ["9\n"], "source_document_id": "p02912", "source_text": "Score : 400 points\n\nProblem Statement\n\nTakahashi is going to buy N items one by one.\n\nThe price of the i-th item he buys is A_i yen (the currency of Japan).\n\nHe has M discount tickets, and he can use any number of them when buying an item.\n\nIf Y tickets are used when buying an item priced X yen, he can get the item for \\frac{X}{2^Y} (rounded down to the nearest integer) yen.\n\nWhat is the minimum amount of money required to buy all the items?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\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 amount of money required to buy all the items.\n\nSample Input 1\n\n3 3\n2 13 8\n\nSample Output 1\n\n9\n\nWe can buy all the items for 9 yen, as follows:\n\nBuy the 1-st item for 2 yen without tickets.\n\nBuy the 2-nd item for 3 yen with 2 tickets.\n\nBuy the 3-rd item for 4 yen with 1 ticket.\n\nSample Input 2\n\n4 4\n1 9 3 5\n\nSample Output 2\n\n6\n\nSample Input 3\n\n1 100000\n1000000000\n\nSample Output 3\n\n0\n\nWe can buy the item priced 1000000000 yen for 0 yen with 100000 tickets.\n\nSample Input 4\n\n10 1\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 4\n\n9500000000", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 593, "memory_kb": 61364}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s358730003", "group_id": "codeNet:p02912", "input_text": "import java.util.*;\n\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n int m = sc.nextInt();\n\n int[] a = new int[n];\n\n// for (int i=0; i pq = new PriorityQueue<>();\n\n for (int i=0; i pq = new PriorityQueue<>();\n\n for (int i=0; i comp = Comparator.comparingDouble(d->d.doubleValue());\n PriorityQueue pq = new PriorityQueue<>(comp.reversed());\n\n try (Scanner sc = new Scanner(System.in)) {\n N = sc.nextInt();\n M = sc.nextInt();\n\n Ai = new long[N];\n for (int i = 0; i < Ai.length; i++) {\n Ai[i] = sc.nextLong();\n }\n }\n for(long l : Ai){\n pq.add((double) l);\n }\n Double d ;\n while(M >0){\n d = pq.poll();\n double temp = d/2;\n pq.add(temp);\n M--;\n }\n long result = 0;\n while((d = pq.poll()) != null){\n result += Math.floor(d);\n }\n System.out.println(result);\n }\n}\n", "language": "Java", "metadata": {"date": 1568597966, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02912.html", "problem_id": "p02912", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02912/input.txt", "sample_output_relpath": "derived/input_output/data/p02912/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02912/Java/s136315580.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s136315580", "user_id": "u499889187"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "import java.util.Comparator;\nimport java.util.PriorityQueue;\nimport java.util.Scanner;\n\npublic class Main {\n public static void debug(String str) {\n System.out.println(str);\n }\n\n public static void main(String[] args) {\n\n int N;\n int M;\n long[] Ai;\n\n Comparator comp = Comparator.comparingDouble(d->d.doubleValue());\n PriorityQueue pq = new PriorityQueue<>(comp.reversed());\n\n try (Scanner sc = new Scanner(System.in)) {\n N = sc.nextInt();\n M = sc.nextInt();\n\n Ai = new long[N];\n for (int i = 0; i < Ai.length; i++) {\n Ai[i] = sc.nextLong();\n }\n }\n for(long l : Ai){\n pq.add((double) l);\n }\n Double d ;\n while(M >0){\n d = pq.poll();\n double temp = d/2;\n pq.add(temp);\n M--;\n }\n long result = 0;\n while((d = pq.poll()) != null){\n result += Math.floor(d);\n }\n System.out.println(result);\n }\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nTakahashi is going to buy N items one by one.\n\nThe price of the i-th item he buys is A_i yen (the currency of Japan).\n\nHe has M discount tickets, and he can use any number of them when buying an item.\n\nIf Y tickets are used when buying an item priced X yen, he can get the item for \\frac{X}{2^Y} (rounded down to the nearest integer) yen.\n\nWhat is the minimum amount of money required to buy all the items?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\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 amount of money required to buy all the items.\n\nSample Input 1\n\n3 3\n2 13 8\n\nSample Output 1\n\n9\n\nWe can buy all the items for 9 yen, as follows:\n\nBuy the 1-st item for 2 yen without tickets.\n\nBuy the 2-nd item for 3 yen with 2 tickets.\n\nBuy the 3-rd item for 4 yen with 1 ticket.\n\nSample Input 2\n\n4 4\n1 9 3 5\n\nSample Output 2\n\n6\n\nSample Input 3\n\n1 100000\n1000000000\n\nSample Output 3\n\n0\n\nWe can buy the item priced 1000000000 yen for 0 yen with 100000 tickets.\n\nSample Input 4\n\n10 1\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 4\n\n9500000000", "sample_input": "3 3\n2 13 8\n"}, "reference_outputs": ["9\n"], "source_document_id": "p02912", "source_text": "Score : 400 points\n\nProblem Statement\n\nTakahashi is going to buy N items one by one.\n\nThe price of the i-th item he buys is A_i yen (the currency of Japan).\n\nHe has M discount tickets, and he can use any number of them when buying an item.\n\nIf Y tickets are used when buying an item priced X yen, he can get the item for \\frac{X}{2^Y} (rounded down to the nearest integer) yen.\n\nWhat is the minimum amount of money required to buy all the items?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\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 amount of money required to buy all the items.\n\nSample Input 1\n\n3 3\n2 13 8\n\nSample Output 1\n\n9\n\nWe can buy all the items for 9 yen, as follows:\n\nBuy the 1-st item for 2 yen without tickets.\n\nBuy the 2-nd item for 3 yen with 2 tickets.\n\nBuy the 3-rd item for 4 yen with 1 ticket.\n\nSample Input 2\n\n4 4\n1 9 3 5\n\nSample Output 2\n\n6\n\nSample Input 3\n\n1 100000\n1000000000\n\nSample Output 3\n\n0\n\nWe can buy the item priced 1000000000 yen for 0 yen with 100000 tickets.\n\nSample Input 4\n\n10 1\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 4\n\n9500000000", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1074, "cpu_time_ms": 738, "memory_kb": 61680}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s211338841", "group_id": "codeNet:p02913", "input_text": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n\tstatic void solve() {\n\t\tint n = ni();\n\t\tchar s[] = ns(n);\n\t\tint dp[][] = new int[n+1][n+1];\n\t\tfor(int i=n-1;i>=0;i--) {\n\t\t\tfor(int j=n-1;j>=0;j--) {\n\t\t\t\tif(s[i] == s[j]) {\n\t\t\t\t\tdp[i][j] = dp[i+1][j+1] + 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tlong ans = 0;\n\t\tfor(int i=0;i void reverse(List ls) {\n\t\tint sz = ls.size();\n\t\tfor (int i = 0; i < sz / 2; i++) {\n\t\t\tT t = ls.get(i);\n\t\t\tls.set(i, ls.get(sz - 1 - i));\n\t\t\tls.set(sz - 1 - i, t);\n\t\t}\n\t}\n\n\tstatic void reverse(T[] ar) {\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tT t = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = t;\n\t\t}\n\t}\n\n\tstatic void sbnl() {//StringBuilderに改行文字をappendする\n\t\tsb.append(\"\\n\");\n\t}\n\n\tstatic int lowerBound(int[] a, int x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] < x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int upperBound(int[] a, int x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] <= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rlowerBound(int[] a, int x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] > x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rupperBound(int[] a, int x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] >= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int lowerBound(long[] a, long x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] < x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int upperBound(long[] a, long x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] <= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rlowerBound(long[] a, long x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] > x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rupperBound(long[] a, long x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] >= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int lowerBound(double[] a, double x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] < x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int upperBound(double[] a, double x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] <= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rlowerBound(double[] a, double x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] > x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rupperBound(double[] a, double x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] >= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int lowerBound(char[] a, char x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] < x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int upperBound(char[] a, char x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] <= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rlowerBound(char[] a, char x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] > x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rupperBound(char[] a, char x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] >= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int lowerBound(List ls, T x) throws RuntimeException {\n\t\tif (ls.size() == 0)\n\t\t\treturn -1;\n\t\tif (ls.get(0) instanceof Integer) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) >= 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Long) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) >= 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Double) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) >= 0 ? 1 : -1);\n\t\t} else {\n\t\t\tSystem.err.println(\n\t\t\t\t\tString.format(\"%s:数値でないリストを二分探索しています。\", Thread.currentThread().getStackTrace()[1].getMethodName()));\n\t\t\tthrow new RuntimeException();\n\t\t}\n\t}\n\n\tstatic int upperBound(List ls, T x) throws RuntimeException {\n\t\tif (ls.size() == 0)\n\t\t\treturn -1;\n\t\tif (ls.get(0) instanceof Integer) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) > 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Long) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) > 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Double) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) > 0 ? 1 : -1);\n\t\t} else {\n\t\t\tSystem.err.println(\n\t\t\t\t\tString.format(\"%s:数値でないリストを二分探索しています。\", Thread.currentThread().getStackTrace()[1].getMethodName()));\n\t\t\tthrow new RuntimeException();\n\t\t}\n\t}\n\n\tstatic int rupperBound(List ls, T x) throws RuntimeException {\n\t\tif (ls.size() == 0)\n\t\t\treturn -1;\n\t\tif (ls.get(0) instanceof Integer) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) < 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Long) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) < 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Double) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) < 0 ? 1 : -1);\n\t\t} else {\n\t\t\tSystem.err.println(\n\t\t\t\t\tString.format(\"%s:数値でないリストを二分探索しています。\", Thread.currentThread().getStackTrace()[1].getMethodName()));\n\t\t\tthrow new RuntimeException();\n\t\t}\n\t}\n\n\tstatic int rlowerBound(List ls, T x) {\n\t\tif (ls.size() == 0)\n\t\t\treturn -1;\n\t\tif (ls.get(0) instanceof Integer) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) <= 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Long) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) <= 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Double) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) <= 0 ? 1 : -1);\n\t\t} else {\n\t\t\tSystem.err.println(\n\t\t\t\t\tString.format(\"%s:数値でないリストを二分探索しています。\", Thread.currentThread().getStackTrace()[1].getMethodName()));\n\t\t\tthrow new RuntimeException();\n\t\t}\n\t}\n\n\tstatic int[] concat(int x, int arr[]) {\n\t\tint ret[] = new int[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 1, ret.length - 1);\n\t\tret[0] = x;\n\t\treturn ret;\n\t}\n\n\tstatic int[] concat(int arr[], int x) {\n\t\tint ret[] = new int[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 0, ret.length - 1);\n\t\tret[ret.length - 1] = x;\n\t\treturn ret;\n\t}\n\n\tstatic long[] concat(long x, long arr[]) {\n\t\tlong ret[] = new long[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 1, ret.length - 1);\n\t\tret[0] = x;\n\t\treturn ret;\n\t}\n\n\tstatic long[] concat(long arr[], long x) {\n\t\tlong ret[] = new long[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 0, ret.length - 1);\n\t\tret[ret.length - 1] = x;\n\t\treturn ret;\n\t}\n\n\tstatic int max(int x, int y) {\n\t\treturn Math.max(x, y);\n\t}\n\n\tstatic int min(int x, int y) {\n\t\treturn Math.min(x, y);\n\t}\n\n\tstatic int max(int x, int y, int z) {\n\t\tx = Math.max(x, y);\n\t\tx = Math.max(x, z);\n\t\treturn x;\n\t}\n\n\tstatic int min(int x, int y, int z) {\n\t\tx = Math.min(x, y);\n\t\tx = Math.min(x, z);\n\t\treturn x;\n\t}\n\n\tstatic long max(long x, long y) {\n\t\treturn Math.max(x, y);\n\t}\n\n\tstatic long min(long x, long y) {\n\t\treturn Math.min(x, y);\n\t}\n\n\tstatic long max(long x, long y, long z) {\n\t\tx = Math.max(x, y);\n\t\tx = Math.max(x, z);\n\t\treturn x;\n\t}\n\n\tstatic long min(long x, long y, long z) {\n\t\tx = Math.min(x, y);\n\t\tx = Math.min(x, z);\n\t\treturn x;\n\t}\n\n\tstatic double max(double x, double y) {\n\t\treturn Math.max(x, y);\n\t}\n\n\tstatic double min(double x, double y) {\n\t\treturn Math.min(x, y);\n\t}\n\n\tstatic double max(double x, double y, double z) {\n\t\tx = Math.max(x, y);\n\t\tx = Math.max(x, z);\n\t\treturn x;\n\t}\n\n\tstatic double min(double x, double y, double z) {\n\t\tx = Math.min(x, y);\n\t\tx = Math.min(x, z);\n\t\treturn x;\n\t}\n\n\tstatic void sort(int[] ar) {\n\t\tArrays.sort(ar);\n\t}\n\n\tstatic void sort(long[] ar) {\n\t\tArrays.sort(ar);\n\t}\n\n\tstatic void sort(double[] ar) {\n\t\tArrays.sort(ar);\n\t}\n\n\tstatic void sort(char[] ar) {\n\t\tArrays.sort(ar);\n\t}\n\n\tstatic void rsort(int[] ar) {\n\t\tArrays.sort(ar);\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tint tmp = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = tmp;\n\t\t}\n\t}\n\n\tstatic void rsort(long[] ar) {\n\t\tArrays.sort(ar);\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tlong tmp = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = tmp;\n\t\t}\n\t}\n\n\tstatic void rsort(double[] ar) {\n\t\tArrays.sort(ar);\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tdouble tmp = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = tmp;\n\t\t}\n\t}\n\n\tstatic void rsort(char[] ar) {\n\t\tArrays.sort(ar);\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tchar tmp = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = tmp;\n\t\t}\n\t}\n\n\tstatic void fill(int arr[], int x) {\n\t\tArrays.fill(arr, x);\n\t}\n\n\tstatic void fill(long arr[], long x) {\n\t\tArrays.fill(arr, x);\n\t}\n\n\tstatic void fill(boolean arr[], boolean x) {\n\t\tArrays.fill(arr, x);\n\t}\n\n\tstatic void fill(double arr[], double x) {\n\t\tArrays.fill(arr, x);\n\t}\n\n\tstatic void fill(int arr[][], int x) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tArrays.fill(arr[i], x);\n\t}\n\n\tstatic void fill(long arr[][], long x) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tArrays.fill(arr[i], x);\n\t}\n\n\tstatic void fill(double arr[][], double x) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tArrays.fill(arr[i], x);\n\t}\n\n\tstatic void fill(boolean arr[][], boolean x) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tArrays.fill(arr[i], x);\n\t}\n\n\t//MOD culc\n\tstatic long plus(long x, long y) {\n\t\tlong res = (x + y) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\n\tstatic long sub(long x, long y) {\n\t\tlong res = (x - y) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\n\tstatic long mul(long x, long y) {\n\t\tlong res = (x * y) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\n\tstatic long div(long x, long y) {\n\t\tlong res = x * pow(y, mod - 2) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\n\tstatic long pow(long x, long y) {\n\t\tif (y < 0)\n\t\t\treturn 0;\n\t\tif (y == 0)\n\t\t\treturn 1;\n\t\tif (y % 2 == 1)\n\t\t\treturn (x * pow(x, y - 1)) % mod;\n\t\tlong root = pow(x, y / 2);\n\t\treturn root * root % mod;\n\t}\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tis = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());\n\t\tout = new PrintWriter(System.out);\n\t\tsolve();\n\t\tout.flush();\n\t}\n\n\t//input\n\tprivate static byte[] inbuf = new byte[1024];\n\tstatic int lenbuf = 0, ptrbuf = 0;\n\n\tprivate static int readByte() {\n\t\tif (lenbuf == -1)\n\t\t\tthrow new InputMismatchException();\n\t\tif (ptrbuf >= lenbuf) {\n\t\t\tptrbuf = 0;\n\t\t\ttry {\n\t\t\t\tlenbuf = is.read(inbuf);\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new InputMismatchException();\n\t\t\t}\n\t\t\tif (lenbuf <= 0)\n\t\t\t\treturn -1;\n\t\t}\n\t\treturn inbuf[ptrbuf++];\n\t}\n\n\tprivate static boolean isSpaceChar(int c) {\n\t\treturn !(c >= 33 && c <= 126);\n\t}\n\n\tprivate static int skip() {\n\t\tint b;\n\t\twhile ((b = readByte()) != -1 && isSpaceChar(b))\n\t\t\t;\n\t\treturn b;\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate static double nd() {\n\t\treturn Double.parseDouble(ns());\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate static char nc() {\n\t\treturn (char) skip();\n\t}\n\n\tprivate static String ns() {\n\t\tint b = skip();\n\t\tStringBuilder sb = new StringBuilder();\n\t\twhile (!(isSpaceChar(b))) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\n\tprivate static char[] ns(int n) {\n\t\tchar[] buf = new char[n];\n\t\tint b = skip(), p = 0;\n\t\twhile (p < n && !(isSpaceChar(b))) {\n\t\t\tbuf[p++] = (char) b;\n\t\t\tb = readByte();\n\t\t}\n\t\treturn n == p ? buf : Arrays.copyOf(buf, p);\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate static char[][] nm(int n, int m) {\n\t\tchar[][] map = new char[n][];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tmap[i] = ns(m);\n\t\treturn map;\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate static int[] na(int n) {\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = ni();\n\t\treturn a;\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate static long[] nla(int n) {\n\t\tlong[] a = new long[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = nl();\n\t\treturn a;\n\t}\n\n\tprivate static int ni() {\n\t\tint num = 0, b;\n\t\tboolean minus = false;\n\t\twhile ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))\n\t\t\t;\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\n\t\twhile (true) {\n\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t} else {\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate static long nl() {\n\t\tlong num = 0;\n\t\tint b;\n\t\tboolean minus = false;\n\t\twhile ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))\n\t\t\t;\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\n\t\twhile (true) {\n\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t} else {\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1588774837, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02913.html", "problem_id": "p02913", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02913/input.txt", "sample_output_relpath": "derived/input_output/data/p02913/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02913/Java/s211338841.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s211338841", "user_id": "u881359256"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n\tstatic void solve() {\n\t\tint n = ni();\n\t\tchar s[] = ns(n);\n\t\tint dp[][] = new int[n+1][n+1];\n\t\tfor(int i=n-1;i>=0;i--) {\n\t\t\tfor(int j=n-1;j>=0;j--) {\n\t\t\t\tif(s[i] == s[j]) {\n\t\t\t\t\tdp[i][j] = dp[i+1][j+1] + 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tlong ans = 0;\n\t\tfor(int i=0;i void reverse(List ls) {\n\t\tint sz = ls.size();\n\t\tfor (int i = 0; i < sz / 2; i++) {\n\t\t\tT t = ls.get(i);\n\t\t\tls.set(i, ls.get(sz - 1 - i));\n\t\t\tls.set(sz - 1 - i, t);\n\t\t}\n\t}\n\n\tstatic void reverse(T[] ar) {\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tT t = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = t;\n\t\t}\n\t}\n\n\tstatic void sbnl() {//StringBuilderに改行文字をappendする\n\t\tsb.append(\"\\n\");\n\t}\n\n\tstatic int lowerBound(int[] a, int x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] < x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int upperBound(int[] a, int x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] <= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rlowerBound(int[] a, int x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] > x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rupperBound(int[] a, int x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] >= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int lowerBound(long[] a, long x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] < x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int upperBound(long[] a, long x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] <= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rlowerBound(long[] a, long x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] > x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rupperBound(long[] a, long x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] >= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int lowerBound(double[] a, double x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] < x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int upperBound(double[] a, double x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] <= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rlowerBound(double[] a, double x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] > x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rupperBound(double[] a, double x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] >= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int lowerBound(char[] a, char x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] < x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int upperBound(char[] a, char x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] <= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rlowerBound(char[] a, char x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] > x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int rupperBound(char[] a, char x) {\n\t\tint l = -1, r = a.length;\n\t\twhile (r - l > 1) {\n\t\t\tint c = (l + r) / 2;\n\t\t\tif (a[c] >= x) {\n\t\t\t\tl = c;\n\t\t\t} else {\n\t\t\t\tr = c;\n\t\t\t}\n\t\t}\n\t\treturn r;\n\t}\n\n\tstatic int lowerBound(List ls, T x) throws RuntimeException {\n\t\tif (ls.size() == 0)\n\t\t\treturn -1;\n\t\tif (ls.get(0) instanceof Integer) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) >= 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Long) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) >= 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Double) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) >= 0 ? 1 : -1);\n\t\t} else {\n\t\t\tSystem.err.println(\n\t\t\t\t\tString.format(\"%s:数値でないリストを二分探索しています。\", Thread.currentThread().getStackTrace()[1].getMethodName()));\n\t\t\tthrow new RuntimeException();\n\t\t}\n\t}\n\n\tstatic int upperBound(List ls, T x) throws RuntimeException {\n\t\tif (ls.size() == 0)\n\t\t\treturn -1;\n\t\tif (ls.get(0) instanceof Integer) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) > 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Long) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) > 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Double) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) > 0 ? 1 : -1);\n\t\t} else {\n\t\t\tSystem.err.println(\n\t\t\t\t\tString.format(\"%s:数値でないリストを二分探索しています。\", Thread.currentThread().getStackTrace()[1].getMethodName()));\n\t\t\tthrow new RuntimeException();\n\t\t}\n\t}\n\n\tstatic int rupperBound(List ls, T x) throws RuntimeException {\n\t\tif (ls.size() == 0)\n\t\t\treturn -1;\n\t\tif (ls.get(0) instanceof Integer) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) < 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Long) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) < 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Double) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) < 0 ? 1 : -1);\n\t\t} else {\n\t\t\tSystem.err.println(\n\t\t\t\t\tString.format(\"%s:数値でないリストを二分探索しています。\", Thread.currentThread().getStackTrace()[1].getMethodName()));\n\t\t\tthrow new RuntimeException();\n\t\t}\n\t}\n\n\tstatic int rlowerBound(List ls, T x) {\n\t\tif (ls.size() == 0)\n\t\t\treturn -1;\n\t\tif (ls.get(0) instanceof Integer) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) <= 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Long) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) <= 0 ? 1 : -1);\n\t\t} else if (ls.get(0) instanceof Double) {\n\t\t\treturn ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) <= 0 ? 1 : -1);\n\t\t} else {\n\t\t\tSystem.err.println(\n\t\t\t\t\tString.format(\"%s:数値でないリストを二分探索しています。\", Thread.currentThread().getStackTrace()[1].getMethodName()));\n\t\t\tthrow new RuntimeException();\n\t\t}\n\t}\n\n\tstatic int[] concat(int x, int arr[]) {\n\t\tint ret[] = new int[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 1, ret.length - 1);\n\t\tret[0] = x;\n\t\treturn ret;\n\t}\n\n\tstatic int[] concat(int arr[], int x) {\n\t\tint ret[] = new int[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 0, ret.length - 1);\n\t\tret[ret.length - 1] = x;\n\t\treturn ret;\n\t}\n\n\tstatic long[] concat(long x, long arr[]) {\n\t\tlong ret[] = new long[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 1, ret.length - 1);\n\t\tret[0] = x;\n\t\treturn ret;\n\t}\n\n\tstatic long[] concat(long arr[], long x) {\n\t\tlong ret[] = new long[arr.length + 1];\n\t\tSystem.arraycopy(arr, 0, ret, 0, ret.length - 1);\n\t\tret[ret.length - 1] = x;\n\t\treturn ret;\n\t}\n\n\tstatic int max(int x, int y) {\n\t\treturn Math.max(x, y);\n\t}\n\n\tstatic int min(int x, int y) {\n\t\treturn Math.min(x, y);\n\t}\n\n\tstatic int max(int x, int y, int z) {\n\t\tx = Math.max(x, y);\n\t\tx = Math.max(x, z);\n\t\treturn x;\n\t}\n\n\tstatic int min(int x, int y, int z) {\n\t\tx = Math.min(x, y);\n\t\tx = Math.min(x, z);\n\t\treturn x;\n\t}\n\n\tstatic long max(long x, long y) {\n\t\treturn Math.max(x, y);\n\t}\n\n\tstatic long min(long x, long y) {\n\t\treturn Math.min(x, y);\n\t}\n\n\tstatic long max(long x, long y, long z) {\n\t\tx = Math.max(x, y);\n\t\tx = Math.max(x, z);\n\t\treturn x;\n\t}\n\n\tstatic long min(long x, long y, long z) {\n\t\tx = Math.min(x, y);\n\t\tx = Math.min(x, z);\n\t\treturn x;\n\t}\n\n\tstatic double max(double x, double y) {\n\t\treturn Math.max(x, y);\n\t}\n\n\tstatic double min(double x, double y) {\n\t\treturn Math.min(x, y);\n\t}\n\n\tstatic double max(double x, double y, double z) {\n\t\tx = Math.max(x, y);\n\t\tx = Math.max(x, z);\n\t\treturn x;\n\t}\n\n\tstatic double min(double x, double y, double z) {\n\t\tx = Math.min(x, y);\n\t\tx = Math.min(x, z);\n\t\treturn x;\n\t}\n\n\tstatic void sort(int[] ar) {\n\t\tArrays.sort(ar);\n\t}\n\n\tstatic void sort(long[] ar) {\n\t\tArrays.sort(ar);\n\t}\n\n\tstatic void sort(double[] ar) {\n\t\tArrays.sort(ar);\n\t}\n\n\tstatic void sort(char[] ar) {\n\t\tArrays.sort(ar);\n\t}\n\n\tstatic void rsort(int[] ar) {\n\t\tArrays.sort(ar);\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tint tmp = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = tmp;\n\t\t}\n\t}\n\n\tstatic void rsort(long[] ar) {\n\t\tArrays.sort(ar);\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tlong tmp = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = tmp;\n\t\t}\n\t}\n\n\tstatic void rsort(double[] ar) {\n\t\tArrays.sort(ar);\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tdouble tmp = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = tmp;\n\t\t}\n\t}\n\n\tstatic void rsort(char[] ar) {\n\t\tArrays.sort(ar);\n\t\tint len = ar.length;\n\t\tfor (int i = 0; i < len / 2; i++) {\n\t\t\tchar tmp = ar[i];\n\t\t\tar[i] = ar[len - 1 - i];\n\t\t\tar[len - 1 - i] = tmp;\n\t\t}\n\t}\n\n\tstatic void fill(int arr[], int x) {\n\t\tArrays.fill(arr, x);\n\t}\n\n\tstatic void fill(long arr[], long x) {\n\t\tArrays.fill(arr, x);\n\t}\n\n\tstatic void fill(boolean arr[], boolean x) {\n\t\tArrays.fill(arr, x);\n\t}\n\n\tstatic void fill(double arr[], double x) {\n\t\tArrays.fill(arr, x);\n\t}\n\n\tstatic void fill(int arr[][], int x) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tArrays.fill(arr[i], x);\n\t}\n\n\tstatic void fill(long arr[][], long x) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tArrays.fill(arr[i], x);\n\t}\n\n\tstatic void fill(double arr[][], double x) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tArrays.fill(arr[i], x);\n\t}\n\n\tstatic void fill(boolean arr[][], boolean x) {\n\t\tfor (int i = 0; i < arr.length; i++)\n\t\t\tArrays.fill(arr[i], x);\n\t}\n\n\t//MOD culc\n\tstatic long plus(long x, long y) {\n\t\tlong res = (x + y) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\n\tstatic long sub(long x, long y) {\n\t\tlong res = (x - y) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\n\tstatic long mul(long x, long y) {\n\t\tlong res = (x * y) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\n\tstatic long div(long x, long y) {\n\t\tlong res = x * pow(y, mod - 2) % mod;\n\t\treturn res < 0 ? res + mod : res;\n\t}\n\n\tstatic long pow(long x, long y) {\n\t\tif (y < 0)\n\t\t\treturn 0;\n\t\tif (y == 0)\n\t\t\treturn 1;\n\t\tif (y % 2 == 1)\n\t\t\treturn (x * pow(x, y - 1)) % mod;\n\t\tlong root = pow(x, y / 2);\n\t\treturn root * root % mod;\n\t}\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tis = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());\n\t\tout = new PrintWriter(System.out);\n\t\tsolve();\n\t\tout.flush();\n\t}\n\n\t//input\n\tprivate static byte[] inbuf = new byte[1024];\n\tstatic int lenbuf = 0, ptrbuf = 0;\n\n\tprivate static int readByte() {\n\t\tif (lenbuf == -1)\n\t\t\tthrow new InputMismatchException();\n\t\tif (ptrbuf >= lenbuf) {\n\t\t\tptrbuf = 0;\n\t\t\ttry {\n\t\t\t\tlenbuf = is.read(inbuf);\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new InputMismatchException();\n\t\t\t}\n\t\t\tif (lenbuf <= 0)\n\t\t\t\treturn -1;\n\t\t}\n\t\treturn inbuf[ptrbuf++];\n\t}\n\n\tprivate static boolean isSpaceChar(int c) {\n\t\treturn !(c >= 33 && c <= 126);\n\t}\n\n\tprivate static int skip() {\n\t\tint b;\n\t\twhile ((b = readByte()) != -1 && isSpaceChar(b))\n\t\t\t;\n\t\treturn b;\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate static double nd() {\n\t\treturn Double.parseDouble(ns());\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate static char nc() {\n\t\treturn (char) skip();\n\t}\n\n\tprivate static String ns() {\n\t\tint b = skip();\n\t\tStringBuilder sb = new StringBuilder();\n\t\twhile (!(isSpaceChar(b))) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\n\tprivate static char[] ns(int n) {\n\t\tchar[] buf = new char[n];\n\t\tint b = skip(), p = 0;\n\t\twhile (p < n && !(isSpaceChar(b))) {\n\t\t\tbuf[p++] = (char) b;\n\t\t\tb = readByte();\n\t\t}\n\t\treturn n == p ? buf : Arrays.copyOf(buf, p);\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate static char[][] nm(int n, int m) {\n\t\tchar[][] map = new char[n][];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tmap[i] = ns(m);\n\t\treturn map;\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate static int[] na(int n) {\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = ni();\n\t\treturn a;\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate static long[] nla(int n) {\n\t\tlong[] a = new long[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = nl();\n\t\treturn a;\n\t}\n\n\tprivate static int ni() {\n\t\tint num = 0, b;\n\t\tboolean minus = false;\n\t\twhile ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))\n\t\t\t;\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\n\t\twhile (true) {\n\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t} else {\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate static long nl() {\n\t\tlong num = 0;\n\t\tint b;\n\t\tboolean minus = false;\n\t\twhile ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))\n\t\t\t;\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\n\t\twhile (true) {\n\t\t\tif (b >= '0' && b <= '9') {\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t} else {\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n}\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nGiven is a string S of length N.\n\nFind the maximum length of a non-empty string that occurs twice or more in S as contiguous substrings without overlapping.\n\nMore formally, find the maximum positive integer len such that there exist integers l_1 and l_2 ( 1 \\leq l_1, l_2 \\leq N - len + 1 ) that satisfy the following:\n\nl_1 + len \\leq l_2\n\nS[l_1+i] = S[l_2+i] (i = 0, 1, ..., len - 1)\n\nIf there is no such integer len, print 0.\n\nConstraints\n\n2 \\leq N \\leq 5 \\times 10^3\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 maximum length of a non-empty string that occurs twice or more in S as contiguous substrings without overlapping. If there is no such non-empty string, print 0 instead.\n\nSample Input 1\n\n5\nababa\n\nSample Output 1\n\n2\n\nThe strings satisfying the conditions are: a, b, ab, and ba. The maximum length among them is 2, which is the answer.\nNote that aba occurs twice in S as contiguous substrings, but there is no pair of integers l_1 and l_2 mentioned in the statement such that l_1 + len \\leq l_2.\n\nSample Input 2\n\n2\nxy\n\nSample Output 2\n\n0\n\nNo non-empty string satisfies the conditions.\n\nSample Input 3\n\n13\nstrangeorange\n\nSample Output 3\n\n5", "sample_input": "5\nababa\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02913", "source_text": "Score : 500 points\n\nProblem Statement\n\nGiven is a string S of length N.\n\nFind the maximum length of a non-empty string that occurs twice or more in S as contiguous substrings without overlapping.\n\nMore formally, find the maximum positive integer len such that there exist integers l_1 and l_2 ( 1 \\leq l_1, l_2 \\leq N - len + 1 ) that satisfy the following:\n\nl_1 + len \\leq l_2\n\nS[l_1+i] = S[l_2+i] (i = 0, 1, ..., len - 1)\n\nIf there is no such integer len, print 0.\n\nConstraints\n\n2 \\leq N \\leq 5 \\times 10^3\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 maximum length of a non-empty string that occurs twice or more in S as contiguous substrings without overlapping. If there is no such non-empty string, print 0 instead.\n\nSample Input 1\n\n5\nababa\n\nSample Output 1\n\n2\n\nThe strings satisfying the conditions are: a, b, ab, and ba. The maximum length among them is 2, which is the answer.\nNote that aba occurs twice in S as contiguous substrings, but there is no pair of integers l_1 and l_2 mentioned in the statement such that l_1 + len \\leq l_2.\n\nSample Input 2\n\n2\nxy\n\nSample Output 2\n\n0\n\nNo non-empty string satisfies the conditions.\n\nSample Input 3\n\n13\nstrangeorange\n\nSample Output 3\n\n5", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 15203, "cpu_time_ms": 257, "memory_kb": 168136}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s218279008", "group_id": "codeNet:p02913", "input_text": "import java.io.FileInputStream;\nimport java.io.FileNotFoundException;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.InputMismatchException;\nimport java.util.Map;\n\npublic class Main {\n InputStream is;\n\n int __t__ = 1;\n int __f__ = 0;\n int __FILE_DEBUG_FLAG__ = __f__;\n String __DEBUG_FILE_NAME__ = \"src/A3\";\n\n FastScanner in;\n PrintWriter out;\n\n public void solve() {\n int n = in.nextInt();\n String s = in.next();\n long[][] dp = new long[n+1][n+1];\n for (int d = 1; d <= n; d++) {\n for (int i = 0; i < n - d; i++) {\n int j = i + d;\n if (s.charAt(i) == s.charAt(j)) {\n dp[i+1][j+1] = dp[i][j] + 1;\n }\n }\n }\n long res = 0;\n for (int i = 0; i <= n; i++) {\n for (int j = i + 1; j <= n; j++) {\n res = Math.max(res, Math.min(dp[i][j], j - i));\n }\n }\n System.out.println(res);\n }\n\n /* MOD_CALCULATION */\n static long MOD = 1000000007L;\n static long ADD(long a, long b) {\n return (a + b) % MOD;\n }\n\n static long SUB(long a, long b) {\n return (a - b + MOD) % MOD;\n }\n\n static long MULT(long a, long b) {\n return (a * b) % MOD;\n }\n\n static long POW(long a, long x) {\n long res = 1;\n for ( ; x > 0; x >>= 1) {\n if (x % 2 == 1) res = MULT(res, a);\n a = MULT(a, a);\n }\n\n return res;\n }\n\n static long DIV(long a, long b) {\n return MULT(a, POW(b, MOD - 2));\n }\n /* end */\n\n public void run() {\n if (__FILE_DEBUG_FLAG__ == __t__) {\n try {\n is = new FileInputStream(__DEBUG_FILE_NAME__);\n } catch (FileNotFoundException e) {\n // TODO 自動生成された catch ブロック\n e.printStackTrace();\n }\n System.out.println(\"FILE_INPUT!\");\n } else {\n is = System.in;\n }\n in = new FastScanner(is);\n out = new PrintWriter(System.out);\n\n solve();\n }\n\n public static void main(final String[] args) {\n new Main().run();\n }\n\n class FastScanner {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n\n public FastScanner(InputStream stream) {\n this.stream = stream;\n // stream = new FileInputStream(new File(\"dec.in\"));\n\n }\n\n int read() {\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n boolean isEndline(int c) {\n return c == '\\n' || c == '\\r' || c == -1;\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n int[] nextIntArray(int n) {\n int[] array = new int[n];\n for (int i = 0; i < n; i++)\n array[i] = nextInt();\n\n return array;\n }\n\n int[][] nextIntMap(int n, int m) {\n int[][] map = new int[n][m];\n for (int i = 0; i < n; i++) {\n map[i] = in.nextIntArray(m);\n }\n return map;\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n long[] nextLongArray(int n) {\n long[] array = new long[n];\n for (int i = 0; i < n; i++)\n array[i] = nextLong();\n\n return array;\n }\n\n long[][] nextLongMap(int n, int m) {\n long[][] map = new long[n][m];\n for (int i = 0; i < n; i++) {\n map[i] = in.nextLongArray(m);\n }\n return map;\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n double[] nextDoubleArray(int n) {\n double[] array = new double[n];\n for (int i = 0; i < n; i++)\n array[i] = nextDouble();\n\n return array;\n }\n\n double[][] nextDoubleMap(int n, int m) {\n double[][] map = new double[n][m];\n for (int i = 0; i < n; i++) {\n map[i] = in.nextDoubleArray(m);\n }\n return map;\n }\n\n String next() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isSpaceChar(c));\n return res.toString();\n }\n\n String[] nextStringArray(int n) {\n String[] array = new String[n];\n for (int i = 0; i < n; i++)\n array[i] = next();\n\n return array;\n }\n\n String nextLine() {\n int c = read();\n while (isEndline(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isEndline(c));\n return res.toString();\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1579150718, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02913.html", "problem_id": "p02913", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02913/input.txt", "sample_output_relpath": "derived/input_output/data/p02913/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02913/Java/s218279008.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s218279008", "user_id": "u617255029"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.io.FileInputStream;\nimport java.io.FileNotFoundException;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.InputMismatchException;\nimport java.util.Map;\n\npublic class Main {\n InputStream is;\n\n int __t__ = 1;\n int __f__ = 0;\n int __FILE_DEBUG_FLAG__ = __f__;\n String __DEBUG_FILE_NAME__ = \"src/A3\";\n\n FastScanner in;\n PrintWriter out;\n\n public void solve() {\n int n = in.nextInt();\n String s = in.next();\n long[][] dp = new long[n+1][n+1];\n for (int d = 1; d <= n; d++) {\n for (int i = 0; i < n - d; i++) {\n int j = i + d;\n if (s.charAt(i) == s.charAt(j)) {\n dp[i+1][j+1] = dp[i][j] + 1;\n }\n }\n }\n long res = 0;\n for (int i = 0; i <= n; i++) {\n for (int j = i + 1; j <= n; j++) {\n res = Math.max(res, Math.min(dp[i][j], j - i));\n }\n }\n System.out.println(res);\n }\n\n /* MOD_CALCULATION */\n static long MOD = 1000000007L;\n static long ADD(long a, long b) {\n return (a + b) % MOD;\n }\n\n static long SUB(long a, long b) {\n return (a - b + MOD) % MOD;\n }\n\n static long MULT(long a, long b) {\n return (a * b) % MOD;\n }\n\n static long POW(long a, long x) {\n long res = 1;\n for ( ; x > 0; x >>= 1) {\n if (x % 2 == 1) res = MULT(res, a);\n a = MULT(a, a);\n }\n\n return res;\n }\n\n static long DIV(long a, long b) {\n return MULT(a, POW(b, MOD - 2));\n }\n /* end */\n\n public void run() {\n if (__FILE_DEBUG_FLAG__ == __t__) {\n try {\n is = new FileInputStream(__DEBUG_FILE_NAME__);\n } catch (FileNotFoundException e) {\n // TODO 自動生成された catch ブロック\n e.printStackTrace();\n }\n System.out.println(\"FILE_INPUT!\");\n } else {\n is = System.in;\n }\n in = new FastScanner(is);\n out = new PrintWriter(System.out);\n\n solve();\n }\n\n public static void main(final String[] args) {\n new Main().run();\n }\n\n class FastScanner {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n\n public FastScanner(InputStream stream) {\n this.stream = stream;\n // stream = new FileInputStream(new File(\"dec.in\"));\n\n }\n\n int read() {\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n boolean isEndline(int c) {\n return c == '\\n' || c == '\\r' || c == -1;\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n int[] nextIntArray(int n) {\n int[] array = new int[n];\n for (int i = 0; i < n; i++)\n array[i] = nextInt();\n\n return array;\n }\n\n int[][] nextIntMap(int n, int m) {\n int[][] map = new int[n][m];\n for (int i = 0; i < n; i++) {\n map[i] = in.nextIntArray(m);\n }\n return map;\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n long[] nextLongArray(int n) {\n long[] array = new long[n];\n for (int i = 0; i < n; i++)\n array[i] = nextLong();\n\n return array;\n }\n\n long[][] nextLongMap(int n, int m) {\n long[][] map = new long[n][m];\n for (int i = 0; i < n; i++) {\n map[i] = in.nextLongArray(m);\n }\n return map;\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n double[] nextDoubleArray(int n) {\n double[] array = new double[n];\n for (int i = 0; i < n; i++)\n array[i] = nextDouble();\n\n return array;\n }\n\n double[][] nextDoubleMap(int n, int m) {\n double[][] map = new double[n][m];\n for (int i = 0; i < n; i++) {\n map[i] = in.nextDoubleArray(m);\n }\n return map;\n }\n\n String next() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isSpaceChar(c));\n return res.toString();\n }\n\n String[] nextStringArray(int n) {\n String[] array = new String[n];\n for (int i = 0; i < n; i++)\n array[i] = next();\n\n return array;\n }\n\n String nextLine() {\n int c = read();\n while (isEndline(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isEndline(c));\n return res.toString();\n }\n }\n}\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nGiven is a string S of length N.\n\nFind the maximum length of a non-empty string that occurs twice or more in S as contiguous substrings without overlapping.\n\nMore formally, find the maximum positive integer len such that there exist integers l_1 and l_2 ( 1 \\leq l_1, l_2 \\leq N - len + 1 ) that satisfy the following:\n\nl_1 + len \\leq l_2\n\nS[l_1+i] = S[l_2+i] (i = 0, 1, ..., len - 1)\n\nIf there is no such integer len, print 0.\n\nConstraints\n\n2 \\leq N \\leq 5 \\times 10^3\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 maximum length of a non-empty string that occurs twice or more in S as contiguous substrings without overlapping. If there is no such non-empty string, print 0 instead.\n\nSample Input 1\n\n5\nababa\n\nSample Output 1\n\n2\n\nThe strings satisfying the conditions are: a, b, ab, and ba. The maximum length among them is 2, which is the answer.\nNote that aba occurs twice in S as contiguous substrings, but there is no pair of integers l_1 and l_2 mentioned in the statement such that l_1 + len \\leq l_2.\n\nSample Input 2\n\n2\nxy\n\nSample Output 2\n\n0\n\nNo non-empty string satisfies the conditions.\n\nSample Input 3\n\n13\nstrangeorange\n\nSample Output 3\n\n5", "sample_input": "5\nababa\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02913", "source_text": "Score : 500 points\n\nProblem Statement\n\nGiven is a string S of length N.\n\nFind the maximum length of a non-empty string that occurs twice or more in S as contiguous substrings without overlapping.\n\nMore formally, find the maximum positive integer len such that there exist integers l_1 and l_2 ( 1 \\leq l_1, l_2 \\leq N - len + 1 ) that satisfy the following:\n\nl_1 + len \\leq l_2\n\nS[l_1+i] = S[l_2+i] (i = 0, 1, ..., len - 1)\n\nIf there is no such integer len, print 0.\n\nConstraints\n\n2 \\leq N \\leq 5 \\times 10^3\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 maximum length of a non-empty string that occurs twice or more in S as contiguous substrings without overlapping. If there is no such non-empty string, print 0 instead.\n\nSample Input 1\n\n5\nababa\n\nSample Output 1\n\n2\n\nThe strings satisfying the conditions are: a, b, ab, and ba. The maximum length among them is 2, which is the answer.\nNote that aba occurs twice in S as contiguous substrings, but there is no pair of integers l_1 and l_2 mentioned in the statement such that l_1 + len \\leq l_2.\n\nSample Input 2\n\n2\nxy\n\nSample Output 2\n\n0\n\nNo non-empty string satisfies the conditions.\n\nSample Input 3\n\n13\nstrangeorange\n\nSample Output 3\n\n5", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 5733, "cpu_time_ms": 323, "memory_kb": 247508}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s460689239", "group_id": "codeNet:p02913", "input_text": "\n\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tString s = sc.next();\n\t\tint[][] dp = new int[n][n];\n\n\n\t\tfor(int j = n-1; j>=0; j--) {\n\t\t\tint i = n-1;\n\t\t\tif(s.charAt(i) == s.charAt(j)) dp[i][j] = 1;\n\t\t\telse dp[i][j] = 0;\n\t\t}\n\n\t\tfor(int i=n-1; i>=0; i--) {\n\t\t\tint j = n-1;\n\t\t\tif(s.charAt(i) == s.charAt(j)) dp[i][j] = 1;\n\t\t\telse dp[i][j] = 0;\n\t\t}\n\n\t\tfor(int i = n-2; i>=0; i--) {\n\t\t\tfor(int j = n-2; j>=0; j--) {\n\t\t\t\tif(s.charAt(i) == s.charAt(j)) dp[i][j] = dp[i+1][j+1]+1;\n\t\t\t\telse dp[i][j] = 0;\n\t\t\t}\n\t\t}\n\n\t\tint len = 0;\n\t\tfor(int i=0; i=0; j--) {\n\t\t\tint i = n-1;\n\t\t\tif(s.charAt(i) == s.charAt(j)) dp[i][j] = 1;\n\t\t\telse dp[i][j] = 0;\n\t\t}\n\n\t\tfor(int i=n-1; i>=0; i--) {\n\t\t\tint j = n-1;\n\t\t\tif(s.charAt(i) == s.charAt(j)) dp[i][j] = 1;\n\t\t\telse dp[i][j] = 0;\n\t\t}\n\n\t\tfor(int i = n-2; i>=0; i--) {\n\t\t\tfor(int j = n-2; j>=0; j--) {\n\t\t\t\tif(s.charAt(i) == s.charAt(j)) dp[i][j] = dp[i+1][j+1]+1;\n\t\t\t\telse dp[i][j] = 0;\n\t\t\t}\n\t\t}\n\n\t\tint len = 0;\n\t\tfor(int i=0; i> 1;\n// System.out.println(mid);\n HashSet set = new HashSet<>();\n for (int i = 0, size = s.length(); i <= size - mid; i++) {\n\n set.add(s.substring(i, i + mid)\n .hashCode());\n\n if (i + 2 * mid <= size && set.contains(s.substring(i + mid, i + 2 * mid)\n .hashCode())) {\n start = mid;\n continue outer;\n }\n }\n\n end = mid - 1;\n }\n\n out.println(start);\n }\n\n static class MyScanner {\n\n BufferedReader br;\n StringTokenizer st;\n\n MyScanner(FileReader fileReader) {\n br = new BufferedReader(fileReader);\n }\n\n MyScanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n String nn() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n String nextLine() {\n String ans = \"\";\n try {\n ans = br.readLine();\n } catch (IOException ex) {\n ex.printStackTrace();\n }\n return ans;\n }\n\n char nc() {\n return nn().charAt(0);\n }\n\n int ni() {\n return Integer.parseInt(nn());\n }\n\n long nl() {\n return Long.parseLong(nn());\n }\n\n double nd() {\n return Double.parseDouble(nn());\n }\n\n int[] niArr0(int n) {\n int[] ar = new int[n];\n for (int i = 0; i < n; i++) {\n ar[i] = ni();\n }\n return ar;\n }\n\n int[] niArr1(int n) {\n int[] ar = new int[n + 1];\n for (int i = 1; i <= n; i++) {\n ar[i] = ni();\n }\n return ar;\n }\n\n Long[] nlArr0(int n) {\n Long[] ar = new Long[n];\n for (int i = 0; i < n; i++) {\n ar[i] = nl();\n }\n return ar;\n }\n\n Long[] nlArr1(int n) {\n Long[] ar = new Long[n + 1];\n for (int i = 1; i <= n; i++) {\n ar[i] = nl();\n }\n return ar;\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1568736522, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02913.html", "problem_id": "p02913", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02913/input.txt", "sample_output_relpath": "derived/input_output/data/p02913/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02913/Java/s572626390.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s572626390", "user_id": "u420105436"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.io.BufferedOutputStream;\nimport java.io.BufferedReader;\nimport java.io.FileNotFoundException;\nimport java.io.FileReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.LinkedHashMap;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.NavigableMap;\nimport java.util.NavigableSet;\nimport java.util.PriorityQueue;\nimport java.util.Queue;\nimport java.util.Random;\nimport java.util.StringTokenizer;\nimport java.util.TreeMap;\nimport java.util.TreeSet;\nimport java.util.stream.Collectors;\n\nclass Main {\n\n private static PrintWriter out;\n\n private static void mprintln(Object... ar) {\n for (Object i : ar) {\n out.print(i + \" \");\n }\n out.println();\n }\n\n public static void main(String[] args) throws FileNotFoundException {\n\n // Input from file\n // File inputFile = new File(\"JavaFile.txt\");\n // File outputFile = new File(\"JavaOutputFile.txt\");\n // FileReader fileReader = new FileReader(inputFile);\n // Here it ends\n\n MyScanner sc = new MyScanner();\n // MyScanner sc = new MyScanner(fileReader);\n\n out = new PrintWriter(new BufferedOutputStream(System.out)); // Output to console\n // out = new PrintWriter(new PrintStream(outputFile)); // Output to file\n\n getAns(sc);\n\n out.close();\n }\n\n /*\n *Don't use builtin function (Math.ceil)\n */\n\n static final long MOD = (long) (1e9 + 7);\n\n private static void getAns(MyScanner sc) {\n int n = sc.ni();\n String s = sc.nn();\n\n int start = 0, end = n / 2 + 1;\n\n outer:\n while (start < end) {\n int mid = start + end + 1 >> 1;\n// System.out.println(mid);\n HashSet set = new HashSet<>();\n for (int i = 0, size = s.length(); i <= size - mid; i++) {\n\n set.add(s.substring(i, i + mid)\n .hashCode());\n\n if (i + 2 * mid <= size && set.contains(s.substring(i + mid, i + 2 * mid)\n .hashCode())) {\n start = mid;\n continue outer;\n }\n }\n\n end = mid - 1;\n }\n\n out.println(start);\n }\n\n static class MyScanner {\n\n BufferedReader br;\n StringTokenizer st;\n\n MyScanner(FileReader fileReader) {\n br = new BufferedReader(fileReader);\n }\n\n MyScanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n String nn() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n String nextLine() {\n String ans = \"\";\n try {\n ans = br.readLine();\n } catch (IOException ex) {\n ex.printStackTrace();\n }\n return ans;\n }\n\n char nc() {\n return nn().charAt(0);\n }\n\n int ni() {\n return Integer.parseInt(nn());\n }\n\n long nl() {\n return Long.parseLong(nn());\n }\n\n double nd() {\n return Double.parseDouble(nn());\n }\n\n int[] niArr0(int n) {\n int[] ar = new int[n];\n for (int i = 0; i < n; i++) {\n ar[i] = ni();\n }\n return ar;\n }\n\n int[] niArr1(int n) {\n int[] ar = new int[n + 1];\n for (int i = 1; i <= n; i++) {\n ar[i] = ni();\n }\n return ar;\n }\n\n Long[] nlArr0(int n) {\n Long[] ar = new Long[n];\n for (int i = 0; i < n; i++) {\n ar[i] = nl();\n }\n return ar;\n }\n\n Long[] nlArr1(int n) {\n Long[] ar = new Long[n + 1];\n for (int i = 1; i <= n; i++) {\n ar[i] = nl();\n }\n return ar;\n }\n }\n}\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nGiven is a string S of length N.\n\nFind the maximum length of a non-empty string that occurs twice or more in S as contiguous substrings without overlapping.\n\nMore formally, find the maximum positive integer len such that there exist integers l_1 and l_2 ( 1 \\leq l_1, l_2 \\leq N - len + 1 ) that satisfy the following:\n\nl_1 + len \\leq l_2\n\nS[l_1+i] = S[l_2+i] (i = 0, 1, ..., len - 1)\n\nIf there is no such integer len, print 0.\n\nConstraints\n\n2 \\leq N \\leq 5 \\times 10^3\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 maximum length of a non-empty string that occurs twice or more in S as contiguous substrings without overlapping. If there is no such non-empty string, print 0 instead.\n\nSample Input 1\n\n5\nababa\n\nSample Output 1\n\n2\n\nThe strings satisfying the conditions are: a, b, ab, and ba. The maximum length among them is 2, which is the answer.\nNote that aba occurs twice in S as contiguous substrings, but there is no pair of integers l_1 and l_2 mentioned in the statement such that l_1 + len \\leq l_2.\n\nSample Input 2\n\n2\nxy\n\nSample Output 2\n\n0\n\nNo non-empty string satisfies the conditions.\n\nSample Input 3\n\n13\nstrangeorange\n\nSample Output 3\n\n5", "sample_input": "5\nababa\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02913", "source_text": "Score : 500 points\n\nProblem Statement\n\nGiven is a string S of length N.\n\nFind the maximum length of a non-empty string that occurs twice or more in S as contiguous substrings without overlapping.\n\nMore formally, find the maximum positive integer len such that there exist integers l_1 and l_2 ( 1 \\leq l_1, l_2 \\leq N - len + 1 ) that satisfy the following:\n\nl_1 + len \\leq l_2\n\nS[l_1+i] = S[l_2+i] (i = 0, 1, ..., len - 1)\n\nIf there is no such integer len, print 0.\n\nConstraints\n\n2 \\leq N \\leq 5 \\times 10^3\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 maximum length of a non-empty string that occurs twice or more in S as contiguous substrings without overlapping. If there is no such non-empty string, print 0 instead.\n\nSample Input 1\n\n5\nababa\n\nSample Output 1\n\n2\n\nThe strings satisfying the conditions are: a, b, ab, and ba. The maximum length among them is 2, which is the answer.\nNote that aba occurs twice in S as contiguous substrings, but there is no pair of integers l_1 and l_2 mentioned in the statement such that l_1 + len \\leq l_2.\n\nSample Input 2\n\n2\nxy\n\nSample Output 2\n\n0\n\nNo non-empty string satisfies the conditions.\n\nSample Input 3\n\n13\nstrangeorange\n\nSample Output 3\n\n5", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 4392, "cpu_time_ms": 208, "memory_kb": 77652}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s827750014", "group_id": "codeNet:p02913", "input_text": "import java.util.Scanner;\n\npublic class Main {\n public static void debug(String str) {\n System.out.println(str);\n }\n\n public static void main(String[] args) {\n\n int N;\n String S;\n\n try (Scanner sc = new Scanner(System.in)) {\n N = sc.nextInt();\n S = sc.next();\n\n }\n //len(暫定値)\n int NStart = 0;\n int NEnd = N;\n int window =0;\n int result = 0;\n while (true) {\n\n window = (NEnd + NStart) / 2;\n\n //探索\n boolean check = chackSub(S, window);\n if (check) {\n result = window;\n NStart = window;\n } else {\n NEnd = window;\n }\n if(NEnd - NStart <=1){\n break;\n }\n }\n\n System.out.println(result);\n }\n\n private static boolean chackSub(String S, int window) {\n int i = 0;\n while (true) {\n int start = i;\n int end = start + window;\n\n if (end + window > S.length()) {\n break;\n }\n String sub1 = S.substring(start, end);\n String sub2 = S.substring(end+1);\n\n if (sub2.contains(sub1)) {\n return true;\n }\n i++;\n }\n return false;\n }\n}\n", "language": "Java", "metadata": {"date": 1568601184, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02913.html", "problem_id": "p02913", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02913/input.txt", "sample_output_relpath": "derived/input_output/data/p02913/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02913/Java/s827750014.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s827750014", "user_id": "u499889187"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n public static void debug(String str) {\n System.out.println(str);\n }\n\n public static void main(String[] args) {\n\n int N;\n String S;\n\n try (Scanner sc = new Scanner(System.in)) {\n N = sc.nextInt();\n S = sc.next();\n\n }\n //len(暫定値)\n int NStart = 0;\n int NEnd = N;\n int window =0;\n int result = 0;\n while (true) {\n\n window = (NEnd + NStart) / 2;\n\n //探索\n boolean check = chackSub(S, window);\n if (check) {\n result = window;\n NStart = window;\n } else {\n NEnd = window;\n }\n if(NEnd - NStart <=1){\n break;\n }\n }\n\n System.out.println(result);\n }\n\n private static boolean chackSub(String S, int window) {\n int i = 0;\n while (true) {\n int start = i;\n int end = start + window;\n\n if (end + window > S.length()) {\n break;\n }\n String sub1 = S.substring(start, end);\n String sub2 = S.substring(end+1);\n\n if (sub2.contains(sub1)) {\n return true;\n }\n i++;\n }\n return false;\n }\n}\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nGiven is a string S of length N.\n\nFind the maximum length of a non-empty string that occurs twice or more in S as contiguous substrings without overlapping.\n\nMore formally, find the maximum positive integer len such that there exist integers l_1 and l_2 ( 1 \\leq l_1, l_2 \\leq N - len + 1 ) that satisfy the following:\n\nl_1 + len \\leq l_2\n\nS[l_1+i] = S[l_2+i] (i = 0, 1, ..., len - 1)\n\nIf there is no such integer len, print 0.\n\nConstraints\n\n2 \\leq N \\leq 5 \\times 10^3\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 maximum length of a non-empty string that occurs twice or more in S as contiguous substrings without overlapping. If there is no such non-empty string, print 0 instead.\n\nSample Input 1\n\n5\nababa\n\nSample Output 1\n\n2\n\nThe strings satisfying the conditions are: a, b, ab, and ba. The maximum length among them is 2, which is the answer.\nNote that aba occurs twice in S as contiguous substrings, but there is no pair of integers l_1 and l_2 mentioned in the statement such that l_1 + len \\leq l_2.\n\nSample Input 2\n\n2\nxy\n\nSample Output 2\n\n0\n\nNo non-empty string satisfies the conditions.\n\nSample Input 3\n\n13\nstrangeorange\n\nSample Output 3\n\n5", "sample_input": "5\nababa\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02913", "source_text": "Score : 500 points\n\nProblem Statement\n\nGiven is a string S of length N.\n\nFind the maximum length of a non-empty string that occurs twice or more in S as contiguous substrings without overlapping.\n\nMore formally, find the maximum positive integer len such that there exist integers l_1 and l_2 ( 1 \\leq l_1, l_2 \\leq N - len + 1 ) that satisfy the following:\n\nl_1 + len \\leq l_2\n\nS[l_1+i] = S[l_2+i] (i = 0, 1, ..., len - 1)\n\nIf there is no such integer len, print 0.\n\nConstraints\n\n2 \\leq N \\leq 5 \\times 10^3\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 maximum length of a non-empty string that occurs twice or more in S as contiguous substrings without overlapping. If there is no such non-empty string, print 0 instead.\n\nSample Input 1\n\n5\nababa\n\nSample Output 1\n\n2\n\nThe strings satisfying the conditions are: a, b, ab, and ba. The maximum length among them is 2, which is the answer.\nNote that aba occurs twice in S as contiguous substrings, but there is no pair of integers l_1 and l_2 mentioned in the statement such that l_1 + len \\leq l_2.\n\nSample Input 2\n\n2\nxy\n\nSample Output 2\n\n0\n\nNo non-empty string satisfies the conditions.\n\nSample Input 3\n\n13\nstrangeorange\n\nSample Output 3\n\n5", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1356, "cpu_time_ms": 2108, "memory_kb": 90028}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s356667988", "group_id": "codeNet:p02913", "input_text": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n String s = sc.next();\n\n int answer = 0;\n for(int i = 0; i< n; i++ ) {\n for (int j = i + 1; j <= n; j++) {\n String base = s.substring(i, j);\n String replace = s.replaceAll(base, \"★\");\n\n long count = replace.chars().filter(ch -> ch == '★').count();\n if (count > 1) {\n if (answer < base.length()) {\n answer = base.length();\n }\n }\n }\n }\n\n System.out.println(answer);\n\n }\n}\n", "language": "Java", "metadata": {"date": 1568601011, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02913.html", "problem_id": "p02913", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02913/input.txt", "sample_output_relpath": "derived/input_output/data/p02913/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02913/Java/s356667988.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s356667988", "user_id": "u669731179"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n String s = sc.next();\n\n int answer = 0;\n for(int i = 0; i< n; i++ ) {\n for (int j = i + 1; j <= n; j++) {\n String base = s.substring(i, j);\n String replace = s.replaceAll(base, \"★\");\n\n long count = replace.chars().filter(ch -> ch == '★').count();\n if (count > 1) {\n if (answer < base.length()) {\n answer = base.length();\n }\n }\n }\n }\n\n System.out.println(answer);\n\n }\n}\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nGiven is a string S of length N.\n\nFind the maximum length of a non-empty string that occurs twice or more in S as contiguous substrings without overlapping.\n\nMore formally, find the maximum positive integer len such that there exist integers l_1 and l_2 ( 1 \\leq l_1, l_2 \\leq N - len + 1 ) that satisfy the following:\n\nl_1 + len \\leq l_2\n\nS[l_1+i] = S[l_2+i] (i = 0, 1, ..., len - 1)\n\nIf there is no such integer len, print 0.\n\nConstraints\n\n2 \\leq N \\leq 5 \\times 10^3\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 maximum length of a non-empty string that occurs twice or more in S as contiguous substrings without overlapping. If there is no such non-empty string, print 0 instead.\n\nSample Input 1\n\n5\nababa\n\nSample Output 1\n\n2\n\nThe strings satisfying the conditions are: a, b, ab, and ba. The maximum length among them is 2, which is the answer.\nNote that aba occurs twice in S as contiguous substrings, but there is no pair of integers l_1 and l_2 mentioned in the statement such that l_1 + len \\leq l_2.\n\nSample Input 2\n\n2\nxy\n\nSample Output 2\n\n0\n\nNo non-empty string satisfies the conditions.\n\nSample Input 3\n\n13\nstrangeorange\n\nSample Output 3\n\n5", "sample_input": "5\nababa\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02913", "source_text": "Score : 500 points\n\nProblem Statement\n\nGiven is a string S of length N.\n\nFind the maximum length of a non-empty string that occurs twice or more in S as contiguous substrings without overlapping.\n\nMore formally, find the maximum positive integer len such that there exist integers l_1 and l_2 ( 1 \\leq l_1, l_2 \\leq N - len + 1 ) that satisfy the following:\n\nl_1 + len \\leq l_2\n\nS[l_1+i] = S[l_2+i] (i = 0, 1, ..., len - 1)\n\nIf there is no such integer len, print 0.\n\nConstraints\n\n2 \\leq N \\leq 5 \\times 10^3\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 maximum length of a non-empty string that occurs twice or more in S as contiguous substrings without overlapping. If there is no such non-empty string, print 0 instead.\n\nSample Input 1\n\n5\nababa\n\nSample Output 1\n\n2\n\nThe strings satisfying the conditions are: a, b, ab, and ba. The maximum length among them is 2, which is the answer.\nNote that aba occurs twice in S as contiguous substrings, but there is no pair of integers l_1 and l_2 mentioned in the statement such that l_1 + len \\leq l_2.\n\nSample Input 2\n\n2\nxy\n\nSample Output 2\n\n0\n\nNo non-empty string satisfies the conditions.\n\nSample Input 3\n\n13\nstrangeorange\n\nSample Output 3\n\n5", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2111, "memory_kb": 348496}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s733061804", "group_id": "codeNet:p02933", "input_text": "import java.util.*;\nimport java.io.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int a = Integer.parseInt(br.readLine());\n String s = br.readLine();\n \n if ( a < 3200 ) {\n System.out.println(\"red\");\n } else {\n System.out.println(s);\n }\n \n }\n}\n", "language": "Java", "metadata": {"date": 1573338484, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02933.html", "problem_id": "p02933", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02933/input.txt", "sample_output_relpath": "derived/input_output/data/p02933/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02933/Java/s733061804.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s733061804", "user_id": "u428922728"}, "prompt_components": {"gold_output": "pink\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int a = Integer.parseInt(br.readLine());\n String s = br.readLine();\n \n if ( a < 3200 ) {\n System.out.println(\"red\");\n } else {\n System.out.println(s);\n }\n \n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will be given an integer a and a string s consisting of lowercase English letters as input.\n\nWrite a program that prints s if a is not less than 3200 and prints red if a is less than 3200.\n\nConstraints\n\n2800 \\leq a < 5000\n\ns is a string of length between 1 and 10 (inclusive).\n\nEach character of s is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\ns\n\nOutput\n\nIf a is not less than 3200, print s; if a is less than 3200, print red.\n\nSample Input 1\n\n3200\npink\n\nSample Output 1\n\npink\n\na = 3200 is not less than 3200, so we print s = pink.\n\nSample Input 2\n\n3199\npink\n\nSample Output 2\n\nred\n\na = 3199 is less than 3200, so we print red.\n\nSample Input 3\n\n4049\nred\n\nSample Output 3\n\nred\n\na = 4049 is not less than 3200, so we print s = red.", "sample_input": "3200\npink\n"}, "reference_outputs": ["pink\n"], "source_document_id": "p02933", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will be given an integer a and a string s consisting of lowercase English letters as input.\n\nWrite a program that prints s if a is not less than 3200 and prints red if a is less than 3200.\n\nConstraints\n\n2800 \\leq a < 5000\n\ns is a string of length between 1 and 10 (inclusive).\n\nEach character of s is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\ns\n\nOutput\n\nIf a is not less than 3200, print s; if a is less than 3200, print red.\n\nSample Input 1\n\n3200\npink\n\nSample Output 1\n\npink\n\na = 3200 is not less than 3200, so we print s = pink.\n\nSample Input 2\n\n3199\npink\n\nSample Output 2\n\nred\n\na = 3199 is less than 3200, so we print red.\n\nSample Input 3\n\n4049\nred\n\nSample Output 3\n\nred\n\na = 4049 is not less than 3200, so we print s = red.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 440, "cpu_time_ms": 68, "memory_kb": 21076}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s165006731", "group_id": "codeNet:p02933", "input_text": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n {\n Scanner input = new Scanner(System.in);\n int a = input.nextInt();\n String s = input.next();\n if(a < 3200)\n System.out.println(\"red\");\n\n else\n System.out.println(s);\n }\n }\n}", "language": "Java", "metadata": {"date": 1566988339, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02933.html", "problem_id": "p02933", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02933/input.txt", "sample_output_relpath": "derived/input_output/data/p02933/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02933/Java/s165006731.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s165006731", "user_id": "u863370423"}, "prompt_components": {"gold_output": "pink\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n {\n Scanner input = new Scanner(System.in);\n int a = input.nextInt();\n String s = input.next();\n if(a < 3200)\n System.out.println(\"red\");\n\n else\n System.out.println(s);\n }\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will be given an integer a and a string s consisting of lowercase English letters as input.\n\nWrite a program that prints s if a is not less than 3200 and prints red if a is less than 3200.\n\nConstraints\n\n2800 \\leq a < 5000\n\ns is a string of length between 1 and 10 (inclusive).\n\nEach character of s is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\ns\n\nOutput\n\nIf a is not less than 3200, print s; if a is less than 3200, print red.\n\nSample Input 1\n\n3200\npink\n\nSample Output 1\n\npink\n\na = 3200 is not less than 3200, so we print s = pink.\n\nSample Input 2\n\n3199\npink\n\nSample Output 2\n\nred\n\na = 3199 is less than 3200, so we print red.\n\nSample Input 3\n\n4049\nred\n\nSample Output 3\n\nred\n\na = 4049 is not less than 3200, so we print s = red.", "sample_input": "3200\npink\n"}, "reference_outputs": ["pink\n"], "source_document_id": "p02933", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will be given an integer a and a string s consisting of lowercase English letters as input.\n\nWrite a program that prints s if a is not less than 3200 and prints red if a is less than 3200.\n\nConstraints\n\n2800 \\leq a < 5000\n\ns is a string of length between 1 and 10 (inclusive).\n\nEach character of s is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\ns\n\nOutput\n\nIf a is not less than 3200, print s; if a is less than 3200, print red.\n\nSample Input 1\n\n3200\npink\n\nSample Output 1\n\npink\n\na = 3200 is not less than 3200, so we print s = pink.\n\nSample Input 2\n\n3199\npink\n\nSample Output 2\n\nred\n\na = 3199 is less than 3200, so we print red.\n\nSample Input 3\n\n4049\nred\n\nSample Output 3\n\nred\n\na = 4049 is not less than 3200, so we print s = red.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 96, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s376306041", "group_id": "codeNet:p02933", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scn = new Scanner(System.in);\n\t\tint n = scn.nextInt();\n\t\tString m = scn.next();\n\t\tSystem.out.println(n>=3200?m:\"red\");\n\t\tscn.close();\n\t}\n}", "language": "Java", "metadata": {"date": 1566395218, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02933.html", "problem_id": "p02933", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02933/input.txt", "sample_output_relpath": "derived/input_output/data/p02933/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02933/Java/s376306041.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s376306041", "user_id": "u784210321"}, "prompt_components": {"gold_output": "pink\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scn = new Scanner(System.in);\n\t\tint n = scn.nextInt();\n\t\tString m = scn.next();\n\t\tSystem.out.println(n>=3200?m:\"red\");\n\t\tscn.close();\n\t}\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will be given an integer a and a string s consisting of lowercase English letters as input.\n\nWrite a program that prints s if a is not less than 3200 and prints red if a is less than 3200.\n\nConstraints\n\n2800 \\leq a < 5000\n\ns is a string of length between 1 and 10 (inclusive).\n\nEach character of s is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\ns\n\nOutput\n\nIf a is not less than 3200, print s; if a is less than 3200, print red.\n\nSample Input 1\n\n3200\npink\n\nSample Output 1\n\npink\n\na = 3200 is not less than 3200, so we print s = pink.\n\nSample Input 2\n\n3199\npink\n\nSample Output 2\n\nred\n\na = 3199 is less than 3200, so we print red.\n\nSample Input 3\n\n4049\nred\n\nSample Output 3\n\nred\n\na = 4049 is not less than 3200, so we print s = red.", "sample_input": "3200\npink\n"}, "reference_outputs": ["pink\n"], "source_document_id": "p02933", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will be given an integer a and a string s consisting of lowercase English letters as input.\n\nWrite a program that prints s if a is not less than 3200 and prints red if a is less than 3200.\n\nConstraints\n\n2800 \\leq a < 5000\n\ns is a string of length between 1 and 10 (inclusive).\n\nEach character of s is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\ns\n\nOutput\n\nIf a is not less than 3200, print s; if a is less than 3200, print red.\n\nSample Input 1\n\n3200\npink\n\nSample Output 1\n\npink\n\na = 3200 is not less than 3200, so we print s = pink.\n\nSample Input 2\n\n3199\npink\n\nSample Output 2\n\nred\n\na = 3199 is less than 3200, so we print red.\n\nSample Input 3\n\n4049\nred\n\nSample Output 3\n\nred\n\na = 4049 is not less than 3200, so we print s = red.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 237, "cpu_time_ms": 95, "memory_kb": 23764}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s953391812", "group_id": "codeNet:p02933", "input_text": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n\n int a = scanner.nextInt();\n String s = scanner.next();\n if (a >= 3200) System.out.println(s);\n else {\n System.out.println(\"red\");\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1566212052, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02933.html", "problem_id": "p02933", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02933/input.txt", "sample_output_relpath": "derived/input_output/data/p02933/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02933/Java/s953391812.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s953391812", "user_id": "u189832798"}, "prompt_components": {"gold_output": "pink\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n\n int a = scanner.nextInt();\n String s = scanner.next();\n if (a >= 3200) System.out.println(s);\n else {\n System.out.println(\"red\");\n }\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will be given an integer a and a string s consisting of lowercase English letters as input.\n\nWrite a program that prints s if a is not less than 3200 and prints red if a is less than 3200.\n\nConstraints\n\n2800 \\leq a < 5000\n\ns is a string of length between 1 and 10 (inclusive).\n\nEach character of s is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\ns\n\nOutput\n\nIf a is not less than 3200, print s; if a is less than 3200, print red.\n\nSample Input 1\n\n3200\npink\n\nSample Output 1\n\npink\n\na = 3200 is not less than 3200, so we print s = pink.\n\nSample Input 2\n\n3199\npink\n\nSample Output 2\n\nred\n\na = 3199 is less than 3200, so we print red.\n\nSample Input 3\n\n4049\nred\n\nSample Output 3\n\nred\n\na = 4049 is not less than 3200, so we print s = red.", "sample_input": "3200\npink\n"}, "reference_outputs": ["pink\n"], "source_document_id": "p02933", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will be given an integer a and a string s consisting of lowercase English letters as input.\n\nWrite a program that prints s if a is not less than 3200 and prints red if a is less than 3200.\n\nConstraints\n\n2800 \\leq a < 5000\n\ns is a string of length between 1 and 10 (inclusive).\n\nEach character of s is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\ns\n\nOutput\n\nIf a is not less than 3200, print s; if a is less than 3200, print red.\n\nSample Input 1\n\n3200\npink\n\nSample Output 1\n\npink\n\na = 3200 is not less than 3200, so we print s = pink.\n\nSample Input 2\n\n3199\npink\n\nSample Output 2\n\nred\n\na = 3199 is less than 3200, so we print red.\n\nSample Input 3\n\n4049\nred\n\nSample Output 3\n\nred\n\na = 4049 is not less than 3200, so we print s = red.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 98, "memory_kb": 21588}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s254017965", "group_id": "codeNet:p02933", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n\tstatic int n;\n\tstatic int q;\n\tstatic int[] result ;\n\tstatic int[][] inheritence;\n\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\t// 整数の入力\n\t\tn = sc.nextInt();\n\t\tq = sc.nextInt();\n\n\t\tresult = new int[n];\n\t\tinheritence = new int[n-1][2];\n\n\t\tfor(int i=0; i=0; k--) {\n\t\t\t\tif(isIncluded(k+1, p)) {\n\t\t\t\t\tresult[k] += x;\n\t\t\t\t}\n\t\t\t\tif(k=0; k--) {\n\t\t\t\tif(isIncluded(k+1, p)) {\n\t\t\t\t\tresult[k] += x;\n\t\t\t\t}\n\t\t\t\tif(k= 3200) {\n\t\t\tSystem.out.println(sc.nextLine());\n\t\t} else {\n\t\t\tSystem.out.println(\"red\");\n\t\t}\n\t}\n}\n", "language": "Java", "metadata": {"date": 1566177641, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02933.html", "problem_id": "p02933", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02933/input.txt", "sample_output_relpath": "derived/input_output/data/p02933/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02933/Java/s370975962.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s370975962", "user_id": "u279005807"}, "prompt_components": {"gold_output": "pink\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tif (sc.nextInt() >= 3200) {\n\t\t\tSystem.out.println(sc.nextLine());\n\t\t} else {\n\t\t\tSystem.out.println(\"red\");\n\t\t}\n\t}\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will be given an integer a and a string s consisting of lowercase English letters as input.\n\nWrite a program that prints s if a is not less than 3200 and prints red if a is less than 3200.\n\nConstraints\n\n2800 \\leq a < 5000\n\ns is a string of length between 1 and 10 (inclusive).\n\nEach character of s is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\ns\n\nOutput\n\nIf a is not less than 3200, print s; if a is less than 3200, print red.\n\nSample Input 1\n\n3200\npink\n\nSample Output 1\n\npink\n\na = 3200 is not less than 3200, so we print s = pink.\n\nSample Input 2\n\n3199\npink\n\nSample Output 2\n\nred\n\na = 3199 is less than 3200, so we print red.\n\nSample Input 3\n\n4049\nred\n\nSample Output 3\n\nred\n\na = 4049 is not less than 3200, so we print s = red.", "sample_input": "3200\npink\n"}, "reference_outputs": ["pink\n"], "source_document_id": "p02933", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will be given an integer a and a string s consisting of lowercase English letters as input.\n\nWrite a program that prints s if a is not less than 3200 and prints red if a is less than 3200.\n\nConstraints\n\n2800 \\leq a < 5000\n\ns is a string of length between 1 and 10 (inclusive).\n\nEach character of s is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\ns\n\nOutput\n\nIf a is not less than 3200, print s; if a is less than 3200, print red.\n\nSample Input 1\n\n3200\npink\n\nSample Output 1\n\npink\n\na = 3200 is not less than 3200, so we print s = pink.\n\nSample Input 2\n\n3199\npink\n\nSample Output 2\n\nred\n\na = 3199 is less than 3200, so we print red.\n\nSample Input 3\n\n4049\nred\n\nSample Output 3\n\nred\n\na = 4049 is not less than 3200, so we print s = red.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 246, "cpu_time_ms": 96, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s561923846", "group_id": "codeNet:p02933", "input_text": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\t// 整数の入力\n\t\tint a = sc.nextInt();\n\t\t// スペース区切りの整数の入力\n\t\tString s = sc.next();\n \tif(a >= 3200){\n System.out.println(s);\n }\n else\n {\n System.out.println(\"red\");\n }\n \n\t}\n}", "language": "Java", "metadata": {"date": 1566177368, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02933.html", "problem_id": "p02933", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02933/input.txt", "sample_output_relpath": "derived/input_output/data/p02933/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02933/Java/s561923846.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s561923846", "user_id": "u834467361"}, "prompt_components": {"gold_output": "pink\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\t// 整数の入力\n\t\tint a = sc.nextInt();\n\t\t// スペース区切りの整数の入力\n\t\tString s = sc.next();\n \tif(a >= 3200){\n System.out.println(s);\n }\n else\n {\n System.out.println(\"red\");\n }\n \n\t}\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will be given an integer a and a string s consisting of lowercase English letters as input.\n\nWrite a program that prints s if a is not less than 3200 and prints red if a is less than 3200.\n\nConstraints\n\n2800 \\leq a < 5000\n\ns is a string of length between 1 and 10 (inclusive).\n\nEach character of s is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\ns\n\nOutput\n\nIf a is not less than 3200, print s; if a is less than 3200, print red.\n\nSample Input 1\n\n3200\npink\n\nSample Output 1\n\npink\n\na = 3200 is not less than 3200, so we print s = pink.\n\nSample Input 2\n\n3199\npink\n\nSample Output 2\n\nred\n\na = 3199 is less than 3200, so we print red.\n\nSample Input 3\n\n4049\nred\n\nSample Output 3\n\nred\n\na = 4049 is not less than 3200, so we print s = red.", "sample_input": "3200\npink\n"}, "reference_outputs": ["pink\n"], "source_document_id": "p02933", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will be given an integer a and a string s consisting of lowercase English letters as input.\n\nWrite a program that prints s if a is not less than 3200 and prints red if a is less than 3200.\n\nConstraints\n\n2800 \\leq a < 5000\n\ns is a string of length between 1 and 10 (inclusive).\n\nEach character of s is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\ns\n\nOutput\n\nIf a is not less than 3200, print s; if a is less than 3200, print red.\n\nSample Input 1\n\n3200\npink\n\nSample Output 1\n\npink\n\na = 3200 is not less than 3200, so we print s = pink.\n\nSample Input 2\n\n3199\npink\n\nSample Output 2\n\nred\n\na = 3199 is less than 3200, so we print red.\n\nSample Input 3\n\n4049\nred\n\nSample Output 3\n\nred\n\na = 4049 is not less than 3200, so we print s = red.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 380, "cpu_time_ms": 93, "memory_kb": 21716}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s912064407", "group_id": "codeNet:p02933", "input_text": "import java.util.*;\nimport java.io.*;\n\npublic class Main{\n public static void main(String args[]) throws IOException\n {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int a = Integer.parseInt(br.readLine());\n String string = br.readLine();\n \n if(a>=3200)\n {\n System.out.println(string);\n }\n else\n {\n System.out.println(\"red\");\n }\n }\n}\n \n", "language": "Java", "metadata": {"date": 1566177315, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02933.html", "problem_id": "p02933", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02933/input.txt", "sample_output_relpath": "derived/input_output/data/p02933/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02933/Java/s912064407.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s912064407", "user_id": "u196501792"}, "prompt_components": {"gold_output": "pink\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\n\npublic class Main{\n public static void main(String args[]) throws IOException\n {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int a = Integer.parseInt(br.readLine());\n String string = br.readLine();\n \n if(a>=3200)\n {\n System.out.println(string);\n }\n else\n {\n System.out.println(\"red\");\n }\n }\n}\n \n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will be given an integer a and a string s consisting of lowercase English letters as input.\n\nWrite a program that prints s if a is not less than 3200 and prints red if a is less than 3200.\n\nConstraints\n\n2800 \\leq a < 5000\n\ns is a string of length between 1 and 10 (inclusive).\n\nEach character of s is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\ns\n\nOutput\n\nIf a is not less than 3200, print s; if a is less than 3200, print red.\n\nSample Input 1\n\n3200\npink\n\nSample Output 1\n\npink\n\na = 3200 is not less than 3200, so we print s = pink.\n\nSample Input 2\n\n3199\npink\n\nSample Output 2\n\nred\n\na = 3199 is less than 3200, so we print red.\n\nSample Input 3\n\n4049\nred\n\nSample Output 3\n\nred\n\na = 4049 is not less than 3200, so we print s = red.", "sample_input": "3200\npink\n"}, "reference_outputs": ["pink\n"], "source_document_id": "p02933", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will be given an integer a and a string s consisting of lowercase English letters as input.\n\nWrite a program that prints s if a is not less than 3200 and prints red if a is less than 3200.\n\nConstraints\n\n2800 \\leq a < 5000\n\ns is a string of length between 1 and 10 (inclusive).\n\nEach character of s is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\ns\n\nOutput\n\nIf a is not less than 3200, print s; if a is less than 3200, print red.\n\nSample Input 1\n\n3200\npink\n\nSample Output 1\n\npink\n\na = 3200 is not less than 3200, so we print s = pink.\n\nSample Input 2\n\n3199\npink\n\nSample Output 2\n\nred\n\na = 3199 is less than 3200, so we print red.\n\nSample Input 3\n\n4049\nred\n\nSample Output 3\n\nred\n\na = 4049 is not less than 3200, so we print s = red.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 70, "memory_kb": 22996}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s244442139", "group_id": "codeNet:p02933", "input_text": "import java.util.*;\n\npublic class Main {\n public static void main (String[]args){\n \n Scanner scanner = new Scanner(System.in);\n \n int a = scanner.nextInt();\n String s = scanner.nextLine();\n\n if (a < 3200){\n System.out.println(\"red\");\n } else{\n System.out.println(s);\n } \n \n scanner.close();\n\n }\n} ", "language": "Java", "metadata": {"date": 1566177283, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02933.html", "problem_id": "p02933", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02933/input.txt", "sample_output_relpath": "derived/input_output/data/p02933/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02933/Java/s244442139.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s244442139", "user_id": "u480938688"}, "prompt_components": {"gold_output": "pink\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n public static void main (String[]args){\n \n Scanner scanner = new Scanner(System.in);\n \n int a = scanner.nextInt();\n String s = scanner.nextLine();\n\n if (a < 3200){\n System.out.println(\"red\");\n } else{\n System.out.println(s);\n } \n \n scanner.close();\n\n }\n} ", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will be given an integer a and a string s consisting of lowercase English letters as input.\n\nWrite a program that prints s if a is not less than 3200 and prints red if a is less than 3200.\n\nConstraints\n\n2800 \\leq a < 5000\n\ns is a string of length between 1 and 10 (inclusive).\n\nEach character of s is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\ns\n\nOutput\n\nIf a is not less than 3200, print s; if a is less than 3200, print red.\n\nSample Input 1\n\n3200\npink\n\nSample Output 1\n\npink\n\na = 3200 is not less than 3200, so we print s = pink.\n\nSample Input 2\n\n3199\npink\n\nSample Output 2\n\nred\n\na = 3199 is less than 3200, so we print red.\n\nSample Input 3\n\n4049\nred\n\nSample Output 3\n\nred\n\na = 4049 is not less than 3200, so we print s = red.", "sample_input": "3200\npink\n"}, "reference_outputs": ["pink\n"], "source_document_id": "p02933", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will be given an integer a and a string s consisting of lowercase English letters as input.\n\nWrite a program that prints s if a is not less than 3200 and prints red if a is less than 3200.\n\nConstraints\n\n2800 \\leq a < 5000\n\ns is a string of length between 1 and 10 (inclusive).\n\nEach character of s is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\ns\n\nOutput\n\nIf a is not less than 3200, print s; if a is less than 3200, print red.\n\nSample Input 1\n\n3200\npink\n\nSample Output 1\n\npink\n\na = 3200 is not less than 3200, so we print s = pink.\n\nSample Input 2\n\n3199\npink\n\nSample Output 2\n\nred\n\na = 3199 is less than 3200, so we print red.\n\nSample Input 3\n\n4049\nred\n\nSample Output 3\n\nred\n\na = 4049 is not less than 3200, so we print s = red.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 110, "memory_kb": 22228}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s966884884", "group_id": "codeNet:p02933", "input_text": "import java.util.*;\n\nclass Main{\n public static void main(String args[]){\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n if(a<3200){\n System.out.println(\"red\");\n }else{\n System.out.println(sc.next());\n }\n }\n}", "language": "Java", "metadata": {"date": 1566176663, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02933.html", "problem_id": "p02933", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02933/input.txt", "sample_output_relpath": "derived/input_output/data/p02933/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02933/Java/s966884884.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s966884884", "user_id": "u458268106"}, "prompt_components": {"gold_output": "pink\n", "input_to_evaluate": "import java.util.*;\n\nclass Main{\n public static void main(String args[]){\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n if(a<3200){\n System.out.println(\"red\");\n }else{\n System.out.println(sc.next());\n }\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will be given an integer a and a string s consisting of lowercase English letters as input.\n\nWrite a program that prints s if a is not less than 3200 and prints red if a is less than 3200.\n\nConstraints\n\n2800 \\leq a < 5000\n\ns is a string of length between 1 and 10 (inclusive).\n\nEach character of s is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\ns\n\nOutput\n\nIf a is not less than 3200, print s; if a is less than 3200, print red.\n\nSample Input 1\n\n3200\npink\n\nSample Output 1\n\npink\n\na = 3200 is not less than 3200, so we print s = pink.\n\nSample Input 2\n\n3199\npink\n\nSample Output 2\n\nred\n\na = 3199 is less than 3200, so we print red.\n\nSample Input 3\n\n4049\nred\n\nSample Output 3\n\nred\n\na = 4049 is not less than 3200, so we print s = red.", "sample_input": "3200\npink\n"}, "reference_outputs": ["pink\n"], "source_document_id": "p02933", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will be given an integer a and a string s consisting of lowercase English letters as input.\n\nWrite a program that prints s if a is not less than 3200 and prints red if a is less than 3200.\n\nConstraints\n\n2800 \\leq a < 5000\n\ns is a string of length between 1 and 10 (inclusive).\n\nEach character of s is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\ns\n\nOutput\n\nIf a is not less than 3200, print s; if a is less than 3200, print red.\n\nSample Input 1\n\n3200\npink\n\nSample Output 1\n\npink\n\na = 3200 is not less than 3200, so we print s = pink.\n\nSample Input 2\n\n3199\npink\n\nSample Output 2\n\nred\n\na = 3199 is less than 3200, so we print red.\n\nSample Input 3\n\n4049\nred\n\nSample Output 3\n\nred\n\na = 4049 is not less than 3200, so we print s = red.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 93, "memory_kb": 22608}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s055013623", "group_id": "codeNet:p02933", "input_text": "import java.util.*;\nimport static java.lang.Math.*;\n\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\n\t\t// 入力\n\t\tint a = sc.nextInt();\n\t\tString s = sc.next();\n\n\t\t// 出力\n\t\tif(a >= 3200){\n\t\t System.out.println(s); \n\t\t}else{\n\t\t System.out.println(\"red\");\n\t\t}\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1566176570, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02933.html", "problem_id": "p02933", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02933/input.txt", "sample_output_relpath": "derived/input_output/data/p02933/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02933/Java/s055013623.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s055013623", "user_id": "u513960802"}, "prompt_components": {"gold_output": "pink\n", "input_to_evaluate": "import java.util.*;\nimport static java.lang.Math.*;\n\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\n\t\t// 入力\n\t\tint a = sc.nextInt();\n\t\tString s = sc.next();\n\n\t\t// 出力\n\t\tif(a >= 3200){\n\t\t System.out.println(s); \n\t\t}else{\n\t\t System.out.println(\"red\");\n\t\t}\n\t}\n\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will be given an integer a and a string s consisting of lowercase English letters as input.\n\nWrite a program that prints s if a is not less than 3200 and prints red if a is less than 3200.\n\nConstraints\n\n2800 \\leq a < 5000\n\ns is a string of length between 1 and 10 (inclusive).\n\nEach character of s is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\ns\n\nOutput\n\nIf a is not less than 3200, print s; if a is less than 3200, print red.\n\nSample Input 1\n\n3200\npink\n\nSample Output 1\n\npink\n\na = 3200 is not less than 3200, so we print s = pink.\n\nSample Input 2\n\n3199\npink\n\nSample Output 2\n\nred\n\na = 3199 is less than 3200, so we print red.\n\nSample Input 3\n\n4049\nred\n\nSample Output 3\n\nred\n\na = 4049 is not less than 3200, so we print s = red.", "sample_input": "3200\npink\n"}, "reference_outputs": ["pink\n"], "source_document_id": "p02933", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will be given an integer a and a string s consisting of lowercase English letters as input.\n\nWrite a program that prints s if a is not less than 3200 and prints red if a is less than 3200.\n\nConstraints\n\n2800 \\leq a < 5000\n\ns is a string of length between 1 and 10 (inclusive).\n\nEach character of s is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\ns\n\nOutput\n\nIf a is not less than 3200, print s; if a is less than 3200, print red.\n\nSample Input 1\n\n3200\npink\n\nSample Output 1\n\npink\n\na = 3200 is not less than 3200, so we print s = pink.\n\nSample Input 2\n\n3199\npink\n\nSample Output 2\n\nred\n\na = 3199 is less than 3200, so we print red.\n\nSample Input 3\n\n4049\nred\n\nSample Output 3\n\nred\n\na = 4049 is not less than 3200, so we print s = red.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 325, "cpu_time_ms": 94, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s779653666", "group_id": "codeNet:p02933", "input_text": "import java.util.*;\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner stdIn = new Scanner(System.in);\n\t\tint a = stdIn.nextInt();\n\t\tString s = stdIn.next();\n\t\tif(a >= 3200) System.out.println(s);\n\t\telse System.out.println(\"red\");\n\t\t\n\t}\n\n}", "language": "Java", "metadata": {"date": 1566176535, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02933.html", "problem_id": "p02933", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02933/input.txt", "sample_output_relpath": "derived/input_output/data/p02933/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02933/Java/s779653666.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s779653666", "user_id": "u847241179"}, "prompt_components": {"gold_output": "pink\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner stdIn = new Scanner(System.in);\n\t\tint a = stdIn.nextInt();\n\t\tString s = stdIn.next();\n\t\tif(a >= 3200) System.out.println(s);\n\t\telse System.out.println(\"red\");\n\t\t\n\t}\n\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will be given an integer a and a string s consisting of lowercase English letters as input.\n\nWrite a program that prints s if a is not less than 3200 and prints red if a is less than 3200.\n\nConstraints\n\n2800 \\leq a < 5000\n\ns is a string of length between 1 and 10 (inclusive).\n\nEach character of s is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\ns\n\nOutput\n\nIf a is not less than 3200, print s; if a is less than 3200, print red.\n\nSample Input 1\n\n3200\npink\n\nSample Output 1\n\npink\n\na = 3200 is not less than 3200, so we print s = pink.\n\nSample Input 2\n\n3199\npink\n\nSample Output 2\n\nred\n\na = 3199 is less than 3200, so we print red.\n\nSample Input 3\n\n4049\nred\n\nSample Output 3\n\nred\n\na = 4049 is not less than 3200, so we print s = red.", "sample_input": "3200\npink\n"}, "reference_outputs": ["pink\n"], "source_document_id": "p02933", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will be given an integer a and a string s consisting of lowercase English letters as input.\n\nWrite a program that prints s if a is not less than 3200 and prints red if a is less than 3200.\n\nConstraints\n\n2800 \\leq a < 5000\n\ns is a string of length between 1 and 10 (inclusive).\n\nEach character of s is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\ns\n\nOutput\n\nIf a is not less than 3200, print s; if a is less than 3200, print red.\n\nSample Input 1\n\n3200\npink\n\nSample Output 1\n\npink\n\na = 3200 is not less than 3200, so we print s = pink.\n\nSample Input 2\n\n3199\npink\n\nSample Output 2\n\nred\n\na = 3199 is less than 3200, so we print red.\n\nSample Input 3\n\n4049\nred\n\nSample Output 3\n\nred\n\na = 4049 is not less than 3200, so we print s = red.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 108, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s405270289", "group_id": "codeNet:p02933", "input_text": "\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.NoSuchElementException;\n\n\n/** テンプレート */\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner();\n\t\tint a = sc.nextInt();\n\t\tString s = sc.next();\n\n\n\n\t\t//************************************/\n\t\t// ここから出力処理\n\t\t//************************************/\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tif(a >= 3200) {\n\t\t\tout.println(s);\n\n\t\t}else {\n\t\t\tout.println(\"red\");\n\n\t\t}\n\t\t// 最後に必ずFlush\n\t\tout.flush();\n\t}\n}\n\n\n//public class Main {\n//\tfinal static int SSSSS = 1000000;\n//\n//\n//\tpublic static void main(String[] args) {\n//\t\tFastScanner sc = new FastScanner();\n//\t\tint N = sc.nextInt();\n//\t\tint K = sc.nextInt();\n//\n//\t\tdouble ans = 0;\n//\t\tint min = Main.calc(K);\n//\t\tint count = 1;\n//\n//\n//\t\tif(K <= N) {\n//\n//\t\t\tfor(int i=2; i<=K-1; i++) {\n//\n//\t\t\t\t count += min / Main.calc((int)Math.ceil((double)K / i));\n//\n//\t\t\t}\n////\t\t\t//deb\n////\t\t\tout.println(count);\n//\n//\t\t\tans = (double)(count+(N-K+1)*min)/(N * min);\n//\n//\t\t}else {\n//\t\t\tfor(int i=2; i<=N; i++) {\n////\t\t\t\t//deb\n////\t\t\t\tout.println(\"count:\");\n////\t\t\t\tout.println(count);\n////\t\t\t\tout.println(\"ceil:\");\n////\t\t\t\tout.println(((int)Math.ceil(K / i)));\n////\t\t\t\tout.println(\"calc:\");\n////\t\t\t\tout.println(Main.calc((int)Math.ceil(K / i)));\n////\t\t\t\tout.println(\"min / calc:\");\n////\t\t\t\tout.println(min / Main.calc((int)Math.ceil(K / i)));\n////\t\t\t\tout.flush();\n////\t\t\t\t//\n//\n//\n//\t\t\t\t count += min / Main.calc((int)Math.ceil((double)K / i));\n//\t\t\t}\n//\n//\t\t\tans = (double)count/(N * min);\n//\t\t}\n//\n//\n//\n//\t\t//************************************/\n//\t\t// ここから出力処理\n//\t\t//************************************/\n//\t\tPrintWriter out = new PrintWriter(System.out);\n//\n//\t\tout.println(ans);\n//\n//\t\t// 最後に必ずFlush\n//\t\tout.flush();\n//\t}\n//\n//\n//\t/**\n//\t * xが2のべき乗かどうか調べる関数\n//\t * @param x\n//\t * @return 2のべき乗ならtrue。0はfalse。\n//\t */\n//\tstatic boolean isPowerOfTwo(int x){\n//\t return x > 0 && (x & (x - 1)) == 0;\n//\t}\n//\n//\tstatic int calc(int num) {\n//\t if(isPowerOfTwo(num)){\n//\t \treturn num;\n//\t }\n//\n//\t\tint ret = 0;\n//\t\tfor(int shift=2; shift<31; shift++){ // 32bit符号付整数なので30回シフト=2^31が限界\n//\t\t\tret = 1 << shift; // 1を左シフトして2のべき乗を生成\n//\t\t\tif(ret > num){\n//\t\t\t\treturn ret;\n//\t\t\t}\n//\t\t}\n//\t\treturn ret;\n//\t}\n//\n//\n//}\n\n\n\n///** ★★テンプレート */\n//public class Main {\n//\tpublic static void main(String[] args) {\n//\t\tFastScanner sc = new FastScanner();\n//\t\tint N = sc.nextInt();\n//\t\tint M = sc.nextInt();\n//\n//\t\tint[] ary = new int[N];\n//\t\tfor (int i = 0; i < N; i++) {\n//\t\t\tary[i] = sc.nextInt();\n//\t\t}\n////\n////\t\tPair[] a = { new Pair(0, 5), new Pair(1, 10), new Pair(2, 3) };\n////\t\tArrays.sort(a, new Comparator() {\n////\t\t\tpublic int compare(Pair o1, Pair o2) {\n////\t\t\t\treturn Integer.compare(o1.v, o2.v); //Java7以降\n////\t\t\t}\n////\t\t});\n//\n//\t\t//************************************/\n//\t\t// ここから出力処理\n//\t\t//************************************/\n//\t\tPrintWriter out = new PrintWriter(System.out);\n//\n//\t\tout.println(\"hoge\");\n//\n//\t\t// 最後に必ずFlush\n//\t\tout.flush();\n//\t}\n//}\n\n\n\n\n/** スキャン用 */\nclass FastScanner {\n\tprivate final InputStream in = System.in;\n\tprivate final byte[] buffer = new byte[1024];\n\tprivate int ptr = 0;\n\tprivate int buflen = 0;\n\n\t/** クラス内部用だよ */\n\tprivate boolean hasNextByte() {\n\t\tif (ptr < buflen) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\tptr = 0;\n\t\t\ttry {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\t/** クラス内部用だよ */\n\tprivate int readByte() {\n\t\tif (hasNextByte()) {\n\t\t\treturn buffer[ptr++];\n\t\t} else {\n\t\t\treturn -1;\n\t\t}\n\t}\n\n\t/**\n\t * クラス内部用だよ\n\t * ASCII の文字の内、表示用の文字を返す関数\n\t *\n\t * @return 改行とか制御文字じゃない、表示用文字ならtrue\n\t * */\n\tprivate static boolean isPrintableChar(int c) {\n\t\treturn 33 <= c && c <= 126;\n\t}\n\n\t/**\n\t * @return 改行文字とか空白以外を除いた、次の文字があればtrue\n\t * */\n\tpublic boolean hasNext() {\n\t\twhile (hasNextByte() && !isPrintableChar(buffer[ptr])) {\n\t\t\tptr++;\n\t\t}\n\t\treturn hasNextByte();\n\t}\n\n\t/**\n\t *\n\t * @return 次の文字列\n\t */\n\tpublic String next() {\n\t\tif (!hasNext()) {\n\t\t\tthrow new NoSuchElementException();\n\t\t}\n\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint b = readByte();\n\t\twhile (isPrintableChar(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\n\t/**\n\t *\n\t * @return 次のLong\n\t */\n\tpublic long nextLong() {\n\t\tif (!hasNext())\n\t\t\tthrow new NoSuchElementException();\n\t\tlong n = 0;\n\t\tboolean minus = false;\n\t\tint b = readByte();\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\tif (b < '0' || '9' < b) {\n\t\t\tthrow new NumberFormatException();\n\t\t}\n\t\twhile (true) {\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n\t/**\n\t *\n\t * @return 次のInt\n\t */\n\tpublic int nextInt() {\n\t\tlong nl = nextLong();\n\t\tif (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)\n\t\t\tthrow new NumberFormatException();\n\t\treturn (int) nl;\n\t}\n\n\t/**\n\t *\n\t * @return 次のDouble\n\t */\n\tpublic double nextDouble() {\n\t\treturn Double.parseDouble(next());\n\t}\n}\n\nclass PairII {\n\tint k;\n\tint v;\n\n\tpublic PairII(int k, int v) {\n\t\tthis.k = k;\n\t\tthis.v = v;\n\t}\n}\n\nclass PairSI {\n\tString k;\n\tint v;\n\tint num; // 出現順\n\n\tpublic PairSI(String k, int v, int num) {\n\t\tthis.k = k;\n\t\tthis.v = v;\n\t\tthis.num = num;\n\t}\n}\n\n//class Pair extends AbstractMap.SimpleEntry {\n//\t/** serialVersionUID. */\n//\tprivate static final long serialVersionUID = 6411527075103472113L;\n//\n//\tpublic Pair(final K key, final V value) {\n//\t\tsuper(key, value);\n//\t}\n//}\n", "language": "Java", "metadata": {"date": 1566176496, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02933.html", "problem_id": "p02933", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02933/input.txt", "sample_output_relpath": "derived/input_output/data/p02933/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02933/Java/s405270289.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s405270289", "user_id": "u635596076"}, "prompt_components": {"gold_output": "pink\n", "input_to_evaluate": "\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.NoSuchElementException;\n\n\n/** テンプレート */\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner();\n\t\tint a = sc.nextInt();\n\t\tString s = sc.next();\n\n\n\n\t\t//************************************/\n\t\t// ここから出力処理\n\t\t//************************************/\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tif(a >= 3200) {\n\t\t\tout.println(s);\n\n\t\t}else {\n\t\t\tout.println(\"red\");\n\n\t\t}\n\t\t// 最後に必ずFlush\n\t\tout.flush();\n\t}\n}\n\n\n//public class Main {\n//\tfinal static int SSSSS = 1000000;\n//\n//\n//\tpublic static void main(String[] args) {\n//\t\tFastScanner sc = new FastScanner();\n//\t\tint N = sc.nextInt();\n//\t\tint K = sc.nextInt();\n//\n//\t\tdouble ans = 0;\n//\t\tint min = Main.calc(K);\n//\t\tint count = 1;\n//\n//\n//\t\tif(K <= N) {\n//\n//\t\t\tfor(int i=2; i<=K-1; i++) {\n//\n//\t\t\t\t count += min / Main.calc((int)Math.ceil((double)K / i));\n//\n//\t\t\t}\n////\t\t\t//deb\n////\t\t\tout.println(count);\n//\n//\t\t\tans = (double)(count+(N-K+1)*min)/(N * min);\n//\n//\t\t}else {\n//\t\t\tfor(int i=2; i<=N; i++) {\n////\t\t\t\t//deb\n////\t\t\t\tout.println(\"count:\");\n////\t\t\t\tout.println(count);\n////\t\t\t\tout.println(\"ceil:\");\n////\t\t\t\tout.println(((int)Math.ceil(K / i)));\n////\t\t\t\tout.println(\"calc:\");\n////\t\t\t\tout.println(Main.calc((int)Math.ceil(K / i)));\n////\t\t\t\tout.println(\"min / calc:\");\n////\t\t\t\tout.println(min / Main.calc((int)Math.ceil(K / i)));\n////\t\t\t\tout.flush();\n////\t\t\t\t//\n//\n//\n//\t\t\t\t count += min / Main.calc((int)Math.ceil((double)K / i));\n//\t\t\t}\n//\n//\t\t\tans = (double)count/(N * min);\n//\t\t}\n//\n//\n//\n//\t\t//************************************/\n//\t\t// ここから出力処理\n//\t\t//************************************/\n//\t\tPrintWriter out = new PrintWriter(System.out);\n//\n//\t\tout.println(ans);\n//\n//\t\t// 最後に必ずFlush\n//\t\tout.flush();\n//\t}\n//\n//\n//\t/**\n//\t * xが2のべき乗かどうか調べる関数\n//\t * @param x\n//\t * @return 2のべき乗ならtrue。0はfalse。\n//\t */\n//\tstatic boolean isPowerOfTwo(int x){\n//\t return x > 0 && (x & (x - 1)) == 0;\n//\t}\n//\n//\tstatic int calc(int num) {\n//\t if(isPowerOfTwo(num)){\n//\t \treturn num;\n//\t }\n//\n//\t\tint ret = 0;\n//\t\tfor(int shift=2; shift<31; shift++){ // 32bit符号付整数なので30回シフト=2^31が限界\n//\t\t\tret = 1 << shift; // 1を左シフトして2のべき乗を生成\n//\t\t\tif(ret > num){\n//\t\t\t\treturn ret;\n//\t\t\t}\n//\t\t}\n//\t\treturn ret;\n//\t}\n//\n//\n//}\n\n\n\n///** ★★テンプレート */\n//public class Main {\n//\tpublic static void main(String[] args) {\n//\t\tFastScanner sc = new FastScanner();\n//\t\tint N = sc.nextInt();\n//\t\tint M = sc.nextInt();\n//\n//\t\tint[] ary = new int[N];\n//\t\tfor (int i = 0; i < N; i++) {\n//\t\t\tary[i] = sc.nextInt();\n//\t\t}\n////\n////\t\tPair[] a = { new Pair(0, 5), new Pair(1, 10), new Pair(2, 3) };\n////\t\tArrays.sort(a, new Comparator() {\n////\t\t\tpublic int compare(Pair o1, Pair o2) {\n////\t\t\t\treturn Integer.compare(o1.v, o2.v); //Java7以降\n////\t\t\t}\n////\t\t});\n//\n//\t\t//************************************/\n//\t\t// ここから出力処理\n//\t\t//************************************/\n//\t\tPrintWriter out = new PrintWriter(System.out);\n//\n//\t\tout.println(\"hoge\");\n//\n//\t\t// 最後に必ずFlush\n//\t\tout.flush();\n//\t}\n//}\n\n\n\n\n/** スキャン用 */\nclass FastScanner {\n\tprivate final InputStream in = System.in;\n\tprivate final byte[] buffer = new byte[1024];\n\tprivate int ptr = 0;\n\tprivate int buflen = 0;\n\n\t/** クラス内部用だよ */\n\tprivate boolean hasNextByte() {\n\t\tif (ptr < buflen) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\tptr = 0;\n\t\t\ttry {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\t/** クラス内部用だよ */\n\tprivate int readByte() {\n\t\tif (hasNextByte()) {\n\t\t\treturn buffer[ptr++];\n\t\t} else {\n\t\t\treturn -1;\n\t\t}\n\t}\n\n\t/**\n\t * クラス内部用だよ\n\t * ASCII の文字の内、表示用の文字を返す関数\n\t *\n\t * @return 改行とか制御文字じゃない、表示用文字ならtrue\n\t * */\n\tprivate static boolean isPrintableChar(int c) {\n\t\treturn 33 <= c && c <= 126;\n\t}\n\n\t/**\n\t * @return 改行文字とか空白以外を除いた、次の文字があればtrue\n\t * */\n\tpublic boolean hasNext() {\n\t\twhile (hasNextByte() && !isPrintableChar(buffer[ptr])) {\n\t\t\tptr++;\n\t\t}\n\t\treturn hasNextByte();\n\t}\n\n\t/**\n\t *\n\t * @return 次の文字列\n\t */\n\tpublic String next() {\n\t\tif (!hasNext()) {\n\t\t\tthrow new NoSuchElementException();\n\t\t}\n\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint b = readByte();\n\t\twhile (isPrintableChar(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\n\t/**\n\t *\n\t * @return 次のLong\n\t */\n\tpublic long nextLong() {\n\t\tif (!hasNext())\n\t\t\tthrow new NoSuchElementException();\n\t\tlong n = 0;\n\t\tboolean minus = false;\n\t\tint b = readByte();\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\tif (b < '0' || '9' < b) {\n\t\t\tthrow new NumberFormatException();\n\t\t}\n\t\twhile (true) {\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n\t/**\n\t *\n\t * @return 次のInt\n\t */\n\tpublic int nextInt() {\n\t\tlong nl = nextLong();\n\t\tif (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)\n\t\t\tthrow new NumberFormatException();\n\t\treturn (int) nl;\n\t}\n\n\t/**\n\t *\n\t * @return 次のDouble\n\t */\n\tpublic double nextDouble() {\n\t\treturn Double.parseDouble(next());\n\t}\n}\n\nclass PairII {\n\tint k;\n\tint v;\n\n\tpublic PairII(int k, int v) {\n\t\tthis.k = k;\n\t\tthis.v = v;\n\t}\n}\n\nclass PairSI {\n\tString k;\n\tint v;\n\tint num; // 出現順\n\n\tpublic PairSI(String k, int v, int num) {\n\t\tthis.k = k;\n\t\tthis.v = v;\n\t\tthis.num = num;\n\t}\n}\n\n//class Pair extends AbstractMap.SimpleEntry {\n//\t/** serialVersionUID. */\n//\tprivate static final long serialVersionUID = 6411527075103472113L;\n//\n//\tpublic Pair(final K key, final V value) {\n//\t\tsuper(key, value);\n//\t}\n//}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will be given an integer a and a string s consisting of lowercase English letters as input.\n\nWrite a program that prints s if a is not less than 3200 and prints red if a is less than 3200.\n\nConstraints\n\n2800 \\leq a < 5000\n\ns is a string of length between 1 and 10 (inclusive).\n\nEach character of s is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\ns\n\nOutput\n\nIf a is not less than 3200, print s; if a is less than 3200, print red.\n\nSample Input 1\n\n3200\npink\n\nSample Output 1\n\npink\n\na = 3200 is not less than 3200, so we print s = pink.\n\nSample Input 2\n\n3199\npink\n\nSample Output 2\n\nred\n\na = 3199 is less than 3200, so we print red.\n\nSample Input 3\n\n4049\nred\n\nSample Output 3\n\nred\n\na = 4049 is not less than 3200, so we print s = red.", "sample_input": "3200\npink\n"}, "reference_outputs": ["pink\n"], "source_document_id": "p02933", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will be given an integer a and a string s consisting of lowercase English letters as input.\n\nWrite a program that prints s if a is not less than 3200 and prints red if a is less than 3200.\n\nConstraints\n\n2800 \\leq a < 5000\n\ns is a string of length between 1 and 10 (inclusive).\n\nEach character of s is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\ns\n\nOutput\n\nIf a is not less than 3200, print s; if a is less than 3200, print red.\n\nSample Input 1\n\n3200\npink\n\nSample Output 1\n\npink\n\na = 3200 is not less than 3200, so we print s = pink.\n\nSample Input 2\n\n3199\npink\n\nSample Output 2\n\nred\n\na = 3199 is less than 3200, so we print red.\n\nSample Input 3\n\n4049\nred\n\nSample Output 3\n\nred\n\na = 4049 is not less than 3200, so we print s = red.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 6047, "cpu_time_ms": 70, "memory_kb": 22996}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s358989703", "group_id": "codeNet:p02936", "input_text": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n // Your code here!\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int k = sc.nextInt();\n \n List[] to = new List[n];\n for (int i = 0; i < n; i++) {\n to[i] = new ArrayList();\n }\n \n // リストの作成\n for (int i = 0; i < n - 1; i++) {\n int s = sc.nextInt() - 1;\n int t = sc.nextInt() - 1;\n to[s].add(t);\n to[t].add(s); \n }\n \n int[] first = new int[n];\n for (int i = 0; i < k; i++) {\n int p = sc.nextInt() - 1;\n int count = sc.nextInt();\n first[p] += count;\n }\n \n int[] last = new int[n];\n \n // visited[i][j]: 当該マスを既に通ったか否か\n boolean[] visited = new boolean[n];\n visited[0] = true;\n \n // steps = BFS((0, 0)→(h, w)までの最短経路の深さ)\n Queue que = new ArrayDeque();\n que.add(new int[]{0, 0});\n while (!que.isEmpty()) {\n int[] cur = que.poll();\n int p = cur[0];\n int count = cur[1] + first[p];\n last[p] = count;\n \n for (Integer q : to[p]) {\n if (!visited[q]) {\n que.add(new int[]{q, count});\n visited[q] = true;\n }\n }\n }\n \n for (int i = 0; i < n; i++) {\n System.out.print(last[i]);\n if (i != n - 1) {\n System.out.print(\" \");\n } else {\n System.out.println();\n }\n }\n }\n}", "language": "Java", "metadata": {"date": 1586569281, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02936.html", "problem_id": "p02936", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02936/input.txt", "sample_output_relpath": "derived/input_output/data/p02936/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02936/Java/s358989703.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s358989703", "user_id": "u273816974"}, "prompt_components": {"gold_output": "100 110 111 110\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n // Your code here!\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int k = sc.nextInt();\n \n List[] to = new List[n];\n for (int i = 0; i < n; i++) {\n to[i] = new ArrayList();\n }\n \n // リストの作成\n for (int i = 0; i < n - 1; i++) {\n int s = sc.nextInt() - 1;\n int t = sc.nextInt() - 1;\n to[s].add(t);\n to[t].add(s); \n }\n \n int[] first = new int[n];\n for (int i = 0; i < k; i++) {\n int p = sc.nextInt() - 1;\n int count = sc.nextInt();\n first[p] += count;\n }\n \n int[] last = new int[n];\n \n // visited[i][j]: 当該マスを既に通ったか否か\n boolean[] visited = new boolean[n];\n visited[0] = true;\n \n // steps = BFS((0, 0)→(h, w)までの最短経路の深さ)\n Queue que = new ArrayDeque();\n que.add(new int[]{0, 0});\n while (!que.isEmpty()) {\n int[] cur = que.poll();\n int p = cur[0];\n int count = cur[1] + first[p];\n last[p] = count;\n \n for (Integer q : to[p]) {\n if (!visited[q]) {\n que.add(new int[]{q, count});\n visited[q] = true;\n }\n }\n }\n \n for (int i = 0; i < n; i++) {\n System.out.print(last[i]);\n if (i != n - 1) {\n System.out.print(\" \");\n } else {\n System.out.println();\n }\n }\n }\n}", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a rooted tree with N vertices numbered 1 to N.\nThe root is Vertex 1, and the i-th edge (1 \\leq i \\leq N - 1) connects Vertex a_i and b_i.\n\nEach of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0.\n\nNow, the following Q operations will be performed:\n\nOperation j (1 \\leq j \\leq Q): Increment by x_j the counter on every vertex contained in the subtree rooted at Vertex p_j.\n\nFind the value of the counter on each vertex after all operations.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq Q \\leq 2 \\times 10^5\n\n1 \\leq a_i < b_i \\leq N\n\n1 \\leq p_j \\leq N\n\n1 \\leq x_j \\leq 10^4\n\nThe given graph is a tree.\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 b_1\n:\na_{N-1} b_{N-1}\np_1 x_1\n:\np_Q x_Q\n\nOutput\n\nPrint the values of the counters on Vertex 1, 2, \\ldots, N after all operations, in this order, with spaces in between.\n\nSample Input 1\n\n4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n\nSample Output 1\n\n100 110 111 110\n\nThe tree in this input is as follows:\n\nEach operation changes the values of the counters on the vertices as follows:\n\nOperation 1: Increment by 10 the counter on every vertex contained in the subtree rooted at Vertex 2, that is, Vertex 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 0, 10, 10, 10, respectively.\n\nOperation 2: Increment by 100 the counter on every vertex contained in the subtree rooted at Vertex 1, that is, Vertex 1, 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 110, 110, respectively.\n\nOperation 3: Increment by 1 the counter on every vertex contained in the subtree rooted at Vertex 3, that is, Vertex 3. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 111, 110, respectively.\n\nSample Input 2\n\n6 2\n1 2\n1 3\n2 4\n3 6\n2 5\n1 10\n1 10\n\nSample Output 2\n\n20 20 20 20 20 20", "sample_input": "4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n"}, "reference_outputs": ["100 110 111 110\n"], "source_document_id": "p02936", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a rooted tree with N vertices numbered 1 to N.\nThe root is Vertex 1, and the i-th edge (1 \\leq i \\leq N - 1) connects Vertex a_i and b_i.\n\nEach of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0.\n\nNow, the following Q operations will be performed:\n\nOperation j (1 \\leq j \\leq Q): Increment by x_j the counter on every vertex contained in the subtree rooted at Vertex p_j.\n\nFind the value of the counter on each vertex after all operations.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq Q \\leq 2 \\times 10^5\n\n1 \\leq a_i < b_i \\leq N\n\n1 \\leq p_j \\leq N\n\n1 \\leq x_j \\leq 10^4\n\nThe given graph is a tree.\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 b_1\n:\na_{N-1} b_{N-1}\np_1 x_1\n:\np_Q x_Q\n\nOutput\n\nPrint the values of the counters on Vertex 1, 2, \\ldots, N after all operations, in this order, with spaces in between.\n\nSample Input 1\n\n4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n\nSample Output 1\n\n100 110 111 110\n\nThe tree in this input is as follows:\n\nEach operation changes the values of the counters on the vertices as follows:\n\nOperation 1: Increment by 10 the counter on every vertex contained in the subtree rooted at Vertex 2, that is, Vertex 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 0, 10, 10, 10, respectively.\n\nOperation 2: Increment by 100 the counter on every vertex contained in the subtree rooted at Vertex 1, that is, Vertex 1, 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 110, 110, respectively.\n\nOperation 3: Increment by 1 the counter on every vertex contained in the subtree rooted at Vertex 3, that is, Vertex 3. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 111, 110, respectively.\n\nSample Input 2\n\n6 2\n1 2\n1 3\n2 4\n3 6\n2 5\n1 10\n1 10\n\nSample Output 2\n\n20 20 20 20 20 20", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1782, "cpu_time_ms": 1966, "memory_kb": 204548}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s577390740", "group_id": "codeNet:p02936", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tstatic Scanner scan = new Scanner(System.in);\n\tstatic int N = scan.nextInt();\n\tstatic int Q = scan.nextInt();\n\tstatic int[]a = new int[N];\n\tstatic int[]b = new int[N];\n\tstatic int[]p = new int[N+1];\n\tstatic int[]x = new int[N+1];\n\tstatic int counter = 0;\n\tstatic int[] tyoutencount = new int[N+1];\n\tstatic int[] tyoutenXcount = new int[N+1];\n\tstatic boolean[] tyoutenserch = new boolean[N+1];\n\tstatic int[][]edge = new int[N+1][N+1];//余分に作っておく\n\t\n\tpublic static void main(String[]args) {\n\t\tfor(int i = 1;i> plain_graph = new ArrayList<>(n_v);\n \n for(int i=0; i null_arr = new ArrayList<>(0);\n plain_graph.add(null_arr);\n }\n \n int a = -1, b = -1;\n for(int i=1; i> null_arrX2 = new ArrayList<>(n_v);\n for(int i=0; i null_arr = new ArrayList<>(0);\n null_arrX2.add(null_arr);\n }\n \n ArrayList> brunch_dt = know_brunch(plain_graph, -1, 0);\n for(int i=0; i> brunch_dt, int[] counter_former, int root_to_add, int amount_to_add){\n counter_former[root_to_add] += amount_to_add;\n for(int i=0; i> know_brunch(ArrayList> plain_graph, int its_root, int now_pos){\n \n int n_brunch = plain_graph.get(now_pos).size() -1, tmp = -1;\n \n for(int i=0; i<=n_brunch; i++){\n tmp = plain_graph.get(now_pos).get(i);\n if(tmp != its_root){\n plain_graph = know_brunch(plain_graph, now_pos, tmp);\n }else{ \n plain_graph.get(now_pos).remove(i);\n i--;\n n_brunch--;\n }\n }\n \n return plain_graph;\n }\n \n /*\n static boolean[][] bfs(boolean[][] state, boolean[][] seen, int x, int y){\n int[] tmpltX = {1,-1,0,0};\n int[] tmpltY = {0,0,1,-1};\n int newX = -1, newY = -1;\n \n seen[y][x] = true;\n for(int i=0; i < 4; i++){\n newX = x+tmpltX[i];\n newY = y+tmpltY[i];\n if((newX >= 0) && (newY >= 0) && (newX < seen[0].length) && (newY < seen.length) && (!seen[newY][newX]) && state[newY][newX]) seen = bfs(state, seen, newX, newY);\n }\n return seen;\n }\n \n public static int binarySearchMax(int[] dt, int target){\n int left=-1, right=dt.length;\n int mid=-1;\n \n while((right-left)>1){\n mid = left + (right-left)/2;\n \n if(dt[mid] <= target){\n left=mid;\n }else{\n right=mid;\n }\n }\n return left+1;\n }*/\n}", "language": "Java", "metadata": {"date": 1584563030, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02936.html", "problem_id": "p02936", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02936/input.txt", "sample_output_relpath": "derived/input_output/data/p02936/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02936/Java/s720777238.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s720777238", "user_id": "u108906751"}, "prompt_components": {"gold_output": "100 110 111 110\n", "input_to_evaluate": "import java.util.*;\n \npublic class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n \n int n_v = Integer.parseInt(sc.next());\n int queri_n = Integer.parseInt(sc.next());\n ArrayList> plain_graph = new ArrayList<>(n_v);\n \n for(int i=0; i null_arr = new ArrayList<>(0);\n plain_graph.add(null_arr);\n }\n \n int a = -1, b = -1;\n for(int i=1; i> null_arrX2 = new ArrayList<>(n_v);\n for(int i=0; i null_arr = new ArrayList<>(0);\n null_arrX2.add(null_arr);\n }\n \n ArrayList> brunch_dt = know_brunch(plain_graph, -1, 0);\n for(int i=0; i> brunch_dt, int[] counter_former, int root_to_add, int amount_to_add){\n counter_former[root_to_add] += amount_to_add;\n for(int i=0; i> know_brunch(ArrayList> plain_graph, int its_root, int now_pos){\n \n int n_brunch = plain_graph.get(now_pos).size() -1, tmp = -1;\n \n for(int i=0; i<=n_brunch; i++){\n tmp = plain_graph.get(now_pos).get(i);\n if(tmp != its_root){\n plain_graph = know_brunch(plain_graph, now_pos, tmp);\n }else{ \n plain_graph.get(now_pos).remove(i);\n i--;\n n_brunch--;\n }\n }\n \n return plain_graph;\n }\n \n /*\n static boolean[][] bfs(boolean[][] state, boolean[][] seen, int x, int y){\n int[] tmpltX = {1,-1,0,0};\n int[] tmpltY = {0,0,1,-1};\n int newX = -1, newY = -1;\n \n seen[y][x] = true;\n for(int i=0; i < 4; i++){\n newX = x+tmpltX[i];\n newY = y+tmpltY[i];\n if((newX >= 0) && (newY >= 0) && (newX < seen[0].length) && (newY < seen.length) && (!seen[newY][newX]) && state[newY][newX]) seen = bfs(state, seen, newX, newY);\n }\n return seen;\n }\n \n public static int binarySearchMax(int[] dt, int target){\n int left=-1, right=dt.length;\n int mid=-1;\n \n while((right-left)>1){\n mid = left + (right-left)/2;\n \n if(dt[mid] <= target){\n left=mid;\n }else{\n right=mid;\n }\n }\n return left+1;\n }*/\n}", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a rooted tree with N vertices numbered 1 to N.\nThe root is Vertex 1, and the i-th edge (1 \\leq i \\leq N - 1) connects Vertex a_i and b_i.\n\nEach of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0.\n\nNow, the following Q operations will be performed:\n\nOperation j (1 \\leq j \\leq Q): Increment by x_j the counter on every vertex contained in the subtree rooted at Vertex p_j.\n\nFind the value of the counter on each vertex after all operations.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq Q \\leq 2 \\times 10^5\n\n1 \\leq a_i < b_i \\leq N\n\n1 \\leq p_j \\leq N\n\n1 \\leq x_j \\leq 10^4\n\nThe given graph is a tree.\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 b_1\n:\na_{N-1} b_{N-1}\np_1 x_1\n:\np_Q x_Q\n\nOutput\n\nPrint the values of the counters on Vertex 1, 2, \\ldots, N after all operations, in this order, with spaces in between.\n\nSample Input 1\n\n4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n\nSample Output 1\n\n100 110 111 110\n\nThe tree in this input is as follows:\n\nEach operation changes the values of the counters on the vertices as follows:\n\nOperation 1: Increment by 10 the counter on every vertex contained in the subtree rooted at Vertex 2, that is, Vertex 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 0, 10, 10, 10, respectively.\n\nOperation 2: Increment by 100 the counter on every vertex contained in the subtree rooted at Vertex 1, that is, Vertex 1, 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 110, 110, respectively.\n\nOperation 3: Increment by 1 the counter on every vertex contained in the subtree rooted at Vertex 3, that is, Vertex 3. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 111, 110, respectively.\n\nSample Input 2\n\n6 2\n1 2\n1 3\n2 4\n3 6\n2 5\n1 10\n1 10\n\nSample Output 2\n\n20 20 20 20 20 20", "sample_input": "4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n"}, "reference_outputs": ["100 110 111 110\n"], "source_document_id": "p02936", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a rooted tree with N vertices numbered 1 to N.\nThe root is Vertex 1, and the i-th edge (1 \\leq i \\leq N - 1) connects Vertex a_i and b_i.\n\nEach of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0.\n\nNow, the following Q operations will be performed:\n\nOperation j (1 \\leq j \\leq Q): Increment by x_j the counter on every vertex contained in the subtree rooted at Vertex p_j.\n\nFind the value of the counter on each vertex after all operations.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq Q \\leq 2 \\times 10^5\n\n1 \\leq a_i < b_i \\leq N\n\n1 \\leq p_j \\leq N\n\n1 \\leq x_j \\leq 10^4\n\nThe given graph is a tree.\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 b_1\n:\na_{N-1} b_{N-1}\np_1 x_1\n:\np_Q x_Q\n\nOutput\n\nPrint the values of the counters on Vertex 1, 2, \\ldots, N after all operations, in this order, with spaces in between.\n\nSample Input 1\n\n4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n\nSample Output 1\n\n100 110 111 110\n\nThe tree in this input is as follows:\n\nEach operation changes the values of the counters on the vertices as follows:\n\nOperation 1: Increment by 10 the counter on every vertex contained in the subtree rooted at Vertex 2, that is, Vertex 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 0, 10, 10, 10, respectively.\n\nOperation 2: Increment by 100 the counter on every vertex contained in the subtree rooted at Vertex 1, that is, Vertex 1, 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 110, 110, respectively.\n\nOperation 3: Increment by 1 the counter on every vertex contained in the subtree rooted at Vertex 3, that is, Vertex 3. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 111, 110, respectively.\n\nSample Input 2\n\n6 2\n1 2\n1 3\n2 4\n3 6\n2 5\n1 10\n1 10\n\nSample Output 2\n\n20 20 20 20 20 20", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3818, "cpu_time_ms": 2111, "memory_kb": 145852}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s137811500", "group_id": "codeNet:p02936", "input_text": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.Scanner;\nimport java.util.ArrayList;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author silviase\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n DKi solver = new DKi();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class DKi {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int n = in.nextInt();\n int q = in.nextInt();\n Graph g = new Graph(n);\n for (int i = 0; i < n - 1; i++) {\n g.addUnDirectedEdge(in.nextInt() - 1, in.nextInt() - 1);\n }\n for (int i = 0; i < q; i++) {\n g.addCost(in.nextInt() - 1, in.nextInt());\n }\n\n // 0から順にdfsをする.\n g.dfs(0, g.getCost(0));\n\n for (int i = 0; i < n; i++) {\n out.println(g.getCost(i));\n }\n\n }\n\n }\n\n static class Graph {\n private int n;\n private ArrayList[] adj;\n private int[] cost;\n private boolean[] visited;\n\n public Graph(int size) {\n n = size;\n cost = new int[n];\n visited = new boolean[n];\n Arrays.fill(visited, false);\n adj = new ArrayList[n];\n for (int i = 0; i < n; i++) {\n adj[i] = new ArrayList<>();\n }\n }\n\n public void addEdge(int from, int to) {\n adj[from].add(to);\n }\n\n public void addUnDirectedEdge(int from, int to) {\n addEdge(from, to);\n addEdge(to, from);\n }\n\n public void addCost(int index, int value) {\n cost[index] += value;\n }\n\n public void dfs(int index, int cost) {\n if (visited[index]) {\n return;\n }\n visited[index] = true;\n this.cost[index] = cost;\n ArrayList nxtAl = adj[index];\n for (int nxt : nxtAl) {\n dfs(nxt, cost + getCost(nxt));\n }\n }\n\n public int getCost(int i) {\n return cost[i];\n }\n\n }\n}\n\n", "language": "Java", "metadata": {"date": 1582416841, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02936.html", "problem_id": "p02936", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02936/input.txt", "sample_output_relpath": "derived/input_output/data/p02936/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02936/Java/s137811500.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s137811500", "user_id": "u902576227"}, "prompt_components": {"gold_output": "100 110 111 110\n", "input_to_evaluate": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.Scanner;\nimport java.util.ArrayList;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author silviase\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n DKi solver = new DKi();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class DKi {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int n = in.nextInt();\n int q = in.nextInt();\n Graph g = new Graph(n);\n for (int i = 0; i < n - 1; i++) {\n g.addUnDirectedEdge(in.nextInt() - 1, in.nextInt() - 1);\n }\n for (int i = 0; i < q; i++) {\n g.addCost(in.nextInt() - 1, in.nextInt());\n }\n\n // 0から順にdfsをする.\n g.dfs(0, g.getCost(0));\n\n for (int i = 0; i < n; i++) {\n out.println(g.getCost(i));\n }\n\n }\n\n }\n\n static class Graph {\n private int n;\n private ArrayList[] adj;\n private int[] cost;\n private boolean[] visited;\n\n public Graph(int size) {\n n = size;\n cost = new int[n];\n visited = new boolean[n];\n Arrays.fill(visited, false);\n adj = new ArrayList[n];\n for (int i = 0; i < n; i++) {\n adj[i] = new ArrayList<>();\n }\n }\n\n public void addEdge(int from, int to) {\n adj[from].add(to);\n }\n\n public void addUnDirectedEdge(int from, int to) {\n addEdge(from, to);\n addEdge(to, from);\n }\n\n public void addCost(int index, int value) {\n cost[index] += value;\n }\n\n public void dfs(int index, int cost) {\n if (visited[index]) {\n return;\n }\n visited[index] = true;\n this.cost[index] = cost;\n ArrayList nxtAl = adj[index];\n for (int nxt : nxtAl) {\n dfs(nxt, cost + getCost(nxt));\n }\n }\n\n public int getCost(int i) {\n return cost[i];\n }\n\n }\n}\n\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a rooted tree with N vertices numbered 1 to N.\nThe root is Vertex 1, and the i-th edge (1 \\leq i \\leq N - 1) connects Vertex a_i and b_i.\n\nEach of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0.\n\nNow, the following Q operations will be performed:\n\nOperation j (1 \\leq j \\leq Q): Increment by x_j the counter on every vertex contained in the subtree rooted at Vertex p_j.\n\nFind the value of the counter on each vertex after all operations.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq Q \\leq 2 \\times 10^5\n\n1 \\leq a_i < b_i \\leq N\n\n1 \\leq p_j \\leq N\n\n1 \\leq x_j \\leq 10^4\n\nThe given graph is a tree.\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 b_1\n:\na_{N-1} b_{N-1}\np_1 x_1\n:\np_Q x_Q\n\nOutput\n\nPrint the values of the counters on Vertex 1, 2, \\ldots, N after all operations, in this order, with spaces in between.\n\nSample Input 1\n\n4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n\nSample Output 1\n\n100 110 111 110\n\nThe tree in this input is as follows:\n\nEach operation changes the values of the counters on the vertices as follows:\n\nOperation 1: Increment by 10 the counter on every vertex contained in the subtree rooted at Vertex 2, that is, Vertex 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 0, 10, 10, 10, respectively.\n\nOperation 2: Increment by 100 the counter on every vertex contained in the subtree rooted at Vertex 1, that is, Vertex 1, 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 110, 110, respectively.\n\nOperation 3: Increment by 1 the counter on every vertex contained in the subtree rooted at Vertex 3, that is, Vertex 3. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 111, 110, respectively.\n\nSample Input 2\n\n6 2\n1 2\n1 3\n2 4\n3 6\n2 5\n1 10\n1 10\n\nSample Output 2\n\n20 20 20 20 20 20", "sample_input": "4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n"}, "reference_outputs": ["100 110 111 110\n"], "source_document_id": "p02936", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a rooted tree with N vertices numbered 1 to N.\nThe root is Vertex 1, and the i-th edge (1 \\leq i \\leq N - 1) connects Vertex a_i and b_i.\n\nEach of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0.\n\nNow, the following Q operations will be performed:\n\nOperation j (1 \\leq j \\leq Q): Increment by x_j the counter on every vertex contained in the subtree rooted at Vertex p_j.\n\nFind the value of the counter on each vertex after all operations.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq Q \\leq 2 \\times 10^5\n\n1 \\leq a_i < b_i \\leq N\n\n1 \\leq p_j \\leq N\n\n1 \\leq x_j \\leq 10^4\n\nThe given graph is a tree.\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 b_1\n:\na_{N-1} b_{N-1}\np_1 x_1\n:\np_Q x_Q\n\nOutput\n\nPrint the values of the counters on Vertex 1, 2, \\ldots, N after all operations, in this order, with spaces in between.\n\nSample Input 1\n\n4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n\nSample Output 1\n\n100 110 111 110\n\nThe tree in this input is as follows:\n\nEach operation changes the values of the counters on the vertices as follows:\n\nOperation 1: Increment by 10 the counter on every vertex contained in the subtree rooted at Vertex 2, that is, Vertex 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 0, 10, 10, 10, respectively.\n\nOperation 2: Increment by 100 the counter on every vertex contained in the subtree rooted at Vertex 1, that is, Vertex 1, 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 110, 110, respectively.\n\nOperation 3: Increment by 1 the counter on every vertex contained in the subtree rooted at Vertex 3, that is, Vertex 3. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 111, 110, respectively.\n\nSample Input 2\n\n6 2\n1 2\n1 3\n2 4\n3 6\n2 5\n1 10\n1 10\n\nSample Output 2\n\n20 20 20 20 20 20", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2508, "cpu_time_ms": 1768, "memory_kb": 217316}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s257221374", "group_id": "codeNet:p02936", "input_text": "import java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Scanner;\nclass Main{\n\n\n\tstatic final int MOD = 1000000007;\n\n\tstatic\tArrayList tree;\n\tstatic HashSet set;\n\tstatic int[] ans;\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\t\t\t//文字の入力\n\t\tint n = sc.nextInt();\n\t\tint q = sc.nextInt();\n\t\ttree = new ArrayList();\n\t\t\n//\t\tfor(int i = 0;i < n;i++){\n//\t\t\tTreeNode node = new TreeNode(i, 0);\n//\t\t\ttree.add(node);\n//\t\t}\n\t\t\n\t\tfor(int i = 0;i < n-1;i++){\n\t\t\tint a = sc.nextInt()-1;\n\t\t\tint b = sc.nextInt()-1;\n//\t\t\ttree.get(a).childlen.add(tree.get(b));\t\t\t//子ノードの追加\n//\t\t\ttree.get(b).childlen.add(tree.get(a));\t\t\t//子ノードの追加\n\n\t\t}\n\n\t\tfor(int i = 0;i < q;i++){\n\t\t\tint p = sc.nextInt()-1;\n\t\t\tint x = sc.nextInt();\n//\t\t\ttree.get(p).sum += x;\n\t\t}\n\t\tint counter = 0;\n\t\t\n\t\tans = new int[n];\n\t\tset = new HashSet();\n\t\tset.add(0);\n\t//\tdfs(0, 0);\n\t\t\n\t\t\n\t\t\n\t\tfor(int i = 0;i < n;i++){\n\t\t\tSystem.out.println(ans[i]);\n\t\t}\n\n\n\n\n\n\t}\n\n\tstatic void dfs(int current,int num){\n\n\t\tans[current] = num + tree.get(current).sum;\n\t\tset.add(current);\n\t\tfor(TreeNode child:tree.get(current).childlen ){\n\t\t\tif(ans[child.value]== 0){\n\t\t\t\tdfs(child.value, num +tree.get(current).sum);\n\t\t\t}\n\t\t}\n\n\t}\n\n\n\n\n\n\tstatic int upperbond(int k,int min,int[] data){\t\t//kより小さい最大の値をdataの中から探し、返す二分探索\n\t\tint max = data.length;\n\t\t//\t\tif(min == data.length-1){\n\t\t//\t\t\tif(data[min] > k){\n\t\t//\t\t\t\treturn min;\n\t\t//\t\t\t}\n\t\t//\t\t}\n\n\t\twhile(max-min > 1){\n\t\t\tint mid = (max+min)/2;\n\t\t\tif(data[mid] >= k){\n\t\t\t\tmax = mid;\n\t\t\t}else{\n\t\t\t\tmin = mid;\n\t\t\t}\n\t\t}\n\n\t\treturn max;\n\t}\n\n\tstatic int lowerbond(int k,int min,int[] data){\t\t//kより大きい最小の値をdataの中から探し、返す二分探索\n\t\tint max = data.length;\n\n\t\twhile(max-min > 1){\n\t\t\tint mid = (max+min)/2;\n\t\t\tif(data[mid] >= k){\n\t\t\t\tmax = mid;\n\t\t\t}else{\n\t\t\t\tmin = mid;\n\t\t\t}\n\t\t}\n\t\treturn min;\n\t}\n\n\n\n\tstatic int gcd(int a,int b){\t\t\t\t//最大公約数を返す\n\t\tif(b == 0){\n\t\t\treturn a;\n\t\t}else{\n\t\t\treturn gcd(b, a%b);\n\t\t}\n\t}\n\tstatic long gcd(long a,long b){\n\t\tif(b == 0){\n\t\t\treturn a;\n\t\t}else{\n\t\t\treturn gcd(b, a%b);\n\t\t}\n\t}\n\n\n\n\tstatic long lcm (long a, long b) {\n\t\tlong g = gcd(a,b);\n\t\treturn a/g*b;\n\t}\n\n\n\n\n}\n\nclass TreeNode{\n\tint value;\n\tint sum;\n\tArrayList childlen;\n\n\tpublic TreeNode(int v,int s) {\n\t\tthis.value = v;\n\t\tthis.sum = s;\n\t\tthis.childlen = new ArrayList();\n\t}\n\n\n}\n\n\nclass Edge implements Comparable{\n\n\tint index;\n\tHashSet hen;\n\tHashSet used;\n\tHashMap map;\n\tint size;\n\n\n\tpublic Edge(int index) {\n\t\t// TODO 自動生成されたコンストラクター・スタブ\n\t\tthis.index = index;\n\t\then = new HashSet();\n\t\tused = new HashSet();\n\t\tmap = new HashMap();\n\t}\n\n\tpublic int compareTo(Object other) {\n\t\tEdge otherpair = (Edge)other;\n\n\t\treturn otherpair.hen.size() - hen.size();\n\t}\n}\n\nclass Food implements Comparable{\n\n\tint minits;\n\tint score;\n\tdouble cospa;\n\n\tpublic Food(int from,int end,double c) {\n\t\tthis.minits = from;\n\t\tthis.score = end;\n\t\tthis.cospa = c;\n\t\t// TODO 自動生成されたコンストラクター・スタブ\n\t}\n\n\t@Override\n\tpublic int compareTo(Object other) {\n\t\tFood otherpair = (Food)other;\n\t\tint dif = Double.compare(otherpair.cospa, cospa);\n\t\treturn dif;\n\t}\n\n}\n\nclass Pair implements Comparable{\n\tint from;\n\tint end;\n\tpublic Pair(int from,int end) {\n\t\tthis.from = from;\n\t\tthis.end = end;\n\t\t// TODO 自動生成されたコンストラクター・スタブ\n\t}\n\n\t@Override\n\tpublic int compareTo(Object other) {\n\t\tPair otherpair = (Pair)other;\n\n\t\treturn from - otherpair.from;\n\t}\n\n\n\n\n\n\n\n\n}\n\n\n\n\n", "language": "Java", "metadata": {"date": 1576137272, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02936.html", "problem_id": "p02936", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02936/input.txt", "sample_output_relpath": "derived/input_output/data/p02936/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02936/Java/s257221374.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s257221374", "user_id": "u632953742"}, "prompt_components": {"gold_output": "100 110 111 110\n", "input_to_evaluate": "import java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Scanner;\nclass Main{\n\n\n\tstatic final int MOD = 1000000007;\n\n\tstatic\tArrayList tree;\n\tstatic HashSet set;\n\tstatic int[] ans;\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\t\t\t//文字の入力\n\t\tint n = sc.nextInt();\n\t\tint q = sc.nextInt();\n\t\ttree = new ArrayList();\n\t\t\n//\t\tfor(int i = 0;i < n;i++){\n//\t\t\tTreeNode node = new TreeNode(i, 0);\n//\t\t\ttree.add(node);\n//\t\t}\n\t\t\n\t\tfor(int i = 0;i < n-1;i++){\n\t\t\tint a = sc.nextInt()-1;\n\t\t\tint b = sc.nextInt()-1;\n//\t\t\ttree.get(a).childlen.add(tree.get(b));\t\t\t//子ノードの追加\n//\t\t\ttree.get(b).childlen.add(tree.get(a));\t\t\t//子ノードの追加\n\n\t\t}\n\n\t\tfor(int i = 0;i < q;i++){\n\t\t\tint p = sc.nextInt()-1;\n\t\t\tint x = sc.nextInt();\n//\t\t\ttree.get(p).sum += x;\n\t\t}\n\t\tint counter = 0;\n\t\t\n\t\tans = new int[n];\n\t\tset = new HashSet();\n\t\tset.add(0);\n\t//\tdfs(0, 0);\n\t\t\n\t\t\n\t\t\n\t\tfor(int i = 0;i < n;i++){\n\t\t\tSystem.out.println(ans[i]);\n\t\t}\n\n\n\n\n\n\t}\n\n\tstatic void dfs(int current,int num){\n\n\t\tans[current] = num + tree.get(current).sum;\n\t\tset.add(current);\n\t\tfor(TreeNode child:tree.get(current).childlen ){\n\t\t\tif(ans[child.value]== 0){\n\t\t\t\tdfs(child.value, num +tree.get(current).sum);\n\t\t\t}\n\t\t}\n\n\t}\n\n\n\n\n\n\tstatic int upperbond(int k,int min,int[] data){\t\t//kより小さい最大の値をdataの中から探し、返す二分探索\n\t\tint max = data.length;\n\t\t//\t\tif(min == data.length-1){\n\t\t//\t\t\tif(data[min] > k){\n\t\t//\t\t\t\treturn min;\n\t\t//\t\t\t}\n\t\t//\t\t}\n\n\t\twhile(max-min > 1){\n\t\t\tint mid = (max+min)/2;\n\t\t\tif(data[mid] >= k){\n\t\t\t\tmax = mid;\n\t\t\t}else{\n\t\t\t\tmin = mid;\n\t\t\t}\n\t\t}\n\n\t\treturn max;\n\t}\n\n\tstatic int lowerbond(int k,int min,int[] data){\t\t//kより大きい最小の値をdataの中から探し、返す二分探索\n\t\tint max = data.length;\n\n\t\twhile(max-min > 1){\n\t\t\tint mid = (max+min)/2;\n\t\t\tif(data[mid] >= k){\n\t\t\t\tmax = mid;\n\t\t\t}else{\n\t\t\t\tmin = mid;\n\t\t\t}\n\t\t}\n\t\treturn min;\n\t}\n\n\n\n\tstatic int gcd(int a,int b){\t\t\t\t//最大公約数を返す\n\t\tif(b == 0){\n\t\t\treturn a;\n\t\t}else{\n\t\t\treturn gcd(b, a%b);\n\t\t}\n\t}\n\tstatic long gcd(long a,long b){\n\t\tif(b == 0){\n\t\t\treturn a;\n\t\t}else{\n\t\t\treturn gcd(b, a%b);\n\t\t}\n\t}\n\n\n\n\tstatic long lcm (long a, long b) {\n\t\tlong g = gcd(a,b);\n\t\treturn a/g*b;\n\t}\n\n\n\n\n}\n\nclass TreeNode{\n\tint value;\n\tint sum;\n\tArrayList childlen;\n\n\tpublic TreeNode(int v,int s) {\n\t\tthis.value = v;\n\t\tthis.sum = s;\n\t\tthis.childlen = new ArrayList();\n\t}\n\n\n}\n\n\nclass Edge implements Comparable{\n\n\tint index;\n\tHashSet hen;\n\tHashSet used;\n\tHashMap map;\n\tint size;\n\n\n\tpublic Edge(int index) {\n\t\t// TODO 自動生成されたコンストラクター・スタブ\n\t\tthis.index = index;\n\t\then = new HashSet();\n\t\tused = new HashSet();\n\t\tmap = new HashMap();\n\t}\n\n\tpublic int compareTo(Object other) {\n\t\tEdge otherpair = (Edge)other;\n\n\t\treturn otherpair.hen.size() - hen.size();\n\t}\n}\n\nclass Food implements Comparable{\n\n\tint minits;\n\tint score;\n\tdouble cospa;\n\n\tpublic Food(int from,int end,double c) {\n\t\tthis.minits = from;\n\t\tthis.score = end;\n\t\tthis.cospa = c;\n\t\t// TODO 自動生成されたコンストラクター・スタブ\n\t}\n\n\t@Override\n\tpublic int compareTo(Object other) {\n\t\tFood otherpair = (Food)other;\n\t\tint dif = Double.compare(otherpair.cospa, cospa);\n\t\treturn dif;\n\t}\n\n}\n\nclass Pair implements Comparable{\n\tint from;\n\tint end;\n\tpublic Pair(int from,int end) {\n\t\tthis.from = from;\n\t\tthis.end = end;\n\t\t// TODO 自動生成���れたコンストラクター・スタブ\n\t}\n\n\t@Override\n\tpublic int compareTo(Object other) {\n\t\tPair otherpair = (Pair)other;\n\n\t\treturn from - otherpair.from;\n\t}\n\n\n\n\n\n\n\n\n}\n\n\n\n\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a rooted tree with N vertices numbered 1 to N.\nThe root is Vertex 1, and the i-th edge (1 \\leq i \\leq N - 1) connects Vertex a_i and b_i.\n\nEach of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0.\n\nNow, the following Q operations will be performed:\n\nOperation j (1 \\leq j \\leq Q): Increment by x_j the counter on every vertex contained in the subtree rooted at Vertex p_j.\n\nFind the value of the counter on each vertex after all operations.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq Q \\leq 2 \\times 10^5\n\n1 \\leq a_i < b_i \\leq N\n\n1 \\leq p_j \\leq N\n\n1 \\leq x_j \\leq 10^4\n\nThe given graph is a tree.\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 b_1\n:\na_{N-1} b_{N-1}\np_1 x_1\n:\np_Q x_Q\n\nOutput\n\nPrint the values of the counters on Vertex 1, 2, \\ldots, N after all operations, in this order, with spaces in between.\n\nSample Input 1\n\n4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n\nSample Output 1\n\n100 110 111 110\n\nThe tree in this input is as follows:\n\nEach operation changes the values of the counters on the vertices as follows:\n\nOperation 1: Increment by 10 the counter on every vertex contained in the subtree rooted at Vertex 2, that is, Vertex 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 0, 10, 10, 10, respectively.\n\nOperation 2: Increment by 100 the counter on every vertex contained in the subtree rooted at Vertex 1, that is, Vertex 1, 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 110, 110, respectively.\n\nOperation 3: Increment by 1 the counter on every vertex contained in the subtree rooted at Vertex 3, that is, Vertex 3. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 111, 110, respectively.\n\nSample Input 2\n\n6 2\n1 2\n1 3\n2 4\n3 6\n2 5\n1 10\n1 10\n\nSample Output 2\n\n20 20 20 20 20 20", "sample_input": "4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n"}, "reference_outputs": ["100 110 111 110\n"], "source_document_id": "p02936", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a rooted tree with N vertices numbered 1 to N.\nThe root is Vertex 1, and the i-th edge (1 \\leq i \\leq N - 1) connects Vertex a_i and b_i.\n\nEach of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0.\n\nNow, the following Q operations will be performed:\n\nOperation j (1 \\leq j \\leq Q): Increment by x_j the counter on every vertex contained in the subtree rooted at Vertex p_j.\n\nFind the value of the counter on each vertex after all operations.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq Q \\leq 2 \\times 10^5\n\n1 \\leq a_i < b_i \\leq N\n\n1 \\leq p_j \\leq N\n\n1 \\leq x_j \\leq 10^4\n\nThe given graph is a tree.\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 b_1\n:\na_{N-1} b_{N-1}\np_1 x_1\n:\np_Q x_Q\n\nOutput\n\nPrint the values of the counters on Vertex 1, 2, \\ldots, N after all operations, in this order, with spaces in between.\n\nSample Input 1\n\n4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n\nSample Output 1\n\n100 110 111 110\n\nThe tree in this input is as follows:\n\nEach operation changes the values of the counters on the vertices as follows:\n\nOperation 1: Increment by 10 the counter on every vertex contained in the subtree rooted at Vertex 2, that is, Vertex 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 0, 10, 10, 10, respectively.\n\nOperation 2: Increment by 100 the counter on every vertex contained in the subtree rooted at Vertex 1, that is, Vertex 1, 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 110, 110, respectively.\n\nOperation 3: Increment by 1 the counter on every vertex contained in the subtree rooted at Vertex 3, that is, Vertex 3. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 111, 110, respectively.\n\nSample Input 2\n\n6 2\n1 2\n1 3\n2 4\n3 6\n2 5\n1 10\n1 10\n\nSample Output 2\n\n20 20 20 20 20 20", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3705, "cpu_time_ms": 1762, "memory_kb": 156168}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s310423465", "group_id": "codeNet:p02936", "input_text": "\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint n = sc.nextInt();\n\t\tint q = sc.nextInt();\n\n\t\tNode node[] = new Node[n];\n\t\t// 頂点の作成\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnode[i] = new Node(i);\n\t\t}\n\n\t\t// 辺情報\n\t\tfor (int i = 0; i < n - 1; i++) {\n\t\t\tint nodeA = sc.nextInt() - 1;\n\t\t\tint nodeB = sc.nextInt() - 1;\n\n\t\t\tnode[nodeA].adjList.add(node[nodeB]);\n\t\t\tnode[nodeB].adjList.add(node[nodeA]);\n\t\t}\n\n\t\t// 親方向の隣接情報を消す\n\t\t//removeParent(0, node);\n\n\t\t/*\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tprintDebug(node[i]);\n\t\t}\n\t\t*/\n\n\t\t// カウンター計算\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tint subRoot = sc.nextInt() - 1;\n\t\t\tlong count = sc.nextLong();\n\n\t\t\tnode[subRoot].count += count;\n\t\t}\n\t\tdfs(null, node[0], 0);\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tSystem.out.print(node[i].count + \" \");\n\t\t\tfor (Node adj : node[i].adjList) {\n\t\t\t\tadj.count += node[i].count;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t\tsc.close();\n\t}\n\n\tprivate static void dfs(Node parent, Node node, int sum) {\n\t\tsum += node.count;\n\t\tnode.count = sum;\n\t\tfor (Node adj : node.adjList) {\n\t\t\tif (adj != parent) {\n\t\t\t\tdfs(node, adj, sum);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static void printDebug(Node node) {\n\t\tSystem.out.println(\"===============================\");\n\t\tSystem.out.println(\"id = \" + node.id);\n\t\tSystem.out.print(\"adj = \");\n\t\tfor (Node adj : node.adjList) {\n\t\t\tSystem.out.print(adj.id + \" \");\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(\"count = \" + node.count);\n\t}\n\n\tprivate static void removeParent(int id, Node[] node) {\n\t\tfor (Node adj : node[id].adjList) {\n\t\t\tnode[adj.id].adjList.remove(node[id]);\n\t\t\tremoveParent(adj.id, node);\n\t\t}\n\t}\n\n\tstatic class Node {\n\t\tint id;\n\t\tList adjList;\n\t\tlong count;\n\n\t\t// コンストラクタ\n\t\tpublic Node(int id) {\n\t\t\tthis.id = id;\n\t\t\tthis.adjList = new ArrayList();\n\t\t\tthis.count = 0;\n\t\t}\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1573625181, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02936.html", "problem_id": "p02936", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02936/input.txt", "sample_output_relpath": "derived/input_output/data/p02936/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02936/Java/s310423465.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s310423465", "user_id": "u981866345"}, "prompt_components": {"gold_output": "100 110 111 110\n", "input_to_evaluate": "\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint n = sc.nextInt();\n\t\tint q = sc.nextInt();\n\n\t\tNode node[] = new Node[n];\n\t\t// 頂点の作成\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnode[i] = new Node(i);\n\t\t}\n\n\t\t// 辺情報\n\t\tfor (int i = 0; i < n - 1; i++) {\n\t\t\tint nodeA = sc.nextInt() - 1;\n\t\t\tint nodeB = sc.nextInt() - 1;\n\n\t\t\tnode[nodeA].adjList.add(node[nodeB]);\n\t\t\tnode[nodeB].adjList.add(node[nodeA]);\n\t\t}\n\n\t\t// 親方向の隣接情報を消す\n\t\t//removeParent(0, node);\n\n\t\t/*\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tprintDebug(node[i]);\n\t\t}\n\t\t*/\n\n\t\t// カウンター計算\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tint subRoot = sc.nextInt() - 1;\n\t\t\tlong count = sc.nextLong();\n\n\t\t\tnode[subRoot].count += count;\n\t\t}\n\t\tdfs(null, node[0], 0);\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tSystem.out.print(node[i].count + \" \");\n\t\t\tfor (Node adj : node[i].adjList) {\n\t\t\t\tadj.count += node[i].count;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t\tsc.close();\n\t}\n\n\tprivate static void dfs(Node parent, Node node, int sum) {\n\t\tsum += node.count;\n\t\tnode.count = sum;\n\t\tfor (Node adj : node.adjList) {\n\t\t\tif (adj != parent) {\n\t\t\t\tdfs(node, adj, sum);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static void printDebug(Node node) {\n\t\tSystem.out.println(\"===============================\");\n\t\tSystem.out.println(\"id = \" + node.id);\n\t\tSystem.out.print(\"adj = \");\n\t\tfor (Node adj : node.adjList) {\n\t\t\tSystem.out.print(adj.id + \" \");\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(\"count = \" + node.count);\n\t}\n\n\tprivate static void removeParent(int id, Node[] node) {\n\t\tfor (Node adj : node[id].adjList) {\n\t\t\tnode[adj.id].adjList.remove(node[id]);\n\t\t\tremoveParent(adj.id, node);\n\t\t}\n\t}\n\n\tstatic class Node {\n\t\tint id;\n\t\tList adjList;\n\t\tlong count;\n\n\t\t// コンストラクタ\n\t\tpublic Node(int id) {\n\t\t\tthis.id = id;\n\t\t\tthis.adjList = new ArrayList();\n\t\t\tthis.count = 0;\n\t\t}\n\t}\n\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a rooted tree with N vertices numbered 1 to N.\nThe root is Vertex 1, and the i-th edge (1 \\leq i \\leq N - 1) connects Vertex a_i and b_i.\n\nEach of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0.\n\nNow, the following Q operations will be performed:\n\nOperation j (1 \\leq j \\leq Q): Increment by x_j the counter on every vertex contained in the subtree rooted at Vertex p_j.\n\nFind the value of the counter on each vertex after all operations.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq Q \\leq 2 \\times 10^5\n\n1 \\leq a_i < b_i \\leq N\n\n1 \\leq p_j \\leq N\n\n1 \\leq x_j \\leq 10^4\n\nThe given graph is a tree.\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 b_1\n:\na_{N-1} b_{N-1}\np_1 x_1\n:\np_Q x_Q\n\nOutput\n\nPrint the values of the counters on Vertex 1, 2, \\ldots, N after all operations, in this order, with spaces in between.\n\nSample Input 1\n\n4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n\nSample Output 1\n\n100 110 111 110\n\nThe tree in this input is as follows:\n\nEach operation changes the values of the counters on the vertices as follows:\n\nOperation 1: Increment by 10 the counter on every vertex contained in the subtree rooted at Vertex 2, that is, Vertex 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 0, 10, 10, 10, respectively.\n\nOperation 2: Increment by 100 the counter on every vertex contained in the subtree rooted at Vertex 1, that is, Vertex 1, 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 110, 110, respectively.\n\nOperation 3: Increment by 1 the counter on every vertex contained in the subtree rooted at Vertex 3, that is, Vertex 3. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 111, 110, respectively.\n\nSample Input 2\n\n6 2\n1 2\n1 3\n2 4\n3 6\n2 5\n1 10\n1 10\n\nSample Output 2\n\n20 20 20 20 20 20", "sample_input": "4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n"}, "reference_outputs": ["100 110 111 110\n"], "source_document_id": "p02936", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a rooted tree with N vertices numbered 1 to N.\nThe root is Vertex 1, and the i-th edge (1 \\leq i \\leq N - 1) connects Vertex a_i and b_i.\n\nEach of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0.\n\nNow, the following Q operations will be performed:\n\nOperation j (1 \\leq j \\leq Q): Increment by x_j the counter on every vertex contained in the subtree rooted at Vertex p_j.\n\nFind the value of the counter on each vertex after all operations.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq Q \\leq 2 \\times 10^5\n\n1 \\leq a_i < b_i \\leq N\n\n1 \\leq p_j \\leq N\n\n1 \\leq x_j \\leq 10^4\n\nThe given graph is a tree.\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 b_1\n:\na_{N-1} b_{N-1}\np_1 x_1\n:\np_Q x_Q\n\nOutput\n\nPrint the values of the counters on Vertex 1, 2, \\ldots, N after all operations, in this order, with spaces in between.\n\nSample Input 1\n\n4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n\nSample Output 1\n\n100 110 111 110\n\nThe tree in this input is as follows:\n\nEach operation changes the values of the counters on the vertices as follows:\n\nOperation 1: Increment by 10 the counter on every vertex contained in the subtree rooted at Vertex 2, that is, Vertex 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 0, 10, 10, 10, respectively.\n\nOperation 2: Increment by 100 the counter on every vertex contained in the subtree rooted at Vertex 1, that is, Vertex 1, 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 110, 110, respectively.\n\nOperation 3: Increment by 1 the counter on every vertex contained in the subtree rooted at Vertex 3, that is, Vertex 3. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 111, 110, respectively.\n\nSample Input 2\n\n6 2\n1 2\n1 3\n2 4\n3 6\n2 5\n1 10\n1 10\n\nSample Output 2\n\n20 20 20 20 20 20", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1972, "cpu_time_ms": 2110, "memory_kb": 224500}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s190415688", "group_id": "codeNet:p02936", "input_text": "import java.util.*;\nclass Main{\n public static void main(String[] args){\n Scanner sc=new Scanner(System.in);\n int n=sc.nextInt();\n int q=sc.nextInt();\n Node[] a = new Node[n];\n for(int i=0;i dq = new ArrayDeque<>();\n dq.addFirst(a[0]);\n a[0].d=true;\n while(!dq.isEmpty()){\n Node hr=dq.pollFirst();\n for(int t:hr.es){\n if(!a[t].d){\n a[t].v+=hr.v;\n dq.addFirst(a[t]);\n }\n }\n }\n for(int i=0;i es = new ArrayList<>();\n }\n}\n", "language": "Java", "metadata": {"date": 1572568330, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02936.html", "problem_id": "p02936", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02936/input.txt", "sample_output_relpath": "derived/input_output/data/p02936/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02936/Java/s190415688.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s190415688", "user_id": "u458268106"}, "prompt_components": {"gold_output": "100 110 111 110\n", "input_to_evaluate": "import java.util.*;\nclass Main{\n public static void main(String[] args){\n Scanner sc=new Scanner(System.in);\n int n=sc.nextInt();\n int q=sc.nextInt();\n Node[] a = new Node[n];\n for(int i=0;i dq = new ArrayDeque<>();\n dq.addFirst(a[0]);\n a[0].d=true;\n while(!dq.isEmpty()){\n Node hr=dq.pollFirst();\n for(int t:hr.es){\n if(!a[t].d){\n a[t].v+=hr.v;\n dq.addFirst(a[t]);\n }\n }\n }\n for(int i=0;i es = new ArrayList<>();\n }\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a rooted tree with N vertices numbered 1 to N.\nThe root is Vertex 1, and the i-th edge (1 \\leq i \\leq N - 1) connects Vertex a_i and b_i.\n\nEach of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0.\n\nNow, the following Q operations will be performed:\n\nOperation j (1 \\leq j \\leq Q): Increment by x_j the counter on every vertex contained in the subtree rooted at Vertex p_j.\n\nFind the value of the counter on each vertex after all operations.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq Q \\leq 2 \\times 10^5\n\n1 \\leq a_i < b_i \\leq N\n\n1 \\leq p_j \\leq N\n\n1 \\leq x_j \\leq 10^4\n\nThe given graph is a tree.\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 b_1\n:\na_{N-1} b_{N-1}\np_1 x_1\n:\np_Q x_Q\n\nOutput\n\nPrint the values of the counters on Vertex 1, 2, \\ldots, N after all operations, in this order, with spaces in between.\n\nSample Input 1\n\n4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n\nSample Output 1\n\n100 110 111 110\n\nThe tree in this input is as follows:\n\nEach operation changes the values of the counters on the vertices as follows:\n\nOperation 1: Increment by 10 the counter on every vertex contained in the subtree rooted at Vertex 2, that is, Vertex 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 0, 10, 10, 10, respectively.\n\nOperation 2: Increment by 100 the counter on every vertex contained in the subtree rooted at Vertex 1, that is, Vertex 1, 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 110, 110, respectively.\n\nOperation 3: Increment by 1 the counter on every vertex contained in the subtree rooted at Vertex 3, that is, Vertex 3. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 111, 110, respectively.\n\nSample Input 2\n\n6 2\n1 2\n1 3\n2 4\n3 6\n2 5\n1 10\n1 10\n\nSample Output 2\n\n20 20 20 20 20 20", "sample_input": "4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n"}, "reference_outputs": ["100 110 111 110\n"], "source_document_id": "p02936", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a rooted tree with N vertices numbered 1 to N.\nThe root is Vertex 1, and the i-th edge (1 \\leq i \\leq N - 1) connects Vertex a_i and b_i.\n\nEach of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0.\n\nNow, the following Q operations will be performed:\n\nOperation j (1 \\leq j \\leq Q): Increment by x_j the counter on every vertex contained in the subtree rooted at Vertex p_j.\n\nFind the value of the counter on each vertex after all operations.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq Q \\leq 2 \\times 10^5\n\n1 \\leq a_i < b_i \\leq N\n\n1 \\leq p_j \\leq N\n\n1 \\leq x_j \\leq 10^4\n\nThe given graph is a tree.\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 b_1\n:\na_{N-1} b_{N-1}\np_1 x_1\n:\np_Q x_Q\n\nOutput\n\nPrint the values of the counters on Vertex 1, 2, \\ldots, N after all operations, in this order, with spaces in between.\n\nSample Input 1\n\n4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n\nSample Output 1\n\n100 110 111 110\n\nThe tree in this input is as follows:\n\nEach operation changes the values of the counters on the vertices as follows:\n\nOperation 1: Increment by 10 the counter on every vertex contained in the subtree rooted at Vertex 2, that is, Vertex 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 0, 10, 10, 10, respectively.\n\nOperation 2: Increment by 100 the counter on every vertex contained in the subtree rooted at Vertex 1, that is, Vertex 1, 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 110, 110, respectively.\n\nOperation 3: Increment by 1 the counter on every vertex contained in the subtree rooted at Vertex 3, that is, Vertex 3. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 111, 110, respectively.\n\nSample Input 2\n\n6 2\n1 2\n1 3\n2 4\n3 6\n2 5\n1 10\n1 10\n\nSample Output 2\n\n20 20 20 20 20 20", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2114, "memory_kb": 686540}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s575226180", "group_id": "codeNet:p02936", "input_text": "import java.util.ArrayList;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tstatic ArrayList[] list;\n\n\tstatic int[] counter;\n\n\tstatic boolean[] flag;\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint N = sc.nextInt();\n\t\tint Q = sc.nextInt();\n\n\t\tlist = new ArrayList[N + 1];\n\t\tfor(int i = 1;i <= N;i++) {\n\t\t\tlist[i] = new ArrayList();\n\t\t}\n\n\t\tfor(int i = 1;i <= N - 1;i++) {\n\t\t\tint a = sc.nextInt();\n\t\t\tint b = sc.nextInt();\n\t\t\tlist[a].add(b);\n\t\t}\n\n\t\tcounter = new int[N + 1];\n\t\tfor(int i = 1;i <= Q;i++) {\n\t\t\tint p = sc.nextInt();\n\t\t\tint x = sc.nextInt();\n\t\t\tcounter[p] += x;\n\t\t}\n\t\tsc.close();\n\n//\t\tfor(int i = 1;i <= N - 1;i++) {\n//\t\t\tSystem.out.println(list[i]);\n//\t\t}\n//\t\tfor(int i = 1;i <= N;i++) {\n//\t\t\tSystem.out.println(counter[i]);\n//\t\t}\n\n\t\tflag = new boolean[N + 1];\n\t\tflag[1] = true;\n\t\tdfs(1);\n\n\t\tfor(int i = 1;i <= N;i++) {\n\t\t\tSystem.out.println(counter[i]);\n\t\t}\n\n\t}\n\n\tprivate static void dfs(int x) {\n\t\tfor(int y : list[x]) {\n//\t\t\tSystem.out.print(y);\n//\t\t\tSystem.out.println(flag[y]);\n\t\t\tif(!flag[y]) {\n//\t\t\t\tSystem.out.print(y);\n//\t\t\t\tSystem.out.println(counter[y]);\n\t\t\t\tcounter[y] += counter[x];\n\t\t\t\tflag[y] = true;\n\t\t\t\tdfs(y);\n\t\t\t}\n\t\t}\n\t}\n}", "language": "Java", "metadata": {"date": 1569075984, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02936.html", "problem_id": "p02936", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02936/input.txt", "sample_output_relpath": "derived/input_output/data/p02936/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02936/Java/s575226180.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s575226180", "user_id": "u887142477"}, "prompt_components": {"gold_output": "100 110 111 110\n", "input_to_evaluate": "import java.util.ArrayList;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tstatic ArrayList[] list;\n\n\tstatic int[] counter;\n\n\tstatic boolean[] flag;\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint N = sc.nextInt();\n\t\tint Q = sc.nextInt();\n\n\t\tlist = new ArrayList[N + 1];\n\t\tfor(int i = 1;i <= N;i++) {\n\t\t\tlist[i] = new ArrayList();\n\t\t}\n\n\t\tfor(int i = 1;i <= N - 1;i++) {\n\t\t\tint a = sc.nextInt();\n\t\t\tint b = sc.nextInt();\n\t\t\tlist[a].add(b);\n\t\t}\n\n\t\tcounter = new int[N + 1];\n\t\tfor(int i = 1;i <= Q;i++) {\n\t\t\tint p = sc.nextInt();\n\t\t\tint x = sc.nextInt();\n\t\t\tcounter[p] += x;\n\t\t}\n\t\tsc.close();\n\n//\t\tfor(int i = 1;i <= N - 1;i++) {\n//\t\t\tSystem.out.println(list[i]);\n//\t\t}\n//\t\tfor(int i = 1;i <= N;i++) {\n//\t\t\tSystem.out.println(counter[i]);\n//\t\t}\n\n\t\tflag = new boolean[N + 1];\n\t\tflag[1] = true;\n\t\tdfs(1);\n\n\t\tfor(int i = 1;i <= N;i++) {\n\t\t\tSystem.out.println(counter[i]);\n\t\t}\n\n\t}\n\n\tprivate static void dfs(int x) {\n\t\tfor(int y : list[x]) {\n//\t\t\tSystem.out.print(y);\n//\t\t\tSystem.out.println(flag[y]);\n\t\t\tif(!flag[y]) {\n//\t\t\t\tSystem.out.print(y);\n//\t\t\t\tSystem.out.println(counter[y]);\n\t\t\t\tcounter[y] += counter[x];\n\t\t\t\tflag[y] = true;\n\t\t\t\tdfs(y);\n\t\t\t}\n\t\t}\n\t}\n}", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a rooted tree with N vertices numbered 1 to N.\nThe root is Vertex 1, and the i-th edge (1 \\leq i \\leq N - 1) connects Vertex a_i and b_i.\n\nEach of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0.\n\nNow, the following Q operations will be performed:\n\nOperation j (1 \\leq j \\leq Q): Increment by x_j the counter on every vertex contained in the subtree rooted at Vertex p_j.\n\nFind the value of the counter on each vertex after all operations.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq Q \\leq 2 \\times 10^5\n\n1 \\leq a_i < b_i \\leq N\n\n1 \\leq p_j \\leq N\n\n1 \\leq x_j \\leq 10^4\n\nThe given graph is a tree.\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 b_1\n:\na_{N-1} b_{N-1}\np_1 x_1\n:\np_Q x_Q\n\nOutput\n\nPrint the values of the counters on Vertex 1, 2, \\ldots, N after all operations, in this order, with spaces in between.\n\nSample Input 1\n\n4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n\nSample Output 1\n\n100 110 111 110\n\nThe tree in this input is as follows:\n\nEach operation changes the values of the counters on the vertices as follows:\n\nOperation 1: Increment by 10 the counter on every vertex contained in the subtree rooted at Vertex 2, that is, Vertex 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 0, 10, 10, 10, respectively.\n\nOperation 2: Increment by 100 the counter on every vertex contained in the subtree rooted at Vertex 1, that is, Vertex 1, 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 110, 110, respectively.\n\nOperation 3: Increment by 1 the counter on every vertex contained in the subtree rooted at Vertex 3, that is, Vertex 3. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 111, 110, respectively.\n\nSample Input 2\n\n6 2\n1 2\n1 3\n2 4\n3 6\n2 5\n1 10\n1 10\n\nSample Output 2\n\n20 20 20 20 20 20", "sample_input": "4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n"}, "reference_outputs": ["100 110 111 110\n"], "source_document_id": "p02936", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a rooted tree with N vertices numbered 1 to N.\nThe root is Vertex 1, and the i-th edge (1 \\leq i \\leq N - 1) connects Vertex a_i and b_i.\n\nEach of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0.\n\nNow, the following Q operations will be performed:\n\nOperation j (1 \\leq j \\leq Q): Increment by x_j the counter on every vertex contained in the subtree rooted at Vertex p_j.\n\nFind the value of the counter on each vertex after all operations.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq Q \\leq 2 \\times 10^5\n\n1 \\leq a_i < b_i \\leq N\n\n1 \\leq p_j \\leq N\n\n1 \\leq x_j \\leq 10^4\n\nThe given graph is a tree.\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 b_1\n:\na_{N-1} b_{N-1}\np_1 x_1\n:\np_Q x_Q\n\nOutput\n\nPrint the values of the counters on Vertex 1, 2, \\ldots, N after all operations, in this order, with spaces in between.\n\nSample Input 1\n\n4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n\nSample Output 1\n\n100 110 111 110\n\nThe tree in this input is as follows:\n\nEach operation changes the values of the counters on the vertices as follows:\n\nOperation 1: Increment by 10 the counter on every vertex contained in the subtree rooted at Vertex 2, that is, Vertex 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 0, 10, 10, 10, respectively.\n\nOperation 2: Increment by 100 the counter on every vertex contained in the subtree rooted at Vertex 1, that is, Vertex 1, 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 110, 110, respectively.\n\nOperation 3: Increment by 1 the counter on every vertex contained in the subtree rooted at Vertex 3, that is, Vertex 3. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 111, 110, respectively.\n\nSample Input 2\n\n6 2\n1 2\n1 3\n2 4\n3 6\n2 5\n1 10\n1 10\n\nSample Output 2\n\n20 20 20 20 20 20", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1213, "cpu_time_ms": 2109, "memory_kb": 216236}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s336201082", "group_id": "codeNet:p02936", "input_text": "import java.util.*;\n\npublic class Main{\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n//////////////////////////////////////////////////////\n int n = sc.nextInt();\n int q = sc.nextInt();\n\n int[] a = new int[n-1];\n int[] b = new int[n-1];\n\n for(int i=0;i\n\t{\n\t\tNode p;\n\t\tint id;\n\t\tint cnt = 0;\n\t\tNode(int _id) {id = _id;}\n\t}\n}", "language": "Java", "metadata": {"date": 1567705927, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02936.html", "problem_id": "p02936", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02936/input.txt", "sample_output_relpath": "derived/input_output/data/p02936/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02936/Java/s046812962.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s046812962", "user_id": "u414665384"}, "prompt_components": {"gold_output": "100 110 111 110\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n\tstatic Node[] ns;\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tint Q = sc.nextInt();\n\t\tns = new Node[N];\n\t\tfor (int i = 0; i < N; i++)\n\t\t\tns[i] = new Node(i);\n\t\tfor (int i = 0; i < N - 1; i++) {\n\t\t\tint s = sc.nextInt() - 1;\n\t\t\tint t = sc.nextInt() - 1;\n\t\t\tns[s].add(ns[t]);\n\t\t\tns[t].add(ns[s]);\n\t\t}\n\t\tdfs(ns[0], null);\n\t\tfor (int i = 0; i < Q; i++) {\n\t\t\tint p = sc.nextInt();\n\t\t\tint x = sc.nextInt();\n\t\t\tns[p - 1].cnt += x;\n\t\t}\n\t\tsum(ns[0]);\n\t\tString res = \"\";\n\t\tfor (Node node: ns)\n\t\t\tres += \" \" + node.cnt;\n\t\tSystem.out.println(res.substring(1));\n\t}\n\tprivate static void sum(Node node)\n\t{\n\t\tif (node.p != null)\n\t\t\tnode.cnt += node.p.cnt;\n\t\tfor (Node c: node) {\n\t\t\tif (c != node.p) {\n\t\t\t\tsum(c);\n\t\t\t}\n\t\t}\n\t}\n\tprivate static void dfs(Node c, Node p)\n\t{\n\t\tc.p = p;\n\t\tfor (Node cc: c)\n\t\t\tif (cc != p)\n\t\t\t\tdfs(cc, c);\n\t}\n\tstatic class Node extends ArrayList\n\t{\n\t\tNode p;\n\t\tint id;\n\t\tint cnt = 0;\n\t\tNode(int _id) {id = _id;}\n\t}\n}", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a rooted tree with N vertices numbered 1 to N.\nThe root is Vertex 1, and the i-th edge (1 \\leq i \\leq N - 1) connects Vertex a_i and b_i.\n\nEach of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0.\n\nNow, the following Q operations will be performed:\n\nOperation j (1 \\leq j \\leq Q): Increment by x_j the counter on every vertex contained in the subtree rooted at Vertex p_j.\n\nFind the value of the counter on each vertex after all operations.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq Q \\leq 2 \\times 10^5\n\n1 \\leq a_i < b_i \\leq N\n\n1 \\leq p_j \\leq N\n\n1 \\leq x_j \\leq 10^4\n\nThe given graph is a tree.\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 b_1\n:\na_{N-1} b_{N-1}\np_1 x_1\n:\np_Q x_Q\n\nOutput\n\nPrint the values of the counters on Vertex 1, 2, \\ldots, N after all operations, in this order, with spaces in between.\n\nSample Input 1\n\n4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n\nSample Output 1\n\n100 110 111 110\n\nThe tree in this input is as follows:\n\nEach operation changes the values of the counters on the vertices as follows:\n\nOperation 1: Increment by 10 the counter on every vertex contained in the subtree rooted at Vertex 2, that is, Vertex 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 0, 10, 10, 10, respectively.\n\nOperation 2: Increment by 100 the counter on every vertex contained in the subtree rooted at Vertex 1, that is, Vertex 1, 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 110, 110, respectively.\n\nOperation 3: Increment by 1 the counter on every vertex contained in the subtree rooted at Vertex 3, that is, Vertex 3. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 111, 110, respectively.\n\nSample Input 2\n\n6 2\n1 2\n1 3\n2 4\n3 6\n2 5\n1 10\n1 10\n\nSample Output 2\n\n20 20 20 20 20 20", "sample_input": "4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n"}, "reference_outputs": ["100 110 111 110\n"], "source_document_id": "p02936", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a rooted tree with N vertices numbered 1 to N.\nThe root is Vertex 1, and the i-th edge (1 \\leq i \\leq N - 1) connects Vertex a_i and b_i.\n\nEach of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0.\n\nNow, the following Q operations will be performed:\n\nOperation j (1 \\leq j \\leq Q): Increment by x_j the counter on every vertex contained in the subtree rooted at Vertex p_j.\n\nFind the value of the counter on each vertex after all operations.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq Q \\leq 2 \\times 10^5\n\n1 \\leq a_i < b_i \\leq N\n\n1 \\leq p_j \\leq N\n\n1 \\leq x_j \\leq 10^4\n\nThe given graph is a tree.\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 b_1\n:\na_{N-1} b_{N-1}\np_1 x_1\n:\np_Q x_Q\n\nOutput\n\nPrint the values of the counters on Vertex 1, 2, \\ldots, N after all operations, in this order, with spaces in between.\n\nSample Input 1\n\n4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n\nSample Output 1\n\n100 110 111 110\n\nThe tree in this input is as follows:\n\nEach operation changes the values of the counters on the vertices as follows:\n\nOperation 1: Increment by 10 the counter on every vertex contained in the subtree rooted at Vertex 2, that is, Vertex 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 0, 10, 10, 10, respectively.\n\nOperation 2: Increment by 100 the counter on every vertex contained in the subtree rooted at Vertex 1, that is, Vertex 1, 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 110, 110, respectively.\n\nOperation 3: Increment by 1 the counter on every vertex contained in the subtree rooted at Vertex 3, that is, Vertex 3. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 111, 110, respectively.\n\nSample Input 2\n\n6 2\n1 2\n1 3\n2 4\n3 6\n2 5\n1 10\n1 10\n\nSample Output 2\n\n20 20 20 20 20 20", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1035, "cpu_time_ms": 2110, "memory_kb": 378604}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s752051286", "group_id": "codeNet:p02936", "input_text": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.NoSuchElementException;\n\npublic class Main {\n\n\tstatic class Node {\n\t\tboolean root=true;\n\t\tlong v;\n\t\tList cs = new ArrayList<>();\n\t\t\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tint n = (int) sc.nextLong();\n\t\tint q = (int) sc.nextLong();\n\n\t\tNode[] nodes = new Node[n + 1];\n\t\tfor (int i = 1, max = n + 1; i < max; i++) {\n\t\t\tnodes[i] = new Node();\n\t\t}\n\n\t\tfor (int i = 0, max = n - 1; i < max; i++) {\n\t\t\tint n0 = (int) sc.nextLong();\n\t\t\tint n1 = (int) sc.nextLong();\n\t\t\tnodes[n0].cs.add(nodes[n1]);\n\t\t\tnodes[n1].root = false;\n\t\t}\n\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tint ni = (int) sc.nextLong();\n\t\t\tint v = (int) sc.nextLong();\n\t\t\tnodes[ni].v += v;\n\t\t}\n\t\t\n\t\taddChild(nodes[1], 0);\n\n\t\tfor (int i = 1; i < nodes.length; i++) {\n\t\t\tif (i != 1) {\n\t\t\t\tpw.print(\" \");\n\t\t\t}\n\t\t\tpw.print(nodes[i].v);\n\t\t}\n\t\tpw.println();\n\t\tpw.flush();\n\t}\n\n\tstatic void addChild(Node n, long v) {\n\t\tn.v += v;\n\t\tfor (Node c : n.cs) {\n\t\t\taddChild(c, n.v);\n\t\t}\n\t}\n\n\n\tstatic final FastScanner sc = new FastScanner();\n\tstatic final PrintWriter pw = new PrintWriter(System.out);\n\n\tstatic class FastScanner {\n\t\tprivate final InputStream in = System.in;\n\t\tprivate final byte[] buffer = new byte[1024];\n\t\tprivate int ptr = 0;\n\t\tprivate int buflen = 0;\n\n\t\tprivate boolean hasNextByte() {\n\t\t\tif (ptr < buflen) {\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\tptr = 0;\n\t\t\t\ttry {\n\t\t\t\t\tbuflen = in.read(buffer);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t\tif (buflen <= 0) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\tprivate int readByte() {\n\t\t\tif (hasNextByte())\n\t\t\t\treturn buffer[ptr++];\n\t\t\telse\n\t\t\t\treturn -1;\n\t\t}\n\n\t\tstatic boolean isPrintableChar(int c) {\n\t\t\treturn 33 <= c && c <= 126;\n\t\t}\n\n\t\tprivate void skipUnprintable() {\n\t\t\twhile (hasNextByte() && !isPrintableChar(buffer[ptr]))\n\t\t\t\tptr++;\n\t\t}\n\n\t\tpublic boolean hasNext() {\n\t\t\tskipUnprintable();\n\t\t\treturn hasNextByte();\n\t\t}\n\n\t\tpublic String next() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tint b = readByte();\n\t\t\twhile (isPrintableChar(b)) {\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\treturn sb.toString();\n\t\t}\n\n\t\tpublic long nextLong() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tlong n = 0;\n\t\t\tboolean minus = false;\n\t\t\tint b = readByte();\n\t\t\tif (b == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\tif (b < '0' || '9' < b) {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\twhile (true) {\n\t\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\t\tn *= 10;\n\t\t\t\t\tn += b - '0';\n\t\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\t\treturn minus ? -n : n;\n\t\t\t\t} else {\n\t\t\t\t\tthrow new NumberFormatException();\n\t\t\t\t}\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t}\n\t}\n}\n", "language": "Java", "metadata": {"date": 1567304012, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02936.html", "problem_id": "p02936", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02936/input.txt", "sample_output_relpath": "derived/input_output/data/p02936/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02936/Java/s752051286.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s752051286", "user_id": "u485617080"}, "prompt_components": {"gold_output": "100 110 111 110\n", "input_to_evaluate": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.NoSuchElementException;\n\npublic class Main {\n\n\tstatic class Node {\n\t\tboolean root=true;\n\t\tlong v;\n\t\tList cs = new ArrayList<>();\n\t\t\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tint n = (int) sc.nextLong();\n\t\tint q = (int) sc.nextLong();\n\n\t\tNode[] nodes = new Node[n + 1];\n\t\tfor (int i = 1, max = n + 1; i < max; i++) {\n\t\t\tnodes[i] = new Node();\n\t\t}\n\n\t\tfor (int i = 0, max = n - 1; i < max; i++) {\n\t\t\tint n0 = (int) sc.nextLong();\n\t\t\tint n1 = (int) sc.nextLong();\n\t\t\tnodes[n0].cs.add(nodes[n1]);\n\t\t\tnodes[n1].root = false;\n\t\t}\n\n\t\tfor (int i = 0; i < q; i++) {\n\t\t\tint ni = (int) sc.nextLong();\n\t\t\tint v = (int) sc.nextLong();\n\t\t\tnodes[ni].v += v;\n\t\t}\n\t\t\n\t\taddChild(nodes[1], 0);\n\n\t\tfor (int i = 1; i < nodes.length; i++) {\n\t\t\tif (i != 1) {\n\t\t\t\tpw.print(\" \");\n\t\t\t}\n\t\t\tpw.print(nodes[i].v);\n\t\t}\n\t\tpw.println();\n\t\tpw.flush();\n\t}\n\n\tstatic void addChild(Node n, long v) {\n\t\tn.v += v;\n\t\tfor (Node c : n.cs) {\n\t\t\taddChild(c, n.v);\n\t\t}\n\t}\n\n\n\tstatic final FastScanner sc = new FastScanner();\n\tstatic final PrintWriter pw = new PrintWriter(System.out);\n\n\tstatic class FastScanner {\n\t\tprivate final InputStream in = System.in;\n\t\tprivate final byte[] buffer = new byte[1024];\n\t\tprivate int ptr = 0;\n\t\tprivate int buflen = 0;\n\n\t\tprivate boolean hasNextByte() {\n\t\t\tif (ptr < buflen) {\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\tptr = 0;\n\t\t\t\ttry {\n\t\t\t\t\tbuflen = in.read(buffer);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t\tif (buflen <= 0) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\tprivate int readByte() {\n\t\t\tif (hasNextByte())\n\t\t\t\treturn buffer[ptr++];\n\t\t\telse\n\t\t\t\treturn -1;\n\t\t}\n\n\t\tstatic boolean isPrintableChar(int c) {\n\t\t\treturn 33 <= c && c <= 126;\n\t\t}\n\n\t\tprivate void skipUnprintable() {\n\t\t\twhile (hasNextByte() && !isPrintableChar(buffer[ptr]))\n\t\t\t\tptr++;\n\t\t}\n\n\t\tpublic boolean hasNext() {\n\t\t\tskipUnprintable();\n\t\t\treturn hasNextByte();\n\t\t}\n\n\t\tpublic String next() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tint b = readByte();\n\t\t\twhile (isPrintableChar(b)) {\n\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\treturn sb.toString();\n\t\t}\n\n\t\tpublic long nextLong() {\n\t\t\tif (!hasNext())\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\tlong n = 0;\n\t\t\tboolean minus = false;\n\t\t\tint b = readByte();\n\t\t\tif (b == '-') {\n\t\t\t\tminus = true;\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t\tif (b < '0' || '9' < b) {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\twhile (true) {\n\t\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\t\tn *= 10;\n\t\t\t\t\tn += b - '0';\n\t\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\t\treturn minus ? -n : n;\n\t\t\t\t} else {\n\t\t\t\t\tthrow new NumberFormatException();\n\t\t\t\t}\n\t\t\t\tb = readByte();\n\t\t\t}\n\t\t}\n\t}\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a rooted tree with N vertices numbered 1 to N.\nThe root is Vertex 1, and the i-th edge (1 \\leq i \\leq N - 1) connects Vertex a_i and b_i.\n\nEach of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0.\n\nNow, the following Q operations will be performed:\n\nOperation j (1 \\leq j \\leq Q): Increment by x_j the counter on every vertex contained in the subtree rooted at Vertex p_j.\n\nFind the value of the counter on each vertex after all operations.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq Q \\leq 2 \\times 10^5\n\n1 \\leq a_i < b_i \\leq N\n\n1 \\leq p_j \\leq N\n\n1 \\leq x_j \\leq 10^4\n\nThe given graph is a tree.\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 b_1\n:\na_{N-1} b_{N-1}\np_1 x_1\n:\np_Q x_Q\n\nOutput\n\nPrint the values of the counters on Vertex 1, 2, \\ldots, N after all operations, in this order, with spaces in between.\n\nSample Input 1\n\n4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n\nSample Output 1\n\n100 110 111 110\n\nThe tree in this input is as follows:\n\nEach operation changes the values of the counters on the vertices as follows:\n\nOperation 1: Increment by 10 the counter on every vertex contained in the subtree rooted at Vertex 2, that is, Vertex 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 0, 10, 10, 10, respectively.\n\nOperation 2: Increment by 100 the counter on every vertex contained in the subtree rooted at Vertex 1, that is, Vertex 1, 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 110, 110, respectively.\n\nOperation 3: Increment by 1 the counter on every vertex contained in the subtree rooted at Vertex 3, that is, Vertex 3. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 111, 110, respectively.\n\nSample Input 2\n\n6 2\n1 2\n1 3\n2 4\n3 6\n2 5\n1 10\n1 10\n\nSample Output 2\n\n20 20 20 20 20 20", "sample_input": "4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n"}, "reference_outputs": ["100 110 111 110\n"], "source_document_id": "p02936", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a rooted tree with N vertices numbered 1 to N.\nThe root is Vertex 1, and the i-th edge (1 \\leq i \\leq N - 1) connects Vertex a_i and b_i.\n\nEach of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0.\n\nNow, the following Q operations will be performed:\n\nOperation j (1 \\leq j \\leq Q): Increment by x_j the counter on every vertex contained in the subtree rooted at Vertex p_j.\n\nFind the value of the counter on each vertex after all operations.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq Q \\leq 2 \\times 10^5\n\n1 \\leq a_i < b_i \\leq N\n\n1 \\leq p_j \\leq N\n\n1 \\leq x_j \\leq 10^4\n\nThe given graph is a tree.\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 b_1\n:\na_{N-1} b_{N-1}\np_1 x_1\n:\np_Q x_Q\n\nOutput\n\nPrint the values of the counters on Vertex 1, 2, \\ldots, N after all operations, in this order, with spaces in between.\n\nSample Input 1\n\n4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n\nSample Output 1\n\n100 110 111 110\n\nThe tree in this input is as follows:\n\nEach operation changes the values of the counters on the vertices as follows:\n\nOperation 1: Increment by 10 the counter on every vertex contained in the subtree rooted at Vertex 2, that is, Vertex 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 0, 10, 10, 10, respectively.\n\nOperation 2: Increment by 100 the counter on every vertex contained in the subtree rooted at Vertex 1, that is, Vertex 1, 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 110, 110, respectively.\n\nOperation 3: Increment by 1 the counter on every vertex contained in the subtree rooted at Vertex 3, that is, Vertex 3. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 111, 110, respectively.\n\nSample Input 2\n\n6 2\n1 2\n1 3\n2 4\n3 6\n2 5\n1 10\n1 10\n\nSample Output 2\n\n20 20 20 20 20 20", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2822, "cpu_time_ms": 1044, "memory_kb": 84652}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s013358926", "group_id": "codeNet:p02936", "input_text": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.FileNotFoundException;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.StringTokenizer;\nimport java.io.BufferedReader;\nimport java.io.FileReader;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author /\\\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n DKi solver = new DKi();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class DKi {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int n = in.nextInt();\n int q = in.nextInt();\n List[] adj = new List[n];\n for (int i = 0; i < n; i++) {\n adj[i] = new ArrayList<>();\n }\n for (int i = 0; i < n - 1; i++) {\n int a = in.nextInt();\n int b = in.nextInt();\n adj[a - 1].add(b - 1);\n }\n long[] added = new long[n];\n while (q-- > 0) {\n int p = in.nextInt() - 1;\n int x = in.nextInt();\n added[p] += x;\n }\n long[] res = new long[n];\n res[0] = added[0];\n dfs(0, res, added, adj);\n StringBuilder sb = new StringBuilder();\n for (long i : res) {\n sb.append(i).append(\" \");\n }\n out.print(sb);\n }\n\n static void dfs(int node, long[] res, long[] added, List[] adj) {\n for (int i : adj[node]) {\n res[i] = res[node] + added[i];\n dfs(i, res, added, adj);\n }\n }\n\n }\n\n static class Scanner {\n private StringTokenizer st;\n private BufferedReader br;\n\n public Scanner(InputStream s) {\n br = new BufferedReader(new InputStreamReader(s));\n }\n\n public Scanner(String s) {\n try {\n br = new BufferedReader(new FileReader(s));\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n }\n\n public String next() {\n while (st == null || !st.hasMoreTokens()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n }\n}\n\n", "language": "Java", "metadata": {"date": 1567089084, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02936.html", "problem_id": "p02936", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02936/input.txt", "sample_output_relpath": "derived/input_output/data/p02936/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02936/Java/s013358926.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s013358926", "user_id": "u574766029"}, "prompt_components": {"gold_output": "100 110 111 110\n", "input_to_evaluate": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.FileNotFoundException;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.StringTokenizer;\nimport java.io.BufferedReader;\nimport java.io.FileReader;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author /\\\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n DKi solver = new DKi();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class DKi {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int n = in.nextInt();\n int q = in.nextInt();\n List[] adj = new List[n];\n for (int i = 0; i < n; i++) {\n adj[i] = new ArrayList<>();\n }\n for (int i = 0; i < n - 1; i++) {\n int a = in.nextInt();\n int b = in.nextInt();\n adj[a - 1].add(b - 1);\n }\n long[] added = new long[n];\n while (q-- > 0) {\n int p = in.nextInt() - 1;\n int x = in.nextInt();\n added[p] += x;\n }\n long[] res = new long[n];\n res[0] = added[0];\n dfs(0, res, added, adj);\n StringBuilder sb = new StringBuilder();\n for (long i : res) {\n sb.append(i).append(\" \");\n }\n out.print(sb);\n }\n\n static void dfs(int node, long[] res, long[] added, List[] adj) {\n for (int i : adj[node]) {\n res[i] = res[node] + added[i];\n dfs(i, res, added, adj);\n }\n }\n\n }\n\n static class Scanner {\n private StringTokenizer st;\n private BufferedReader br;\n\n public Scanner(InputStream s) {\n br = new BufferedReader(new InputStreamReader(s));\n }\n\n public Scanner(String s) {\n try {\n br = new BufferedReader(new FileReader(s));\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n }\n\n public String next() {\n while (st == null || !st.hasMoreTokens()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n }\n}\n\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a rooted tree with N vertices numbered 1 to N.\nThe root is Vertex 1, and the i-th edge (1 \\leq i \\leq N - 1) connects Vertex a_i and b_i.\n\nEach of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0.\n\nNow, the following Q operations will be performed:\n\nOperation j (1 \\leq j \\leq Q): Increment by x_j the counter on every vertex contained in the subtree rooted at Vertex p_j.\n\nFind the value of the counter on each vertex after all operations.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq Q \\leq 2 \\times 10^5\n\n1 \\leq a_i < b_i \\leq N\n\n1 \\leq p_j \\leq N\n\n1 \\leq x_j \\leq 10^4\n\nThe given graph is a tree.\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 b_1\n:\na_{N-1} b_{N-1}\np_1 x_1\n:\np_Q x_Q\n\nOutput\n\nPrint the values of the counters on Vertex 1, 2, \\ldots, N after all operations, in this order, with spaces in between.\n\nSample Input 1\n\n4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n\nSample Output 1\n\n100 110 111 110\n\nThe tree in this input is as follows:\n\nEach operation changes the values of the counters on the vertices as follows:\n\nOperation 1: Increment by 10 the counter on every vertex contained in the subtree rooted at Vertex 2, that is, Vertex 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 0, 10, 10, 10, respectively.\n\nOperation 2: Increment by 100 the counter on every vertex contained in the subtree rooted at Vertex 1, that is, Vertex 1, 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 110, 110, respectively.\n\nOperation 3: Increment by 1 the counter on every vertex contained in the subtree rooted at Vertex 3, that is, Vertex 3. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 111, 110, respectively.\n\nSample Input 2\n\n6 2\n1 2\n1 3\n2 4\n3 6\n2 5\n1 10\n1 10\n\nSample Output 2\n\n20 20 20 20 20 20", "sample_input": "4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n"}, "reference_outputs": ["100 110 111 110\n"], "source_document_id": "p02936", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a rooted tree with N vertices numbered 1 to N.\nThe root is Vertex 1, and the i-th edge (1 \\leq i \\leq N - 1) connects Vertex a_i and b_i.\n\nEach of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0.\n\nNow, the following Q operations will be performed:\n\nOperation j (1 \\leq j \\leq Q): Increment by x_j the counter on every vertex contained in the subtree rooted at Vertex p_j.\n\nFind the value of the counter on each vertex after all operations.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq Q \\leq 2 \\times 10^5\n\n1 \\leq a_i < b_i \\leq N\n\n1 \\leq p_j \\leq N\n\n1 \\leq x_j \\leq 10^4\n\nThe given graph is a tree.\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 b_1\n:\na_{N-1} b_{N-1}\np_1 x_1\n:\np_Q x_Q\n\nOutput\n\nPrint the values of the counters on Vertex 1, 2, \\ldots, N after all operations, in this order, with spaces in between.\n\nSample Input 1\n\n4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n\nSample Output 1\n\n100 110 111 110\n\nThe tree in this input is as follows:\n\nEach operation changes the values of the counters on the vertices as follows:\n\nOperation 1: Increment by 10 the counter on every vertex contained in the subtree rooted at Vertex 2, that is, Vertex 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 0, 10, 10, 10, respectively.\n\nOperation 2: Increment by 100 the counter on every vertex contained in the subtree rooted at Vertex 1, that is, Vertex 1, 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 110, 110, respectively.\n\nOperation 3: Increment by 1 the counter on every vertex contained in the subtree rooted at Vertex 3, that is, Vertex 3. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 111, 110, respectively.\n\nSample Input 2\n\n6 2\n1 2\n1 3\n2 4\n3 6\n2 5\n1 10\n1 10\n\nSample Output 2\n\n20 20 20 20 20 20", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2900, "cpu_time_ms": 1043, "memory_kb": 111296}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s130525540", "group_id": "codeNet:p02936", "input_text": "\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Scanner;\nimport java.util.Set;\n\npublic class Main {\n public static void main(final String[] args) {\n final Scanner scanner = new Scanner(System.in);\n final int n = scanner.nextInt();\n final int q = scanner.nextInt();\n\n final Map> map = new HashMap<>();\n for (int i = 0; i < n - 1; i++) {\n final int a = scanner.nextInt() - 1;\n final int b = scanner.nextInt() - 1;\n\n map.computeIfAbsent(a, e -> new ArrayList<>())\n .add(b);\n\n map.computeIfAbsent(b, e -> new ArrayList<>())\n .add(a);\n }\n\n final int[] answers = new int[n];\n\n for (int i = 0; i < q; i++) {\n final int node = scanner.nextInt() - 1;\n final int operation = scanner.nextInt();\n answers[node] += operation;\n }\n\n recursive(map, answers, 0);\n\n for (final int answer : answers) {\n System.out.print(answer + \" \");\n }\n }\n\n private static void recursive(final Map> map, final int[] answers, final int node) {\n for (final int relatedNode : map.get(node)) {\n map.get(relatedNode).remove(node);\n answers[relatedNode] += answers[node];\n\n recursive(map, answers, relatedNode);\n\n /*\n final Set relatedRelatedNodes = map.get(relatedNode);\n if (relatedRelatedNodes == null) {\n return;\n }\n\n relatedRelatedNodes.remove(node);\n if (!relatedRelatedNodes.isEmpty()) {\n recursive(map, answers, relatedNode);\n }\n\n */\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1566701779, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02936.html", "problem_id": "p02936", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02936/input.txt", "sample_output_relpath": "derived/input_output/data/p02936/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02936/Java/s130525540.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s130525540", "user_id": "u476482490"}, "prompt_components": {"gold_output": "100 110 111 110\n", "input_to_evaluate": "\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Scanner;\nimport java.util.Set;\n\npublic class Main {\n public static void main(final String[] args) {\n final Scanner scanner = new Scanner(System.in);\n final int n = scanner.nextInt();\n final int q = scanner.nextInt();\n\n final Map> map = new HashMap<>();\n for (int i = 0; i < n - 1; i++) {\n final int a = scanner.nextInt() - 1;\n final int b = scanner.nextInt() - 1;\n\n map.computeIfAbsent(a, e -> new ArrayList<>())\n .add(b);\n\n map.computeIfAbsent(b, e -> new ArrayList<>())\n .add(a);\n }\n\n final int[] answers = new int[n];\n\n for (int i = 0; i < q; i++) {\n final int node = scanner.nextInt() - 1;\n final int operation = scanner.nextInt();\n answers[node] += operation;\n }\n\n recursive(map, answers, 0);\n\n for (final int answer : answers) {\n System.out.print(answer + \" \");\n }\n }\n\n private static void recursive(final Map> map, final int[] answers, final int node) {\n for (final int relatedNode : map.get(node)) {\n map.get(relatedNode).remove(node);\n answers[relatedNode] += answers[node];\n\n recursive(map, answers, relatedNode);\n\n /*\n final Set relatedRelatedNodes = map.get(relatedNode);\n if (relatedRelatedNodes == null) {\n return;\n }\n\n relatedRelatedNodes.remove(node);\n if (!relatedRelatedNodes.isEmpty()) {\n recursive(map, answers, relatedNode);\n }\n\n */\n }\n }\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a rooted tree with N vertices numbered 1 to N.\nThe root is Vertex 1, and the i-th edge (1 \\leq i \\leq N - 1) connects Vertex a_i and b_i.\n\nEach of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0.\n\nNow, the following Q operations will be performed:\n\nOperation j (1 \\leq j \\leq Q): Increment by x_j the counter on every vertex contained in the subtree rooted at Vertex p_j.\n\nFind the value of the counter on each vertex after all operations.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq Q \\leq 2 \\times 10^5\n\n1 \\leq a_i < b_i \\leq N\n\n1 \\leq p_j \\leq N\n\n1 \\leq x_j \\leq 10^4\n\nThe given graph is a tree.\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 b_1\n:\na_{N-1} b_{N-1}\np_1 x_1\n:\np_Q x_Q\n\nOutput\n\nPrint the values of the counters on Vertex 1, 2, \\ldots, N after all operations, in this order, with spaces in between.\n\nSample Input 1\n\n4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n\nSample Output 1\n\n100 110 111 110\n\nThe tree in this input is as follows:\n\nEach operation changes the values of the counters on the vertices as follows:\n\nOperation 1: Increment by 10 the counter on every vertex contained in the subtree rooted at Vertex 2, that is, Vertex 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 0, 10, 10, 10, respectively.\n\nOperation 2: Increment by 100 the counter on every vertex contained in the subtree rooted at Vertex 1, that is, Vertex 1, 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 110, 110, respectively.\n\nOperation 3: Increment by 1 the counter on every vertex contained in the subtree rooted at Vertex 3, that is, Vertex 3. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 111, 110, respectively.\n\nSample Input 2\n\n6 2\n1 2\n1 3\n2 4\n3 6\n2 5\n1 10\n1 10\n\nSample Output 2\n\n20 20 20 20 20 20", "sample_input": "4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n"}, "reference_outputs": ["100 110 111 110\n"], "source_document_id": "p02936", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a rooted tree with N vertices numbered 1 to N.\nThe root is Vertex 1, and the i-th edge (1 \\leq i \\leq N - 1) connects Vertex a_i and b_i.\n\nEach of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0.\n\nNow, the following Q operations will be performed:\n\nOperation j (1 \\leq j \\leq Q): Increment by x_j the counter on every vertex contained in the subtree rooted at Vertex p_j.\n\nFind the value of the counter on each vertex after all operations.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq Q \\leq 2 \\times 10^5\n\n1 \\leq a_i < b_i \\leq N\n\n1 \\leq p_j \\leq N\n\n1 \\leq x_j \\leq 10^4\n\nThe given graph is a tree.\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 b_1\n:\na_{N-1} b_{N-1}\np_1 x_1\n:\np_Q x_Q\n\nOutput\n\nPrint the values of the counters on Vertex 1, 2, \\ldots, N after all operations, in this order, with spaces in between.\n\nSample Input 1\n\n4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n\nSample Output 1\n\n100 110 111 110\n\nThe tree in this input is as follows:\n\nEach operation changes the values of the counters on the vertices as follows:\n\nOperation 1: Increment by 10 the counter on every vertex contained in the subtree rooted at Vertex 2, that is, Vertex 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 0, 10, 10, 10, respectively.\n\nOperation 2: Increment by 100 the counter on every vertex contained in the subtree rooted at Vertex 1, that is, Vertex 1, 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 110, 110, respectively.\n\nOperation 3: Increment by 1 the counter on every vertex contained in the subtree rooted at Vertex 3, that is, Vertex 3. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 111, 110, respectively.\n\nSample Input 2\n\n6 2\n1 2\n1 3\n2 4\n3 6\n2 5\n1 10\n1 10\n\nSample Output 2\n\n20 20 20 20 20 20", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1848, "cpu_time_ms": 1753, "memory_kb": 216164}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s992494628", "group_id": "codeNet:p02936", "input_text": "/**\n * Created at 16:15 on 2019-08-22\n */\n\nimport java.io.*;\nimport java.util.*;\n\npublic class Main {\n\n static FastScanner sc = new FastScanner();\n static Output out = new Output(System.out);\n\n static final int[] dx = {0, 1, 0, -1};\n static final int[] dy = {-1, 0, 1, 0};\n\n static final long MOD = (long) (1e9 + 7);\n static final long INF = Long.MAX_VALUE / 2;\n\n public static class Solver {\n\n ArrayList[] to;\n long[] count;\n\n public Solver() {\n\n int N = sc.nextInt();\n int Q = sc.nextInt();\n\n to = new ArrayList[N];\n for (int i=0; i();\n }\n\n for (int i=0; i[] to;\n long[] count;\n\n public Solver() {\n\n int N = sc.nextInt();\n int Q = sc.nextInt();\n\n to = new ArrayList[N];\n for (int i=0; i();\n }\n\n for (int i=0; i queue = new LinkedList<>();\n queue.add(nodes[0]);\n while (!queue.isEmpty())\n {\n Node curr = queue.remove();\n if (curr.visited)\n {\n continue;\n }\n curr.visited = true;\n Iterator it = curr.children.iterator();\n while (it.hasNext())\n {\n Node next = it.next();\n if (next.visited)\n {\n it.remove();\n }\n else\n {\n queue.add(next);\n }\n }\n }\n\n for (int i = 0; i < q; i++)\n {\n tok = new StringTokenizer(in.readLine());\n int p = Integer.parseInt(tok.nextToken())-1;\n int x = Integer.parseInt(tok.nextToken());\n nodes[p].value += x;\n }\n update(nodes[0], 0);\n for (int i = 0; i < n; i++)\n {\n if (i != 0)\n {\n out.print(\" \");\n }\n out.print(nodes[i].value);\n }\n // out.println();\n\n out.flush();\n in.close();\n }\n\n public void update(Node curr, long add)\n {\n curr.value += add;\n for (Node next : curr.children)\n {\n update(next, curr.value);\n }\n }\n\n public static void main(String[] args) throws IOException\n {\n new Main().go();\n }\n\n private class Node\n {\n ArrayList children;\n long value;\n boolean visited;\n\n public Node()\n {\n children = new ArrayList<>();\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1566295484, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02936.html", "problem_id": "p02936", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02936/input.txt", "sample_output_relpath": "derived/input_output/data/p02936/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02936/Java/s222113552.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s222113552", "user_id": "u169500433"}, "prompt_components": {"gold_output": "100 110 111 110\n", "input_to_evaluate": "import java.io.*;\nimport java.util.*;\n\npublic class Main\n{\n PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n\n public void go() throws IOException\n {\n StringTokenizer tok = new StringTokenizer(in.readLine());\n int n = Integer.parseInt(tok.nextToken());\n int q = Integer.parseInt(tok.nextToken());\n Node[] nodes = new Node[n];\n for (int i = 0; i < n; i++)\n {\n nodes[i] = new Node();\n }\n for (int i = 0; i < n-1; i++)\n {\n tok = new StringTokenizer(in.readLine());\n int a = Integer.parseInt(tok.nextToken())-1;\n int b = Integer.parseInt(tok.nextToken())-1;\n nodes[a].children.add(nodes[b]);\n nodes[b].children.add(nodes[a]);\n }\n\n LinkedList queue = new LinkedList<>();\n queue.add(nodes[0]);\n while (!queue.isEmpty())\n {\n Node curr = queue.remove();\n if (curr.visited)\n {\n continue;\n }\n curr.visited = true;\n Iterator it = curr.children.iterator();\n while (it.hasNext())\n {\n Node next = it.next();\n if (next.visited)\n {\n it.remove();\n }\n else\n {\n queue.add(next);\n }\n }\n }\n\n for (int i = 0; i < q; i++)\n {\n tok = new StringTokenizer(in.readLine());\n int p = Integer.parseInt(tok.nextToken())-1;\n int x = Integer.parseInt(tok.nextToken());\n nodes[p].value += x;\n }\n update(nodes[0], 0);\n for (int i = 0; i < n; i++)\n {\n if (i != 0)\n {\n out.print(\" \");\n }\n out.print(nodes[i].value);\n }\n // out.println();\n\n out.flush();\n in.close();\n }\n\n public void update(Node curr, long add)\n {\n curr.value += add;\n for (Node next : curr.children)\n {\n update(next, curr.value);\n }\n }\n\n public static void main(String[] args) throws IOException\n {\n new Main().go();\n }\n\n private class Node\n {\n ArrayList children;\n long value;\n boolean visited;\n\n public Node()\n {\n children = new ArrayList<>();\n }\n }\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a rooted tree with N vertices numbered 1 to N.\nThe root is Vertex 1, and the i-th edge (1 \\leq i \\leq N - 1) connects Vertex a_i and b_i.\n\nEach of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0.\n\nNow, the following Q operations will be performed:\n\nOperation j (1 \\leq j \\leq Q): Increment by x_j the counter on every vertex contained in the subtree rooted at Vertex p_j.\n\nFind the value of the counter on each vertex after all operations.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq Q \\leq 2 \\times 10^5\n\n1 \\leq a_i < b_i \\leq N\n\n1 \\leq p_j \\leq N\n\n1 \\leq x_j \\leq 10^4\n\nThe given graph is a tree.\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 b_1\n:\na_{N-1} b_{N-1}\np_1 x_1\n:\np_Q x_Q\n\nOutput\n\nPrint the values of the counters on Vertex 1, 2, \\ldots, N after all operations, in this order, with spaces in between.\n\nSample Input 1\n\n4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n\nSample Output 1\n\n100 110 111 110\n\nThe tree in this input is as follows:\n\nEach operation changes the values of the counters on the vertices as follows:\n\nOperation 1: Increment by 10 the counter on every vertex contained in the subtree rooted at Vertex 2, that is, Vertex 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 0, 10, 10, 10, respectively.\n\nOperation 2: Increment by 100 the counter on every vertex contained in the subtree rooted at Vertex 1, that is, Vertex 1, 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 110, 110, respectively.\n\nOperation 3: Increment by 1 the counter on every vertex contained in the subtree rooted at Vertex 3, that is, Vertex 3. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 111, 110, respectively.\n\nSample Input 2\n\n6 2\n1 2\n1 3\n2 4\n3 6\n2 5\n1 10\n1 10\n\nSample Output 2\n\n20 20 20 20 20 20", "sample_input": "4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n"}, "reference_outputs": ["100 110 111 110\n"], "source_document_id": "p02936", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a rooted tree with N vertices numbered 1 to N.\nThe root is Vertex 1, and the i-th edge (1 \\leq i \\leq N - 1) connects Vertex a_i and b_i.\n\nEach of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0.\n\nNow, the following Q operations will be performed:\n\nOperation j (1 \\leq j \\leq Q): Increment by x_j the counter on every vertex contained in the subtree rooted at Vertex p_j.\n\nFind the value of the counter on each vertex after all operations.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq Q \\leq 2 \\times 10^5\n\n1 \\leq a_i < b_i \\leq N\n\n1 \\leq p_j \\leq N\n\n1 \\leq x_j \\leq 10^4\n\nThe given graph is a tree.\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 b_1\n:\na_{N-1} b_{N-1}\np_1 x_1\n:\np_Q x_Q\n\nOutput\n\nPrint the values of the counters on Vertex 1, 2, \\ldots, N after all operations, in this order, with spaces in between.\n\nSample Input 1\n\n4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n\nSample Output 1\n\n100 110 111 110\n\nThe tree in this input is as follows:\n\nEach operation changes the values of the counters on the vertices as follows:\n\nOperation 1: Increment by 10 the counter on every vertex contained in the subtree rooted at Vertex 2, that is, Vertex 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 0, 10, 10, 10, respectively.\n\nOperation 2: Increment by 100 the counter on every vertex contained in the subtree rooted at Vertex 1, that is, Vertex 1, 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 110, 110, respectively.\n\nOperation 3: Increment by 1 the counter on every vertex contained in the subtree rooted at Vertex 3, that is, Vertex 3. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 111, 110, respectively.\n\nSample Input 2\n\n6 2\n1 2\n1 3\n2 4\n3 6\n2 5\n1 10\n1 10\n\nSample Output 2\n\n20 20 20 20 20 20", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2560, "cpu_time_ms": 1325, "memory_kb": 126080}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s833203052", "group_id": "codeNet:p02936", "input_text": "import java.util.*;\nimport java.math.BigDecimal;\n\npublic class Main {\n public static void main(String[] args) {\n int N, Q;\n Node[] nodes;\n int[] p, x;\n try(Scanner sc = new Scanner(System.in)) {\n N = sc.nextInt();\n Q = sc.nextInt();\n nodes = new Node[N];\n for(int i = 0; i < N-1; i++) {\n int a = sc.nextInt();\n int b = sc.nextInt();\n Node nodeA = nodes[a-1];\n if ( nodeA == null ) {\n nodeA = new Node();\n nodes[a-1] = nodeA;\n }\n Node nodeB = nodes[b-1];\n if ( nodeB == null ) {\n nodeB = new Node();\n nodes[b-1] = nodeB;\n }\n nodeA.addChild(nodeB);\n }\n p = new int[Q];\n x = new int[Q];\n for(int j = 0; j < Q; j++) {\n p[j] = sc.nextInt();\n x[j] = sc.nextInt();\n }\n }\n solve(nodes, p, x);\n System.out.print(nodes[0].getScore());\n for(int i = 1; i < N; i++) {\n System.out.print(\" \");\n System.out.print(nodes[i].getScore());\n }\n System.out.println();\n }\n \n private static void solve(Node[] nodes, int[] p, int[] x) {\n int q = p.length;\n for(int j = 0; j < q; j++) {\n Node tmpRoot = nodes[p[j]-1];\n tmpRoot.addScore(x[j]);\n }\n nodes[0].propagateAll();\n }\n \n private static class Node {\n private Node[] children;\n \n private volatile long score;\n \n public Node() {\n children = new Node[0];\n }\n \n public void addChild(Node child) {\n int n = this.children.length;\n Node[] newChildren = new Node[n+1];\n System.arraycopy(children, 0, newChildren, 0, n);\n newChildren[n] = child;\n this.children = newChildren;\n }\n \n public void addScore(long value) {\n score += value;\n }\n \n public void propagateAll() {\n for( Node child : children ) {\n child.addScore(score);\n child.propagateAll();\n }\n }\n\n public long getScore() {\n return score;\n }\n }\n\n}\n", "language": "Java", "metadata": {"date": 1566269030, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02936.html", "problem_id": "p02936", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02936/input.txt", "sample_output_relpath": "derived/input_output/data/p02936/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02936/Java/s833203052.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s833203052", "user_id": "u422413213"}, "prompt_components": {"gold_output": "100 110 111 110\n", "input_to_evaluate": "import java.util.*;\nimport java.math.BigDecimal;\n\npublic class Main {\n public static void main(String[] args) {\n int N, Q;\n Node[] nodes;\n int[] p, x;\n try(Scanner sc = new Scanner(System.in)) {\n N = sc.nextInt();\n Q = sc.nextInt();\n nodes = new Node[N];\n for(int i = 0; i < N-1; i++) {\n int a = sc.nextInt();\n int b = sc.nextInt();\n Node nodeA = nodes[a-1];\n if ( nodeA == null ) {\n nodeA = new Node();\n nodes[a-1] = nodeA;\n }\n Node nodeB = nodes[b-1];\n if ( nodeB == null ) {\n nodeB = new Node();\n nodes[b-1] = nodeB;\n }\n nodeA.addChild(nodeB);\n }\n p = new int[Q];\n x = new int[Q];\n for(int j = 0; j < Q; j++) {\n p[j] = sc.nextInt();\n x[j] = sc.nextInt();\n }\n }\n solve(nodes, p, x);\n System.out.print(nodes[0].getScore());\n for(int i = 1; i < N; i++) {\n System.out.print(\" \");\n System.out.print(nodes[i].getScore());\n }\n System.out.println();\n }\n \n private static void solve(Node[] nodes, int[] p, int[] x) {\n int q = p.length;\n for(int j = 0; j < q; j++) {\n Node tmpRoot = nodes[p[j]-1];\n tmpRoot.addScore(x[j]);\n }\n nodes[0].propagateAll();\n }\n \n private static class Node {\n private Node[] children;\n \n private volatile long score;\n \n public Node() {\n children = new Node[0];\n }\n \n public void addChild(Node child) {\n int n = this.children.length;\n Node[] newChildren = new Node[n+1];\n System.arraycopy(children, 0, newChildren, 0, n);\n newChildren[n] = child;\n this.children = newChildren;\n }\n \n public void addScore(long value) {\n score += value;\n }\n \n public void propagateAll() {\n for( Node child : children ) {\n child.addScore(score);\n child.propagateAll();\n }\n }\n\n public long getScore() {\n return score;\n }\n }\n\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a rooted tree with N vertices numbered 1 to N.\nThe root is Vertex 1, and the i-th edge (1 \\leq i \\leq N - 1) connects Vertex a_i and b_i.\n\nEach of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0.\n\nNow, the following Q operations will be performed:\n\nOperation j (1 \\leq j \\leq Q): Increment by x_j the counter on every vertex contained in the subtree rooted at Vertex p_j.\n\nFind the value of the counter on each vertex after all operations.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq Q \\leq 2 \\times 10^5\n\n1 \\leq a_i < b_i \\leq N\n\n1 \\leq p_j \\leq N\n\n1 \\leq x_j \\leq 10^4\n\nThe given graph is a tree.\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 b_1\n:\na_{N-1} b_{N-1}\np_1 x_1\n:\np_Q x_Q\n\nOutput\n\nPrint the values of the counters on Vertex 1, 2, \\ldots, N after all operations, in this order, with spaces in between.\n\nSample Input 1\n\n4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n\nSample Output 1\n\n100 110 111 110\n\nThe tree in this input is as follows:\n\nEach operation changes the values of the counters on the vertices as follows:\n\nOperation 1: Increment by 10 the counter on every vertex contained in the subtree rooted at Vertex 2, that is, Vertex 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 0, 10, 10, 10, respectively.\n\nOperation 2: Increment by 100 the counter on every vertex contained in the subtree rooted at Vertex 1, that is, Vertex 1, 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 110, 110, respectively.\n\nOperation 3: Increment by 1 the counter on every vertex contained in the subtree rooted at Vertex 3, that is, Vertex 3. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 111, 110, respectively.\n\nSample Input 2\n\n6 2\n1 2\n1 3\n2 4\n3 6\n2 5\n1 10\n1 10\n\nSample Output 2\n\n20 20 20 20 20 20", "sample_input": "4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n"}, "reference_outputs": ["100 110 111 110\n"], "source_document_id": "p02936", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a rooted tree with N vertices numbered 1 to N.\nThe root is Vertex 1, and the i-th edge (1 \\leq i \\leq N - 1) connects Vertex a_i and b_i.\n\nEach of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0.\n\nNow, the following Q operations will be performed:\n\nOperation j (1 \\leq j \\leq Q): Increment by x_j the counter on every vertex contained in the subtree rooted at Vertex p_j.\n\nFind the value of the counter on each vertex after all operations.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq Q \\leq 2 \\times 10^5\n\n1 \\leq a_i < b_i \\leq N\n\n1 \\leq p_j \\leq N\n\n1 \\leq x_j \\leq 10^4\n\nThe given graph is a tree.\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 b_1\n:\na_{N-1} b_{N-1}\np_1 x_1\n:\np_Q x_Q\n\nOutput\n\nPrint the values of the counters on Vertex 1, 2, \\ldots, N after all operations, in this order, with spaces in between.\n\nSample Input 1\n\n4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n\nSample Output 1\n\n100 110 111 110\n\nThe tree in this input is as follows:\n\nEach operation changes the values of the counters on the vertices as follows:\n\nOperation 1: Increment by 10 the counter on every vertex contained in the subtree rooted at Vertex 2, that is, Vertex 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 0, 10, 10, 10, respectively.\n\nOperation 2: Increment by 100 the counter on every vertex contained in the subtree rooted at Vertex 1, that is, Vertex 1, 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 110, 110, respectively.\n\nOperation 3: Increment by 1 the counter on every vertex contained in the subtree rooted at Vertex 3, that is, Vertex 3. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 111, 110, respectively.\n\nSample Input 2\n\n6 2\n1 2\n1 3\n2 4\n3 6\n2 5\n1 10\n1 10\n\nSample Output 2\n\n20 20 20 20 20 20", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1968, "cpu_time_ms": 2110, "memory_kb": 351268}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s719336503", "group_id": "codeNet:p02936", "input_text": "import java.util.*;\nimport java.io.*;\nimport java.nio.charset.StandardCharsets;\n\npublic class Main {\n\tstatic class Node {\n\t\tint id;\n\t\tSet childrenIds = new HashSet<>();\n\t\tSet children = new HashSet<>();\n\t\tint counter = 0;\n\n\t\tNode(int id) {\n\t\t\tthis.id = id;\n\t\t}\n\n\t\tvoid findChildren(Set set) {\n\t\t\tif (set == null) {\n\t\t\t\tchildrenIds.add(this.id);\n\t\t\t\tfor (Node node : children) {\n\t\t\t\t\tnode.findChildren(this.childrenIds);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.childrenIds.addAll(set);\n\t\t\t\tthis.childrenIds.add(this.id);\n\t\t\t\tfor (Node node : children) {\n\t\t\t\t\tnode.findChildren(this.childrenIds);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tInputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);\n\t\tBufferedReader in = new BufferedReader(reader);\n\t\tString[] tokens = in.readLine().split(\" \");\n\t\tint N = Integer.parseInt(tokens[0]);\n\t\tint Q = Integer.parseInt(tokens[1]);\n\n\t\tNode[] tree = new Node[N];\n\t\tfor (int i = 0; i < N; ++i) {\n\t\t\ttree[i] = new Node(i);\n\t\t}\n\t\tfor (int i = 0; i < N - 1; ++i) {\n\t\t\ttokens = in.readLine().split(\" \");\n\t\t\tint a = Integer.parseInt(tokens[0]) - 1;\n\t\t\tint b = Integer.parseInt(tokens[1]) - 1;\n\t\t\ttree[a].children.add(tree[b]);\n\t\t}\n\t\ttree[0].findChildren(null);\n\n\t\tfor (int i = 0; i < Q; ++i) {\n\t\t\ttokens = in.readLine().split(\" \");\n\t\t\tint p = Integer.parseInt(tokens[0]) - 1;\n\t\t\tint q = Integer.parseInt(tokens[1]);\n\t\t\tfor (Node node : tree) {\n\t\t\t\tif (node.childrenIds.contains(p)) {\n\t\t\t\t\tnode.counter += q;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tStringBuilder strBuilder = new StringBuilder();\n\t\tstrBuilder.append(Integer.toString(tree[0].counter));\n\t\tfor (int i = 1; i < N; ++i) {\n\t\t\tstrBuilder.append(\" \" + Integer.toString(tree[i].counter));\n\t\t}\n\t\tSystem.out.println(strBuilder.toString());\n\t}\n}", "language": "Java", "metadata": {"date": 1566178193, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02936.html", "problem_id": "p02936", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02936/input.txt", "sample_output_relpath": "derived/input_output/data/p02936/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02936/Java/s719336503.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s719336503", "user_id": "u655125439"}, "prompt_components": {"gold_output": "100 110 111 110\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\nimport java.nio.charset.StandardCharsets;\n\npublic class Main {\n\tstatic class Node {\n\t\tint id;\n\t\tSet childrenIds = new HashSet<>();\n\t\tSet children = new HashSet<>();\n\t\tint counter = 0;\n\n\t\tNode(int id) {\n\t\t\tthis.id = id;\n\t\t}\n\n\t\tvoid findChildren(Set set) {\n\t\t\tif (set == null) {\n\t\t\t\tchildrenIds.add(this.id);\n\t\t\t\tfor (Node node : children) {\n\t\t\t\t\tnode.findChildren(this.childrenIds);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.childrenIds.addAll(set);\n\t\t\t\tthis.childrenIds.add(this.id);\n\t\t\t\tfor (Node node : children) {\n\t\t\t\t\tnode.findChildren(this.childrenIds);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tInputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);\n\t\tBufferedReader in = new BufferedReader(reader);\n\t\tString[] tokens = in.readLine().split(\" \");\n\t\tint N = Integer.parseInt(tokens[0]);\n\t\tint Q = Integer.parseInt(tokens[1]);\n\n\t\tNode[] tree = new Node[N];\n\t\tfor (int i = 0; i < N; ++i) {\n\t\t\ttree[i] = new Node(i);\n\t\t}\n\t\tfor (int i = 0; i < N - 1; ++i) {\n\t\t\ttokens = in.readLine().split(\" \");\n\t\t\tint a = Integer.parseInt(tokens[0]) - 1;\n\t\t\tint b = Integer.parseInt(tokens[1]) - 1;\n\t\t\ttree[a].children.add(tree[b]);\n\t\t}\n\t\ttree[0].findChildren(null);\n\n\t\tfor (int i = 0; i < Q; ++i) {\n\t\t\ttokens = in.readLine().split(\" \");\n\t\t\tint p = Integer.parseInt(tokens[0]) - 1;\n\t\t\tint q = Integer.parseInt(tokens[1]);\n\t\t\tfor (Node node : tree) {\n\t\t\t\tif (node.childrenIds.contains(p)) {\n\t\t\t\t\tnode.counter += q;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tStringBuilder strBuilder = new StringBuilder();\n\t\tstrBuilder.append(Integer.toString(tree[0].counter));\n\t\tfor (int i = 1; i < N; ++i) {\n\t\t\tstrBuilder.append(\" \" + Integer.toString(tree[i].counter));\n\t\t}\n\t\tSystem.out.println(strBuilder.toString());\n\t}\n}", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a rooted tree with N vertices numbered 1 to N.\nThe root is Vertex 1, and the i-th edge (1 \\leq i \\leq N - 1) connects Vertex a_i and b_i.\n\nEach of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0.\n\nNow, the following Q operations will be performed:\n\nOperation j (1 \\leq j \\leq Q): Increment by x_j the counter on every vertex contained in the subtree rooted at Vertex p_j.\n\nFind the value of the counter on each vertex after all operations.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq Q \\leq 2 \\times 10^5\n\n1 \\leq a_i < b_i \\leq N\n\n1 \\leq p_j \\leq N\n\n1 \\leq x_j \\leq 10^4\n\nThe given graph is a tree.\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 b_1\n:\na_{N-1} b_{N-1}\np_1 x_1\n:\np_Q x_Q\n\nOutput\n\nPrint the values of the counters on Vertex 1, 2, \\ldots, N after all operations, in this order, with spaces in between.\n\nSample Input 1\n\n4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n\nSample Output 1\n\n100 110 111 110\n\nThe tree in this input is as follows:\n\nEach operation changes the values of the counters on the vertices as follows:\n\nOperation 1: Increment by 10 the counter on every vertex contained in the subtree rooted at Vertex 2, that is, Vertex 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 0, 10, 10, 10, respectively.\n\nOperation 2: Increment by 100 the counter on every vertex contained in the subtree rooted at Vertex 1, that is, Vertex 1, 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 110, 110, respectively.\n\nOperation 3: Increment by 1 the counter on every vertex contained in the subtree rooted at Vertex 3, that is, Vertex 3. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 111, 110, respectively.\n\nSample Input 2\n\n6 2\n1 2\n1 3\n2 4\n3 6\n2 5\n1 10\n1 10\n\nSample Output 2\n\n20 20 20 20 20 20", "sample_input": "4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n"}, "reference_outputs": ["100 110 111 110\n"], "source_document_id": "p02936", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a rooted tree with N vertices numbered 1 to N.\nThe root is Vertex 1, and the i-th edge (1 \\leq i \\leq N - 1) connects Vertex a_i and b_i.\n\nEach of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0.\n\nNow, the following Q operations will be performed:\n\nOperation j (1 \\leq j \\leq Q): Increment by x_j the counter on every vertex contained in the subtree rooted at Vertex p_j.\n\nFind the value of the counter on each vertex after all operations.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq Q \\leq 2 \\times 10^5\n\n1 \\leq a_i < b_i \\leq N\n\n1 \\leq p_j \\leq N\n\n1 \\leq x_j \\leq 10^4\n\nThe given graph is a tree.\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 b_1\n:\na_{N-1} b_{N-1}\np_1 x_1\n:\np_Q x_Q\n\nOutput\n\nPrint the values of the counters on Vertex 1, 2, \\ldots, N after all operations, in this order, with spaces in between.\n\nSample Input 1\n\n4 3\n1 2\n2 3\n2 4\n2 10\n1 100\n3 1\n\nSample Output 1\n\n100 110 111 110\n\nThe tree in this input is as follows:\n\nEach operation changes the values of the counters on the vertices as follows:\n\nOperation 1: Increment by 10 the counter on every vertex contained in the subtree rooted at Vertex 2, that is, Vertex 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 0, 10, 10, 10, respectively.\n\nOperation 2: Increment by 100 the counter on every vertex contained in the subtree rooted at Vertex 1, that is, Vertex 1, 2, 3, 4. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 110, 110, respectively.\n\nOperation 3: Increment by 1 the counter on every vertex contained in the subtree rooted at Vertex 3, that is, Vertex 3. The values of the counters on Vertex 1, 2, 3, 4 are now 100, 110, 111, 110, respectively.\n\nSample Input 2\n\n6 2\n1 2\n1 3\n2 4\n3 6\n2 5\n1 10\n1 10\n\nSample Output 2\n\n20 20 20 20 20 20", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1785, "cpu_time_ms": 2110, "memory_kb": 336044}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s530599069", "group_id": "codeNet:p02949", "input_text": "\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.math.BigInteger;\nimport java.util.*;\nimport java.util.stream.IntStream;\nimport java.util.stream.LongStream;\n\n/**\n * https://kenkoooo.com/atcoder#/contest/show/8b029028-97c3-438c-9705-00a15ecfbe15\n */\npublic class Main {\n\n public Main() throws IOException {\n }\n\n public static void main(String[] args) throws IOException {\n new Main().solve();\n }\n\n // private final InputStream in = Files.newInputStream(Paths.get(\"C:\\\\Users\\\\ryo.suzuki\\\\Downloads\\\\02.txt\"));\n private final InputStream in = System.in;\n private final PrintWriter out = new PrintWriter(System.out);\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n private void solve() throws IOException {\n try {\n// solveA();\n// solveB();\n// solveC();\n// solveD();\n// solveE();\n solveF();\n } finally {\n if (in != null) {\n in.close();\n }\n if (out != null) {\n out.flush();\n out.close();\n }\n }\n\n }\n\n // mods\n long MOD = (long) Math.pow(10, 9) + 7;\n\n /**\n * https://atcoder.jp/contests/m-solutions2019/tasks/m_solutions2019_a\n * A - Sum of Interior Angl\n */\n private void solveA() {\n out.println((nextInt() - 2) * 180);\n }\n\n /**\n * https://atcoder.jp/contests/abc093/tasks/arc094_a\n */\n private void solveB() {\n int[] abc = IntStream.range(0, 3).map(i -> nextInt()).sorted().toArray();\n boolean isBcEve = (abc[2] - abc[1]) % 2 == 0;\n boolean isAcEve = (abc[2] - abc[0]) % 2 == 0;\n int res = 0;\n if (isAcEve && isBcEve) {\n res = (abc[2] - abc[1]) / 2 + (abc[2] - abc[0]) / 2;\n } else if (!isAcEve && !isBcEve) {\n res = (abc[2] - abc[1]) / 2 + (abc[2] - abc[0]) / 2 + 1;\n } else {\n res = (abc[2] - abc[1]) / 2 + (abc[2] - abc[0]) / 2 + 2;\n }\n out.println(res);\n }\n\n /**\n * https://atcoder.jp/contests/abc118/tasks/abc118_c\n * C - Monsters Battle Royale\n */\n private void solveC() {\n int n = nextInt();\n int[] a = IntStream.range(0, n).map(i -> nextInt()).toArray();\n long res = a[0];\n for (int item : a) {\n res = gcd(res, item);\n }\n out.println(res);\n }\n\n /**\n * https://atcoder.jp/contests/agc018/tasks/agc018_a\n * A - Getting Difference\n *

\n * 操作がユークリッドの互除法と同じ?\n * なら、KをGCDで割り切れてかつ、aの最大値より小さければkを作れるはず\n */\n private void solveD() {\n int n = nextInt();\n int k = nextInt();\n int[] a = IntStream.range(0, n).map(i -> nextInt()).sorted().toArray();\n long gcd = a[0];\n for (int item : a) {\n gcd = gcd(gcd, item);\n }\n if (k % gcd == 0 && k <= a[n - 1])\n out.println(\"POSSIBLE\");\n else\n out.println(\"IMPOSSIBLE\");\n }\n\n /**\n * https://atcoder.jp/contests/arc097/tasks/arc097_b\n * D - Equals\n */\n private void solveE() {\n int n = nextInt();\n int m = nextInt();\n int[] p = IntStream.range(0, n).map(i -> nextInt() - 1).toArray();\n int[][] xy = IntStream.range(0, m).mapToObj(i -> new int[]{nextInt() - 1, nextInt() - 1}).toArray(int[][]::new);\n\n UnionFind unionFind = new UnionFind(n);\n for (int[] item : xy) {\n unionFind.unite(item[0], item[1]);\n }\n int res = 0;\n for (int i = 0; i < n; i++) {\n if (unionFind.isSame(i, p[i]))\n res++;\n }\n out.println(res);\n\n }\n\n /**\n * https://atcoder.jp/contests/abc137/tasks/abc137_e\n * E - Coins Respawn\n */\n private void solveF() {\n int n = nextInt();\n int m = nextInt();\n int p = nextInt();\n\n int[][] abc = IntStream.range(0, m).mapToObj(i -> new int[]{nextInt() - 1, nextInt() - 1, -(nextInt() - p)}).toArray(int[][]::new);\n BellmanFord bellmanFord = new BellmanFord(n);\n Map> edges = new HashMap>();\n Map> reverseEdges = new HashMap>();\n for (int[] item : abc) {\n int from = item[0];\n int to = item[1];\n int cost = item[2];\n bellmanFord.addEdge(from, to, cost);\n edges.put(from, edges.getOrDefault(from, new ArrayList()));\n edges.get(from).add(to);\n reverseEdges.put(to, reverseEdges.getOrDefault(to, new ArrayList()));\n reverseEdges.get(to).add(from);\n }\n boolean[] sToE = new boolean[n];\n dfs(sToE, edges, 0);\n boolean[] eToS = new boolean[n];\n dfs(eToS, reverseEdges, n - 1);\n boolean[] root = new boolean[n];\n for (int i = 0; i < n; i++) {\n root[i] = sToE[i] && eToS[i];\n }\n try {\n bellmanFord.shortestPath(0, root);\n out.println(Long.max(-bellmanFord.distance[n - 1], 0));\n } catch (Exception e) {\n// e.printStackTrace();\n out.println(-1);\n }\n }\n\n private void dfs(boolean[] visited, Map> edges, int curr) {\n if (visited[curr])\n return;\n visited[curr] = true;\n for (int next : edges.getOrDefault(curr, new ArrayList())) {\n dfs(visited, edges, next);\n }\n }\n\n private static class BellmanFord {\n static boolean debug = false;\n\n static class Edge {\n int from, to, cost;\n\n public Edge(int from, int to, int cost) {\n this.from = from;\n this.to = to;\n this.cost = cost;\n }\n\n public String toString() {\n return \"edge[\" + from + \", \" + to + \", \" + cost + \"]\";\n }\n }\n\n final int MAX_V;\n List edges;\n int[] distance;\n\n public BellmanFord(int n) {\n MAX_V = n;\n edges = new ArrayList();\n distance = new int[n];\n }\n\n public void addEdge(int from, int to, int cost) {\n edges.add(new Edge(from, to, cost));\n }\n\n public void shortestPath(int src, boolean[] canUseEdges) {\n for (int i = 0; i < distance.length; i++)\n distance[i] = Integer.MAX_VALUE;\n distance[src] = 0;\n int count = 0;\n boolean updated = true;\n while (updated) {\n updated = false;\n for (Edge e : edges) {\n /*\n canUseEdges[e.to] 行ってはいけないところは計算しない\n */\n if (canUseEdges[e.to] && distance[e.from] != Integer.MAX_VALUE\n && distance[e.to] > distance[e.from] + e.cost) {\n distance[e.to] = distance[e.from] + e.cost;\n updated = true;\n if (count == MAX_V - 1)\n throw new RuntimeException(\"negative loop\");\n }\n }\n count++;\n }\n }\n }\n\n public static class UnionFind {\n int[] pars;\n\n public UnionFind(int n) {\n pars = new int[n];\n Arrays.fill(pars, -1);\n }\n\n public int getChilds(int n) {\n int wk = getRoot(n);\n return pars[wk];\n }\n\n public int getRoot(int n) {\n if (pars[n] < 0)\n return n;\n return pars[n] = getRoot(pars[n]);\n }\n\n public boolean isSame(int a, int b) {\n return getRoot(a) == getRoot(b);\n }\n\n private int getSize(int a) {\n return -pars[getRoot(a)];\n }\n\n public void unite(int a, int b) {\n int wkA = getRoot(a);\n int wkB = getRoot(b);\n if (wkA == wkB)\n return;\n\n if (getSize(wkA) < getSize(wkB)) {\n int tmp = wkA;\n wkA = wkB;\n wkB = tmp;\n }\n pars[wkA] = pars[wkA] + pars[wkB];\n pars[wkB] = wkA;\n }\n }\n\n static final long CONST_INF = Long.MAX_VALUE / 4;\n\n\n private static class VectorCalculation {\n /**\n * 点Pと線(AB)の距離\n *\n * @param p\n * @param a\n * @param b\n * @return\n */\n private double distanceDotAndLine(DoublePair p, DoublePair a, DoublePair b) {\n DoublePair ab = new DoublePair(b.x - a.x, b.y - a.y);\n DoublePair ap = new DoublePair(p.x - a.x, p.y - a.y);\n\n // ベクトルAB、APの外積の絶対値が平行四辺形Dの面積になる\n double d = Math.abs(crossVector(ab, ap));\n\n double l = distanceVertex(a, b); // AB間の距離\n\n double h = d / l;\n return h;\n }\n\n /**\n * 2点間距離\n *\n * @param p1\n * @param p2\n * @return\n */\n private double distanceVertex(DoublePair p1, DoublePair p2) {\n double dx = p1.x - p2.x;\n double dy = p1.y - p2.y;\n return Math.sqrt(dx * dx + dy * dy);\n }\n\n /**\n * ベクトル外積\n *\n * @param vl\n * @param vr\n * @return\n */\n private double crossVector(DoublePair vl, DoublePair vr) {\n return vl.x * vr.y - vl.y * vr.x;\n }\n }\n\n private static class DoublePair implements Comparable {\n double x;\n double y;\n\n public DoublePair(double k, double v) {\n this.x = k;\n this.y = v;\n }\n\n public int compareTo(DoublePair pair) {\n return Double.compare(this.y, pair.y);\n }\n }\n\n private static class SimplePair implements Comparable {\n long k;\n long v;\n\n public SimplePair(int k, int v) {\n this.k = k;\n this.v = v;\n }\n\n public SimplePair(long k, long v) {\n this.k = k;\n this.v = v;\n }\n\n public int compareTo(SimplePair pair) {\n return Long.compare(this.v, pair.v);\n }\n }\n\n\n private static class SimpleGraphNode {\n private int n;\n private Map childs;\n\n public SimpleGraphNode(int n) {\n this.n = n;\n childs = new HashMap();\n }\n\n public void addChild(int child, int d) {\n this.childs.put(child, d);\n }\n }\n\n private static class SimpleGraph {\n\n private Map graph;\n\n public SimpleGraph(int[][] list) {\n graph = new HashMap();\n Arrays.stream(list).forEach(l -> {\n int a = l[0];\n int b = l[1];\n int d = l[2];\n graph.put(a, graph.getOrDefault(a, new SimpleGraphNode(a)));\n graph.get(a).addChild(b, d);\n graph.put(b, graph.getOrDefault(b, new SimpleGraphNode(b)));\n graph.get(b).addChild(a, d);\n });\n }\n\n public SimpleGraphNode getNode(int i) {\n return graph.getOrDefault(i, new SimpleGraphNode(-1));\n }\n\n }\n\n private static class GraphNode {\n private long n;\n private Map childs;\n\n public GraphNode(long n) {\n this.n = n;\n childs = new TreeMap();\n }\n\n /**\n * not update\n *\n * @param child\n * @param d\n */\n public void addChild(long child, long d) {\n this.childs.put(child, this.childs.getOrDefault(child, new SimplePair(child, d)));\n }\n\n public SimplePair getChild(long child) {\n return this.childs.getOrDefault(child, new SimplePair(child, CONST_INF));\n }\n }\n\n private static class Graph {\n\n private Map graph;\n int n;\n\n /**\n * @param n 頂点数\n * @param list\n */\n public Graph(int n, int[][] list) {\n this.n = n;\n graph = new HashMap();\n /*\n 隣接行列作成\n 0-indexed\n */\n Arrays.stream(list).forEach(l -> {\n long a = l[0] - 1;\n long b = l[1] - 1;\n long d = l[2];\n graph.put(a, graph.getOrDefault(a, new GraphNode(a)));\n graph.get(a).addChild(b, d);\n graph.put(b, graph.getOrDefault(b, new GraphNode(b)));\n graph.get(b).addChild(a, d);\n });\n /*\n たどり着けない場所はCONST_INFで埋める\n 自分へはCOST=0でたどり着ける\n */\n for (long i = 0; i < n; i++) {\n graph.put(i, graph.getOrDefault(i, new GraphNode(i)));\n GraphNode node = graph.get(i);\n for (int j = 0; j < n; j++) {\n if (i == j)\n node.addChild(j, 0L);\n else\n node.addChild(j, CONST_INF);\n }\n }\n }\n\n /**\n * ワーシャルフロイド\n */\n public void warshallFloyd() {\n for (long k = 0; k < n; k++) {\n for (long i = 0; i < n; i++) {\n for (long j = 0; j < n; j++) {\n long min = Math.min(graph.get(i).getChild(j).v, graph.get(i).getChild(k).v + graph.get(k).getChild(j).v);\n graph.get(i).getChild(j).v = min;\n }\n }\n }\n }\n\n public void partialUpdateAndWarshallFloyd(long x, long y, long w) {\n if (graph.get(x).getChild(y).v > w)\n graph.get(x).getChild(y).v = graph.get(y).getChild(x).v = w;\n long[] l = {x, y};\n for (long k : l) {\n for (long i = 0; i < n; i++) {\n for (long j = 0; j < n; j++) {\n if (graph.get(i).getChild(j).v > graph.get(i).getChild(k).v + graph.get(k).getChild(j).v) {\n graph.get(i).getChild(j).v = graph.get(i).getChild(k).v + graph.get(k).getChild(j).v;\n }\n }\n }\n }\n }\n\n /**\n * 2点間の距離\n *\n * @param from\n * @param to\n * @return\n */\n public long getDistance(long from, long to) {\n return graph.get(from).getChild(to).v;\n }\n\n }\n\n public long calcSimpleCombination(long n, long m, long CONST_MOD) {\n long mole = 1;\n for (long i = 1; i <= n + m; i++) {\n mole *= i;\n mole %= CONST_MOD;\n }\n long deno = 1;\n for (long i = 1; i <= n; i++) {\n deno *= i;\n deno %= CONST_MOD;\n }\n for (int i = 1; i <= m; i++) {\n deno *= i;\n deno %= CONST_MOD;\n }\n deno = modInverse(deno, CONST_MOD);\n return (mole * deno) % CONST_MOD;\n }\n\n long abs(double x) {\n return (long) Math.abs(x);\n }\n\n long round(double x) {\n return Math.round(x);\n }\n\n long floor(double x) {\n return (long) Math.floor(x);\n }\n\n long ceil(double x) {\n return (long) Math.ceil(x);\n }\n\n double sqrt(double x) {\n return Math.sqrt(x);\n }\n\n double pow(double x, double y) {\n return Math.pow(x, y);\n }\n\n long pow(long x, long y) {\n return (long) Math.pow(x, y);\n }\n\n int gcd(int a, int b) {\n return b == 0 ? a : gcd(b, a % b);\n }\n\n long gcd(long a, long b) {\n return b == 0 ? a : gcd(b, a % b);\n }\n\n long lcm(long a, long b) {\n return a * b / gcd(a, b);\n }\n\n public long lcmMod(long... ab) {\n\n Map ps = new HashMap();\n\n for (int abl = 0; abl < ab.length; abl++) {\n long target = ab[abl];\n long l = target;\n for (long p = 2; p * p <= l; p++) {\n long cnt = 0;\n while (target > 1 && target % p == 0) {\n cnt++;\n target /= p;\n }\n if (cnt == 0)\n continue;\n ps.put(p, Long.max(cnt, ps.getOrDefault(p, 0L)));\n }\n if (target > 1)\n ps.put(target, Long.max(1, ps.getOrDefault(target, 0L)));\n }\n long res = 1L;\n for (Map.Entry e : ps.entrySet()) {\n res *= powMod(e.getKey(), e.getValue());\n res %= MOD;\n }\n return res;\n }\n\n int upperToInt(char a) {\n return a - 'A';\n }\n\n int lowerToInt(char a) {\n return a - 'a';\n }\n\n int numToInt(char a) {\n return a - '0';\n }\n\n int charToInt(char a) {\n return a >= 'a' ? lowerToInt(a) : a >= 'A' ? upperToInt(a) : numToInt(a);\n }\n\n char intToUpper(int a) {\n return (char) (a + 'A');\n }\n\n char intToLower(int a) {\n return (char) (a + 'a');\n }\n\n char intToNum(int a) {\n return (char) (a + '0');\n }\n\n void reverse(String array[]) {\n String reversed[] = new String[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void reverse(int array[]) {\n int reversed[] = new int[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void reverse(long array[]) {\n long reversed[] = new long[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void reverse(double array[]) {\n double reversed[] = new double[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void reverse(boolean array[]) {\n boolean reversed[] = new boolean[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void fill(int array[][], int x) {\n for (int a[] : array) {\n Arrays.fill(a, x);\n }\n }\n\n void fill(long array[][], long x) {\n for (long a[] : array) {\n Arrays.fill(a, x);\n }\n }\n\n void fill(double array[][], double x) {\n for (double a[] : array) {\n Arrays.fill(a, x);\n }\n }\n\n void fill(boolean array[][], boolean x) {\n for (boolean a[] : array) {\n Arrays.fill(a, x);\n }\n }\n\n void fill(int array[][][], int x) {\n for (int a[][] : array) {\n fill(a, x);\n }\n }\n\n void fill(long array[][][], long x) {\n for (long a[][] : array) {\n fill(a, x);\n }\n }\n\n void fill(double array[][][], double x) {\n for (double a[][] : array) {\n fill(a, x);\n }\n }\n\n void fill(boolean array[][][], boolean x) {\n for (boolean a[][] : array) {\n fill(a, x);\n }\n }\n\n long L_INF = (long) 1e18 + 7;\n\n boolean isINF(long a) {\n return abs(a) > L_INF / 1000;\n }\n\n boolean isPlusINF(long a) {\n return a > 0 && isINF(a);\n }\n\n boolean isMinusINF(long a) {\n return isPlusINF(-a);\n }\n\n int I_INF = (int) 1e9 + 7;\n\n boolean isINF(int a) {\n return abs(a) > I_INF / 1000;\n }\n\n boolean isPlusINF(int a) {\n return a > 0 && isINF(a);\n }\n\n boolean isMinusINF(int a) {\n return isPlusINF(-a);\n }\n\n /**\n * 指定したx以下の素数をリストアップする\n */\n public long[] getPrimesUnderX(long x) {\n return LongStream.rangeClosed(2, x)\n .filter(i -> LongStream.rangeClosed(2, (long) Math.sqrt(i)).allMatch(j -> i % j != 0)).toArray();\n }\n\n\n public long mod(long i) {\n return i % MOD + ((i % MOD) < 0 ? MOD : 0);\n }\n\n long powMod(long x, long y) {\n if (y == 0) {\n return 1;\n } else {\n long tmp = powMod(x, y / 2);\n return mod(mod(tmp * tmp) * (y % 2 == 0 ? 1 : x));\n }\n }\n\n long inv(long x) {\n return powMod(x, MOD - 2);\n }\n\n int MAX_FACT = 5_000_100;\n long fact[];\n long invFact[];\n\n /**\n * Combination簡易版\n * 5 C 2\n * 異なる n個のものから r個を選ぶ組み合わせの総数 nCr を求めます。\n * 5!(5*4*3*2*1)\n * /\n * 2!(2*1) * (5-2)!(3*2*1)\n *\n * @param n\n * @param r\n * @return\n */\n private long getComb(int n, int r) {\n long tmp = 1;\n for (int i = 1; i <= r; i++) {\n tmp *= n - i + 1;\n tmp = mod(tmp);\n tmp *= inv(i);\n tmp = mod(tmp);\n }\n return tmp;\n }\n\n /**\n * 階乗計算の事前累積和\n * [1, 1, 2, 3, 4, 5, … FACTORIAL_NUM]\n * mod済\n */\n void prepareFact() {\n fact = new long[MAX_FACT];\n Arrays.fill(fact, 0);\n invFact = new long[MAX_FACT];\n Arrays.fill(invFact, 0);\n fact[0] = 1;\n int maxIndex = (int) min(MAX_FACT, (int) MOD);\n for (int i = 1; i < maxIndex; i++) {\n fact[i] = mod(fact[i - 1] * i);\n }\n invFact[maxIndex - 1] = inv(fact[maxIndex - 1]);\n for (int i = maxIndex - 1; i > 0; i--) {\n invFact[i - 1] = mod(invFact[i] * i);\n }\n }\n\n /**\n * 順列\n * nPk -> n! / (n-k)!\n *\n * @param n\n * @param r\n * @return\n */\n long permutation(int n, int r) {\n if (n < 0 || r < 0 || n < r) {\n return 0;\n }\n return mod(fact[n] * invFact[n - r]);\n }\n\n /**\n * 組み合わせ\n * nCk -> n! / k!・(n-k)!\n *\n * @param n\n * @param r\n * @return\n */\n long combination(int n, int r) {\n if (n < 0 || r < 0 || n < r) {\n return 0;\n }\n return mod(permutation(n, r) * invFact[r]);\n }\n\n /**\n * 重複組合せ nHr (同次積)\n * nHr = (n+r-1)Cr\n * 異なるn個のものから重複を許してr個取る組合せの総数\n * 例:\n * リンゴ,ミカン,牛肉の3種類の果物があります.これらの中から6個の食材を買って帰ります.\n * このとき,何通りの買い方がありますか?ただし,含まれない食材があってもよいものとします\n *\n * @param n\n * @param r\n * @return\n */\n long homogeneousProduct(int n, int r) {\n return combination((n - 1) + r, r);\n }\n\n /**\n * 多項係数\n * 文字aをp個,bをq個,cをr個, dをs個 あわせてn個を1列に並べるときの並べ方\n * n! / p!・q!・r!・s!\n *\n * @param n\n * @param strNum\n * @param mod\n * @return\n */\n\n /**\n * フェルマーの小定理を用いて逆元を求める。\n * ある数xのmod p(pは素数)の逆数x'はx' = x^(p-2)\n * 繰り返し二乗法を用いて計算する。\n * http://satanic0258.hatenablog.com/entry/2016/04/29/004730\n * {@link BigInteger#modInverse(BigInteger)}とどちらが速いか?\n *\n * @param x\n * @return\n */\n private long modInverse(long x, long mod) {\n long res = 1L;\n long k = mod - 2L;\n long y = x;\n while (k != 0) {\n if (k % 2 != 0) {\n res = (res * y) % mod;\n }\n y = (y * y) % mod;\n k /= 2;\n }\n return res;\n }\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte())\n return buffer[ptr++];\n else\n return -1;\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n private void skipUnprintable() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr]))\n ptr++;\n }\n\n public boolean hasNext() {\n skipUnprintable();\n return hasNextByte();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public String next() {\n if (!hasNext())\n throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext())\n throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public long min(long... v) {\n long min = Long.MAX_VALUE;\n for (long i : v) min = Math.min(min, i);\n return min;\n }\n\n public long max(long... v) {\n long max = Long.MIN_VALUE;\n for (long i : v) max = Math.max(max, i);\n return max;\n }\n}\n", "language": "Java", "metadata": {"date": 1588422505, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02949.html", "problem_id": "p02949", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02949/input.txt", "sample_output_relpath": "derived/input_output/data/p02949/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02949/Java/s530599069.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s530599069", "user_id": "u345932819"}, "prompt_components": {"gold_output": "35\n", "input_to_evaluate": "\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.math.BigInteger;\nimport java.util.*;\nimport java.util.stream.IntStream;\nimport java.util.stream.LongStream;\n\n/**\n * https://kenkoooo.com/atcoder#/contest/show/8b029028-97c3-438c-9705-00a15ecfbe15\n */\npublic class Main {\n\n public Main() throws IOException {\n }\n\n public static void main(String[] args) throws IOException {\n new Main().solve();\n }\n\n // private final InputStream in = Files.newInputStream(Paths.get(\"C:\\\\Users\\\\ryo.suzuki\\\\Downloads\\\\02.txt\"));\n private final InputStream in = System.in;\n private final PrintWriter out = new PrintWriter(System.out);\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n private void solve() throws IOException {\n try {\n// solveA();\n// solveB();\n// solveC();\n// solveD();\n// solveE();\n solveF();\n } finally {\n if (in != null) {\n in.close();\n }\n if (out != null) {\n out.flush();\n out.close();\n }\n }\n\n }\n\n // mods\n long MOD = (long) Math.pow(10, 9) + 7;\n\n /**\n * https://atcoder.jp/contests/m-solutions2019/tasks/m_solutions2019_a\n * A - Sum of Interior Angl\n */\n private void solveA() {\n out.println((nextInt() - 2) * 180);\n }\n\n /**\n * https://atcoder.jp/contests/abc093/tasks/arc094_a\n */\n private void solveB() {\n int[] abc = IntStream.range(0, 3).map(i -> nextInt()).sorted().toArray();\n boolean isBcEve = (abc[2] - abc[1]) % 2 == 0;\n boolean isAcEve = (abc[2] - abc[0]) % 2 == 0;\n int res = 0;\n if (isAcEve && isBcEve) {\n res = (abc[2] - abc[1]) / 2 + (abc[2] - abc[0]) / 2;\n } else if (!isAcEve && !isBcEve) {\n res = (abc[2] - abc[1]) / 2 + (abc[2] - abc[0]) / 2 + 1;\n } else {\n res = (abc[2] - abc[1]) / 2 + (abc[2] - abc[0]) / 2 + 2;\n }\n out.println(res);\n }\n\n /**\n * https://atcoder.jp/contests/abc118/tasks/abc118_c\n * C - Monsters Battle Royale\n */\n private void solveC() {\n int n = nextInt();\n int[] a = IntStream.range(0, n).map(i -> nextInt()).toArray();\n long res = a[0];\n for (int item : a) {\n res = gcd(res, item);\n }\n out.println(res);\n }\n\n /**\n * https://atcoder.jp/contests/agc018/tasks/agc018_a\n * A - Getting Difference\n *

\n * 操作がユークリッドの互除法と同じ?\n * なら、KをGCDで割り切れてかつ、aの最大値より小さければkを作れるはず\n */\n private void solveD() {\n int n = nextInt();\n int k = nextInt();\n int[] a = IntStream.range(0, n).map(i -> nextInt()).sorted().toArray();\n long gcd = a[0];\n for (int item : a) {\n gcd = gcd(gcd, item);\n }\n if (k % gcd == 0 && k <= a[n - 1])\n out.println(\"POSSIBLE\");\n else\n out.println(\"IMPOSSIBLE\");\n }\n\n /**\n * https://atcoder.jp/contests/arc097/tasks/arc097_b\n * D - Equals\n */\n private void solveE() {\n int n = nextInt();\n int m = nextInt();\n int[] p = IntStream.range(0, n).map(i -> nextInt() - 1).toArray();\n int[][] xy = IntStream.range(0, m).mapToObj(i -> new int[]{nextInt() - 1, nextInt() - 1}).toArray(int[][]::new);\n\n UnionFind unionFind = new UnionFind(n);\n for (int[] item : xy) {\n unionFind.unite(item[0], item[1]);\n }\n int res = 0;\n for (int i = 0; i < n; i++) {\n if (unionFind.isSame(i, p[i]))\n res++;\n }\n out.println(res);\n\n }\n\n /**\n * https://atcoder.jp/contests/abc137/tasks/abc137_e\n * E - Coins Respawn\n */\n private void solveF() {\n int n = nextInt();\n int m = nextInt();\n int p = nextInt();\n\n int[][] abc = IntStream.range(0, m).mapToObj(i -> new int[]{nextInt() - 1, nextInt() - 1, -(nextInt() - p)}).toArray(int[][]::new);\n BellmanFord bellmanFord = new BellmanFord(n);\n Map> edges = new HashMap>();\n Map> reverseEdges = new HashMap>();\n for (int[] item : abc) {\n int from = item[0];\n int to = item[1];\n int cost = item[2];\n bellmanFord.addEdge(from, to, cost);\n edges.put(from, edges.getOrDefault(from, new ArrayList()));\n edges.get(from).add(to);\n reverseEdges.put(to, reverseEdges.getOrDefault(to, new ArrayList()));\n reverseEdges.get(to).add(from);\n }\n boolean[] sToE = new boolean[n];\n dfs(sToE, edges, 0);\n boolean[] eToS = new boolean[n];\n dfs(eToS, reverseEdges, n - 1);\n boolean[] root = new boolean[n];\n for (int i = 0; i < n; i++) {\n root[i] = sToE[i] && eToS[i];\n }\n try {\n bellmanFord.shortestPath(0, root);\n out.println(Long.max(-bellmanFord.distance[n - 1], 0));\n } catch (Exception e) {\n// e.printStackTrace();\n out.println(-1);\n }\n }\n\n private void dfs(boolean[] visited, Map> edges, int curr) {\n if (visited[curr])\n return;\n visited[curr] = true;\n for (int next : edges.getOrDefault(curr, new ArrayList())) {\n dfs(visited, edges, next);\n }\n }\n\n private static class BellmanFord {\n static boolean debug = false;\n\n static class Edge {\n int from, to, cost;\n\n public Edge(int from, int to, int cost) {\n this.from = from;\n this.to = to;\n this.cost = cost;\n }\n\n public String toString() {\n return \"edge[\" + from + \", \" + to + \", \" + cost + \"]\";\n }\n }\n\n final int MAX_V;\n List edges;\n int[] distance;\n\n public BellmanFord(int n) {\n MAX_V = n;\n edges = new ArrayList();\n distance = new int[n];\n }\n\n public void addEdge(int from, int to, int cost) {\n edges.add(new Edge(from, to, cost));\n }\n\n public void shortestPath(int src, boolean[] canUseEdges) {\n for (int i = 0; i < distance.length; i++)\n distance[i] = Integer.MAX_VALUE;\n distance[src] = 0;\n int count = 0;\n boolean updated = true;\n while (updated) {\n updated = false;\n for (Edge e : edges) {\n /*\n canUseEdges[e.to] 行ってはいけないところは計算しない\n */\n if (canUseEdges[e.to] && distance[e.from] != Integer.MAX_VALUE\n && distance[e.to] > distance[e.from] + e.cost) {\n distance[e.to] = distance[e.from] + e.cost;\n updated = true;\n if (count == MAX_V - 1)\n throw new RuntimeException(\"negative loop\");\n }\n }\n count++;\n }\n }\n }\n\n public static class UnionFind {\n int[] pars;\n\n public UnionFind(int n) {\n pars = new int[n];\n Arrays.fill(pars, -1);\n }\n\n public int getChilds(int n) {\n int wk = getRoot(n);\n return pars[wk];\n }\n\n public int getRoot(int n) {\n if (pars[n] < 0)\n return n;\n return pars[n] = getRoot(pars[n]);\n }\n\n public boolean isSame(int a, int b) {\n return getRoot(a) == getRoot(b);\n }\n\n private int getSize(int a) {\n return -pars[getRoot(a)];\n }\n\n public void unite(int a, int b) {\n int wkA = getRoot(a);\n int wkB = getRoot(b);\n if (wkA == wkB)\n return;\n\n if (getSize(wkA) < getSize(wkB)) {\n int tmp = wkA;\n wkA = wkB;\n wkB = tmp;\n }\n pars[wkA] = pars[wkA] + pars[wkB];\n pars[wkB] = wkA;\n }\n }\n\n static final long CONST_INF = Long.MAX_VALUE / 4;\n\n\n private static class VectorCalculation {\n /**\n * 点Pと線(AB)の距離\n *\n * @param p\n * @param a\n * @param b\n * @return\n */\n private double distanceDotAndLine(DoublePair p, DoublePair a, DoublePair b) {\n DoublePair ab = new DoublePair(b.x - a.x, b.y - a.y);\n DoublePair ap = new DoublePair(p.x - a.x, p.y - a.y);\n\n // ベクトルAB、APの外積の絶対値が平行四辺形Dの面積になる\n double d = Math.abs(crossVector(ab, ap));\n\n double l = distanceVertex(a, b); // AB間の距離\n\n double h = d / l;\n return h;\n }\n\n /**\n * 2点間距離\n *\n * @param p1\n * @param p2\n * @return\n */\n private double distanceVertex(DoublePair p1, DoublePair p2) {\n double dx = p1.x - p2.x;\n double dy = p1.y - p2.y;\n return Math.sqrt(dx * dx + dy * dy);\n }\n\n /**\n * ベクトル外積\n *\n * @param vl\n * @param vr\n * @return\n */\n private double crossVector(DoublePair vl, DoublePair vr) {\n return vl.x * vr.y - vl.y * vr.x;\n }\n }\n\n private static class DoublePair implements Comparable {\n double x;\n double y;\n\n public DoublePair(double k, double v) {\n this.x = k;\n this.y = v;\n }\n\n public int compareTo(DoublePair pair) {\n return Double.compare(this.y, pair.y);\n }\n }\n\n private static class SimplePair implements Comparable {\n long k;\n long v;\n\n public SimplePair(int k, int v) {\n this.k = k;\n this.v = v;\n }\n\n public SimplePair(long k, long v) {\n this.k = k;\n this.v = v;\n }\n\n public int compareTo(SimplePair pair) {\n return Long.compare(this.v, pair.v);\n }\n }\n\n\n private static class SimpleGraphNode {\n private int n;\n private Map childs;\n\n public SimpleGraphNode(int n) {\n this.n = n;\n childs = new HashMap();\n }\n\n public void addChild(int child, int d) {\n this.childs.put(child, d);\n }\n }\n\n private static class SimpleGraph {\n\n private Map graph;\n\n public SimpleGraph(int[][] list) {\n graph = new HashMap();\n Arrays.stream(list).forEach(l -> {\n int a = l[0];\n int b = l[1];\n int d = l[2];\n graph.put(a, graph.getOrDefault(a, new SimpleGraphNode(a)));\n graph.get(a).addChild(b, d);\n graph.put(b, graph.getOrDefault(b, new SimpleGraphNode(b)));\n graph.get(b).addChild(a, d);\n });\n }\n\n public SimpleGraphNode getNode(int i) {\n return graph.getOrDefault(i, new SimpleGraphNode(-1));\n }\n\n }\n\n private static class GraphNode {\n private long n;\n private Map childs;\n\n public GraphNode(long n) {\n this.n = n;\n childs = new TreeMap();\n }\n\n /**\n * not update\n *\n * @param child\n * @param d\n */\n public void addChild(long child, long d) {\n this.childs.put(child, this.childs.getOrDefault(child, new SimplePair(child, d)));\n }\n\n public SimplePair getChild(long child) {\n return this.childs.getOrDefault(child, new SimplePair(child, CONST_INF));\n }\n }\n\n private static class Graph {\n\n private Map graph;\n int n;\n\n /**\n * @param n 頂点数\n * @param list\n */\n public Graph(int n, int[][] list) {\n this.n = n;\n graph = new HashMap();\n /*\n 隣接行列作成\n 0-indexed\n */\n Arrays.stream(list).forEach(l -> {\n long a = l[0] - 1;\n long b = l[1] - 1;\n long d = l[2];\n graph.put(a, graph.getOrDefault(a, new GraphNode(a)));\n graph.get(a).addChild(b, d);\n graph.put(b, graph.getOrDefault(b, new GraphNode(b)));\n graph.get(b).addChild(a, d);\n });\n /*\n たどり着けない場所はCONST_INFで埋める\n 自分へはCOST=0でたどり着ける\n */\n for (long i = 0; i < n; i++) {\n graph.put(i, graph.getOrDefault(i, new GraphNode(i)));\n GraphNode node = graph.get(i);\n for (int j = 0; j < n; j++) {\n if (i == j)\n node.addChild(j, 0L);\n else\n node.addChild(j, CONST_INF);\n }\n }\n }\n\n /**\n * ワーシャルフロイド\n */\n public void warshallFloyd() {\n for (long k = 0; k < n; k++) {\n for (long i = 0; i < n; i++) {\n for (long j = 0; j < n; j++) {\n long min = Math.min(graph.get(i).getChild(j).v, graph.get(i).getChild(k).v + graph.get(k).getChild(j).v);\n graph.get(i).getChild(j).v = min;\n }\n }\n }\n }\n\n public void partialUpdateAndWarshallFloyd(long x, long y, long w) {\n if (graph.get(x).getChild(y).v > w)\n graph.get(x).getChild(y).v = graph.get(y).getChild(x).v = w;\n long[] l = {x, y};\n for (long k : l) {\n for (long i = 0; i < n; i++) {\n for (long j = 0; j < n; j++) {\n if (graph.get(i).getChild(j).v > graph.get(i).getChild(k).v + graph.get(k).getChild(j).v) {\n graph.get(i).getChild(j).v = graph.get(i).getChild(k).v + graph.get(k).getChild(j).v;\n }\n }\n }\n }\n }\n\n /**\n * 2点間の距離\n *\n * @param from\n * @param to\n * @return\n */\n public long getDistance(long from, long to) {\n return graph.get(from).getChild(to).v;\n }\n\n }\n\n public long calcSimpleCombination(long n, long m, long CONST_MOD) {\n long mole = 1;\n for (long i = 1; i <= n + m; i++) {\n mole *= i;\n mole %= CONST_MOD;\n }\n long deno = 1;\n for (long i = 1; i <= n; i++) {\n deno *= i;\n deno %= CONST_MOD;\n }\n for (int i = 1; i <= m; i++) {\n deno *= i;\n deno %= CONST_MOD;\n }\n deno = modInverse(deno, CONST_MOD);\n return (mole * deno) % CONST_MOD;\n }\n\n long abs(double x) {\n return (long) Math.abs(x);\n }\n\n long round(double x) {\n return Math.round(x);\n }\n\n long floor(double x) {\n return (long) Math.floor(x);\n }\n\n long ceil(double x) {\n return (long) Math.ceil(x);\n }\n\n double sqrt(double x) {\n return Math.sqrt(x);\n }\n\n double pow(double x, double y) {\n return Math.pow(x, y);\n }\n\n long pow(long x, long y) {\n return (long) Math.pow(x, y);\n }\n\n int gcd(int a, int b) {\n return b == 0 ? a : gcd(b, a % b);\n }\n\n long gcd(long a, long b) {\n return b == 0 ? a : gcd(b, a % b);\n }\n\n long lcm(long a, long b) {\n return a * b / gcd(a, b);\n }\n\n public long lcmMod(long... ab) {\n\n Map ps = new HashMap();\n\n for (int abl = 0; abl < ab.length; abl++) {\n long target = ab[abl];\n long l = target;\n for (long p = 2; p * p <= l; p++) {\n long cnt = 0;\n while (target > 1 && target % p == 0) {\n cnt++;\n target /= p;\n }\n if (cnt == 0)\n continue;\n ps.put(p, Long.max(cnt, ps.getOrDefault(p, 0L)));\n }\n if (target > 1)\n ps.put(target, Long.max(1, ps.getOrDefault(target, 0L)));\n }\n long res = 1L;\n for (Map.Entry e : ps.entrySet()) {\n res *= powMod(e.getKey(), e.getValue());\n res %= MOD;\n }\n return res;\n }\n\n int upperToInt(char a) {\n return a - 'A';\n }\n\n int lowerToInt(char a) {\n return a - 'a';\n }\n\n int numToInt(char a) {\n return a - '0';\n }\n\n int charToInt(char a) {\n return a >= 'a' ? lowerToInt(a) : a >= 'A' ? upperToInt(a) : numToInt(a);\n }\n\n char intToUpper(int a) {\n return (char) (a + 'A');\n }\n\n char intToLower(int a) {\n return (char) (a + 'a');\n }\n\n char intToNum(int a) {\n return (char) (a + '0');\n }\n\n void reverse(String array[]) {\n String reversed[] = new String[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void reverse(int array[]) {\n int reversed[] = new int[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void reverse(long array[]) {\n long reversed[] = new long[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void reverse(double array[]) {\n double reversed[] = new double[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void reverse(boolean array[]) {\n boolean reversed[] = new boolean[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void fill(int array[][], int x) {\n for (int a[] : array) {\n Arrays.fill(a, x);\n }\n }\n\n void fill(long array[][], long x) {\n for (long a[] : array) {\n Arrays.fill(a, x);\n }\n }\n\n void fill(double array[][], double x) {\n for (double a[] : array) {\n Arrays.fill(a, x);\n }\n }\n\n void fill(boolean array[][], boolean x) {\n for (boolean a[] : array) {\n Arrays.fill(a, x);\n }\n }\n\n void fill(int array[][][], int x) {\n for (int a[][] : array) {\n fill(a, x);\n }\n }\n\n void fill(long array[][][], long x) {\n for (long a[][] : array) {\n fill(a, x);\n }\n }\n\n void fill(double array[][][], double x) {\n for (double a[][] : array) {\n fill(a, x);\n }\n }\n\n void fill(boolean array[][][], boolean x) {\n for (boolean a[][] : array) {\n fill(a, x);\n }\n }\n\n long L_INF = (long) 1e18 + 7;\n\n boolean isINF(long a) {\n return abs(a) > L_INF / 1000;\n }\n\n boolean isPlusINF(long a) {\n return a > 0 && isINF(a);\n }\n\n boolean isMinusINF(long a) {\n return isPlusINF(-a);\n }\n\n int I_INF = (int) 1e9 + 7;\n\n boolean isINF(int a) {\n return abs(a) > I_INF / 1000;\n }\n\n boolean isPlusINF(int a) {\n return a > 0 && isINF(a);\n }\n\n boolean isMinusINF(int a) {\n return isPlusINF(-a);\n }\n\n /**\n * 指定したx以下の素数をリストアップする\n */\n public long[] getPrimesUnderX(long x) {\n return LongStream.rangeClosed(2, x)\n .filter(i -> LongStream.rangeClosed(2, (long) Math.sqrt(i)).allMatch(j -> i % j != 0)).toArray();\n }\n\n\n public long mod(long i) {\n return i % MOD + ((i % MOD) < 0 ? MOD : 0);\n }\n\n long powMod(long x, long y) {\n if (y == 0) {\n return 1;\n } else {\n long tmp = powMod(x, y / 2);\n return mod(mod(tmp * tmp) * (y % 2 == 0 ? 1 : x));\n }\n }\n\n long inv(long x) {\n return powMod(x, MOD - 2);\n }\n\n int MAX_FACT = 5_000_100;\n long fact[];\n long invFact[];\n\n /**\n * Combination簡易版\n * 5 C 2\n * 異なる n個のものから r個を選ぶ組み合わせの総数 nCr を求めます。\n * 5!(5*4*3*2*1)\n * /\n * 2!(2*1) * (5-2)!(3*2*1)\n *\n * @param n\n * @param r\n * @return\n */\n private long getComb(int n, int r) {\n long tmp = 1;\n for (int i = 1; i <= r; i++) {\n tmp *= n - i + 1;\n tmp = mod(tmp);\n tmp *= inv(i);\n tmp = mod(tmp);\n }\n return tmp;\n }\n\n /**\n * 階乗計算の事前累積和\n * [1, 1, 2, 3, 4, 5, … FACTORIAL_NUM]\n * mod済\n */\n void prepareFact() {\n fact = new long[MAX_FACT];\n Arrays.fill(fact, 0);\n invFact = new long[MAX_FACT];\n Arrays.fill(invFact, 0);\n fact[0] = 1;\n int maxIndex = (int) min(MAX_FACT, (int) MOD);\n for (int i = 1; i < maxIndex; i++) {\n fact[i] = mod(fact[i - 1] * i);\n }\n invFact[maxIndex - 1] = inv(fact[maxIndex - 1]);\n for (int i = maxIndex - 1; i > 0; i--) {\n invFact[i - 1] = mod(invFact[i] * i);\n }\n }\n\n /**\n * 順列\n * nPk -> n! / (n-k)!\n *\n * @param n\n * @param r\n * @return\n */\n long permutation(int n, int r) {\n if (n < 0 || r < 0 || n < r) {\n return 0;\n }\n return mod(fact[n] * invFact[n - r]);\n }\n\n /**\n * 組み合わせ\n * nCk -> n! / k!・(n-k)!\n *\n * @param n\n * @param r\n * @return\n */\n long combination(int n, int r) {\n if (n < 0 || r < 0 || n < r) {\n return 0;\n }\n return mod(permutation(n, r) * invFact[r]);\n }\n\n /**\n * 重複組合せ nHr (同次積)\n * nHr = (n+r-1)Cr\n * 異なるn個のものから重複を許してr個取る組合せの総数\n * 例:\n * リンゴ,ミカン,牛肉の3種類の果物があります.これらの中から6個の食材を買って帰ります.\n * このとき,何通りの買い方がありますか?ただし,含まれない食材があってもよいものとします\n *\n * @param n\n * @param r\n * @return\n */\n long homogeneousProduct(int n, int r) {\n return combination((n - 1) + r, r);\n }\n\n /**\n * 多項係数\n * 文字aをp個,bをq個,cをr個, dをs個 あわせてn個を1列に並べるときの並べ方\n * n! / p!・q!・r!・s!\n *\n * @param n\n * @param strNum\n * @param mod\n * @return\n */\n\n /**\n * フェルマーの小定理を用いて逆元を求める。\n * ある数xのmod p(pは素数)の逆数x'はx' = x^(p-2)\n * 繰り返し二乗法を用いて計算する。\n * http://satanic0258.hatenablog.com/entry/2016/04/29/004730\n * {@link BigInteger#modInverse(BigInteger)}とどちらが速いか?\n *\n * @param x\n * @return\n */\n private long modInverse(long x, long mod) {\n long res = 1L;\n long k = mod - 2L;\n long y = x;\n while (k != 0) {\n if (k % 2 != 0) {\n res = (res * y) % mod;\n }\n y = (y * y) % mod;\n k /= 2;\n }\n return res;\n }\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte())\n return buffer[ptr++];\n else\n return -1;\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n private void skipUnprintable() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr]))\n ptr++;\n }\n\n public boolean hasNext() {\n skipUnprintable();\n return hasNextByte();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public String next() {\n if (!hasNext())\n throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext())\n throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public long min(long... v) {\n long min = Long.MAX_VALUE;\n for (long i : v) min = Math.min(min, i);\n return min;\n }\n\n public long max(long... v) {\n long max = Long.MIN_VALUE;\n for (long i : v) max = Math.max(max, i);\n return max;\n }\n}\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere is a directed graph with N vertices numbered 1 to N and M edges.\nThe i-th edge is directed from Vertex A_i to Vertex B_i, and there are C_i coins \bplaced along that edge.\nAdditionally, there is a button on Vertex N.\n\nWe will play a game on this graph.\nYou start the game on Vertex 1 with zero coins, and head for Vertex N by traversing the edges while collecting coins.\nIt takes one minute to traverse an edge, and you can collect the coins placed along the edge each time you traverse it.\nAs usual in games, even if you traverse an edge once and collect the coins, the same number of coins will reappear next time you traverse that edge, which you can collect again.\n\nWhen you reach Vertex N, you can end the game by pressing the button. (You can also choose to leave Vertex N without pressing the button and continue traveling.)\nHowever, when you end the game, you will be asked to pay T \\times P coins, where T is the number of minutes elapsed since the start of the game. If you have less than T \\times P coins, you will have to pay all of your coins instead.\n\nYour score will be the number of coins you have after this payment.\nDetermine if there exists a maximum value of the score that can be obtained. If the answer is yes, find that maximum value.\n\nConstraints\n\n2 \\leq N \\leq 2500\n\n1 \\leq M \\leq 5000\n\n1 \\leq A_i, B_i \\leq N\n\n1 \\leq C_i \\leq 10^5\n\n0 \\leq P \\leq 10^5\n\nAll values in input are integers.\n\nVertex N can be reached from Vertex 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M P\nA_1 B_1 C_1\n:\nA_M B_M C_M\n\nOutput\n\nIf there exists a maximum value of the score that can be obtained, print that maximum value; otherwise, print -1.\n\nSample Input 1\n\n3 3 10\n1 2 20\n2 3 30\n1 3 45\n\nSample Output 1\n\n35\n\nThere are two ways to travel from Vertex 1 to Vertex 3:\n\nVertex 1 \\rightarrow 2 \\rightarrow 3: You collect 20 + 30 = 50 coins on the way. After two minutes from the start of the game, you press the button, pay 2 \\times 10 = 20 coins, and you have 50 - 20 = 30 coins left.\n\nVertex 1 \\rightarrow 2: You collect 45 coins on the way. After one minute from the start of the game, you press the button, pay 1 \\times 10 = 10 coins, and you have 45 - 10 = 35 coins left.\n\nThus, the maximum score that can be obtained is 35.\n\nSample Input 2\n\n2 2 10\n1 2 100\n2 2 100\n\nSample Output 2\n\n-1\n\nThe edge extending from Vertex 1 takes you to Vertex 2. If you then traverse the edge extending from Vertex 2 to itself t times and press the button, your score will be 90 + 90t. Thus, you can infinitely increase your score, which means there is no maximum value of the score that can be obtained.\n\nSample Input 3\n\n4 5 10\n1 2 1\n1 4 1\n3 4 1\n2 2 100\n3 3 100\n\nSample Output 3\n\n0\n\nThere is no way to travel from Vertex 1 to Vertex 4 other than traversing the edge leading from Vertex 1 to Vertex 4 directly. You will pick up one coin along this edge, but after being asked to paying 10 coins, your score will be 0.\n\nNote that you can collect an infinite number of coins if you traverse the edge leading from Vertex 1 to Vertex 2, but this is pointless since you can no longer reach Vertex 4 and end the game.", "sample_input": "3 3 10\n1 2 20\n2 3 30\n1 3 45\n"}, "reference_outputs": ["35\n"], "source_document_id": "p02949", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere is a directed graph with N vertices numbered 1 to N and M edges.\nThe i-th edge is directed from Vertex A_i to Vertex B_i, and there are C_i coins \bplaced along that edge.\nAdditionally, there is a button on Vertex N.\n\nWe will play a game on this graph.\nYou start the game on Vertex 1 with zero coins, and head for Vertex N by traversing the edges while collecting coins.\nIt takes one minute to traverse an edge, and you can collect the coins placed along the edge each time you traverse it.\nAs usual in games, even if you traverse an edge once and collect the coins, the same number of coins will reappear next time you traverse that edge, which you can collect again.\n\nWhen you reach Vertex N, you can end the game by pressing the button. (You can also choose to leave Vertex N without pressing the button and continue traveling.)\nHowever, when you end the game, you will be asked to pay T \\times P coins, where T is the number of minutes elapsed since the start of the game. If you have less than T \\times P coins, you will have to pay all of your coins instead.\n\nYour score will be the number of coins you have after this payment.\nDetermine if there exists a maximum value of the score that can be obtained. If the answer is yes, find that maximum value.\n\nConstraints\n\n2 \\leq N \\leq 2500\n\n1 \\leq M \\leq 5000\n\n1 \\leq A_i, B_i \\leq N\n\n1 \\leq C_i \\leq 10^5\n\n0 \\leq P \\leq 10^5\n\nAll values in input are integers.\n\nVertex N can be reached from Vertex 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M P\nA_1 B_1 C_1\n:\nA_M B_M C_M\n\nOutput\n\nIf there exists a maximum value of the score that can be obtained, print that maximum value; otherwise, print -1.\n\nSample Input 1\n\n3 3 10\n1 2 20\n2 3 30\n1 3 45\n\nSample Output 1\n\n35\n\nThere are two ways to travel from Vertex 1 to Vertex 3:\n\nVertex 1 \\rightarrow 2 \\rightarrow 3: You collect 20 + 30 = 50 coins on the way. After two minutes from the start of the game, you press the button, pay 2 \\times 10 = 20 coins, and you have 50 - 20 = 30 coins left.\n\nVertex 1 \\rightarrow 2: You collect 45 coins on the way. After one minute from the start of the game, you press the button, pay 1 \\times 10 = 10 coins, and you have 45 - 10 = 35 coins left.\n\nThus, the maximum score that can be obtained is 35.\n\nSample Input 2\n\n2 2 10\n1 2 100\n2 2 100\n\nSample Output 2\n\n-1\n\nThe edge extending from Vertex 1 takes you to Vertex 2. If you then traverse the edge extending from Vertex 2 to itself t times and press the button, your score will be 90 + 90t. Thus, you can infinitely increase your score, which means there is no maximum value of the score that can be obtained.\n\nSample Input 3\n\n4 5 10\n1 2 1\n1 4 1\n3 4 1\n2 2 100\n3 3 100\n\nSample Output 3\n\n0\n\nThere is no way to travel from Vertex 1 to Vertex 4 other than traversing the edge leading from Vertex 1 to Vertex 4 directly. You will pick up one coin along this edge, but after being asked to paying 10 coins, your score will be 0.\n\nNote that you can collect an infinite number of coins if you traverse the edge leading from Vertex 1 to Vertex 2, but this is pointless since you can no longer reach Vertex 4 and end the game.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 26918, "cpu_time_ms": 422, "memory_kb": 33196}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s236199567", "group_id": "codeNet:p02949", "input_text": "import java.util.*;\nimport java.io.*;\nimport java.nio.charset.StandardCharsets;\n\npublic class Main {\n\tstatic class Node {\n\t\tint id;\n\t\tList edges = new ArrayList<>();\n\t\t/*\n\t\t * Queue edges = new PriorityQueue<>(new Comparator() {\n\t\t * \n\t\t * @Override public int compare(Edge o1, Edge o2) { return -1 *\n\t\t * Integer.compare(o1.length, o2.length); } });\n\t\t */\n\t\tSet passedEdges = new HashSet<>();\n\t\tint dist = Integer.MIN_VALUE / 2;\n\n\t\tNode(int id) {\n\t\t\tthis.id = id;\n\t\t}\n\t}\n\n\tstatic class Edge {\n\t\tint src, dst, length;\n\n\t\tEdge(int src, int dst, int length) {\n\t\t\tthis.src = src;\n\t\t\tthis.dst = dst;\n\t\t\tthis.length = length;\n\t\t}\n\t}\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tInputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);\n\t\tBufferedReader in = new BufferedReader(reader);\n\t\tString[] tokens = in.readLine().split(\" \");\n\t\tint N = Integer.parseInt(tokens[0]);\n\t\tint M = Integer.parseInt(tokens[1]);\n\t\tint P = Integer.parseInt(tokens[2]);\n\n\t\tNode[] graph = new Node[N];\n\t\tfor (int i = 0; i < N; ++i) {\n\t\t\tgraph[i] = new Node(i);\n\t\t}\n\t\tfor (int i = 0; i < M; ++i) {\n\t\t\ttokens = in.readLine().split(\" \");\n\t\t\tint a = Integer.parseInt(tokens[0]);\n\t\t\tint b = Integer.parseInt(tokens[1]);\n\t\t\tint c = Integer.parseInt(tokens[2]);\n\t\t\tEdge edge = new Edge(a - 1, b - 1, c - P);\n\t\t\tgraph[a - 1].edges.add(edge);\n\t\t}\n\t\t// 開始ノードの距離は0\n\t\tgraph[0].dist = 0;\n\n\t\tfor (int i = 0; i < graph.length; ++i) {\n\t\t\tfor (int j = 0; j < graph[i].edges.size(); ++j) {\n\t\t\t\tEdge edge = graph[i].edges.get(j);\n\t\t\t\tif (graph[edge.dst].dist < graph[edge.src].dist + edge.length) {\n\t\t\t\t\tgraph[edge.dst].dist = graph[edge.src].dist + edge.length;\n\t\t\t\t\tgraph[edge.dst].passedEdges.addAll(graph[edge.src].passedEdges);\n\t\t\t\t\tgraph[edge.dst].passedEdges.add(edge);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// 閉路チェック\n\t\tboolean hasNegativeLoop = false;\n\t\tfor (Edge edge : graph[graph.length - 1].passedEdges) {\n\t\t\tif (graph[edge.src].dist + edge.length > graph[edge.dst].dist) {\n\t\t\t\thasNegativeLoop = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (hasNegativeLoop) {\n\t\t\tSystem.out.println(\"-1\");\n\t\t} else {\n\t\t\tint result = Math.max(0, graph[graph.length - 1].dist);\n\t\t\tSystem.out.println(result);\n\t\t}\n\t}\n}", "language": "Java", "metadata": {"date": 1565662240, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02949.html", "problem_id": "p02949", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02949/input.txt", "sample_output_relpath": "derived/input_output/data/p02949/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02949/Java/s236199567.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s236199567", "user_id": "u655125439"}, "prompt_components": {"gold_output": "35\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\nimport java.nio.charset.StandardCharsets;\n\npublic class Main {\n\tstatic class Node {\n\t\tint id;\n\t\tList edges = new ArrayList<>();\n\t\t/*\n\t\t * Queue edges = new PriorityQueue<>(new Comparator() {\n\t\t * \n\t\t * @Override public int compare(Edge o1, Edge o2) { return -1 *\n\t\t * Integer.compare(o1.length, o2.length); } });\n\t\t */\n\t\tSet passedEdges = new HashSet<>();\n\t\tint dist = Integer.MIN_VALUE / 2;\n\n\t\tNode(int id) {\n\t\t\tthis.id = id;\n\t\t}\n\t}\n\n\tstatic class Edge {\n\t\tint src, dst, length;\n\n\t\tEdge(int src, int dst, int length) {\n\t\t\tthis.src = src;\n\t\t\tthis.dst = dst;\n\t\t\tthis.length = length;\n\t\t}\n\t}\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tInputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);\n\t\tBufferedReader in = new BufferedReader(reader);\n\t\tString[] tokens = in.readLine().split(\" \");\n\t\tint N = Integer.parseInt(tokens[0]);\n\t\tint M = Integer.parseInt(tokens[1]);\n\t\tint P = Integer.parseInt(tokens[2]);\n\n\t\tNode[] graph = new Node[N];\n\t\tfor (int i = 0; i < N; ++i) {\n\t\t\tgraph[i] = new Node(i);\n\t\t}\n\t\tfor (int i = 0; i < M; ++i) {\n\t\t\ttokens = in.readLine().split(\" \");\n\t\t\tint a = Integer.parseInt(tokens[0]);\n\t\t\tint b = Integer.parseInt(tokens[1]);\n\t\t\tint c = Integer.parseInt(tokens[2]);\n\t\t\tEdge edge = new Edge(a - 1, b - 1, c - P);\n\t\t\tgraph[a - 1].edges.add(edge);\n\t\t}\n\t\t// 開始ノードの距離は0\n\t\tgraph[0].dist = 0;\n\n\t\tfor (int i = 0; i < graph.length; ++i) {\n\t\t\tfor (int j = 0; j < graph[i].edges.size(); ++j) {\n\t\t\t\tEdge edge = graph[i].edges.get(j);\n\t\t\t\tif (graph[edge.dst].dist < graph[edge.src].dist + edge.length) {\n\t\t\t\t\tgraph[edge.dst].dist = graph[edge.src].dist + edge.length;\n\t\t\t\t\tgraph[edge.dst].passedEdges.addAll(graph[edge.src].passedEdges);\n\t\t\t\t\tgraph[edge.dst].passedEdges.add(edge);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// 閉路チェック\n\t\tboolean hasNegativeLoop = false;\n\t\tfor (Edge edge : graph[graph.length - 1].passedEdges) {\n\t\t\tif (graph[edge.src].dist + edge.length > graph[edge.dst].dist) {\n\t\t\t\thasNegativeLoop = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (hasNegativeLoop) {\n\t\t\tSystem.out.println(\"-1\");\n\t\t} else {\n\t\t\tint result = Math.max(0, graph[graph.length - 1].dist);\n\t\t\tSystem.out.println(result);\n\t\t}\n\t}\n}", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere is a directed graph with N vertices numbered 1 to N and M edges.\nThe i-th edge is directed from Vertex A_i to Vertex B_i, and there are C_i coins \bplaced along that edge.\nAdditionally, there is a button on Vertex N.\n\nWe will play a game on this graph.\nYou start the game on Vertex 1 with zero coins, and head for Vertex N by traversing the edges while collecting coins.\nIt takes one minute to traverse an edge, and you can collect the coins placed along the edge each time you traverse it.\nAs usual in games, even if you traverse an edge once and collect the coins, the same number of coins will reappear next time you traverse that edge, which you can collect again.\n\nWhen you reach Vertex N, you can end the game by pressing the button. (You can also choose to leave Vertex N without pressing the button and continue traveling.)\nHowever, when you end the game, you will be asked to pay T \\times P coins, where T is the number of minutes elapsed since the start of the game. If you have less than T \\times P coins, you will have to pay all of your coins instead.\n\nYour score will be the number of coins you have after this payment.\nDetermine if there exists a maximum value of the score that can be obtained. If the answer is yes, find that maximum value.\n\nConstraints\n\n2 \\leq N \\leq 2500\n\n1 \\leq M \\leq 5000\n\n1 \\leq A_i, B_i \\leq N\n\n1 \\leq C_i \\leq 10^5\n\n0 \\leq P \\leq 10^5\n\nAll values in input are integers.\n\nVertex N can be reached from Vertex 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M P\nA_1 B_1 C_1\n:\nA_M B_M C_M\n\nOutput\n\nIf there exists a maximum value of the score that can be obtained, print that maximum value; otherwise, print -1.\n\nSample Input 1\n\n3 3 10\n1 2 20\n2 3 30\n1 3 45\n\nSample Output 1\n\n35\n\nThere are two ways to travel from Vertex 1 to Vertex 3:\n\nVertex 1 \\rightarrow 2 \\rightarrow 3: You collect 20 + 30 = 50 coins on the way. After two minutes from the start of the game, you press the button, pay 2 \\times 10 = 20 coins, and you have 50 - 20 = 30 coins left.\n\nVertex 1 \\rightarrow 2: You collect 45 coins on the way. After one minute from the start of the game, you press the button, pay 1 \\times 10 = 10 coins, and you have 45 - 10 = 35 coins left.\n\nThus, the maximum score that can be obtained is 35.\n\nSample Input 2\n\n2 2 10\n1 2 100\n2 2 100\n\nSample Output 2\n\n-1\n\nThe edge extending from Vertex 1 takes you to Vertex 2. If you then traverse the edge extending from Vertex 2 to itself t times and press the button, your score will be 90 + 90t. Thus, you can infinitely increase your score, which means there is no maximum value of the score that can be obtained.\n\nSample Input 3\n\n4 5 10\n1 2 1\n1 4 1\n3 4 1\n2 2 100\n3 3 100\n\nSample Output 3\n\n0\n\nThere is no way to travel from Vertex 1 to Vertex 4 other than traversing the edge leading from Vertex 1 to Vertex 4 directly. You will pick up one coin along this edge, but after being asked to paying 10 coins, your score will be 0.\n\nNote that you can collect an infinite number of coins if you traverse the edge leading from Vertex 1 to Vertex 2, but this is pointless since you can no longer reach Vertex 4 and end the game.", "sample_input": "3 3 10\n1 2 20\n2 3 30\n1 3 45\n"}, "reference_outputs": ["35\n"], "source_document_id": "p02949", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere is a directed graph with N vertices numbered 1 to N and M edges.\nThe i-th edge is directed from Vertex A_i to Vertex B_i, and there are C_i coins \bplaced along that edge.\nAdditionally, there is a button on Vertex N.\n\nWe will play a game on this graph.\nYou start the game on Vertex 1 with zero coins, and head for Vertex N by traversing the edges while collecting coins.\nIt takes one minute to traverse an edge, and you can collect the coins placed along the edge each time you traverse it.\nAs usual in games, even if you traverse an edge once and collect the coins, the same number of coins will reappear next time you traverse that edge, which you can collect again.\n\nWhen you reach Vertex N, you can end the game by pressing the button. (You can also choose to leave Vertex N without pressing the button and continue traveling.)\nHowever, when you end the game, you will be asked to pay T \\times P coins, where T is the number of minutes elapsed since the start of the game. If you have less than T \\times P coins, you will have to pay all of your coins instead.\n\nYour score will be the number of coins you have after this payment.\nDetermine if there exists a maximum value of the score that can be obtained. If the answer is yes, find that maximum value.\n\nConstraints\n\n2 \\leq N \\leq 2500\n\n1 \\leq M \\leq 5000\n\n1 \\leq A_i, B_i \\leq N\n\n1 \\leq C_i \\leq 10^5\n\n0 \\leq P \\leq 10^5\n\nAll values in input are integers.\n\nVertex N can be reached from Vertex 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M P\nA_1 B_1 C_1\n:\nA_M B_M C_M\n\nOutput\n\nIf there exists a maximum value of the score that can be obtained, print that maximum value; otherwise, print -1.\n\nSample Input 1\n\n3 3 10\n1 2 20\n2 3 30\n1 3 45\n\nSample Output 1\n\n35\n\nThere are two ways to travel from Vertex 1 to Vertex 3:\n\nVertex 1 \\rightarrow 2 \\rightarrow 3: You collect 20 + 30 = 50 coins on the way. After two minutes from the start of the game, you press the button, pay 2 \\times 10 = 20 coins, and you have 50 - 20 = 30 coins left.\n\nVertex 1 \\rightarrow 2: You collect 45 coins on the way. After one minute from the start of the game, you press the button, pay 1 \\times 10 = 10 coins, and you have 45 - 10 = 35 coins left.\n\nThus, the maximum score that can be obtained is 35.\n\nSample Input 2\n\n2 2 10\n1 2 100\n2 2 100\n\nSample Output 2\n\n-1\n\nThe edge extending from Vertex 1 takes you to Vertex 2. If you then traverse the edge extending from Vertex 2 to itself t times and press the button, your score will be 90 + 90t. Thus, you can infinitely increase your score, which means there is no maximum value of the score that can be obtained.\n\nSample Input 3\n\n4 5 10\n1 2 1\n1 4 1\n3 4 1\n2 2 100\n3 3 100\n\nSample Output 3\n\n0\n\nThere is no way to travel from Vertex 1 to Vertex 4 other than traversing the edge leading from Vertex 1 to Vertex 4 directly. You will pick up one coin along this edge, but after being asked to paying 10 coins, your score will be 0.\n\nNote that you can collect an infinite number of coins if you traverse the edge leading from Vertex 1 to Vertex 2, but this is pointless since you can no longer reach Vertex 4 and end the game.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2231, "cpu_time_ms": 1736, "memory_kb": 189504}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s791804215", "group_id": "codeNet:p02949", "input_text": "import java.io.*;\nimport java.util.*;\n\nclass Main {\n static Scanner scanner = new Scanner();\n static long inf = 0x7fffffffffL;\n\n public static void main(String[]$) throws IOException {\n int n = scanner.nextInt();\n int m = scanner.nextInt();\n int p = scanner.nextInt();\n Edge[] edges = new Edge[m];\n for (int i = 0; i < m; i++) {\n int a = scanner.nextInt() - 1;\n int b = scanner.nextInt() - 1;\n int c = scanner.nextInt();\n edges[i] = new Edge(a, b, p - c);\n }\n long[] d = new long[n];\n Arrays.fill(d, inf);\n d[0] = 0;\n\n Set loop = new HashSet<>();\n\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n if (d[edges[j].to] > d[edges[j].from] + edges[j].cost) {\n d[edges[j].to] = d[edges[j].from] + edges[j].cost;\n if (i == n - 1) {\n loop.add(edges[j].to);\n }\n }\n }\n }\n\n if (loop.contains(n - 1)) {\n System.out.println(-1);\n } else {\n System.out.println(Math.max(0, -d[n - 1]));\n }\n }\n\n static class Edge implements Comparable {\n int from;\n int to;\n long cost;\n\n Edge(int from, int to, long cost) {\n this.from = from;\n this.to = to;\n this.cost = cost;\n }\n\n @Override\n public int compareTo(Edge o) {\n return Long.compare(this.cost, o.cost);\n }\n\n @Override\n public String toString() {\n return String.format(\"[%s, %s, %s]\", from, to, cost);\n }\n }\n\n static class Scanner {\n BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 32768);\n StringTokenizer tokenizer;\n\n String next() throws IOException {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n tokenizer = new StringTokenizer(reader.readLine());\n }\n return tokenizer.nextToken();\n }\n\n int nextInt() throws IOException {\n return Integer.parseInt(next());\n }\n\n long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n\n double nextDouble() throws IOException {\n return Double.parseDouble(next());\n }\n }\n}", "language": "Java", "metadata": {"date": 1565489845, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02949.html", "problem_id": "p02949", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02949/input.txt", "sample_output_relpath": "derived/input_output/data/p02949/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02949/Java/s791804215.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s791804215", "user_id": "u981808900"}, "prompt_components": {"gold_output": "35\n", "input_to_evaluate": "import java.io.*;\nimport java.util.*;\n\nclass Main {\n static Scanner scanner = new Scanner();\n static long inf = 0x7fffffffffL;\n\n public static void main(String[]$) throws IOException {\n int n = scanner.nextInt();\n int m = scanner.nextInt();\n int p = scanner.nextInt();\n Edge[] edges = new Edge[m];\n for (int i = 0; i < m; i++) {\n int a = scanner.nextInt() - 1;\n int b = scanner.nextInt() - 1;\n int c = scanner.nextInt();\n edges[i] = new Edge(a, b, p - c);\n }\n long[] d = new long[n];\n Arrays.fill(d, inf);\n d[0] = 0;\n\n Set loop = new HashSet<>();\n\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n if (d[edges[j].to] > d[edges[j].from] + edges[j].cost) {\n d[edges[j].to] = d[edges[j].from] + edges[j].cost;\n if (i == n - 1) {\n loop.add(edges[j].to);\n }\n }\n }\n }\n\n if (loop.contains(n - 1)) {\n System.out.println(-1);\n } else {\n System.out.println(Math.max(0, -d[n - 1]));\n }\n }\n\n static class Edge implements Comparable {\n int from;\n int to;\n long cost;\n\n Edge(int from, int to, long cost) {\n this.from = from;\n this.to = to;\n this.cost = cost;\n }\n\n @Override\n public int compareTo(Edge o) {\n return Long.compare(this.cost, o.cost);\n }\n\n @Override\n public String toString() {\n return String.format(\"[%s, %s, %s]\", from, to, cost);\n }\n }\n\n static class Scanner {\n BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 32768);\n StringTokenizer tokenizer;\n\n String next() throws IOException {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n tokenizer = new StringTokenizer(reader.readLine());\n }\n return tokenizer.nextToken();\n }\n\n int nextInt() throws IOException {\n return Integer.parseInt(next());\n }\n\n long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n\n double nextDouble() throws IOException {\n return Double.parseDouble(next());\n }\n }\n}", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere is a directed graph with N vertices numbered 1 to N and M edges.\nThe i-th edge is directed from Vertex A_i to Vertex B_i, and there are C_i coins \bplaced along that edge.\nAdditionally, there is a button on Vertex N.\n\nWe will play a game on this graph.\nYou start the game on Vertex 1 with zero coins, and head for Vertex N by traversing the edges while collecting coins.\nIt takes one minute to traverse an edge, and you can collect the coins placed along the edge each time you traverse it.\nAs usual in games, even if you traverse an edge once and collect the coins, the same number of coins will reappear next time you traverse that edge, which you can collect again.\n\nWhen you reach Vertex N, you can end the game by pressing the button. (You can also choose to leave Vertex N without pressing the button and continue traveling.)\nHowever, when you end the game, you will be asked to pay T \\times P coins, where T is the number of minutes elapsed since the start of the game. If you have less than T \\times P coins, you will have to pay all of your coins instead.\n\nYour score will be the number of coins you have after this payment.\nDetermine if there exists a maximum value of the score that can be obtained. If the answer is yes, find that maximum value.\n\nConstraints\n\n2 \\leq N \\leq 2500\n\n1 \\leq M \\leq 5000\n\n1 \\leq A_i, B_i \\leq N\n\n1 \\leq C_i \\leq 10^5\n\n0 \\leq P \\leq 10^5\n\nAll values in input are integers.\n\nVertex N can be reached from Vertex 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M P\nA_1 B_1 C_1\n:\nA_M B_M C_M\n\nOutput\n\nIf there exists a maximum value of the score that can be obtained, print that maximum value; otherwise, print -1.\n\nSample Input 1\n\n3 3 10\n1 2 20\n2 3 30\n1 3 45\n\nSample Output 1\n\n35\n\nThere are two ways to travel from Vertex 1 to Vertex 3:\n\nVertex 1 \\rightarrow 2 \\rightarrow 3: You collect 20 + 30 = 50 coins on the way. After two minutes from the start of the game, you press the button, pay 2 \\times 10 = 20 coins, and you have 50 - 20 = 30 coins left.\n\nVertex 1 \\rightarrow 2: You collect 45 coins on the way. After one minute from the start of the game, you press the button, pay 1 \\times 10 = 10 coins, and you have 45 - 10 = 35 coins left.\n\nThus, the maximum score that can be obtained is 35.\n\nSample Input 2\n\n2 2 10\n1 2 100\n2 2 100\n\nSample Output 2\n\n-1\n\nThe edge extending from Vertex 1 takes you to Vertex 2. If you then traverse the edge extending from Vertex 2 to itself t times and press the button, your score will be 90 + 90t. Thus, you can infinitely increase your score, which means there is no maximum value of the score that can be obtained.\n\nSample Input 3\n\n4 5 10\n1 2 1\n1 4 1\n3 4 1\n2 2 100\n3 3 100\n\nSample Output 3\n\n0\n\nThere is no way to travel from Vertex 1 to Vertex 4 other than traversing the edge leading from Vertex 1 to Vertex 4 directly. You will pick up one coin along this edge, but after being asked to paying 10 coins, your score will be 0.\n\nNote that you can collect an infinite number of coins if you traverse the edge leading from Vertex 1 to Vertex 2, but this is pointless since you can no longer reach Vertex 4 and end the game.", "sample_input": "3 3 10\n1 2 20\n2 3 30\n1 3 45\n"}, "reference_outputs": ["35\n"], "source_document_id": "p02949", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere is a directed graph with N vertices numbered 1 to N and M edges.\nThe i-th edge is directed from Vertex A_i to Vertex B_i, and there are C_i coins \bplaced along that edge.\nAdditionally, there is a button on Vertex N.\n\nWe will play a game on this graph.\nYou start the game on Vertex 1 with zero coins, and head for Vertex N by traversing the edges while collecting coins.\nIt takes one minute to traverse an edge, and you can collect the coins placed along the edge each time you traverse it.\nAs usual in games, even if you traverse an edge once and collect the coins, the same number of coins will reappear next time you traverse that edge, which you can collect again.\n\nWhen you reach Vertex N, you can end the game by pressing the button. (You can also choose to leave Vertex N without pressing the button and continue traveling.)\nHowever, when you end the game, you will be asked to pay T \\times P coins, where T is the number of minutes elapsed since the start of the game. If you have less than T \\times P coins, you will have to pay all of your coins instead.\n\nYour score will be the number of coins you have after this payment.\nDetermine if there exists a maximum value of the score that can be obtained. If the answer is yes, find that maximum value.\n\nConstraints\n\n2 \\leq N \\leq 2500\n\n1 \\leq M \\leq 5000\n\n1 \\leq A_i, B_i \\leq N\n\n1 \\leq C_i \\leq 10^5\n\n0 \\leq P \\leq 10^5\n\nAll values in input are integers.\n\nVertex N can be reached from Vertex 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M P\nA_1 B_1 C_1\n:\nA_M B_M C_M\n\nOutput\n\nIf there exists a maximum value of the score that can be obtained, print that maximum value; otherwise, print -1.\n\nSample Input 1\n\n3 3 10\n1 2 20\n2 3 30\n1 3 45\n\nSample Output 1\n\n35\n\nThere are two ways to travel from Vertex 1 to Vertex 3:\n\nVertex 1 \\rightarrow 2 \\rightarrow 3: You collect 20 + 30 = 50 coins on the way. After two minutes from the start of the game, you press the button, pay 2 \\times 10 = 20 coins, and you have 50 - 20 = 30 coins left.\n\nVertex 1 \\rightarrow 2: You collect 45 coins on the way. After one minute from the start of the game, you press the button, pay 1 \\times 10 = 10 coins, and you have 45 - 10 = 35 coins left.\n\nThus, the maximum score that can be obtained is 35.\n\nSample Input 2\n\n2 2 10\n1 2 100\n2 2 100\n\nSample Output 2\n\n-1\n\nThe edge extending from Vertex 1 takes you to Vertex 2. If you then traverse the edge extending from Vertex 2 to itself t times and press the button, your score will be 90 + 90t. Thus, you can infinitely increase your score, which means there is no maximum value of the score that can be obtained.\n\nSample Input 3\n\n4 5 10\n1 2 1\n1 4 1\n3 4 1\n2 2 100\n3 3 100\n\nSample Output 3\n\n0\n\nThere is no way to travel from Vertex 1 to Vertex 4 other than traversing the edge leading from Vertex 1 to Vertex 4 directly. You will pick up one coin along this edge, but after being asked to paying 10 coins, your score will be 0.\n\nNote that you can collect an infinite number of coins if you traverse the edge leading from Vertex 1 to Vertex 2, but this is pointless since you can no longer reach Vertex 4 and end the game.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2434, "cpu_time_ms": 256, "memory_kb": 27632}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s602118949", "group_id": "codeNet:p02953", "input_text": "\nimport java.io.*;\nimport java.io.BufferedReader; \nimport java.io.IOException; \nimport java.io.InputStreamReader;\nimport java.math.BigInteger;\nimport java.util.*;\n\n\n/**\n * @author Utkarsh\n *\n */\npublic class Main \n{\n\n\t \n\t static class FastReader \n\t { \n\t BufferedReader br; \n\t StringTokenizer st; \n\t \n\t \n\t public FastReader() \n\t { \n\t br = new BufferedReader(new\n\t InputStreamReader(System.in)); \n\t } \n\t \n\t String next() \n\t { \n\t while (st == null || !st.hasMoreTokens()) \n\t { \n\t try\n\t { \n\t st = new StringTokenizer(br.readLine()); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t } \n\t return st.nextToken();\n\t \n\t } \n\t \n\t int nextInt() \n\t { \n\t return Integer.parseInt(next()); \n\t } \n\t \n\t long nextLong() \n\t { \n\t return Long.parseLong(next()); \n\t } \n\t \n\t double nextDouble() \n\t { \n\t return Double.parseDouble(next()); \n\t } \n\t \n\t String nextLine() \n\t { \n\t String str = \"\"; \n\t try\n\t { \n\t str = br.readLine(); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t return str; \n\t }\n\n\t\t\tpublic Character charAt(int i) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tpublic BigInteger nextBigInteger() {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\treturn null;\n\t\t\t} \n\t } \n\n \n\n\t // Complete the hurdleRace function below.\n// public static void solve() {\n// \tFastReader s=new FastReader();\n\t int binarySearch(int arr[], int l, int r, int x) \n\t { \n\t if (r >= l) { \n\t int mid = l + (r - l) / 2; \n\t \n\t // If the element is present at the \n\t // middle itself \n\t if (arr[mid] == x) \n\t return mid; \n\t \n\t // If element is smaller than mid, then \n\t // it can only be present in left subarray \n\t if (arr[mid] > x) \n\t return binarySearch(arr, l, mid - 1, x); \n\t \n\t // Else the element can only be present \n\t // in right subarray \n\t return binarySearch(arr, mid + 1, r, x); \n\t } \n\t \n\t // We reach here when element is not present \n\t // in array \n\t return -1; \n\t } \n\t \n\t static // Driver method to test above \n\n\t// Java implementation of iterative Binary Search \n\n\t // Returns index of x if it is present in arr[], \n\t // else return -1 \n\t int lowerBound(int[] a,int n,int key){\n\t int s =0,e=n-1;\n\t int ans = -1;\n\n\t while(s<=e){\n\t int mid = (s+e)/2;\n\n\t if(a[mid]==key){\n\t ans = mid;\n\t e = mid - 1;\n\t }\n\t else if(a[mid]>key){\n\t e = mid - 1;\n\t }\n\t else{\n\t s = mid + 1;\n\t }\n\t }\n\n\t return ans;\n\t }\n\t static int count(String se,char c,int l,int r) {\n\t\t\tif(l==r) {\n\t\t\t\tif(se.charAt(l)==c)return 0;\n\t\t\t\telse return 1;\n\t\t\t}\n\t\t\tint mid = (l+r)/2;\n\t\t\tint c1=0,c2=0;\n\t\t\tfor(int i=l;i<=mid;i++) {\n\t\t\t\tif(se.charAt(i)!=c)c1++;\n\t\t\t}\n\t\t\tfor(int i=r;i>mid;i--) {\n\t\t\t\tif(se.charAt(i)!=c)c2++;\n\t\t\t}\n\t\t\tint y = count(se,(char)((int)c+1),mid+1,r);\n\t\t\tint x = count(se,(char)((int)c+1),l,mid);\n\t \treturn Math.min(c1+y, c2+x);\n\t \t\n\t }\n\t public static double log2(long N) \n\t { \n\t \n\t // calculate log2 N indirectly \n\t // using log() method \n\t double result = (double)(Math.log(N) / Math.log(2)); \n\t \n\t return result; \n\t }\n\t static boolean sign(long n) {\n\t \treturn n>0;\n\t }\n\t public static int solve(long[] ar,int n) {\n\t \tlong sum=0;\n\t \tfor(int i=0;i=0;i--) {\n\t \t\tsum+=ar[i];\n\t \t\tif(sum<=0)return 0;\n\t \t}\n\t\t\treturn 1;\n\t }\n public static void main(String[] args) throws IOException {\n \tFastReader s=new FastReader();\n \tint n = s.nextInt();\n \tint[] ar = new int[n];\n \tfor(int i=0;iar[i])ar[i-1]--;\n \t}\n// \tfor(int i=0;iar[i])flag=1;\n \t}\n \tif(flag==1)System.out.println(\"No\"); \n \telse System.out.println(\"Yes\");\n }\t\n}\n//2999999997\n\n \n \n\n \n ", "language": "Java", "metadata": {"date": 1596396750, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02953.html", "problem_id": "p02953", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02953/input.txt", "sample_output_relpath": "derived/input_output/data/p02953/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02953/Java/s602118949.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s602118949", "user_id": "u185912325"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "\nimport java.io.*;\nimport java.io.BufferedReader; \nimport java.io.IOException; \nimport java.io.InputStreamReader;\nimport java.math.BigInteger;\nimport java.util.*;\n\n\n/**\n * @author Utkarsh\n *\n */\npublic class Main \n{\n\n\t \n\t static class FastReader \n\t { \n\t BufferedReader br; \n\t StringTokenizer st; \n\t \n\t \n\t public FastReader() \n\t { \n\t br = new BufferedReader(new\n\t InputStreamReader(System.in)); \n\t } \n\t \n\t String next() \n\t { \n\t while (st == null || !st.hasMoreTokens()) \n\t { \n\t try\n\t { \n\t st = new StringTokenizer(br.readLine()); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t } \n\t return st.nextToken();\n\t \n\t } \n\t \n\t int nextInt() \n\t { \n\t return Integer.parseInt(next()); \n\t } \n\t \n\t long nextLong() \n\t { \n\t return Long.parseLong(next()); \n\t } \n\t \n\t double nextDouble() \n\t { \n\t return Double.parseDouble(next()); \n\t } \n\t \n\t String nextLine() \n\t { \n\t String str = \"\"; \n\t try\n\t { \n\t str = br.readLine(); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t return str; \n\t }\n\n\t\t\tpublic Character charAt(int i) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tpublic BigInteger nextBigInteger() {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\treturn null;\n\t\t\t} \n\t } \n\n \n\n\t // Complete the hurdleRace function below.\n// public static void solve() {\n// \tFastReader s=new FastReader();\n\t int binarySearch(int arr[], int l, int r, int x) \n\t { \n\t if (r >= l) { \n\t int mid = l + (r - l) / 2; \n\t \n\t // If the element is present at the \n\t // middle itself \n\t if (arr[mid] == x) \n\t return mid; \n\t \n\t // If element is smaller than mid, then \n\t // it can only be present in left subarray \n\t if (arr[mid] > x) \n\t return binarySearch(arr, l, mid - 1, x); \n\t \n\t // Else the element can only be present \n\t // in right subarray \n\t return binarySearch(arr, mid + 1, r, x); \n\t } \n\t \n\t // We reach here when element is not present \n\t // in array \n\t return -1; \n\t } \n\t \n\t static // Driver method to test above \n\n\t// Java implementation of iterative Binary Search \n\n\t // Returns index of x if it is present in arr[], \n\t // else return -1 \n\t int lowerBound(int[] a,int n,int key){\n\t int s =0,e=n-1;\n\t int ans = -1;\n\n\t while(s<=e){\n\t int mid = (s+e)/2;\n\n\t if(a[mid]==key){\n\t ans = mid;\n\t e = mid - 1;\n\t }\n\t else if(a[mid]>key){\n\t e = mid - 1;\n\t }\n\t else{\n\t s = mid + 1;\n\t }\n\t }\n\n\t return ans;\n\t }\n\t static int count(String se,char c,int l,int r) {\n\t\t\tif(l==r) {\n\t\t\t\tif(se.charAt(l)==c)return 0;\n\t\t\t\telse return 1;\n\t\t\t}\n\t\t\tint mid = (l+r)/2;\n\t\t\tint c1=0,c2=0;\n\t\t\tfor(int i=l;i<=mid;i++) {\n\t\t\t\tif(se.charAt(i)!=c)c1++;\n\t\t\t}\n\t\t\tfor(int i=r;i>mid;i--) {\n\t\t\t\tif(se.charAt(i)!=c)c2++;\n\t\t\t}\n\t\t\tint y = count(se,(char)((int)c+1),mid+1,r);\n\t\t\tint x = count(se,(char)((int)c+1),l,mid);\n\t \treturn Math.min(c1+y, c2+x);\n\t \t\n\t }\n\t public static double log2(long N) \n\t { \n\t \n\t // calculate log2 N indirectly \n\t // using log() method \n\t double result = (double)(Math.log(N) / Math.log(2)); \n\t \n\t return result; \n\t }\n\t static boolean sign(long n) {\n\t \treturn n>0;\n\t }\n\t public static int solve(long[] ar,int n) {\n\t \tlong sum=0;\n\t \tfor(int i=0;i=0;i--) {\n\t \t\tsum+=ar[i];\n\t \t\tif(sum<=0)return 0;\n\t \t}\n\t\t\treturn 1;\n\t }\n public static void main(String[] args) throws IOException {\n \tFastReader s=new FastReader();\n \tint n = s.nextInt();\n \tint[] ar = new int[n];\n \tfor(int i=0;iar[i])ar[i-1]--;\n \t}\n// \tfor(int i=0;iar[i])flag=1;\n \t}\n \tif(flag==1)System.out.println(\"No\"); \n \telse System.out.println(\"Yes\");\n }\t\n}\n//2999999997\n\n \n \n\n \n ", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "sample_input": "5\n1 2 1 1 3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02953", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 4792, "cpu_time_ms": 207, "memory_kb": 47088}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s242032286", "group_id": "codeNet:p02953", "input_text": "import java.io.BufferedReader;\nimport java.io.BufferedWriter;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.OutputStreamWriter;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.StringTokenizer;\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tInputReader in = new InputReader(System.in);\n\t\tPrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)),true);\n\t\tTaskB solver = new TaskB();\n\t\tsolver.solve(1, in, out);\n\t\tout.flush();\n\t\tout.close();\n\t}\n}\n\nclass TaskB {\n public void solve(int testNumber, InputReader in, PrintWriter pw) {\n \tint n=in.nextInt();\n \tint arr[]=new int[n];\n \tfor(int i=0;imax?temp-1:max;\n \t\ttemp=arr[i];\n \t}\n \tif(flag) {\n \t\tpw.println(\"Yes\");\n \t}else {\n \t\tpw.println(\"No\");\n \t}\n \t\n \t\t\n \t}\n}\nclass Pair{\n\tA first;\n\tB second;\n\tPair(A first,B second){\n\t\tthis.first=first;\n\t\tthis.second=second;\n\t}\n}\n\n\nclass InputReader{\n BufferedReader br;\n StringTokenizer st;\n public InputReader(InputStream in){\n br=new BufferedReader(new InputStreamReader(in));\n st=null;\n }\n public String next(){\n while(st==null||!st.hasMoreTokens()){\n try{\n st=new StringTokenizer(br.readLine());\n }catch(IOException e){\n throw new RuntimeException(e);\n }\n }\n return st.nextToken();\n }\n public int nextInt(){\n return Integer.parseInt(next());\n }\n public long nextLong() {\n \treturn Long.parseLong(next());\n }\n}\n", "language": "Java", "metadata": {"date": 1589785744, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02953.html", "problem_id": "p02953", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02953/input.txt", "sample_output_relpath": "derived/input_output/data/p02953/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02953/Java/s242032286.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s242032286", "user_id": "u497722438"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.BufferedWriter;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.OutputStreamWriter;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.StringTokenizer;\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tInputReader in = new InputReader(System.in);\n\t\tPrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)),true);\n\t\tTaskB solver = new TaskB();\n\t\tsolver.solve(1, in, out);\n\t\tout.flush();\n\t\tout.close();\n\t}\n}\n\nclass TaskB {\n public void solve(int testNumber, InputReader in, PrintWriter pw) {\n \tint n=in.nextInt();\n \tint arr[]=new int[n];\n \tfor(int i=0;imax?temp-1:max;\n \t\ttemp=arr[i];\n \t}\n \tif(flag) {\n \t\tpw.println(\"Yes\");\n \t}else {\n \t\tpw.println(\"No\");\n \t}\n \t\n \t\t\n \t}\n}\nclass Pair{\n\tA first;\n\tB second;\n\tPair(A first,B second){\n\t\tthis.first=first;\n\t\tthis.second=second;\n\t}\n}\n\n\nclass InputReader{\n BufferedReader br;\n StringTokenizer st;\n public InputReader(InputStream in){\n br=new BufferedReader(new InputStreamReader(in));\n st=null;\n }\n public String next(){\n while(st==null||!st.hasMoreTokens()){\n try{\n st=new StringTokenizer(br.readLine());\n }catch(IOException e){\n throw new RuntimeException(e);\n }\n }\n return st.nextToken();\n }\n public int nextInt(){\n return Integer.parseInt(next());\n }\n public long nextLong() {\n \treturn Long.parseLong(next());\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "sample_input": "5\n1 2 1 1 3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02953", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1973, "cpu_time_ms": 196, "memory_kb": 40892}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s678892079", "group_id": "codeNet:p02953", "input_text": "import java.io.BufferedInputStream;\nimport java.io.BufferedOutputStream;\nimport java.io.PrintWriter;\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) throws Exception {\n try (BufferedInputStream in = new BufferedInputStream(System.in);\n PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {\n\n Scanner sc = new Scanner(in);\n\n // 12:44-\n\n int n = sc.nextInt();\n int last = sc.nextInt() - 1;\n for (int i = 1; i < n; i++) {\n int cur = sc.nextInt();\n if (cur < last) {\n out.println(\"NO\");\n return;\n }\n if (cur > last) cur--;\n last = cur;\n }\n\n out.println(\"YES\");\n }\n }\n\n}\n", "language": "Java", "metadata": {"date": 1567035996, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02953.html", "problem_id": "p02953", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02953/input.txt", "sample_output_relpath": "derived/input_output/data/p02953/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02953/Java/s678892079.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s678892079", "user_id": "u181837459"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.io.BufferedInputStream;\nimport java.io.BufferedOutputStream;\nimport java.io.PrintWriter;\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) throws Exception {\n try (BufferedInputStream in = new BufferedInputStream(System.in);\n PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {\n\n Scanner sc = new Scanner(in);\n\n // 12:44-\n\n int n = sc.nextInt();\n int last = sc.nextInt() - 1;\n for (int i = 1; i < n; i++) {\n int cur = sc.nextInt();\n if (cur < last) {\n out.println(\"NO\");\n return;\n }\n if (cur > last) cur--;\n last = cur;\n }\n\n out.println(\"YES\");\n }\n }\n\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "sample_input": "5\n1 2 1 1 3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02953", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 849, "cpu_time_ms": 474, "memory_kb": 45868}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s129579255", "group_id": "codeNet:p02953", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tint a;\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\ta = sc.nextInt();\n\n\t\tint[] b = new int[a];\n\n\t\tfor (int i = 0; i < b.length; i++) {\n\t\t\tb[i] = sc.nextInt();\n\t\t}\n\n\t\tint count = 1;\n\t\tboolean flag = true;\n\n\t\tfor (int i = 1; i < b.length; i++) {\n\n\t\t\tif (b[i - 1] <= b[i]) {\n\n\t\t\t\t++count;\n\n\t\t\t} else if ((b[i - 1] -1) <= b[i] && flag) {\n\n\t\t\t\t++count;\n\t\t\t\tflag = false;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif (b.length == count) {\n\t\t\tSystem.out.println(\"Yes\");\n\t\t} else {\n\t\t\tSystem.out.println(\"No\");\n\t\t}\n\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1566353207, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02953.html", "problem_id": "p02953", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02953/input.txt", "sample_output_relpath": "derived/input_output/data/p02953/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02953/Java/s129579255.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s129579255", "user_id": "u395242880"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tint a;\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\ta = sc.nextInt();\n\n\t\tint[] b = new int[a];\n\n\t\tfor (int i = 0; i < b.length; i++) {\n\t\t\tb[i] = sc.nextInt();\n\t\t}\n\n\t\tint count = 1;\n\t\tboolean flag = true;\n\n\t\tfor (int i = 1; i < b.length; i++) {\n\n\t\t\tif (b[i - 1] <= b[i]) {\n\n\t\t\t\t++count;\n\n\t\t\t} else if ((b[i - 1] -1) <= b[i] && flag) {\n\n\t\t\t\t++count;\n\t\t\t\tflag = false;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif (b.length == count) {\n\t\t\tSystem.out.println(\"Yes\");\n\t\t} else {\n\t\t\tSystem.out.println(\"No\");\n\t\t}\n\n\t}\n\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "sample_input": "5\n1 2 1 1 3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02953", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 577, "cpu_time_ms": 473, "memory_kb": 48968}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s752366337", "group_id": "codeNet:p02953", "input_text": "import java.util.*;\n\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int h ;\n int[] a = new int[n];\n\n for(int i=0; ia[j+1]){\n a[j] = a[j]-1;\n if(j==0 && a[j]>a[j+1]){\n System.out.println(\"No\");\n break ;\n }\n if(a[j-1]>a[j] || a[j]>a[j+1]){\n System.out.println(\"No\");\n break ;\n }\n }\n }\n System.out.println(\"Yes\");\n }\n }\n}", "language": "Java", "metadata": {"date": 1566167366, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02953.html", "problem_id": "p02953", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02953/input.txt", "sample_output_relpath": "derived/input_output/data/p02953/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02953/Java/s752366337.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s752366337", "user_id": "u008695540"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int h ;\n int[] a = new int[n];\n\n for(int i=0; ia[j+1]){\n a[j] = a[j]-1;\n if(j==0 && a[j]>a[j+1]){\n System.out.println(\"No\");\n break ;\n }\n if(a[j-1]>a[j] || a[j]>a[j+1]){\n System.out.println(\"No\");\n break ;\n }\n }\n }\n System.out.println(\"Yes\");\n }\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "sample_input": "5\n1 2 1 1 3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02953", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 680, "cpu_time_ms": 495, "memory_kb": 51372}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s489291619", "group_id": "codeNet:p02953", "input_text": "import java.util.Scanner;\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner stdin=new Scanner(System.in);\n\t\tint n=stdin.nextInt();\n\t\tint[] h=new int[n+1];\n\t\tfor(int i=0;ih[i+1]) {\n\t\t\t\th[i]=h[i]-1;\n\t\t\t}\n\t\t}\n\t\tint cnt=0;\n\t\tfor(int i=0;ih[i+1]) cnt++;\n\t\t}\n\n\t\tif(cnt<=0) System.out.println(\"YES\");\n\t\telse System.out.println(\"NO\");\n\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1565354445, "filename_ext": "java", "original_language": "Java7 (OpenJDK 1.7.0)", "problem_description_relpath": "problem_descriptions/p02953.html", "problem_id": "p02953", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02953/input.txt", "sample_output_relpath": "derived/input_output/data/p02953/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02953/Java/s489291619.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s489291619", "user_id": "u740253305"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.Scanner;\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner stdin=new Scanner(System.in);\n\t\tint n=stdin.nextInt();\n\t\tint[] h=new int[n+1];\n\t\tfor(int i=0;ih[i+1]) {\n\t\t\t\th[i]=h[i]-1;\n\t\t\t}\n\t\t}\n\t\tint cnt=0;\n\t\tfor(int i=0;ih[i+1]) cnt++;\n\t\t}\n\n\t\tif(cnt<=0) System.out.println(\"YES\");\n\t\telse System.out.println(\"NO\");\n\n\t}\n\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "sample_input": "5\n1 2 1 1 3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02953", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 451, "cpu_time_ms": 435, "memory_kb": 51716}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s877921689", "group_id": "codeNet:p02953", "input_text": "import java.util.Scanner;\n\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint N = sc.nextInt();\n\t\tboolean result = true;\n\n\t\tint left = 0;\n\t\tint mid = sc.nextInt();\t// 1個目\n\t\tint right = 0;\n\n\t\tfor (int i = 0; i < N - 1; i++) {\n\t\t\tright = sc.nextInt();\n\n\t\t\tif (mid - 1 > right) {\n\t\t\t\tresult = false;\n\t\t\t\tbreak;\n\t\t\t} else if (mid - 1 == right && left > mid - 1) {\n\t\t\t\tresult = false;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (mid - 1 == right) {\n\t\t\t\tleft = mid - 1;\n\t\t\t\tmid = right;\n\t\t\t} else {\n\t\t\t\tleft = mid;\n\t\t\t\tmid = right;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(result ? \"Yes\" : \"No\");\n\t}\n}", "language": "Java", "metadata": {"date": 1565063964, "filename_ext": "java", "original_language": "Java7 (OpenJDK 1.7.0)", "problem_description_relpath": "problem_descriptions/p02953.html", "problem_id": "p02953", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02953/input.txt", "sample_output_relpath": "derived/input_output/data/p02953/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02953/Java/s877921689.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s877921689", "user_id": "u404850460"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.Scanner;\n\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint N = sc.nextInt();\n\t\tboolean result = true;\n\n\t\tint left = 0;\n\t\tint mid = sc.nextInt();\t// 1個目\n\t\tint right = 0;\n\n\t\tfor (int i = 0; i < N - 1; i++) {\n\t\t\tright = sc.nextInt();\n\n\t\t\tif (mid - 1 > right) {\n\t\t\t\tresult = false;\n\t\t\t\tbreak;\n\t\t\t} else if (mid - 1 == right && left > mid - 1) {\n\t\t\t\tresult = false;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (mid - 1 == right) {\n\t\t\t\tleft = mid - 1;\n\t\t\t\tmid = right;\n\t\t\t} else {\n\t\t\t\tleft = mid;\n\t\t\t\tmid = right;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(result ? \"Yes\" : \"No\");\n\t}\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "sample_input": "5\n1 2 1 1 3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02953", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 627, "cpu_time_ms": 423, "memory_kb": 47888}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s778713737", "group_id": "codeNet:p02953", "input_text": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int[] A = new int[N];\n for (int i = 0; i < N; i++) {\n A[i] = sc.nextInt();\n }\n \n for (int i = 1; i < N; i++) {\n if (A[i - 1] < A[i]) {\n A[i]--;\n } \n else {\n if (A[i - 1] != A[i]) {\n System.out.println(\"No\");\n break;\n }\n }\n }\n System.out.println(\"Yes\");\n }\n}", "language": "Java", "metadata": {"date": 1565028866, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02953.html", "problem_id": "p02953", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02953/input.txt", "sample_output_relpath": "derived/input_output/data/p02953/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02953/Java/s778713737.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s778713737", "user_id": "u382169090"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int[] A = new int[N];\n for (int i = 0; i < N; i++) {\n A[i] = sc.nextInt();\n }\n \n for (int i = 1; i < N; i++) {\n if (A[i - 1] < A[i]) {\n A[i]--;\n } \n else {\n if (A[i - 1] != A[i]) {\n System.out.println(\"No\");\n break;\n }\n }\n }\n System.out.println(\"Yes\");\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "sample_input": "5\n1 2 1 1 3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02953", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 482, "memory_kb": 53116}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s110180303", "group_id": "codeNet:p02953", "input_text": "import java.util.*;\npublic class Main {\n public static void main(String[] args) {\n Scanner s = new Scanner(System.in);\n int N = s.nextInt();\n int H[] = new int[N];\n for (int i = 0; i < N; i++) {\n H[i] = s.nextInt();\n }\n boolean bl = false;\n int ch = 0;\n for (int i = 0; i < (N-1); i++) {\n if (H[i] <= H[i + 1]) {\n ch++;\n }\n }\n if (ch ==( N-1)) {\n bl = true;\n }\n if (!bl) {\n for (int i = 0; i <( N-1); i++) {\n if (H[i] > H[i + 1]) {\n H[i] -= 1;\n }\n }\n ch = 0;\n for (int i = 0; i <( N-1); i++) {\n if (H[i] <= H[i + 1]) {\n ch++;\n }\n }\n if(ch==(N-1)){\n bl=true;\n }\n }\n if(bl){\n System.out.print(\"Yes\");\n }\n else{\n System.out.print(\"No\");\n }\n }\n}\n\n", "language": "Java", "metadata": {"date": 1564976148, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02953.html", "problem_id": "p02953", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02953/input.txt", "sample_output_relpath": "derived/input_output/data/p02953/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02953/Java/s110180303.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s110180303", "user_id": "u469281291"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n public static void main(String[] args) {\n Scanner s = new Scanner(System.in);\n int N = s.nextInt();\n int H[] = new int[N];\n for (int i = 0; i < N; i++) {\n H[i] = s.nextInt();\n }\n boolean bl = false;\n int ch = 0;\n for (int i = 0; i < (N-1); i++) {\n if (H[i] <= H[i + 1]) {\n ch++;\n }\n }\n if (ch ==( N-1)) {\n bl = true;\n }\n if (!bl) {\n for (int i = 0; i <( N-1); i++) {\n if (H[i] > H[i + 1]) {\n H[i] -= 1;\n }\n }\n ch = 0;\n for (int i = 0; i <( N-1); i++) {\n if (H[i] <= H[i + 1]) {\n ch++;\n }\n }\n if(ch==(N-1)){\n bl=true;\n }\n }\n if(bl){\n System.out.print(\"Yes\");\n }\n else{\n System.out.print(\"No\");\n }\n }\n}\n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "sample_input": "5\n1 2 1 1 3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02953", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1039, "cpu_time_ms": 471, "memory_kb": 49712}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s196779968", "group_id": "codeNet:p02953", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] h = new int[n];\n\t\tfor (int i = 0; i < h.length; i++) {\n\t\t\th[i] = sc.nextInt();\n\t\t}\n\t\tString ans = \"Yes\";\n\n\t\tfor (int i = n; i > 0; i--) {\n\t\t\tif (h[i] - h[i-1] > 1 ) {\n\t\t\t\tcontinue;\n\n\t\t\t}else if (h[i] - h[i-1] == 1 ) {\n\t\t\t\th[i]--;\n\n\t\t\t} else {\n\t\t\t\tans = \"No\";\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(ans);\n\t\tsc.close();\n\t}\n}", "language": "Java", "metadata": {"date": 1564973853, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02953.html", "problem_id": "p02953", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02953/input.txt", "sample_output_relpath": "derived/input_output/data/p02953/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02953/Java/s196779968.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s196779968", "user_id": "u698000453"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] h = new int[n];\n\t\tfor (int i = 0; i < h.length; i++) {\n\t\t\th[i] = sc.nextInt();\n\t\t}\n\t\tString ans = \"Yes\";\n\n\t\tfor (int i = n; i > 0; i--) {\n\t\t\tif (h[i] - h[i-1] > 1 ) {\n\t\t\t\tcontinue;\n\n\t\t\t}else if (h[i] - h[i-1] == 1 ) {\n\t\t\t\th[i]--;\n\n\t\t\t} else {\n\t\t\t\tans = \"No\";\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(ans);\n\t\tsc.close();\n\t}\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "sample_input": "5\n1 2 1 1 3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02953", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 485, "cpu_time_ms": 463, "memory_kb": 49304}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s281661304", "group_id": "codeNet:p02953", "input_text": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n \n\t\t// 整数の入力\n\t\tint n = sc.nextInt();\n int[] list = new int[n];\n int previous = 0;\n boolean decreased = false;\n boolean isFalse = false;\n for (int i = 0; i < n; i++) {\n int value = sc.nextInt();\n if (value < previous) {\n if (!decreased) {\n list[i - 1] -= 1;\n decreased = true;\n }\n } \n previous = value;\n list[i] = value;\n }\n previous = 0;\n boolean judge = true;\n for (int i = 0; i < n; i++) {\n if (list[i] < previous) {\n judge = false;\n break;\n }\n previous = list[i];\n } \n if (judge) {\n System.out.println(\"Yes\");\n } else {\n System.out.println(\"No\");\n }\n \n\t}\n}\n", "language": "Java", "metadata": {"date": 1564972462, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02953.html", "problem_id": "p02953", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02953/input.txt", "sample_output_relpath": "derived/input_output/data/p02953/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02953/Java/s281661304.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s281661304", "user_id": "u711620077"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n \n\t\t// 整数の入力\n\t\tint n = sc.nextInt();\n int[] list = new int[n];\n int previous = 0;\n boolean decreased = false;\n boolean isFalse = false;\n for (int i = 0; i < n; i++) {\n int value = sc.nextInt();\n if (value < previous) {\n if (!decreased) {\n list[i - 1] -= 1;\n decreased = true;\n }\n } \n previous = value;\n list[i] = value;\n }\n previous = 0;\n boolean judge = true;\n for (int i = 0; i < n; i++) {\n if (list[i] < previous) {\n judge = false;\n break;\n }\n previous = list[i];\n } \n if (judge) {\n System.out.println(\"Yes\");\n } else {\n System.out.println(\"No\");\n }\n \n\t}\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "sample_input": "5\n1 2 1 1 3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02953", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 954, "cpu_time_ms": 470, "memory_kb": 50952}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s228807398", "group_id": "codeNet:p02953", "input_text": "import java.util.ArrayList;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n boolean flg = true;\n Long[] Hs = new Long[N + 1];\n Long fix = 0L;\n int cnt = 0;\n for (int i = 1; i <= N; i++) {\n long H = sc.nextLong();\n Hs[i] = H;\n if (Hs[i - 1] > H) {\n Hs[i - 1] = Hs[i - 1] - 1;\n if (cnt == 0) {\n fix = Hs[i - 1];\n }\n cnt++;\n if (Hs[i - 1] > fix) {\n flg = false;\n break;\n }\n }\n }\n\n if (flg) {\n System.out.println(\"Yes\");\n } else {\n System.out.println(\"No\");\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1564971264, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02953.html", "problem_id": "p02953", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02953/input.txt", "sample_output_relpath": "derived/input_output/data/p02953/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02953/Java/s228807398.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s228807398", "user_id": "u965001777"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.ArrayList;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n boolean flg = true;\n Long[] Hs = new Long[N + 1];\n Long fix = 0L;\n int cnt = 0;\n for (int i = 1; i <= N; i++) {\n long H = sc.nextLong();\n Hs[i] = H;\n if (Hs[i - 1] > H) {\n Hs[i - 1] = Hs[i - 1] - 1;\n if (cnt == 0) {\n fix = Hs[i - 1];\n }\n cnt++;\n if (Hs[i - 1] > fix) {\n flg = false;\n break;\n }\n }\n }\n\n if (flg) {\n System.out.println(\"Yes\");\n } else {\n System.out.println(\"No\");\n }\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "sample_input": "5\n1 2 1 1 3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02953", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 94, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s971399820", "group_id": "codeNet:p02953", "input_text": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t int buildcnt = sc.nextInt();\n int hights[]= new int[buildcnt];\n boolean reach =false;\n String answer = \"YES\";\n for(int i=0;i numlist = new ArrayList();\n// while(sc.hasnext()){\n // numlist.add(sc.nextInt());\n // }\n for(int i=0 ; i < buildcnt ;i++){\n for(int j=i; j < buildcnt;j++){\n if(hights[i] - hights[i+j]>j){\n answer = \"NO\";\n }\n }\n }\n\n// int now = sc.nextInt();\n// while(sc.hasNext()){\n// int next = sc.nextInt();\n //今-次が2以上ならNG\n // if(now - next >= 2){\n// answer=\"NO\";\n // break;\n // }else if(now - next == 1){\n \n // if(reach == true){\n // answer =\"NO\";\n // break;\n // }else{\n // reach=true;\n // now = next;\n // }\n // }else{\n // now = next;\n // reach=false;\n // }\n // }\n // 出力 \n\t\tSystem.out.println(answer);\n\t}\n}", "language": "Java", "metadata": {"date": 1564970301, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02953.html", "problem_id": "p02953", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02953/input.txt", "sample_output_relpath": "derived/input_output/data/p02953/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02953/Java/s971399820.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s971399820", "user_id": "u167206842"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t int buildcnt = sc.nextInt();\n int hights[]= new int[buildcnt];\n boolean reach =false;\n String answer = \"YES\";\n for(int i=0;i numlist = new ArrayList();\n// while(sc.hasnext()){\n // numlist.add(sc.nextInt());\n // }\n for(int i=0 ; i < buildcnt ;i++){\n for(int j=i; j < buildcnt;j++){\n if(hights[i] - hights[i+j]>j){\n answer = \"NO\";\n }\n }\n }\n\n// int now = sc.nextInt();\n// while(sc.hasNext()){\n// int next = sc.nextInt();\n //今-次が2以上ならNG\n // if(now - next >= 2){\n// answer=\"NO\";\n // break;\n // }else if(now - next == 1){\n \n // if(reach == true){\n // answer =\"NO\";\n // break;\n // }else{\n // reach=true;\n // now = next;\n // }\n // }else{\n // now = next;\n // reach=false;\n // }\n // }\n // 出力 \n\t\tSystem.out.println(answer);\n\t}\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "sample_input": "5\n1 2 1 1 3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02953", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1189, "cpu_time_ms": 480, "memory_kb": 50640}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s698362933", "group_id": "codeNet:p02953", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] h = new int[n];\n\t\tfor (int i = 0; i < h.length; i++) {\n\t\t\th[i] = sc.nextInt();\n\t\t}\n\t\tString ans = \"Yes\";\n\n\t\tfor (int i = 0; i < h.length - 1; i++) {\n\t\t\tif (h[i] <= h[i+1]) {\n\t\t\t\tcontinue;\n\t\t\t} else {\n\t\t\t\tif (h[i]-1 != h[i+1] || h[i]-1 < 0) {\n\t\t\t\t\tans = \"No\";\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (i != 0 && h[i-1] > h[i]-1) {\n\t\t\t\t\tans = \"No\";\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\th[i]--;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(ans);\n\t\tsc.close();\n\t}\n}\n", "language": "Java", "metadata": {"date": 1564968984, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02953.html", "problem_id": "p02953", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02953/input.txt", "sample_output_relpath": "derived/input_output/data/p02953/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02953/Java/s698362933.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s698362933", "user_id": "u698000453"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] h = new int[n];\n\t\tfor (int i = 0; i < h.length; i++) {\n\t\t\th[i] = sc.nextInt();\n\t\t}\n\t\tString ans = \"Yes\";\n\n\t\tfor (int i = 0; i < h.length - 1; i++) {\n\t\t\tif (h[i] <= h[i+1]) {\n\t\t\t\tcontinue;\n\t\t\t} else {\n\t\t\t\tif (h[i]-1 != h[i+1] || h[i]-1 < 0) {\n\t\t\t\t\tans = \"No\";\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (i != 0 && h[i-1] > h[i]-1) {\n\t\t\t\t\tans = \"No\";\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\th[i]--;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(ans);\n\t\tsc.close();\n\t}\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "sample_input": "5\n1 2 1 1 3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02953", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 469, "memory_kb": 50880}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s822160017", "group_id": "codeNet:p02953", "input_text": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n int n = Integer.parseInt(sc.nextLine());\n int[] ary = new int[n];\n String line = sc.nextLine();\n String[] line1 = line.split(\" \");\n boolean ans = true;\n for(int i = 0; i < n; i++) ary[i] = Integer.parseInt(line1[i]);\n for(int i = 0; i < n - 1; i++){\n if(ary[i] > ary[i + 1]){\n ary[i] -= 1;\n break;\n }\n }\n for(int i = 0; i < n - 1; i++){\n if(ary[i] > ary[i + 1]) ans = false;\n }\n if(ans) System.out.println(\"Yes\");\n else System.out.println(\"No\");\n }\n}", "language": "Java", "metadata": {"date": 1564968870, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02953.html", "problem_id": "p02953", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02953/input.txt", "sample_output_relpath": "derived/input_output/data/p02953/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02953/Java/s822160017.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s822160017", "user_id": "u000348730"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n int n = Integer.parseInt(sc.nextLine());\n int[] ary = new int[n];\n String line = sc.nextLine();\n String[] line1 = line.split(\" \");\n boolean ans = true;\n for(int i = 0; i < n; i++) ary[i] = Integer.parseInt(line1[i]);\n for(int i = 0; i < n - 1; i++){\n if(ary[i] > ary[i + 1]){\n ary[i] -= 1;\n break;\n }\n }\n for(int i = 0; i < n - 1; i++){\n if(ary[i] > ary[i + 1]) ans = false;\n }\n if(ans) System.out.println(\"Yes\");\n else System.out.println(\"No\");\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "sample_input": "5\n1 2 1 1 3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02953", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 352, "memory_kb": 51072}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s390772297", "group_id": "codeNet:p02953", "input_text": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\n\npublic class Main {\n\n\tpublic static void main(String[] args) throws Exception {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tBufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n\t\tString W = in.readLine();\n\t\tint N = Integer.parseInt(W);\n\n\t\tW = in.readLine();\n\t\tString[] ws = W.split(\" \");\n\t\tlong[] H = new long[ws.length];\n\t\tString ans = \"Yes\";\n\t\tfor(int i=0;i= H[i]){\n\t\t\t\t\tH[i-1] = H[i-1]-1;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tif(H[i-1] >= H[i]){\n\t\t\t\t\tif(H[i-2] < H[i-1]){\n\t\t\t\t\t\tH[i-1]=H[i-1]-1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(i!=0 && H[i-1] > H[i]){\n\t\t\t\tans=\"No\";\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(ans);\n\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1564968763, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02953.html", "problem_id": "p02953", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02953/input.txt", "sample_output_relpath": "derived/input_output/data/p02953/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02953/Java/s390772297.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s390772297", "user_id": "u845434829"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\n\npublic class Main {\n\n\tpublic static void main(String[] args) throws Exception {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tBufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n\t\tString W = in.readLine();\n\t\tint N = Integer.parseInt(W);\n\n\t\tW = in.readLine();\n\t\tString[] ws = W.split(\" \");\n\t\tlong[] H = new long[ws.length];\n\t\tString ans = \"Yes\";\n\t\tfor(int i=0;i= H[i]){\n\t\t\t\t\tH[i-1] = H[i-1]-1;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tif(H[i-1] >= H[i]){\n\t\t\t\t\tif(H[i-2] < H[i-1]){\n\t\t\t\t\t\tH[i-1]=H[i-1]-1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(i!=0 && H[i-1] > H[i]){\n\t\t\t\tans=\"No\";\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(ans);\n\n\t}\n\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "sample_input": "5\n1 2 1 1 3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02953", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 213, "memory_kb": 49108}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s934868455", "group_id": "codeNet:p02953", "input_text": "import java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.BufferedReader;\nimport java.util.*;\nimport java.math.*;\nimport java.io.*;\nimport java.text.*;\nimport java.math.BigInteger;\n \npublic class Main\n{ \n \n //Life's a bitch\n public static boolean[] sieve(long n)\n {\n boolean[] prime = new boolean[(int)n+1];\n Arrays.fill(prime,true);\n prime[0] = false;\n prime[1] = false;\n long m = (long)Math.sqrt(n);\n for(int i=2;i<=m;i++)\n {\n if(prime[i])\n {\n for(int k=i*i;k<=n;k+=i)\n {\n prime[k] = false;\n }\n }\n }\n return prime;\n } \n \n \n static long GCD(long a,long b)\n {\n if(b==0)\n {\n return a;\n }\n return GCD(b,a%b);\n }\n \n static long CountCoPrimes(long n)\n {\n long res = n;\n for(int i=2;i*i<=n;i++)\n {\n if(n%i==0)\n {\n while(n%i==0)\n {\n n/=i;\n }\n res-=res/i;\n }\n }\n if(n>1)\n {\n res-=res/n;\n }\n return res;\n }\n \n \n \n \n \n \n static boolean prime(int n)\n {\n for(int i=2;i*i<=n;i++)\n {\n if(i%2==0 ||i%3==0)\n {\n return false;\n }\n }\n return true;\n }\n\n \n \n \n \n \n \n \n \n public static void main(String[] args) throws IOException\n {\n \n new Main().run();\n \n }\n \n \n \n \n \n static long findGCD(ArrayList arr,long start, long n) \n { \n long result = arr.get((int)start); \n for (int i = (int)start+1; i < n; i++) \n result = GCD(arr.get(i), result); \n \n return result; \n } \n \n \n Scanner in = new Scanner(System.in);\n void run() throws IOException\n {\n\n \n\n int n = ni();\n long[] a = new long[n];\n for(int i=0;ia[i+1])\n {\n a[i]-=1;\n if(a[i]>a[i+1])\n {\n printS(\"NO\");\n return;\n }\n }\n\n }\n\n if(isSorted(a,n))\n {\n printS(\"Yes\");\n return;\n }\n\n printS(\"No\");\n \n\n\n \n }\n\n\n static boolean isSorted(long[] a,int n)\n {\n for(int i=0;ia[i+1])\n {\n return false;\n }\n }\n return true;\n }\n\n \n \n\n\n \n \n \n \n \n \n \n \n \n //xor range query\n static long xor(long n)\n {\n \n if(n%4==0)\n {\n return n;\n }\n if(n%4==1)\n {\n return 1;\n }\n if(n%4==2)\n {\n return n+1;\n }\n return 0;\n }\n \n static long xor(long a,long b)\n {\n return xor(b)^xor(a-1);\n }\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n void printL(long a)\n {\n System.out.println(a);\n }\n void printS(String s)\n {\n System.out.println(s);\n }\n \n void printD(Double d)\n {\n System.out.println(d);\n }\n \n \n \n static void swap(char c,char p)\n {\n char t = c;\n c = p;\n p = t;\n }\n \n static long max(long n,long m)\n {\n return Math.max(n,m);\n }\n static long min(long n,long m)\n {\n return Math.min(n,m);\n }\n \n double nd() throws IOException\n {\n return Double.parseDouble(in.next());\n }\n int ni() throws IOException\n {\n return Integer.parseInt(in.next());\n }\n \n long nl() throws IOException\n {\n return Long.parseLong(in.next());\n }\n \n String si() throws IOException\n {\n return in.next();\n }\n \n \n \n \n static int abs(int n)\n {\n return Math.abs(n);\n }\n \n static class Scanner \n {\n StringTokenizer st;\n BufferedReader br;\n \n public Scanner(InputStream s){ br = new BufferedReader(new InputStreamReader(s));}\n \n public String next() throws IOException \n {\n while (st == null || !st.hasMoreTokens()) \n {\n st = new StringTokenizer(br.readLine());\n }\n return st.nextToken();\n }\n \n public int nextInt() throws IOException {return Integer.parseInt(next());}\n \n public long nextLong() throws IOException {return Long.parseLong(next());}\n \n public String nextLine() throws IOException {return br.readLine();}\n \n public boolean ready() throws IOException {return br.ready();}\n \n \n }\n \n \n}\n \n \n \nclass Pair implements Comparable\n{\n int x,y;\n public Pair(int x,int y)\n {\n this.x = x;\n this.y = y;\n }\n public int compareTo(Pair o)\n {\n return this.y-o.y;\n }\n}", "language": "Java", "metadata": {"date": 1564968745, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02953.html", "problem_id": "p02953", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02953/input.txt", "sample_output_relpath": "derived/input_output/data/p02953/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02953/Java/s934868455.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s934868455", "user_id": "u836207173"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.BufferedReader;\nimport java.util.*;\nimport java.math.*;\nimport java.io.*;\nimport java.text.*;\nimport java.math.BigInteger;\n \npublic class Main\n{ \n \n //Life's a bitch\n public static boolean[] sieve(long n)\n {\n boolean[] prime = new boolean[(int)n+1];\n Arrays.fill(prime,true);\n prime[0] = false;\n prime[1] = false;\n long m = (long)Math.sqrt(n);\n for(int i=2;i<=m;i++)\n {\n if(prime[i])\n {\n for(int k=i*i;k<=n;k+=i)\n {\n prime[k] = false;\n }\n }\n }\n return prime;\n } \n \n \n static long GCD(long a,long b)\n {\n if(b==0)\n {\n return a;\n }\n return GCD(b,a%b);\n }\n \n static long CountCoPrimes(long n)\n {\n long res = n;\n for(int i=2;i*i<=n;i++)\n {\n if(n%i==0)\n {\n while(n%i==0)\n {\n n/=i;\n }\n res-=res/i;\n }\n }\n if(n>1)\n {\n res-=res/n;\n }\n return res;\n }\n \n \n \n \n \n \n static boolean prime(int n)\n {\n for(int i=2;i*i<=n;i++)\n {\n if(i%2==0 ||i%3==0)\n {\n return false;\n }\n }\n return true;\n }\n\n \n \n \n \n \n \n \n \n public static void main(String[] args) throws IOException\n {\n \n new Main().run();\n \n }\n \n \n \n \n \n static long findGCD(ArrayList arr,long start, long n) \n { \n long result = arr.get((int)start); \n for (int i = (int)start+1; i < n; i++) \n result = GCD(arr.get(i), result); \n \n return result; \n } \n \n \n Scanner in = new Scanner(System.in);\n void run() throws IOException\n {\n\n \n\n int n = ni();\n long[] a = new long[n];\n for(int i=0;ia[i+1])\n {\n a[i]-=1;\n if(a[i]>a[i+1])\n {\n printS(\"NO\");\n return;\n }\n }\n\n }\n\n if(isSorted(a,n))\n {\n printS(\"Yes\");\n return;\n }\n\n printS(\"No\");\n \n\n\n \n }\n\n\n static boolean isSorted(long[] a,int n)\n {\n for(int i=0;ia[i+1])\n {\n return false;\n }\n }\n return true;\n }\n\n \n \n\n\n \n \n \n \n \n \n \n \n \n //xor range query\n static long xor(long n)\n {\n \n if(n%4==0)\n {\n return n;\n }\n if(n%4==1)\n {\n return 1;\n }\n if(n%4==2)\n {\n return n+1;\n }\n return 0;\n }\n \n static long xor(long a,long b)\n {\n return xor(b)^xor(a-1);\n }\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n void printL(long a)\n {\n System.out.println(a);\n }\n void printS(String s)\n {\n System.out.println(s);\n }\n \n void printD(Double d)\n {\n System.out.println(d);\n }\n \n \n \n static void swap(char c,char p)\n {\n char t = c;\n c = p;\n p = t;\n }\n \n static long max(long n,long m)\n {\n return Math.max(n,m);\n }\n static long min(long n,long m)\n {\n return Math.min(n,m);\n }\n \n double nd() throws IOException\n {\n return Double.parseDouble(in.next());\n }\n int ni() throws IOException\n {\n return Integer.parseInt(in.next());\n }\n \n long nl() throws IOException\n {\n return Long.parseLong(in.next());\n }\n \n String si() throws IOException\n {\n return in.next();\n }\n \n \n \n \n static int abs(int n)\n {\n return Math.abs(n);\n }\n \n static class Scanner \n {\n StringTokenizer st;\n BufferedReader br;\n \n public Scanner(InputStream s){ br = new BufferedReader(new InputStreamReader(s));}\n \n public String next() throws IOException \n {\n while (st == null || !st.hasMoreTokens()) \n {\n st = new StringTokenizer(br.readLine());\n }\n return st.nextToken();\n }\n \n public int nextInt() throws IOException {return Integer.parseInt(next());}\n \n public long nextLong() throws IOException {return Long.parseLong(next());}\n \n public String nextLine() throws IOException {return br.readLine();}\n \n public boolean ready() throws IOException {return br.ready();}\n \n \n }\n \n \n}\n \n \n \nclass Pair implements Comparable\n{\n int x,y;\n public Pair(int x,int y)\n {\n this.x = x;\n this.y = y;\n }\n public int compareTo(Pair o)\n {\n return this.y-o.y;\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "sample_input": "5\n1 2 1 1 3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02953", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 5136, "cpu_time_ms": 182, "memory_kb": 40080}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s641046705", "group_id": "codeNet:p02953", "input_text": "import java.util.Scanner;\n\npublic class Main {\n public static void debug(String str) {\n boolean debug = false;\n if (debug != false) {\n return;\n }\n System.out.println(str);\n }\n\n public static void main(String[] args) {\n\n int N;\n long[] H;\n\n try (Scanner sc = new Scanner(System.in)) {\n N = sc.nextInt();\n H = new long[N];\n for (int i = 0; i < N; i++) {\n H[i] = sc.nextLong();\n }\n }\n\n if (H.length == 1) {\n System.out.println(\"Yes\");\n return;\n }\n if (H.length == 2 && H[0] - H[1] <= 1) {\n System.out.println(\"Yes\");\n return;\n }\n\n for (int i = 1; i < N; i++) {\n if (H[i - 1] - H[i] > 1) {\n //1以上減少するケース\n System.out.println(\"No\");\n return;\n } else if (H[i - 1] - H[i] == 1) {\n\n if (H[i - 2] == H[i - 1]) {\n //減少させると2つ前のよりも減少するケース\n System.out.println(\"No\");\n return;\n }else{\n //減少させる\n H[i - 1]--;\n }\n }\n }\n\n System.out.println(\"Yes\");\n return;\n\n }\n}\n", "language": "Java", "metadata": {"date": 1564968687, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02953.html", "problem_id": "p02953", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02953/input.txt", "sample_output_relpath": "derived/input_output/data/p02953/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02953/Java/s641046705.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s641046705", "user_id": "u499889187"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n public static void debug(String str) {\n boolean debug = false;\n if (debug != false) {\n return;\n }\n System.out.println(str);\n }\n\n public static void main(String[] args) {\n\n int N;\n long[] H;\n\n try (Scanner sc = new Scanner(System.in)) {\n N = sc.nextInt();\n H = new long[N];\n for (int i = 0; i < N; i++) {\n H[i] = sc.nextLong();\n }\n }\n\n if (H.length == 1) {\n System.out.println(\"Yes\");\n return;\n }\n if (H.length == 2 && H[0] - H[1] <= 1) {\n System.out.println(\"Yes\");\n return;\n }\n\n for (int i = 1; i < N; i++) {\n if (H[i - 1] - H[i] > 1) {\n //1以上減少するケース\n System.out.println(\"No\");\n return;\n } else if (H[i - 1] - H[i] == 1) {\n\n if (H[i - 2] == H[i - 1]) {\n //減少させると2つ前のよりも減少するケース\n System.out.println(\"No\");\n return;\n }else{\n //減少させる\n H[i - 1]--;\n }\n }\n }\n\n System.out.println(\"Yes\");\n return;\n\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "sample_input": "5\n1 2 1 1 3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02953", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1367, "cpu_time_ms": 469, "memory_kb": 49808}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s673710262", "group_id": "codeNet:p02953", "input_text": "import java.io.*;\n\npublic class Main{\n public static void main(String[] args) throws Exception{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n String[] line = br.readLine().split(\" \");\n int[] nums = new int[n];\n int i;\n boolean flag = false;\n nums[n-1] = Integer.parseInt(line[n-1]);\n for(i=n-2; 0<=i; i--){\n nums[i] = Integer.parseInt(line[i]);\n if( nums[i] > nums[i+1] ){\n if( nums[i]-1 > nums[i+1] || flag ){\n System.out.println(\"No\");\n System.exit(0);\n }else\n flag = true;\n }else\n flag = false;\n }\n System.out.println(\"Yes\");\n }\n}\n", "language": "Java", "metadata": {"date": 1564968184, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02953.html", "problem_id": "p02953", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02953/input.txt", "sample_output_relpath": "derived/input_output/data/p02953/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02953/Java/s673710262.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s673710262", "user_id": "u657065743"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.io.*;\n\npublic class Main{\n public static void main(String[] args) throws Exception{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n String[] line = br.readLine().split(\" \");\n int[] nums = new int[n];\n int i;\n boolean flag = false;\n nums[n-1] = Integer.parseInt(line[n-1]);\n for(i=n-2; 0<=i; i--){\n nums[i] = Integer.parseInt(line[i]);\n if( nums[i] > nums[i+1] ){\n if( nums[i]-1 > nums[i+1] || flag ){\n System.out.println(\"No\");\n System.exit(0);\n }else\n flag = true;\n }else\n flag = false;\n }\n System.out.println(\"Yes\");\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "sample_input": "5\n1 2 1 1 3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02953", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\nDecrease the height of the square by 1.\n\nDo nothing.\n\nDetermine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.\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\nIf it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes; otherwise, print No.\n\nSample Input 1\n\n5\n1 2 1 1 3\n\nSample Output 1\n\nYes\n\nYou can achieve the objective by decreasing the height of only the second square from the left by 1.\n\nSample Input 2\n\n4\n1 3 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n1 2 3 4 5\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 701, "cpu_time_ms": 196, "memory_kb": 45268}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s515019327", "group_id": "codeNet:p02953", "input_text": "import java.util.Scanner;\n\npublic class Main{\n\tpublic static void main(String[] args){\n\t\tScanner scanner = new Scanner(System.in);\n\t\tString inputN = scanner.nextLine();\n\t\t\n\t\tString inputP = scanner.nextLine();\n\t\tString[] pStr = inputP.split(\" \", 0);\n\t\t\n\t\tint n = Integer.parseInt(inputN);\n\t\tint pInt[] = new int[n];\n\t\tfor(int i=0;i pInt[i-1]){\n\t\t\t\tpInt[i]--;\n\t\t\t}\n\t\t}\n\t\t\n\t\tboolean isStair = true;\n\t\t\n\t\tfor(int i=1;i pInt[i-1]){\n\t\t\t\tpInt[i]--;\n\t\t\t}\n\t\t}\n\t\t\n\t\tboolean isStair = true;\n\t\t\n\t\tfor(int i=1;i 2018) {\n\t\t\tSystem.out.println(0);\n\t\t\treturn;\n\t\t}\n\t\tlong lMod = (l + 2019) % 2019;\n\t\tlong rMod = (r + 2019) % 2019;\n\t\tif(rMod < lMod) {\n\t\t\tSystem.out.println(0);\n\t\t}\n\t\telse if(rMod == lMod)\n\t\t\tSystem.out.print((rMod * (rMod + 1)) % 2019);\n\t\telse\n\t\t\tSystem.out.println((lMod * (lMod + 1)) % 2019);\n\n\n\t}\n}\n\n", "language": "Java", "metadata": {"date": 1595722660, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p02983.html", "problem_id": "p02983", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02983/input.txt", "sample_output_relpath": "derived/input_output/data/p02983/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02983/Java/s124895124.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s124895124", "user_id": "u465572759"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tlong l = sc.nextLong();\n\t\tlong r = sc.nextLong();\n\t\tsc.close();\n\t\tif(l - r > 2018) {\n\t\t\tSystem.out.println(0);\n\t\t\treturn;\n\t\t}\n\t\tlong lMod = (l + 2019) % 2019;\n\t\tlong rMod = (r + 2019) % 2019;\n\t\tif(rMod < lMod) {\n\t\t\tSystem.out.println(0);\n\t\t}\n\t\telse if(rMod == lMod)\n\t\t\tSystem.out.print((rMod * (rMod + 1)) % 2019);\n\t\telse\n\t\t\tSystem.out.println((lMod * (lMod + 1)) % 2019);\n\n\n\t}\n}\n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "sample_input": "2020 2040\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02983", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 119, "memory_kb": 35612}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s268460897", "group_id": "codeNet:p02983", "input_text": "\nimport java.text.DecimalFormat;\nimport java.util.stream.LongStream;\nimport java.util.stream.IntStream;\nimport java.io.*;\nimport java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n FastScanner sc = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n\n AtCoder problem = new AtCoder(sc);\n problem.solve(out);\n\n out.flush();\n }\n\n}\n\nclass AtCoder {\n\n int L, R;\n\n AtCoder(FastScanner sc) {\n L = sc.nextInt();\n R = sc.nextInt();\n }\n\n void solve(PrintWriter out) {\n long min = Long.MAX_VALUE;\n int cnt = 0;\n outer:\n for (long i = L; i <= R; i++) {\n for (long j = i + 1; j <= R; j++) {\n long rem = i * j % 2019;\n min = Math.min(rem, min);\n cnt++;\n if (cnt > 1e5) break outer;\n }\n }\n out.println(min);\n }\n\n}\n\nclass FastScanner {\n\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte()) {\n return buffer[ptr++];\n } else {\n return -1;\n }\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr])) {\n ptr++;\n }\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {\n throw new NumberFormatException();\n }\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public int[] arrayInt(int N) {\n int[] array = new int[N];\n for (int i = 0; i < N; i++) {\n array[i] = nextInt();\n }\n return array;\n }\n\n public long[] arrayLong(int N) {\n long[] array = new long[N];\n for (int i = 0; i < N; i++) {\n array[i] = nextLong();\n }\n return array;\n }\n\n public double[] arrayDouble(int N) {\n double[] array = new double[N];\n for (int i = 0; i < N; i++) {\n array[i] = nextDouble();\n }\n return array;\n }\n\n public String[] arrayString(int N) {\n String[] array = new String[N];\n for (int i = 0; i < N; i++) {\n array[i] = next();\n }\n return array;\n }\n}\n\nclass My {\n\n static void ans(boolean b) {\n System.out.println(b ? \"Yes\" : \"No\");\n }\n\n static void ANS(boolean b) {\n System.out.println(b ? \"YES\" : \"NO\");\n }\n\n static String sort(String s) {\n char[] ch = s.toCharArray();\n Arrays.sort(ch);\n return String.valueOf(ch);\n }\n\n static String reverse(String s) {\n return new StringBuilder(s).reverse().toString();\n }\n\n static int[] reverse(int[] array) {\n for (int i = 0; i < array.length / 2; i++) {\n int temp = array[i];\n array[i] = array[array.length - 1 - i];\n array[array.length - 1 - i] = temp;\n }\n return array;\n }\n\n static long[] reverse(long[] array) {\n for (int i = 0; i < array.length / 2; i++) {\n long temp = array[i];\n array[i] = array[array.length - 1 - i];\n array[array.length - 1 - i] = temp;\n }\n return array;\n }\n\n static double[] reverse(double[] array) {\n for (int i = 0; i < array.length / 2; i++) {\n double temp = array[i];\n array[i] = array[array.length - 1 - i];\n array[array.length - 1 - i] = temp;\n }\n return array;\n }\n\n static String[] reverse(String[] array) {\n for (int i = 0; i < array.length / 2; i++) {\n String temp = array[i];\n array[i] = array[array.length - 1 - i];\n array[array.length - 1 - i] = temp;\n }\n return array;\n }\n\n static char[] reverse(char[] array) {\n for (int i = 0; i < array.length / 2; i++) {\n char temp = array[i];\n array[i] = array[array.length - 1 - i];\n array[array.length - 1 - i] = temp;\n }\n return array;\n }\n\n static long min(long... numbers) {\n Arrays.sort(numbers);\n return numbers[0];\n }\n\n static int min(int... numbers) {\n Arrays.sort(numbers);\n return numbers[0];\n }\n\n static double min(double... numbers) {\n Arrays.sort(numbers);\n return numbers[0];\n }\n\n static long max(long... numbers) {\n Arrays.sort(numbers);\n return numbers[numbers.length - 1];\n }\n\n static int max(int... numbers) {\n Arrays.sort(numbers);\n return numbers[numbers.length - 1];\n }\n\n static double max(double... numbers) {\n Arrays.sort(numbers);\n return numbers[numbers.length - 1];\n }\n\n static int sum(long number) {\n int sum = 0;\n while (number > 0) {\n sum += number % 10;\n number /= 10;\n }\n return sum;\n }\n\n}\n", "language": "Java", "metadata": {"date": 1592451369, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02983.html", "problem_id": "p02983", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02983/input.txt", "sample_output_relpath": "derived/input_output/data/p02983/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02983/Java/s268460897.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s268460897", "user_id": "u871244227"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "\nimport java.text.DecimalFormat;\nimport java.util.stream.LongStream;\nimport java.util.stream.IntStream;\nimport java.io.*;\nimport java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n FastScanner sc = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n\n AtCoder problem = new AtCoder(sc);\n problem.solve(out);\n\n out.flush();\n }\n\n}\n\nclass AtCoder {\n\n int L, R;\n\n AtCoder(FastScanner sc) {\n L = sc.nextInt();\n R = sc.nextInt();\n }\n\n void solve(PrintWriter out) {\n long min = Long.MAX_VALUE;\n int cnt = 0;\n outer:\n for (long i = L; i <= R; i++) {\n for (long j = i + 1; j <= R; j++) {\n long rem = i * j % 2019;\n min = Math.min(rem, min);\n cnt++;\n if (cnt > 1e5) break outer;\n }\n }\n out.println(min);\n }\n\n}\n\nclass FastScanner {\n\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte()) {\n return buffer[ptr++];\n } else {\n return -1;\n }\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr])) {\n ptr++;\n }\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {\n throw new NumberFormatException();\n }\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public int[] arrayInt(int N) {\n int[] array = new int[N];\n for (int i = 0; i < N; i++) {\n array[i] = nextInt();\n }\n return array;\n }\n\n public long[] arrayLong(int N) {\n long[] array = new long[N];\n for (int i = 0; i < N; i++) {\n array[i] = nextLong();\n }\n return array;\n }\n\n public double[] arrayDouble(int N) {\n double[] array = new double[N];\n for (int i = 0; i < N; i++) {\n array[i] = nextDouble();\n }\n return array;\n }\n\n public String[] arrayString(int N) {\n String[] array = new String[N];\n for (int i = 0; i < N; i++) {\n array[i] = next();\n }\n return array;\n }\n}\n\nclass My {\n\n static void ans(boolean b) {\n System.out.println(b ? \"Yes\" : \"No\");\n }\n\n static void ANS(boolean b) {\n System.out.println(b ? \"YES\" : \"NO\");\n }\n\n static String sort(String s) {\n char[] ch = s.toCharArray();\n Arrays.sort(ch);\n return String.valueOf(ch);\n }\n\n static String reverse(String s) {\n return new StringBuilder(s).reverse().toString();\n }\n\n static int[] reverse(int[] array) {\n for (int i = 0; i < array.length / 2; i++) {\n int temp = array[i];\n array[i] = array[array.length - 1 - i];\n array[array.length - 1 - i] = temp;\n }\n return array;\n }\n\n static long[] reverse(long[] array) {\n for (int i = 0; i < array.length / 2; i++) {\n long temp = array[i];\n array[i] = array[array.length - 1 - i];\n array[array.length - 1 - i] = temp;\n }\n return array;\n }\n\n static double[] reverse(double[] array) {\n for (int i = 0; i < array.length / 2; i++) {\n double temp = array[i];\n array[i] = array[array.length - 1 - i];\n array[array.length - 1 - i] = temp;\n }\n return array;\n }\n\n static String[] reverse(String[] array) {\n for (int i = 0; i < array.length / 2; i++) {\n String temp = array[i];\n array[i] = array[array.length - 1 - i];\n array[array.length - 1 - i] = temp;\n }\n return array;\n }\n\n static char[] reverse(char[] array) {\n for (int i = 0; i < array.length / 2; i++) {\n char temp = array[i];\n array[i] = array[array.length - 1 - i];\n array[array.length - 1 - i] = temp;\n }\n return array;\n }\n\n static long min(long... numbers) {\n Arrays.sort(numbers);\n return numbers[0];\n }\n\n static int min(int... numbers) {\n Arrays.sort(numbers);\n return numbers[0];\n }\n\n static double min(double... numbers) {\n Arrays.sort(numbers);\n return numbers[0];\n }\n\n static long max(long... numbers) {\n Arrays.sort(numbers);\n return numbers[numbers.length - 1];\n }\n\n static int max(int... numbers) {\n Arrays.sort(numbers);\n return numbers[numbers.length - 1];\n }\n\n static double max(double... numbers) {\n Arrays.sort(numbers);\n return numbers[numbers.length - 1];\n }\n\n static int sum(long number) {\n int sum = 0;\n while (number > 0) {\n sum += number % 10;\n number /= 10;\n }\n return sum;\n }\n\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "sample_input": "2020 2040\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02983", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 6625, "cpu_time_ms": 79, "memory_kb": 21588}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s172892787", "group_id": "codeNet:p02983", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc=new Scanner(System.in);\n\t\tint l=sc.nextInt(),r=sc.nextInt();\n\t\tsc.close();\n\t\tif(r-l>=2018) System.out.println(0);\n\t\telse {\n\t\t\tlong min=2018;\n\t\t\tfor(int i=l;i=2018) System.out.println(0);\n\t\telse {\n\t\t\tlong min=2018;\n\t\t\tfor(int i=l;i{\n int a;\n int b;\n public Pair(int x,int y){a=x;b=y;}\n public Pair(){}\n public int compareTo(Pair p){\n return a - p.a ;\n }\n }\nstatic class TrieNode{\n TrieNode[]child;\n int w;\n boolean term;\n TrieNode(){\n child = new TrieNode[26]; \n }\n}\n public static int gcd(int a,int b)\n {\n if(a>adj ;\nstatic boolean[]vis;\nstatic void dfs(int sv,int d,int[]dis) {\n\tvis[sv] = true;\n\tdis[sv] = d;\n\tfor(int i=0;i0){\n \tint l = s.nextInt();\n \tint r = s.nextInt();\n \tif(r - l > 2019) {\n \t\tout.println(\"0\");\n \t}\n \telse {\n \t\tint ans = 2020;\n \t\tfor(int i=l;i<=r;i++) {\n \t\t\tfor(int j=i+1;j<=r;j++) {\n \t\t\t\tans = Math.min(ans, (i*j)%2019);\n \t\t\t}\n \t\t}\n \t\tout.println(ans);\n \t}\n }\n \n \n out.flush();\n}\n \n \n \n \n \n //-----------PrintWriter for faster output---------------------------------\n public static PrintWriter out;\n \n //-----------MyScanner class for faster input----------\n public static class MyScanner {\n BufferedReader br;\n StringTokenizer st;\n \n public MyScanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n \n String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n \n int nextInt() { return Integer.parseInt(next()); }\n long nextLong() { return Long.parseLong(next()); }\n double nextDouble() { return Double.parseDouble(next()); }\n \n String nextLine(){\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n }\n //--------------------------------------------------------\n}\n", "language": "Java", "metadata": {"date": 1589611560, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02983.html", "problem_id": "p02983", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02983/input.txt", "sample_output_relpath": "derived/input_output/data/p02983/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02983/Java/s050519747.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s050519747", "user_id": "u683057705"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.io.*;\nimport java.util.*;\nimport java.math.*;\n\n \n public class Main\t{\n static class Pair implements Comparable{\n int a;\n int b;\n public Pair(int x,int y){a=x;b=y;}\n public Pair(){}\n public int compareTo(Pair p){\n return a - p.a ;\n }\n }\nstatic class TrieNode{\n TrieNode[]child;\n int w;\n boolean term;\n TrieNode(){\n child = new TrieNode[26]; \n }\n}\n public static int gcd(int a,int b)\n {\n if(a>adj ;\nstatic boolean[]vis;\nstatic void dfs(int sv,int d,int[]dis) {\n\tvis[sv] = true;\n\tdis[sv] = d;\n\tfor(int i=0;i0){\n \tint l = s.nextInt();\n \tint r = s.nextInt();\n \tif(r - l > 2019) {\n \t\tout.println(\"0\");\n \t}\n \telse {\n \t\tint ans = 2020;\n \t\tfor(int i=l;i<=r;i++) {\n \t\t\tfor(int j=i+1;j<=r;j++) {\n \t\t\t\tans = Math.min(ans, (i*j)%2019);\n \t\t\t}\n \t\t}\n \t\tout.println(ans);\n \t}\n }\n \n \n out.flush();\n}\n \n \n \n \n \n //-----------PrintWriter for faster output---------------------------------\n public static PrintWriter out;\n \n //-----------MyScanner class for faster input----------\n public static class MyScanner {\n BufferedReader br;\n StringTokenizer st;\n \n public MyScanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n \n String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n \n int nextInt() { return Integer.parseInt(next()); }\n long nextLong() { return Long.parseLong(next()); }\n double nextDouble() { return Double.parseDouble(next()); }\n \n String nextLine(){\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n }\n //--------------------------------------------------------\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "sample_input": "2020 2040\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02983", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3549, "cpu_time_ms": 84, "memory_kb": 23764}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s572278590", "group_id": "codeNet:p02983", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tlong L = sc.nextLong();\n\t\tlong R = sc.nextLong();\n\t\tif (L%2019==0||R%2019==0) {\n\t\t\tSystem.out.println(0);\n\t\t\treturn ;\n\t\t}\n\t\tif (L/2019!=R/2019) {\n\t\t\tSystem.out.println(0);\n\t\t\treturn ;\n\t\t}\n\t\tint min = 2019;\n\t\tfor (long i=L;ia){min=a;}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(min);\n\t}\n}", "language": "Java", "metadata": {"date": 1565821740, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02983.html", "problem_id": "p02983", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02983/input.txt", "sample_output_relpath": "derived/input_output/data/p02983/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02983/Java/s372094783.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s372094783", "user_id": "u954094464"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.*;\nclass Main{\n\tpublic static void main(String[] args){\n\t\tScanner sc=new Scanner(System.in);\n\t\tint L=sc.nextInt();\n\t\tint R=sc.nextInt();\n\t\tint min=0;\n\t\tif(L%2019==0||R%2019==0||L/2019a){min=a;}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(min);\n\t}\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "sample_input": "2020 2040\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02983", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 404, "cpu_time_ms": 103, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s588933574", "group_id": "codeNet:p02983", "input_text": "import java.util.*;\n\npublic class Main{\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int L=sc.nextInt();\n int R=sc.nextInt();\n\n //0 < L <= i < j <= R\n\n int mod,ii,jj;\n int ans = 2019;\n\n for(int i=L;i2019){\n R = L+2019;\n }\n if(L >= 2019){\n L %= 2019;\n R %= 2019;\n }\n for(int i = L; i 0 ) {\n result = N % 2019;\n } else if(N%2019 == 0){\n result = N % 2019;\n break;\n }\n }\n }\n System.out.println(result);\n \n \n }catch(IOException e) {\n \n }\n }\n\n}", "language": "Java", "metadata": {"date": 1563817512, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02983.html", "problem_id": "p02983", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02983/input.txt", "sample_output_relpath": "derived/input_output/data/p02983/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02983/Java/s557705240.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s557705240", "user_id": "u526829702"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\npublic class Main {\n\n public static void main(String[] args) {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n try {\n String str = br.readLine();\n String input[] = str.split(\" \");\n int L = Integer.valueOf(input[0]);\n int R = Integer.valueOf(input[1]);\n \n int result = 2018;\n if(R-L >2019){\n R = L+2019;\n }\n if(L >= 2019){\n L %= 2019;\n R %= 2019;\n }\n for(int i = L; i 0 ) {\n result = N % 2019;\n } else if(N%2019 == 0){\n result = N % 2019;\n break;\n }\n }\n }\n System.out.println(result);\n \n \n }catch(IOException e) {\n \n }\n }\n\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "sample_input": "2020 2040\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02983", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1249, "cpu_time_ms": 74, "memory_kb": 22356}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s554043342", "group_id": "codeNet:p02983", "input_text": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\npublic class Main {\n\n public static void main(String[] args) {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n try {\n String str = br.readLine();\n String input[] = str.split(\" \");\n int L = Integer.valueOf(input[0]);\n int R = Integer.valueOf(input[1]);\n \tif(L>R || L < 0 || R>2000000000) {\n System.exit(1);\n }\n \n int result = 2018;\n for(int i = L; iR || L < 0 || R>2000000000) {\n System.exit(1);\n }\n \n int result = 2018;\n for(int i = L; i=2019){\n System.out.println(0);\n }else{\n for(long i=L;i=2019){\n System.out.println(0);\n }else{\n for(long i=L;i i; j--) {\n\t\t\t\tif(min > Math.floorMod(i * j , 2019)) {\n\t\t\t\t\tmin = Math.floorMod(i * j , 2019);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(min);\n\t\tsc.close();\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1562952181, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02983.html", "problem_id": "p02983", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02983/input.txt", "sample_output_relpath": "derived/input_output/data/p02983/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02983/Java/s264547475.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s264547475", "user_id": "u978944540"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main{\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tlong R = sc.nextLong();\n\t\tlong L = sc.nextLong();\n\t\t\n\t\tlong min = Long.MAX_VALUE;\n\t\t\n\t\tfor(long i = R; i < L-1; i++) {\n\t\t\tfor(long j = L; j > i; j--) {\n\t\t\t\tif(min > Math.floorMod(i * j , 2019)) {\n\t\t\t\t\tmin = Math.floorMod(i * j , 2019);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(min);\n\t\tsc.close();\n\t}\n\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "sample_input": "2020 2040\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02983", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2109, "memory_kb": 23892}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s053970589", "group_id": "codeNet:p02983", "input_text": "import java.io.*;\nclass Main{\n public static void main(String[] args) throws Exception{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n String sb1 = br.readLine();\n String[] a = sb1.split(\" \");\n long[] c = new long[a.length];\n long[] b = new long[a.length];\n long d = 2019;\n for(int i = 0;i < a.length;i++){\n c[i] = Long.parseLong(a[i]);\n }\n for(int i = 0;i < a.length;i++){\n b[i] = c[i]/d;\n }\n \n if(c[1] < 2019){\n System.out.println(c[0] * (c[0] + 1));\n System.out.println(1);\n } else if(b[0] == b[1]){\n System.out.println((c[0] * (c[0] + 1) %2019));\n } else {\n System.out.println(0);\n }\n \n }\n}", "language": "Java", "metadata": {"date": 1562864473, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02983.html", "problem_id": "p02983", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02983/input.txt", "sample_output_relpath": "derived/input_output/data/p02983/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02983/Java/s053970589.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s053970589", "user_id": "u676749446"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.io.*;\nclass Main{\n public static void main(String[] args) throws Exception{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n String sb1 = br.readLine();\n String[] a = sb1.split(\" \");\n long[] c = new long[a.length];\n long[] b = new long[a.length];\n long d = 2019;\n for(int i = 0;i < a.length;i++){\n c[i] = Long.parseLong(a[i]);\n }\n for(int i = 0;i < a.length;i++){\n b[i] = c[i]/d;\n }\n \n if(c[1] < 2019){\n System.out.println(c[0] * (c[0] + 1));\n System.out.println(1);\n } else if(b[0] == b[1]){\n System.out.println((c[0] * (c[0] + 1) %2019));\n } else {\n System.out.println(0);\n }\n \n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "sample_input": "2020 2040\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02983", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 809, "cpu_time_ms": 71, "memory_kb": 22356}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s060699527", "group_id": "codeNet:p02983", "input_text": "import java.util.*;\npublic class Main {\n\tpublic static void main(String args[] ){\n\t\tScanner sc =new Scanner(System.in);\n\tlong n = sc.nextLong();\n\tlong m =sc.nextLong();\n\tlong min =Integer.MAX_VALUE;\n\t\n\t\n\tif(m<2019) {\n\t\tlong data =(n*(n+1))%2019;\n\t\tmin =data;\n\t}else{\n\t\tfor(long i=n;i data) {\n\t\t\t\t\t//System.out.println(i+\" \"+j);\n\t\t\t\t\tmin =data;\n\t\t\t\t}\n\t\t\t\tif(min==0) break;\n\t\t\t\t\n\t\t\t}\n\t\t\tif(min==0) break;\n\t\t}\n\t\t}\n\t\n\t\n\tSystem.out.println(min);\n\t\n\t\n\t}\n}\n", "language": "Java", "metadata": {"date": 1562564262, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02983.html", "problem_id": "p02983", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02983/input.txt", "sample_output_relpath": "derived/input_output/data/p02983/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02983/Java/s060699527.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s060699527", "user_id": "u014079196"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n\tpublic static void main(String args[] ){\n\t\tScanner sc =new Scanner(System.in);\n\tlong n = sc.nextLong();\n\tlong m =sc.nextLong();\n\tlong min =Integer.MAX_VALUE;\n\t\n\t\n\tif(m<2019) {\n\t\tlong data =(n*(n+1))%2019;\n\t\tmin =data;\n\t}else{\n\t\tfor(long i=n;i data) {\n\t\t\t\t\t//System.out.println(i+\" \"+j);\n\t\t\t\t\tmin =data;\n\t\t\t\t}\n\t\t\t\tif(min==0) break;\n\t\t\t\t\n\t\t\t}\n\t\t\tif(min==0) break;\n\t\t}\n\t\t}\n\t\n\t\n\tSystem.out.println(min);\n\t\n\t\n\t}\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "sample_input": "2020 2040\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02983", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 528, "cpu_time_ms": 108, "memory_kb": 23252}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s972223161", "group_id": "codeNet:p02983", "input_text": "\nimport java.util.Scanner;\n \npublic class Main {\n \n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n long L = scan.nextLong();\n long R = scan.nextLong();\n \n long result = 2018;\n\n for (long i = L; i < R; i++){\n for (long j = i + 1; j <= R; j++){\n long mod = (i * j) % 2019;\n if(result > mod) result = mod;\n if(result == 0) break;\n }\n if(result == 0) break;\n }\n\n System.out.println(result);\n }\n}", "language": "Java", "metadata": {"date": 1562556592, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02983.html", "problem_id": "p02983", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02983/input.txt", "sample_output_relpath": "derived/input_output/data/p02983/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02983/Java/s972223161.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s972223161", "user_id": "u537235757"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "\nimport java.util.Scanner;\n \npublic class Main {\n \n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n long L = scan.nextLong();\n long R = scan.nextLong();\n \n long result = 2018;\n\n for (long i = L; i < R; i++){\n for (long j = i + 1; j <= R; j++){\n long mod = (i * j) % 2019;\n if(result > mod) result = mod;\n if(result == 0) break;\n }\n if(result == 0) break;\n }\n\n System.out.println(result);\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "sample_input": "2020 2040\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02983", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 566, "cpu_time_ms": 110, "memory_kb": 23764}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s910153833", "group_id": "codeNet:p02983", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n long l = Long.parseLong(sc.next());\n long r = Long.parseLong(sc.next());\n long ans = Long.MAX_VALUE;\n long num = 0;\n for (long i = l; i < r; i++) {\n for (long j = i + 1; j <= r; j++) {\n num = (i * j) % 2019;\n if (num < ans) {\n ans = num;\n }\n if (num == 0) {\n System.out.println(0);\n return;\n }\n }\n }\n System.out.println(ans);\n }\n}", "language": "Java", "metadata": {"date": 1562556139, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02983.html", "problem_id": "p02983", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02983/input.txt", "sample_output_relpath": "derived/input_output/data/p02983/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02983/Java/s910153833.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s910153833", "user_id": "u522656211"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n long l = Long.parseLong(sc.next());\n long r = Long.parseLong(sc.next());\n long ans = Long.MAX_VALUE;\n long num = 0;\n for (long i = l; i < r; i++) {\n for (long j = i + 1; j <= r; j++) {\n num = (i * j) % 2019;\n if (num < ans) {\n ans = num;\n }\n if (num == 0) {\n System.out.println(0);\n return;\n }\n }\n }\n System.out.println(ans);\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "sample_input": "2020 2040\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02983", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 95, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s620902528", "group_id": "codeNet:p02983", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tlong L = sc.nextLong();\n\t\tlong R = sc.nextLong();\n\n\t\tif (R - L >= 2019) {\n\t\t\tSystem.out.println(0);\n\t\t\treturn;\n\t\t}\n\n\t\tlong ans = Long.MAX_VALUE;\n\t\tfor (long i = L; i < R; i++) {\n\t\t\tlong tmp =0;\n\t\t\tfor (long j = i+1; j <= R; j++) {\n\t\t\t\ttmp=(i*j)%2019;\n\t\t\t\tans = Math.min(ans, tmp);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}\n", "language": "Java", "metadata": {"date": 1562555508, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02983.html", "problem_id": "p02983", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02983/input.txt", "sample_output_relpath": "derived/input_output/data/p02983/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02983/Java/s620902528.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s620902528", "user_id": "u820451342"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tlong L = sc.nextLong();\n\t\tlong R = sc.nextLong();\n\n\t\tif (R - L >= 2019) {\n\t\t\tSystem.out.println(0);\n\t\t\treturn;\n\t\t}\n\n\t\tlong ans = Long.MAX_VALUE;\n\t\tfor (long i = L; i < R; i++) {\n\t\t\tlong tmp =0;\n\t\t\tfor (long j = i+1; j <= R; j++) {\n\t\t\t\ttmp=(i*j)%2019;\n\t\t\t\tans = Math.min(ans, tmp);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "sample_input": "2020 2040\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02983", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 453, "cpu_time_ms": 102, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s316008217", "group_id": "codeNet:p02983", "input_text": "import java.io.*;\nimport java.util.*;\n\n\npublic class Main {\n\n public static void main(String[] args) {\n FastScanner sc = new FastScanner(System.in);\n int l = sc.nextInt() % 2019;\n int r = sc.nextInt() % 2019;\n int mini = 2019;\n for (int i = l + 1; i <= r; i++) {\n for (int j = l; j < i; j++) {\n if ((j * i) % 2019 < mini) {\n mini = (j * i) % 2019;\n }\n }\n }\n if(mini ==2019){\n \tmini = l;\n }\n System.out.println(mini);\n }\n\n\n static class FastScanner {\n private BufferedReader reader;\n private StringTokenizer tokenizer;\n\n public FastScanner(InputStream in) {\n reader = new BufferedReader(new InputStreamReader(in));\n tokenizer = null;\n }\n\n public String next() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public String nextLine() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n return reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n\n return tokenizer.nextToken(\"\\n\");\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n\n public long[] nextLongArray(int n) {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = nextLong();\n return a;\n }\n }\n}", "language": "Java", "metadata": {"date": 1562553188, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02983.html", "problem_id": "p02983", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02983/input.txt", "sample_output_relpath": "derived/input_output/data/p02983/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02983/Java/s316008217.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s316008217", "user_id": "u060469111"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.io.*;\nimport java.util.*;\n\n\npublic class Main {\n\n public static void main(String[] args) {\n FastScanner sc = new FastScanner(System.in);\n int l = sc.nextInt() % 2019;\n int r = sc.nextInt() % 2019;\n int mini = 2019;\n for (int i = l + 1; i <= r; i++) {\n for (int j = l; j < i; j++) {\n if ((j * i) % 2019 < mini) {\n mini = (j * i) % 2019;\n }\n }\n }\n if(mini ==2019){\n \tmini = l;\n }\n System.out.println(mini);\n }\n\n\n static class FastScanner {\n private BufferedReader reader;\n private StringTokenizer tokenizer;\n\n public FastScanner(InputStream in) {\n reader = new BufferedReader(new InputStreamReader(in));\n tokenizer = null;\n }\n\n public String next() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public String nextLine() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n return reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n\n return tokenizer.nextToken(\"\\n\");\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n\n public long[] nextLongArray(int n) {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = nextLong();\n return a;\n }\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "sample_input": "2020 2040\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02983", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2025, "cpu_time_ms": 83, "memory_kb": 21204}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s980445057", "group_id": "codeNet:p02983", "input_text": "import java.util.*;\n \npublic class Main {\n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n \n int a = scan.nextInt();\n int b = scan.nextInt();\n if((b-a)%2019==0&&(a%2019)!=0&&(b%2019)!=0){\n System.out.println(((a%2019)*((a+1)%2019))%2019);\n }else{\n System.out.println(0);\n }\n }\n}", "language": "Java", "metadata": {"date": 1562553079, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02983.html", "problem_id": "p02983", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02983/input.txt", "sample_output_relpath": "derived/input_output/data/p02983/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02983/Java/s980445057.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s980445057", "user_id": "u704651206"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.*;\n \npublic class Main {\n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n \n int a = scan.nextInt();\n int b = scan.nextInt();\n if((b-a)%2019==0&&(a%2019)!=0&&(b%2019)!=0){\n System.out.println(((a%2019)*((a+1)%2019))%2019);\n }else{\n System.out.println(0);\n }\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "sample_input": "2020 2040\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02983", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 382, "cpu_time_ms": 97, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s388864756", "group_id": "codeNet:p02983", "input_text": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int left = Integer.parseInt(in.next());\n int right = Integer.parseInt(in.next());\n in.close();\n int leftdiv = left / 2019;\n int rightdiv = right / 2019;\n int leftMod = left % 2019;\n int ans = 0;\n if (leftdiv == rightdiv) {\n ans = leftMod * (leftMod + 1) % 2019;\n }\n System.out.println(ans);\n }\n}\n", "language": "Java", "metadata": {"date": 1562552866, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02983.html", "problem_id": "p02983", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02983/input.txt", "sample_output_relpath": "derived/input_output/data/p02983/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02983/Java/s388864756.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s388864756", "user_id": "u018916376"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int left = Integer.parseInt(in.next());\n int right = Integer.parseInt(in.next());\n in.close();\n int leftdiv = left / 2019;\n int rightdiv = right / 2019;\n int leftMod = left % 2019;\n int ans = 0;\n if (leftdiv == rightdiv) {\n ans = leftMod * (leftMod + 1) % 2019;\n }\n System.out.println(ans);\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "sample_input": "2020 2040\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02983", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 518, "cpu_time_ms": 91, "memory_kb": 24020}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s448762973", "group_id": "codeNet:p02983", "input_text": "import java.util.*;\n \npublic class Main {\n\tpublic static void main (String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\t\n\t\tlong L = in.nextLong();\n long R = in.nextLong();\n if(L>4037){L=L/2019;R=R/2019;}\n \n if(L>2019){System.out.print((L*(L+1))%2019);}\n else if(R<2019){System.out.print((R*(R-1))%2019);}\n \n\t}\n}", "language": "Java", "metadata": {"date": 1562552847, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02983.html", "problem_id": "p02983", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02983/input.txt", "sample_output_relpath": "derived/input_output/data/p02983/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02983/Java/s448762973.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s448762973", "user_id": "u646483356"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.*;\n \npublic class Main {\n\tpublic static void main (String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\t\n\t\tlong L = in.nextLong();\n long R = in.nextLong();\n if(L>4037){L=L/2019;R=R/2019;}\n \n if(L>2019){System.out.print((L*(L+1))%2019);}\n else if(R<2019){System.out.print((R*(R-1))%2019);}\n \n\t}\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "sample_input": "2020 2040\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02983", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 348, "cpu_time_ms": 101, "memory_kb": 23892}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s802815198", "group_id": "codeNet:p02983", "input_text": "import java.util.*;\npublic class Main {\n \n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n int L = sc.nextInt();\n int R = sc.nextInt();\n \n if ((R / 2019) > (L / 2019)) {\n System.out.println(0);\n return;\n }\n \n int a = Math.min(L%2019, R%2019);\n \n System.out.println(a*(a + 1));\n } \n}\n", "language": "Java", "metadata": {"date": 1562551723, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02983.html", "problem_id": "p02983", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02983/input.txt", "sample_output_relpath": "derived/input_output/data/p02983/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02983/Java/s802815198.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s802815198", "user_id": "u507706381"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n \n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n int L = sc.nextInt();\n int R = sc.nextInt();\n \n if ((R / 2019) > (L / 2019)) {\n System.out.println(0);\n return;\n }\n \n int a = Math.min(L%2019, R%2019);\n \n System.out.println(a*(a + 1));\n } \n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "sample_input": "2020 2040\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02983", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 95, "memory_kb": 21588}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s923437528", "group_id": "codeNet:p02983", "input_text": "\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n\n Scanner scanner = new Scanner(System.in);\n long L = scanner.nextLong();\n long R = scanner.nextLong();\n\n\n long modL = mod2019(mod2019(L));\n long modR = mod2019(mod2019(R));\n\n long nextMod0Number = (L + 2019 - modL);\n\n if (nextMod0Number < R) {\n System.out.println(mod2019((nextMod0Number * (nextMod0Number + 1))));\n } else if (nextMod0Number == R) {\n System.out.println(mod2019(R + nextMod0Number));\n } else {\n System.out.println(mod2019(L * (L + 1)));\n }\n }\n\n private static long mod2019(long hoge) {\n return hoge % 2019;\n }\n}", "language": "Java", "metadata": {"date": 1562551225, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02983.html", "problem_id": "p02983", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02983/input.txt", "sample_output_relpath": "derived/input_output/data/p02983/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02983/Java/s923437528.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s923437528", "user_id": "u298823169"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n\n Scanner scanner = new Scanner(System.in);\n long L = scanner.nextLong();\n long R = scanner.nextLong();\n\n\n long modL = mod2019(mod2019(L));\n long modR = mod2019(mod2019(R));\n\n long nextMod0Number = (L + 2019 - modL);\n\n if (nextMod0Number < R) {\n System.out.println(mod2019((nextMod0Number * (nextMod0Number + 1))));\n } else if (nextMod0Number == R) {\n System.out.println(mod2019(R + nextMod0Number));\n } else {\n System.out.println(mod2019(L * (L + 1)));\n }\n }\n\n private static long mod2019(long hoge) {\n return hoge % 2019;\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "sample_input": "2020 2040\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02983", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 97, "memory_kb": 21716}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s678973051", "group_id": "codeNet:p02983", "input_text": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.util.NoSuchElementException;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tFScanner sc = new FScanner();\n\t\tlong L = sc.nextLong();\n\t\tlong R = sc.nextLong();\n\t\tif (R < 2019) {\n\t\t\tlong min = (L * R) % 2019;\n\t\t\tfor (long i = L; i < R; i++) {\n\t\t\t\tfor (long j = i + 1; j <= R; j++) {\n\t\t\t\t\tlong cal = (i * j) % 2019;\n\t\t\t\t\tmin = Math.min(min, cal);\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(min);\n\t\t\treturn;\n\t\t} else {\n\t\t\tint q = 1;\n\t\t\tboolean contain = false;\n\t\t\twhile (q * 2019 <= R) {\n\t\t\t\tif (L <= q * 2019 && R >= 2019 * q) {\n\t\t\t\t\tcontain = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tq++;\n\t\t\t}\n\t\t\tif (contain) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t} else {\n\t\t\t\tlong min = (L * R) % 2019;\n\t\t\t\tfor (long i = L; i < R; i++) {\n\t\t\t\t\tfor (long j = i + 1; j <= R; j++) {\n\t\t\t\t\t\tlong cal = (i * j) % 2019;\n\t\t\t\t\t\tmin = Math.min(min, cal);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tSystem.out.println(min);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n\n}\n\nclass FScanner {\n\tprivate final InputStream in = System.in;\n\tprivate final byte[] buffer = new byte[1024];\n\tprivate int ptr = 0;\n\tprivate int buflen = 0;\n\n\tprivate boolean hasNextByte() {\n\t\tif (ptr < buflen) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\tptr = 0;\n\t\t\ttry {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\tprivate int readByte() {\n\t\tif (hasNextByte())\n\t\t\treturn buffer[ptr++];\n\t\telse\n\t\t\treturn -1;\n\t}\n\n\tprivate static boolean isPrintableChar(int c) {\n\t\treturn 33 <= c && c <= 126;\n\t}\n\n\tpublic boolean hasNext() {\n\t\twhile (hasNextByte() && !isPrintableChar(buffer[ptr]))\n\t\t\tptr++;\n\t\treturn hasNextByte();\n\t}\n\n\tpublic String next() {\n\t\tif (!hasNext())\n\t\t\tthrow new NoSuchElementException();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint b = readByte();\n\t\twhile (isPrintableChar(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\n\tpublic long nextLong() {\n\t\tif (!hasNext())\n\t\t\tthrow new NoSuchElementException();\n\t\tlong n = 0;\n\t\tboolean minus = false;\n\t\tint b = readByte();\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\tif (b < '0' || '9' < b) {\n\t\t\tthrow new NumberFormatException();\n\t\t}\n\t\twhile (true) {\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n\tpublic int nextInt() {\n\t\tlong nl = nextLong();\n\t\tif (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)\n\t\t\tthrow new NumberFormatException();\n\t\treturn (int) nl;\n\t}\n\n\tpublic double nextDouble() {\n\t\treturn Double.parseDouble(next());\n\t}\n}", "language": "Java", "metadata": {"date": 1562551105, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02983.html", "problem_id": "p02983", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02983/input.txt", "sample_output_relpath": "derived/input_output/data/p02983/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02983/Java/s678973051.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s678973051", "user_id": "u163859002"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.util.NoSuchElementException;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tFScanner sc = new FScanner();\n\t\tlong L = sc.nextLong();\n\t\tlong R = sc.nextLong();\n\t\tif (R < 2019) {\n\t\t\tlong min = (L * R) % 2019;\n\t\t\tfor (long i = L; i < R; i++) {\n\t\t\t\tfor (long j = i + 1; j <= R; j++) {\n\t\t\t\t\tlong cal = (i * j) % 2019;\n\t\t\t\t\tmin = Math.min(min, cal);\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(min);\n\t\t\treturn;\n\t\t} else {\n\t\t\tint q = 1;\n\t\t\tboolean contain = false;\n\t\t\twhile (q * 2019 <= R) {\n\t\t\t\tif (L <= q * 2019 && R >= 2019 * q) {\n\t\t\t\t\tcontain = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tq++;\n\t\t\t}\n\t\t\tif (contain) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t} else {\n\t\t\t\tlong min = (L * R) % 2019;\n\t\t\t\tfor (long i = L; i < R; i++) {\n\t\t\t\t\tfor (long j = i + 1; j <= R; j++) {\n\t\t\t\t\t\tlong cal = (i * j) % 2019;\n\t\t\t\t\t\tmin = Math.min(min, cal);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tSystem.out.println(min);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n\n}\n\nclass FScanner {\n\tprivate final InputStream in = System.in;\n\tprivate final byte[] buffer = new byte[1024];\n\tprivate int ptr = 0;\n\tprivate int buflen = 0;\n\n\tprivate boolean hasNextByte() {\n\t\tif (ptr < buflen) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\tptr = 0;\n\t\t\ttry {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\tprivate int readByte() {\n\t\tif (hasNextByte())\n\t\t\treturn buffer[ptr++];\n\t\telse\n\t\t\treturn -1;\n\t}\n\n\tprivate static boolean isPrintableChar(int c) {\n\t\treturn 33 <= c && c <= 126;\n\t}\n\n\tpublic boolean hasNext() {\n\t\twhile (hasNextByte() && !isPrintableChar(buffer[ptr]))\n\t\t\tptr++;\n\t\treturn hasNextByte();\n\t}\n\n\tpublic String next() {\n\t\tif (!hasNext())\n\t\t\tthrow new NoSuchElementException();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint b = readByte();\n\t\twhile (isPrintableChar(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\n\tpublic long nextLong() {\n\t\tif (!hasNext())\n\t\t\tthrow new NoSuchElementException();\n\t\tlong n = 0;\n\t\tboolean minus = false;\n\t\tint b = readByte();\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\tif (b < '0' || '9' < b) {\n\t\t\tthrow new NumberFormatException();\n\t\t}\n\t\twhile (true) {\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n\tpublic int nextInt() {\n\t\tlong nl = nextLong();\n\t\tif (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)\n\t\t\tthrow new NumberFormatException();\n\t\treturn (int) nl;\n\t}\n\n\tpublic double nextDouble() {\n\t\treturn Double.parseDouble(next());\n\t}\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "sample_input": "2020 2040\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02983", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2682, "cpu_time_ms": 81, "memory_kb": 22868}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s302602046", "group_id": "codeNet:p02983", "input_text": "import java.util.Scanner;\n\nclass Main{\n\t\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint L = sc.nextInt();\n\t\tint R = sc.nextInt();\n\t\tint min = 2019;\n\t\tint mod = 0;\n\t\tfor(int i = L; i < R; i++) {\n\t\t\tfor(int j = i + 1;j <= R; j++) {\n\t\t\t\tmod = (i % 2019) * (j % 2019) % 2019;\n\t\t\t\tif(mod < min) min = mod;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(min);\n\t\tsc.close();\n\t}\n}", "language": "Java", "metadata": {"date": 1562551023, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02983.html", "problem_id": "p02983", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02983/input.txt", "sample_output_relpath": "derived/input_output/data/p02983/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02983/Java/s302602046.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s302602046", "user_id": "u126404727"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.Scanner;\n\nclass Main{\n\t\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint L = sc.nextInt();\n\t\tint R = sc.nextInt();\n\t\tint min = 2019;\n\t\tint mod = 0;\n\t\tfor(int i = L; i < R; i++) {\n\t\t\tfor(int j = i + 1;j <= R; j++) {\n\t\t\t\tmod = (i % 2019) * (j % 2019) % 2019;\n\t\t\t\tif(mod < min) min = mod;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(min);\n\t\tsc.close();\n\t}\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "sample_input": "2020 2040\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02983", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2109, "memory_kb": 21972}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s908671414", "group_id": "codeNet:p02983", "input_text": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int l = sc.nextInt();\n int r = sc.nextInt();\n\n int min = Integer.MAX_VALUE;\n int tmp = Math.min(r, l + 2019);\n for (int i = l+1; i <= tmp; i++) {\n for (int j = l; j < i; j++) {\n min = Math.min(min, (i * j) % 2019);\n }\n }\n\n System.out.println(min);\n }\n}", "language": "Java", "metadata": {"date": 1562549986, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02983.html", "problem_id": "p02983", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02983/input.txt", "sample_output_relpath": "derived/input_output/data/p02983/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02983/Java/s908671414.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s908671414", "user_id": "u387806792"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int l = sc.nextInt();\n int r = sc.nextInt();\n\n int min = Integer.MAX_VALUE;\n int tmp = Math.min(r, l + 2019);\n for (int i = l+1; i <= tmp; i++) {\n for (int j = l; j < i; j++) {\n min = Math.min(min, (i * j) % 2019);\n }\n }\n\n System.out.println(min);\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "sample_input": "2020 2040\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02983", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 480, "cpu_time_ms": 122, "memory_kb": 21972}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s489281988", "group_id": "codeNet:p02983", "input_text": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.IOException;\n\nclass MyScanner {\n BufferedReader br;\n\n MyScanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n public int intLine() throws IOException {\n return Integer.parseInt(br.readLine());\n }\n\n public String line() throws IOException {\n return br.readLine();\n }\n\n public int[] intArray() throws IOException {\n String[] in = br.readLine().split(\" \");\n int n = in.length;\n int[] res = new int[n];\n for(int i = 0; i < n; i++) {\n res[i] = Integer.parseInt(in[i]);\n }\n return res;\n }\n}\n\npublic class Main {\n public static void main(String[] args) throws IOException {\n MyScanner sc = new MyScanner();\n\n int[] in = sc.intArray();\n int l = in[0];\n int r = in[1];\n\n /*\n int min = 2019;\n boolean minIsR = true;\n int max = 0;\n boolean maxIsL = true;\n for(int i = l; i <= r; i++) {\n int remainder = i % 2019;\n if(min >= remainder) {\n min = remainder;\n minIsR &= (i == r);\n }\n if(max <= remainder) {\n max = remainder;\n maxIsL &= (i == l);\n }\n }\n if(min == 0) {\n System.out.println(0);\n }else {\n int ans = 2019;\n if(!minIsR) {\n ans = Math.min(ans, (min * (min + 1)) % 2019);\n }\n if(!maxIsL) {\n ans = Math.min(ans, (max * (max - 1)) % 2019);\n }\n System.out.println(ans);\n }\n */\n\n int ans = 2019;\n for(int i = l; i < r; i++) {\n ans = Math.min(ans, ((i % 2019) * ((i + 1) % 2019)) % 2019);\n }\n System.out.println(ans);\n\n sc.br.close();\n }\n}", "language": "Java", "metadata": {"date": 1562549381, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02983.html", "problem_id": "p02983", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02983/input.txt", "sample_output_relpath": "derived/input_output/data/p02983/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02983/Java/s489281988.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s489281988", "user_id": "u976817999"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.IOException;\n\nclass MyScanner {\n BufferedReader br;\n\n MyScanner() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n public int intLine() throws IOException {\n return Integer.parseInt(br.readLine());\n }\n\n public String line() throws IOException {\n return br.readLine();\n }\n\n public int[] intArray() throws IOException {\n String[] in = br.readLine().split(\" \");\n int n = in.length;\n int[] res = new int[n];\n for(int i = 0; i < n; i++) {\n res[i] = Integer.parseInt(in[i]);\n }\n return res;\n }\n}\n\npublic class Main {\n public static void main(String[] args) throws IOException {\n MyScanner sc = new MyScanner();\n\n int[] in = sc.intArray();\n int l = in[0];\n int r = in[1];\n\n /*\n int min = 2019;\n boolean minIsR = true;\n int max = 0;\n boolean maxIsL = true;\n for(int i = l; i <= r; i++) {\n int remainder = i % 2019;\n if(min >= remainder) {\n min = remainder;\n minIsR &= (i == r);\n }\n if(max <= remainder) {\n max = remainder;\n maxIsL &= (i == l);\n }\n }\n if(min == 0) {\n System.out.println(0);\n }else {\n int ans = 2019;\n if(!minIsR) {\n ans = Math.min(ans, (min * (min + 1)) % 2019);\n }\n if(!maxIsL) {\n ans = Math.min(ans, (max * (max - 1)) % 2019);\n }\n System.out.println(ans);\n }\n */\n\n int ans = 2019;\n for(int i = l; i < r; i++) {\n ans = Math.min(ans, ((i % 2019) * ((i + 1) % 2019)) % 2019);\n }\n System.out.println(ans);\n\n sc.br.close();\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "sample_input": "2020 2040\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02983", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1911, "cpu_time_ms": 2108, "memory_kb": 21332}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s079398720", "group_id": "codeNet:p02983", "input_text": "import java.util.*;\n\npublic class Main {\n\tScanner sc = new Scanner(System.in);\n\tfinal int MOD = 1000000007;\n\tfinal int MAX = Integer.MAX_VALUE;\n\tfinal long LMAX = Long.MAX_VALUE;\n\tfinal int LEN = 100000;\n\n\tvoid doIt() {\n\t\tint l = sc.nextInt();\n\t\tint r = sc.nextInt();\n\t\tif(r - l < 2019) {\n\t\t\tint min = MAX;\n\t\t\tfor(int i = l; i <= r; i++) {\n\t\t\t\tmin = Math.min(min, i % 2019);\n\t\t\t}\n\t\t\tSystem.out.println(min * (min + 1));\n\t\t}\n\t\telse {\n\t\t\tSystem.out.println(1);\n\t\t}\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\tnew Main().doIt();\n\t}\n}\n", "language": "Java", "metadata": {"date": 1562547986, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p02983.html", "problem_id": "p02983", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02983/input.txt", "sample_output_relpath": "derived/input_output/data/p02983/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02983/Java/s079398720.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s079398720", "user_id": "u159117533"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n\tScanner sc = new Scanner(System.in);\n\tfinal int MOD = 1000000007;\n\tfinal int MAX = Integer.MAX_VALUE;\n\tfinal long LMAX = Long.MAX_VALUE;\n\tfinal int LEN = 100000;\n\n\tvoid doIt() {\n\t\tint l = sc.nextInt();\n\t\tint r = sc.nextInt();\n\t\tif(r - l < 2019) {\n\t\t\tint min = MAX;\n\t\t\tfor(int i = l; i <= r; i++) {\n\t\t\t\tmin = Math.min(min, i % 2019);\n\t\t\t}\n\t\t\tSystem.out.println(min * (min + 1));\n\t\t}\n\t\telse {\n\t\t\tSystem.out.println(1);\n\t\t}\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\tnew Main().doIt();\n\t}\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "sample_input": "2020 2040\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02983", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq L < R \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the minimum possible value of (i \\times j) \\mbox{ mod } 2019 when i and j are chosen under the given condition.\n\nSample Input 1\n\n2020 2040\n\nSample Output 1\n\n2\n\nWhen (i, j) = (2020, 2021), (i \\times j) \\mbox{ mod } 2019 = 2.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n20\n\nWe have only one choice: (i, j) = (4, 5).", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 536, "cpu_time_ms": 95, "memory_kb": 22996}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s055718453", "group_id": "codeNet:p03018", "input_text": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\npublic class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tchar str[] = br.readLine().toCharArray();\n\n\t\tlong tmp = 0;\n\t\tlong ans = 0;\n\n\t\tfor (int i = 0; i < str.length - 1; ++i) {\n\t\t\tif (str[i] == 'A') {\n\t\t\t\ttmp++;\n\t\t\t} else if (str[i] == 'B' && str[i + 1] == 'C') {\n\t\t\t\tans += tmp;\n\t\t\t\ti++;\n\t\t\t} else {\n\t\t\t\ttmp = 0;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(ans);\n\t}\n\n}", "language": "Java", "metadata": {"date": 1598990798, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p03018.html", "problem_id": "p03018", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03018/input.txt", "sample_output_relpath": "derived/input_output/data/p03018/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03018/Java/s055718453.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s055718453", "user_id": "u043263787"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\npublic class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tchar str[] = br.readLine().toCharArray();\n\n\t\tlong tmp = 0;\n\t\tlong ans = 0;\n\n\t\tfor (int i = 0; i < str.length - 1; ++i) {\n\t\t\tif (str[i] == 'A') {\n\t\t\t\ttmp++;\n\t\t\t} else if (str[i] == 'B' && str[i + 1] == 'C') {\n\t\t\t\tans += tmp;\n\t\t\t\ti++;\n\t\t\t} else {\n\t\t\t\ttmp = 0;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(ans);\n\t}\n\n}", "problem_context": "Score : 600 points\n\nProblem Statement\n\nYou are given a string s consisting of A, B and C.\n\nSnuke wants to perform the following operation on s as many times as possible:\n\nChoose a contiguous substring of s that reads ABC and replace it with BCA.\n\nFind the maximum possible number of operations.\n\nConstraints\n\n1 \\leq |s| \\leq 200000\n\nEach character of s is A, B and C.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nFind the maximum possible number of operations.\n\nSample Input 1\n\nABCABC\n\nSample Output 1\n\n3\n\nYou can perform the operations three times as follows: ABCABC → BCAABC → BCABCA → BCBCAA. This is the maximum result.\n\nSample Input 2\n\nC\n\nSample Output 2\n\n0\n\nSample Input 3\n\nABCACCBABCBCAABCB\n\nSample Output 3\n\n6", "sample_input": "ABCABC\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03018", "source_text": "Score : 600 points\n\nProblem Statement\n\nYou are given a string s consisting of A, B and C.\n\nSnuke wants to perform the following operation on s as many times as possible:\n\nChoose a contiguous substring of s that reads ABC and replace it with BCA.\n\nFind the maximum possible number of operations.\n\nConstraints\n\n1 \\leq |s| \\leq 200000\n\nEach character of s is A, B and C.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nFind the maximum possible number of operations.\n\nSample Input 1\n\nABCABC\n\nSample Output 1\n\n3\n\nYou can perform the operations three times as follows: ABCABC → BCAABC → BCABCA → BCBCAA. This is the maximum result.\n\nSample Input 2\n\nC\n\nSample Output 2\n\n0\n\nSample Input 3\n\nABCACCBABCBCAABCB\n\nSample Output 3\n\n6", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 555, "cpu_time_ms": 141, "memory_kb": 36436}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s549112829", "group_id": "codeNet:p03018", "input_text": "\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(final String[] args) {\n final Scanner scanner = new Scanner(System.in);\n final String s = scanner.next();\n\n long count = 0;\n long constraintA = 0;\n\n int i = 0;\n while (i < s.length()) {\n final char c = s.charAt(i);\n if (c == 'A') {\n long tmp = i;\n while (i < s.length() && s.charAt(i) == 'A') {\n i++;\n }\n final long aCount = i - tmp + constraintA;\n\n tmp = i;\n while (i < s.length() - 1 && s.charAt(i) == 'B' && s.charAt(i + 1) == 'C') {\n i += 2;\n }\n final long bcCount = (i - tmp) / 2;\n count += aCount * bcCount;\n constraintA += aCount;\n } else {\n constraintA = 0;\n i++;\n }\n }\n System.out.println(count);\n }\n}\n", "language": "Java", "metadata": {"date": 1586725238, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03018.html", "problem_id": "p03018", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03018/input.txt", "sample_output_relpath": "derived/input_output/data/p03018/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03018/Java/s549112829.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s549112829", "user_id": "u476482490"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(final String[] args) {\n final Scanner scanner = new Scanner(System.in);\n final String s = scanner.next();\n\n long count = 0;\n long constraintA = 0;\n\n int i = 0;\n while (i < s.length()) {\n final char c = s.charAt(i);\n if (c == 'A') {\n long tmp = i;\n while (i < s.length() && s.charAt(i) == 'A') {\n i++;\n }\n final long aCount = i - tmp + constraintA;\n\n tmp = i;\n while (i < s.length() - 1 && s.charAt(i) == 'B' && s.charAt(i + 1) == 'C') {\n i += 2;\n }\n final long bcCount = (i - tmp) / 2;\n count += aCount * bcCount;\n constraintA += aCount;\n } else {\n constraintA = 0;\n i++;\n }\n }\n System.out.println(count);\n }\n}\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nYou are given a string s consisting of A, B and C.\n\nSnuke wants to perform the following operation on s as many times as possible:\n\nChoose a contiguous substring of s that reads ABC and replace it with BCA.\n\nFind the maximum possible number of operations.\n\nConstraints\n\n1 \\leq |s| \\leq 200000\n\nEach character of s is A, B and C.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nFind the maximum possible number of operations.\n\nSample Input 1\n\nABCABC\n\nSample Output 1\n\n3\n\nYou can perform the operations three times as follows: ABCABC → BCAABC → BCABCA → BCBCAA. This is the maximum result.\n\nSample Input 2\n\nC\n\nSample Output 2\n\n0\n\nSample Input 3\n\nABCACCBABCBCAABCB\n\nSample Output 3\n\n6", "sample_input": "ABCABC\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03018", "source_text": "Score : 600 points\n\nProblem Statement\n\nYou are given a string s consisting of A, B and C.\n\nSnuke wants to perform the following operation on s as many times as possible:\n\nChoose a contiguous substring of s that reads ABC and replace it with BCA.\n\nFind the maximum possible number of operations.\n\nConstraints\n\n1 \\leq |s| \\leq 200000\n\nEach character of s is A, B and C.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nFind the maximum possible number of operations.\n\nSample Input 1\n\nABCABC\n\nSample Output 1\n\n3\n\nYou can perform the operations three times as follows: ABCABC → BCAABC → BCABCA → BCBCAA. This is the maximum result.\n\nSample Input 2\n\nC\n\nSample Output 2\n\n0\n\nSample Input 3\n\nABCACCBABCBCAABCB\n\nSample Output 3\n\n6", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1008, "cpu_time_ms": 179, "memory_kb": 27244}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s484488367", "group_id": "codeNet:p03018", "input_text": "// 20/03/18 22:40\n\nimport java.io.*;\nimport java.util.*;\n\nclass Main{\n final static long INF = Long.MAX_VALUE / 2;\n final static int MOD = 1_000_000_007;\n final static int SIZE = 1_000_000;\n long[] fac = new long[SIZE];\n long[] inv = new long[SIZE];\n long[] finv = new long[SIZE];\n FastScanner sc = new FastScanner();\n\n public static void main(String[] args) {\n new Main().solve();\n }\n\n void solve(){\n\n String s = sc.next();\n long sum = 0;\n int d = 0;\n boolean flag = false;\n\n for(int i = 0; i < s.length(); i++){\n if(s.charAt(i) == 'A'){\n d++;\n if(i + 2 < s.length() && s.charAt(i + 1) == 'B' && s.charAt(i + 2) == 'C'){\n sum += d;\n flag = true;\n i += 2;\n }\n }else if(flag && s.charAt(i) == 'B' && i + 1 < s.length() && s.charAt(i + 1) == 'C'){\n sum += d;\n i++;\n }else{\n d = 0;\n flag = false;\n }\n }\n\n System.out.println(sum);\n\n }\n\n long gcd(long a, long b){ // return aとbの最大公約数\n if(b == 0){\n return a;\n }\n return gcd(b, a % b);\n }\n\n long lcm(long a, long b){ // return aとbの最小公倍数\n return a * b / gcd(a, b);\n }\n\n long inv(long a){ // return aの逆元 (mod MOD)\n return pow(a, MOD - 2);\n }\n\n long pow(long a, long r){ // return a^r (mod MOD)\n long sum = 1;\n while(r > 0){\n if((r & 1) == 1){ // 2進数表記で末尾1の時\n sum *= a;\n sum %= MOD;\n }\n a *= a;\n a %= MOD;\n r >>= 1;\n }\n return sum;\n }\n\n long modFact(long n){ // retur n! (mod MOD)\n if(n == 0){\n return 1;\n }\n return n * modFact(n - 1) % MOD;\n }\n\n long fact(long n){ // return n!\n if(n == 0){\n return 1;\n }\n return n * fact(n - 1);\n }\n\n void initCOMB(){\n fac[0] = fac[1] = 1;\n inv[1] = 1;\n finv[0] = finv[1] = 1;\n for(int i = 2; i < SIZE; i++){\n fac[i] = fac[i - 1] * i % MOD;\n inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;\n finv[i] = finv[i - 1] * inv[i] % MOD;\n }\n }\n\n long modComb(int n, int r){ // return nCr (先にinitCOMB()必要)\n if(n < r || n < 0 || r < 0) return 0;\n return fac[n] * finv[r] % MOD * finv[n - r] % MOD;\n }\n\n long comb(long n, long r){ // return nCr\n long num = 1;\n for(long i = 1; i <= r; i++){\n num = num * (n - i + 1) / i;\n }\n return num;\n }\n\n boolean isPrime(long a){ // aの素数判定\n if(a <= 1) return false;\n for(int i = 2; i * i <= a; i++){\n if(a % i == 0) return false;\n }\n return true;\n }\n\n String nextPermutation(String s){ // return sの次の順列\n ArrayList list = new ArrayList<>();\n for(int i = 0; i < s.length(); i++) list.add(s.charAt(i));\n\n int pivotPos = -1;\n char pivot = 0;\n for(int i = list.size() - 2; i >= 0; i--){\n if(list.get(i) < list.get(i+1)){\n \t\t\tpivotPos = i;\n \t\t\tpivot = list.get(i);\n \t\t\tbreak;\n \t\t}\n \t}\n\n if(pivotPos == -1 && pivot == 0) return null;\n\n int L = pivotPos + 1;\n int R = list.size() - 1;\n \tint minPos = -1;\n \tchar min = Character.MAX_VALUE;\n \tfor(int i = R; i >= L; i--){\n \t\tif(pivot < list.get(i)){\n \t\t\tif(list.get(i) < min){\n \t\t\t\tmin = list.get(i);\n \t\t\t\tminPos = i;\n \t\t\t}\n \t\t}\n \t}\n\n \tCollections.swap(list, pivotPos, minPos);\n \tCollections.sort(list.subList(L, R + 1));\n\n \tStringBuilder sb = new StringBuilder();\n \tfor(int i=0; i 0; i--){\n if(a[i - 1] < a[i]){\n int swapIndex = find(a[i - 1], a, i, a.length - 1);\n long temp = a[swapIndex];\n a[swapIndex] = a[i - 1];\n a[i - 1] = temp;\n Arrays.sort(a, i, a.length);\n return true;\n }\n }\n return false;\n }\n\n int find(long dest, long[] a, int s, int e){\n if(s == e){\n return s;\n }\n int m = (s + e + 1) / 2;\n return a[m] <= dest ? find(dest, a, s, m - 1) : find(dest, a, m, e);\n }\n\n void elimination(int[][] a, int[] b) {\n int n = a.length;\n double f;\n for(int k = 0; k < n - 1; k++){\n for(int i = k + 1; i < n; i++){\n f = - a[i][k] / a[k][k];\n for(int j = k + 1; j < n; j++){\n a[i][j] += f * a[k][j];\n }\n b[i] += f * b[k];\n }\n for(int i = n - 1; i >= 0; i--){\n for(int j = i + 1; j < n; j++){\n b[i] -= a[i][j] * b[j];\n }\n b[i] = b[i] / a[i][i];\n }\n }\n }\n\n}\n\n\n\nclass Pair implements Comparable{\n long a, b;\n public Pair(long i, long j){\n a = i;\n b = j;\n }\n\n @Override\n public int compareTo(Pair p){\n if(this.b < p.b) return -1;\n else if(this.b > p.b) return 1;\n else return 0;\n }\n}\n\n\n\nclass FastScanner {\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n private boolean hasNextByte(){\n if(ptr < buflen){\n return true;\n }else{\n ptr = 0;\n try{\n buflen = in.read(buffer);\n }catch(IOException e){\n e.printStackTrace();\n }\n if(buflen <= 0){\n return false;\n }\n }\n return true;\n }\n private int readByte(){\n if(hasNextByte()) return buffer[ptr++];\n else return -1;\n }\n private static boolean isPrintableChar(int c){\n return 33 <= c && c <= 126;\n }\n public boolean hasNext(){\n while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;\n return hasNextByte();\n }\n public String next(){\n if(!hasNext()) throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while(isPrintableChar(b)){\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n public long nextLong(){\n if(!hasNext()) throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if(b == '-'){\n minus = true;\n b = readByte();\n }\n if(b < '0' || '9' < b){\n throw new NumberFormatException();\n }\n while(true){\n if('0' <= b && b <= '9'){\n n *= 10;\n n += b - '0';\n }else if(b == -1 || !isPrintableChar(b)){\n return minus ? -n : n;\n }else{\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n public int nextInt(){\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }\n public double nextDouble(){\n return Double.parseDouble(next());\n }\n}\n", "language": "Java", "metadata": {"date": 1584587952, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03018.html", "problem_id": "p03018", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03018/input.txt", "sample_output_relpath": "derived/input_output/data/p03018/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03018/Java/s484488367.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s484488367", "user_id": "u521293705"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "// 20/03/18 22:40\n\nimport java.io.*;\nimport java.util.*;\n\nclass Main{\n final static long INF = Long.MAX_VALUE / 2;\n final static int MOD = 1_000_000_007;\n final static int SIZE = 1_000_000;\n long[] fac = new long[SIZE];\n long[] inv = new long[SIZE];\n long[] finv = new long[SIZE];\n FastScanner sc = new FastScanner();\n\n public static void main(String[] args) {\n new Main().solve();\n }\n\n void solve(){\n\n String s = sc.next();\n long sum = 0;\n int d = 0;\n boolean flag = false;\n\n for(int i = 0; i < s.length(); i++){\n if(s.charAt(i) == 'A'){\n d++;\n if(i + 2 < s.length() && s.charAt(i + 1) == 'B' && s.charAt(i + 2) == 'C'){\n sum += d;\n flag = true;\n i += 2;\n }\n }else if(flag && s.charAt(i) == 'B' && i + 1 < s.length() && s.charAt(i + 1) == 'C'){\n sum += d;\n i++;\n }else{\n d = 0;\n flag = false;\n }\n }\n\n System.out.println(sum);\n\n }\n\n long gcd(long a, long b){ // return aとbの最大公約数\n if(b == 0){\n return a;\n }\n return gcd(b, a % b);\n }\n\n long lcm(long a, long b){ // return aとbの最小公倍数\n return a * b / gcd(a, b);\n }\n\n long inv(long a){ // return aの逆元 (mod MOD)\n return pow(a, MOD - 2);\n }\n\n long pow(long a, long r){ // return a^r (mod MOD)\n long sum = 1;\n while(r > 0){\n if((r & 1) == 1){ // 2進数表記で末尾1の時\n sum *= a;\n sum %= MOD;\n }\n a *= a;\n a %= MOD;\n r >>= 1;\n }\n return sum;\n }\n\n long modFact(long n){ // retur n! (mod MOD)\n if(n == 0){\n return 1;\n }\n return n * modFact(n - 1) % MOD;\n }\n\n long fact(long n){ // return n!\n if(n == 0){\n return 1;\n }\n return n * fact(n - 1);\n }\n\n void initCOMB(){\n fac[0] = fac[1] = 1;\n inv[1] = 1;\n finv[0] = finv[1] = 1;\n for(int i = 2; i < SIZE; i++){\n fac[i] = fac[i - 1] * i % MOD;\n inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;\n finv[i] = finv[i - 1] * inv[i] % MOD;\n }\n }\n\n long modComb(int n, int r){ // return nCr (先にinitCOMB()必要)\n if(n < r || n < 0 || r < 0) return 0;\n return fac[n] * finv[r] % MOD * finv[n - r] % MOD;\n }\n\n long comb(long n, long r){ // return nCr\n long num = 1;\n for(long i = 1; i <= r; i++){\n num = num * (n - i + 1) / i;\n }\n return num;\n }\n\n boolean isPrime(long a){ // aの素数判定\n if(a <= 1) return false;\n for(int i = 2; i * i <= a; i++){\n if(a % i == 0) return false;\n }\n return true;\n }\n\n String nextPermutation(String s){ // return sの次の順列\n ArrayList list = new ArrayList<>();\n for(int i = 0; i < s.length(); i++) list.add(s.charAt(i));\n\n int pivotPos = -1;\n char pivot = 0;\n for(int i = list.size() - 2; i >= 0; i--){\n if(list.get(i) < list.get(i+1)){\n \t\t\tpivotPos = i;\n \t\t\tpivot = list.get(i);\n \t\t\tbreak;\n \t\t}\n \t}\n\n if(pivotPos == -1 && pivot == 0) return null;\n\n int L = pivotPos + 1;\n int R = list.size() - 1;\n \tint minPos = -1;\n \tchar min = Character.MAX_VALUE;\n \tfor(int i = R; i >= L; i--){\n \t\tif(pivot < list.get(i)){\n \t\t\tif(list.get(i) < min){\n \t\t\t\tmin = list.get(i);\n \t\t\t\tminPos = i;\n \t\t\t}\n \t\t}\n \t}\n\n \tCollections.swap(list, pivotPos, minPos);\n \tCollections.sort(list.subList(L, R + 1));\n\n \tStringBuilder sb = new StringBuilder();\n \tfor(int i=0; i 0; i--){\n if(a[i - 1] < a[i]){\n int swapIndex = find(a[i - 1], a, i, a.length - 1);\n long temp = a[swapIndex];\n a[swapIndex] = a[i - 1];\n a[i - 1] = temp;\n Arrays.sort(a, i, a.length);\n return true;\n }\n }\n return false;\n }\n\n int find(long dest, long[] a, int s, int e){\n if(s == e){\n return s;\n }\n int m = (s + e + 1) / 2;\n return a[m] <= dest ? find(dest, a, s, m - 1) : find(dest, a, m, e);\n }\n\n void elimination(int[][] a, int[] b) {\n int n = a.length;\n double f;\n for(int k = 0; k < n - 1; k++){\n for(int i = k + 1; i < n; i++){\n f = - a[i][k] / a[k][k];\n for(int j = k + 1; j < n; j++){\n a[i][j] += f * a[k][j];\n }\n b[i] += f * b[k];\n }\n for(int i = n - 1; i >= 0; i--){\n for(int j = i + 1; j < n; j++){\n b[i] -= a[i][j] * b[j];\n }\n b[i] = b[i] / a[i][i];\n }\n }\n }\n\n}\n\n\n\nclass Pair implements Comparable{\n long a, b;\n public Pair(long i, long j){\n a = i;\n b = j;\n }\n\n @Override\n public int compareTo(Pair p){\n if(this.b < p.b) return -1;\n else if(this.b > p.b) return 1;\n else return 0;\n }\n}\n\n\n\nclass FastScanner {\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n private boolean hasNextByte(){\n if(ptr < buflen){\n return true;\n }else{\n ptr = 0;\n try{\n buflen = in.read(buffer);\n }catch(IOException e){\n e.printStackTrace();\n }\n if(buflen <= 0){\n return false;\n }\n }\n return true;\n }\n private int readByte(){\n if(hasNextByte()) return buffer[ptr++];\n else return -1;\n }\n private static boolean isPrintableChar(int c){\n return 33 <= c && c <= 126;\n }\n public boolean hasNext(){\n while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;\n return hasNextByte();\n }\n public String next(){\n if(!hasNext()) throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while(isPrintableChar(b)){\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n public long nextLong(){\n if(!hasNext()) throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if(b == '-'){\n minus = true;\n b = readByte();\n }\n if(b < '0' || '9' < b){\n throw new NumberFormatException();\n }\n while(true){\n if('0' <= b && b <= '9'){\n n *= 10;\n n += b - '0';\n }else if(b == -1 || !isPrintableChar(b)){\n return minus ? -n : n;\n }else{\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n public int nextInt(){\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }\n public double nextDouble(){\n return Double.parseDouble(next());\n }\n}\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nYou are given a string s consisting of A, B and C.\n\nSnuke wants to perform the following operation on s as many times as possible:\n\nChoose a contiguous substring of s that reads ABC and replace it with BCA.\n\nFind the maximum possible number of operations.\n\nConstraints\n\n1 \\leq |s| \\leq 200000\n\nEach character of s is A, B and C.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nFind the maximum possible number of operations.\n\nSample Input 1\n\nABCABC\n\nSample Output 1\n\n3\n\nYou can perform the operations three times as follows: ABCABC → BCAABC → BCABCA → BCBCAA. This is the maximum result.\n\nSample Input 2\n\nC\n\nSample Output 2\n\n0\n\nSample Input 3\n\nABCACCBABCBCAABCB\n\nSample Output 3\n\n6", "sample_input": "ABCABC\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03018", "source_text": "Score : 600 points\n\nProblem Statement\n\nYou are given a string s consisting of A, B and C.\n\nSnuke wants to perform the following operation on s as many times as possible:\n\nChoose a contiguous substring of s that reads ABC and replace it with BCA.\n\nFind the maximum possible number of operations.\n\nConstraints\n\n1 \\leq |s| \\leq 200000\n\nEach character of s is A, B and C.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nFind the maximum possible number of operations.\n\nSample Input 1\n\nABCABC\n\nSample Output 1\n\n3\n\nYou can perform the operations three times as follows: ABCABC → BCAABC → BCABCA → BCBCAA. This is the maximum result.\n\nSample Input 2\n\nC\n\nSample Output 2\n\n0\n\nSample Input 3\n\nABCACCBABCBCAABCB\n\nSample Output 3\n\n6", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 7609, "cpu_time_ms": 124, "memory_kb": 47828}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s061288693", "group_id": "codeNet:p03018", "input_text": "\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\ttry (Scanner sc = new Scanner(System.in)) {\n\n\t\t\tchar[] str = sc.next().replaceAll(\"BC\", \"D\").toCharArray();\n\t\t\tint count = 0;\n\t\t\tint acount = 0;\n\t\t\tfor (char ch : str) {\n\t\t\t\tswitch(ch) {\n\t\t\t\tcase 'A':\n\t\t\t\t\tacount++;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'D':\n\t\t\t\t\tcount += acount;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tacount = 0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tSystem.out.println(count);\n\t\t}\n\t}\n}\n", "language": "Java", "metadata": {"date": 1559534337, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03018.html", "problem_id": "p03018", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03018/input.txt", "sample_output_relpath": "derived/input_output/data/p03018/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03018/Java/s061288693.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s061288693", "user_id": "u578423830"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\ttry (Scanner sc = new Scanner(System.in)) {\n\n\t\t\tchar[] str = sc.next().replaceAll(\"BC\", \"D\").toCharArray();\n\t\t\tint count = 0;\n\t\t\tint acount = 0;\n\t\t\tfor (char ch : str) {\n\t\t\t\tswitch(ch) {\n\t\t\t\tcase 'A':\n\t\t\t\t\tacount++;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'D':\n\t\t\t\t\tcount += acount;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tacount = 0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tSystem.out.println(count);\n\t\t}\n\t}\n}\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nYou are given a string s consisting of A, B and C.\n\nSnuke wants to perform the following operation on s as many times as possible:\n\nChoose a contiguous substring of s that reads ABC and replace it with BCA.\n\nFind the maximum possible number of operations.\n\nConstraints\n\n1 \\leq |s| \\leq 200000\n\nEach character of s is A, B and C.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nFind the maximum possible number of operations.\n\nSample Input 1\n\nABCABC\n\nSample Output 1\n\n3\n\nYou can perform the operations three times as follows: ABCABC → BCAABC → BCABCA → BCBCAA. This is the maximum result.\n\nSample Input 2\n\nC\n\nSample Output 2\n\n0\n\nSample Input 3\n\nABCACCBABCBCAABCB\n\nSample Output 3\n\n6", "sample_input": "ABCABC\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03018", "source_text": "Score : 600 points\n\nProblem Statement\n\nYou are given a string s consisting of A, B and C.\n\nSnuke wants to perform the following operation on s as many times as possible:\n\nChoose a contiguous substring of s that reads ABC and replace it with BCA.\n\nFind the maximum possible number of operations.\n\nConstraints\n\n1 \\leq |s| \\leq 200000\n\nEach character of s is A, B and C.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nFind the maximum possible number of operations.\n\nSample Input 1\n\nABCABC\n\nSample Output 1\n\n3\n\nYou can perform the operations three times as follows: ABCABC → BCAABC → BCABCA → BCBCAA. This is the maximum result.\n\nSample Input 2\n\nC\n\nSample Output 2\n\n0\n\nSample Input 3\n\nABCACCBABCBCAABCB\n\nSample Output 3\n\n6", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 227, "memory_kb": 32104}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s619391868", "group_id": "codeNet:p03018", "input_text": "import java.util.*;\n\nclass Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString S = sc.next();\n\t\tint cnt=0;\n\t\tfor (int i=0;i0 && S.charAt(j)=='A'/*S.charAt(j)=='C' && S.charAt(j-1)=='B'*/) {\n\t\t\t\t\tcnt++;\n\t\t\t\t\tj--;\n\t\t\t\t}\n\t\t\t\tint k=i+3;\n\t\t\t\tright=k;\n\t\t\t\twhile (k0 && S.charAt(j)=='A'/*S.charAt(j)=='C' && S.charAt(j-1)=='B'*/) {\n\t\t\t\t\tcnt++;\n\t\t\t\t\tj--;\n\t\t\t\t}\n\t\t\t\tint k=i+3;\n\t\t\t\tright=k;\n\t\t\t\twhile (k extends ArrayList {\n\n Comparator comparator;\n\n TreeList(Comparator c) {\n super();\n comparator = c;\n }\n\n /*\n ソート済みのリストに要素を追加する\n */\n public boolean add(E e) {\n int lowIndex = 0;\n int highIndex = size() - 1;\n int index = 0;\n\n if (size() == 0) {\n super.add(e);\n return true;\n }\n\n if (comparator.compare(e, get(0)) < 0) {\n index = 0;\n } else if (comparator.compare(e, get(highIndex)) > 0) {\n index = highIndex + 1;\n } else {\n while (lowIndex <= highIndex) {\n\n if (highIndex == lowIndex + 1 || highIndex == lowIndex) {\n index = highIndex;\n break;\n }\n\n int midIndex = (lowIndex + highIndex) / 2;\n ;\n\n if (comparator.compare(e, get(midIndex)) > 0) {\n lowIndex = midIndex;\n } else {\n highIndex = midIndex;\n }\n\n }\n }\n\n super.add(index, e);\n return true;\n }\n\n }\n\n static class FastScanner {\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte()) return buffer[ptr++];\n else return -1;\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n private void skipUnprintable() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;\n }\n\n public boolean hasNext() {\n skipUnprintable();\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext()) throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext()) throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n return (int) nextLong();\n }\n }\n\n}\n", "language": "Java", "metadata": {"date": 1559525948, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03018.html", "problem_id": "p03018", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03018/input.txt", "sample_output_relpath": "derived/input_output/data/p03018/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03018/Java/s789610152.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s789610152", "user_id": "u951672936"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "/**\n * Created at 20:51 on 2019-06-02\n */\n\nimport java.io.*;\nimport java.util.*;\nimport java.math.BigInteger;\n\npublic class Main {\n\n static FastScanner sc = new FastScanner();\n\n public static void main(String[] args) {\n\n String s = sc.next();\n StringBuffer sb = new StringBuffer(s);\n sb = sb.reverse();\n s = sb.toString();\n\n s = s.replaceAll(\"CB\", \"X\");\n\n long count = 0;\n long countX = 0;\n for (int i=0; i extends ArrayList {\n\n Comparator comparator;\n\n TreeList(Comparator c) {\n super();\n comparator = c;\n }\n\n /*\n ソート済みのリストに要素を追加する\n */\n public boolean add(E e) {\n int lowIndex = 0;\n int highIndex = size() - 1;\n int index = 0;\n\n if (size() == 0) {\n super.add(e);\n return true;\n }\n\n if (comparator.compare(e, get(0)) < 0) {\n index = 0;\n } else if (comparator.compare(e, get(highIndex)) > 0) {\n index = highIndex + 1;\n } else {\n while (lowIndex <= highIndex) {\n\n if (highIndex == lowIndex + 1 || highIndex == lowIndex) {\n index = highIndex;\n break;\n }\n\n int midIndex = (lowIndex + highIndex) / 2;\n ;\n\n if (comparator.compare(e, get(midIndex)) > 0) {\n lowIndex = midIndex;\n } else {\n highIndex = midIndex;\n }\n\n }\n }\n\n super.add(index, e);\n return true;\n }\n\n }\n\n static class FastScanner {\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte()) return buffer[ptr++];\n else return -1;\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n private void skipUnprintable() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;\n }\n\n public boolean hasNext() {\n skipUnprintable();\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext()) throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext()) throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n return (int) nextLong();\n }\n }\n\n}\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nYou are given a string s consisting of A, B and C.\n\nSnuke wants to perform the following operation on s as many times as possible:\n\nChoose a contiguous substring of s that reads ABC and replace it with BCA.\n\nFind the maximum possible number of operations.\n\nConstraints\n\n1 \\leq |s| \\leq 200000\n\nEach character of s is A, B and C.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nFind the maximum possible number of operations.\n\nSample Input 1\n\nABCABC\n\nSample Output 1\n\n3\n\nYou can perform the operations three times as follows: ABCABC → BCAABC → BCABCA → BCBCAA. This is the maximum result.\n\nSample Input 2\n\nC\n\nSample Output 2\n\n0\n\nSample Input 3\n\nABCACCBABCBCAABCB\n\nSample Output 3\n\n6", "sample_input": "ABCABC\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03018", "source_text": "Score : 600 points\n\nProblem Statement\n\nYou are given a string s consisting of A, B and C.\n\nSnuke wants to perform the following operation on s as many times as possible:\n\nChoose a contiguous substring of s that reads ABC and replace it with BCA.\n\nFind the maximum possible number of operations.\n\nConstraints\n\n1 \\leq |s| \\leq 200000\n\nEach character of s is A, B and C.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nFind the maximum possible number of operations.\n\nSample Input 1\n\nABCABC\n\nSample Output 1\n\n3\n\nYou can perform the operations three times as follows: ABCABC → BCAABC → BCABCA → BCBCAA. This is the maximum result.\n\nSample Input 2\n\nC\n\nSample Output 2\n\n0\n\nSample Input 3\n\nABCACCBABCBCAABCB\n\nSample Output 3\n\n6", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 6148, "cpu_time_ms": 179, "memory_kb": 34120}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s323636580", "group_id": "codeNet:p03053", "input_text": "import java.util.*;\nimport java.lang.String;\n\n\npublic class Main {\n static class Position {\n public Position(int x, int y) {\n this.x = x; this.y = y;\n }\n public int x;\n public int y;\n }\n\n static int solve(String[] G) {\n int H = G.length;\n int W = G[0].length();\n int INF = Integer.MAX_VALUE/2;\n int[][] step = new int[H][W];\n ArrayList starts = new ArrayList();\n for (int i=0; i que = new ArrayDeque();\n\n for (int i = 0; i < starts.size(); i++) {\n que.addLast(starts.get(i));\n step[starts.get(i).x][starts.get(i).y] = 0;\n }\n\n int res = 0;\n while (!que.isEmpty()) {\n Position pos = que.removeFirst();\n int x = pos.x; int y = pos.y;\n for (int i=0; i step[x][y] + 1) {\n step[nx][ny] = step[x][y] + 1;\n que.addLast(new Position(nx, ny));\n res = Math.max(res, step[nx][ny]);\n }\n }\n }\n\n return res;\n }\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int H = sc.nextInt();\n int W = sc.nextInt();\n\n String[] A = new String[H];\n for (int i=0; i starts = new ArrayList();\n for (int i=0; i que = new ArrayDeque();\n\n for (int i = 0; i < starts.size(); i++) {\n que.addLast(starts.get(i));\n step[starts.get(i).x][starts.get(i).y] = 0;\n }\n\n int res = 0;\n while (!que.isEmpty()) {\n Position pos = que.removeFirst();\n int x = pos.x; int y = pos.y;\n for (int i=0; i step[x][y] + 1) {\n step[nx][ny] = step[x][y] + 1;\n que.addLast(new Position(nx, ny));\n res = Math.max(res, step[nx][ny]);\n }\n }\n }\n\n return res;\n }\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int H = sc.nextInt();\n int W = sc.nextInt();\n\n String[] A = new String[H];\n for (int i=0; i q = new ArrayDeque<>();\n\n\n for (int i = 0; i < h; i++) {\n for (int j = 0; j < w; j++) {\n // 多点bfs\n if (c[i][j] == '#') {\n q.addLast(i * w + j);\n used[i][j] = true;\n man[i][j] = 0;\n }\n }\n }\n\n while (!q.isEmpty()) {\n //out.println(\"q:\" + q.peek());\n int now = q.pollFirst();\n for (int i = 0; i < 4; i++) {\n int x = now / w;\n int y = now % w;\n int nx = x + dx[i];\n int ny = y + dy[i];\n if (!(0 <= nx && nx < h && 0 <= ny && ny < w)) continue;\n if (!used[nx][ny]) {\n used[nx][ny] = true;\n man[nx][ny] = man[x][y] + 1;\n q.addLast(nx * w + ny);\n }\n }\n }\n\n int max = -1;\n for (int i = 0; i < h; i++) {\n // out.println(Arrays.toString(man[i]));\n for (int j = 0; j < w; j++) {\n max = Math.max(max, man[i][j]);\n }\n }\n\n out.println(max);\n\n }\n\n }\n}\n\n", "language": "Java", "metadata": {"date": 1586894347, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03053.html", "problem_id": "p03053", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03053/input.txt", "sample_output_relpath": "derived/input_output/data/p03053/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03053/Java/s692797848.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s692797848", "user_id": "u902576227"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.Scanner;\nimport java.util.ArrayDeque;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author silviase\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n ADarkerAndDarker solver = new ADarkerAndDarker();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class ADarkerAndDarker {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n final int INF = (int) 1e9;\n int[] dx = {-1, 0, 0, 1};\n int[] dy = {0, -1, 1, 0};\n\n int h = in.nextInt();\n int w = in.nextInt();\n\n char[][] c = new char[h][w];\n for (int i = 0; i < h; i++) {\n c[i] = in.next().toCharArray();\n }\n int[][] man = new int[h + 1][w + 1];\n boolean[][] used = new boolean[h + 1][w + 1];\n\n for (int i = 0; i <= h; i++) {\n Arrays.fill(man[i], INF);\n Arrays.fill(used[i], false);\n }\n ArrayDeque q = new ArrayDeque<>();\n\n\n for (int i = 0; i < h; i++) {\n for (int j = 0; j < w; j++) {\n // 多点bfs\n if (c[i][j] == '#') {\n q.addLast(i * w + j);\n used[i][j] = true;\n man[i][j] = 0;\n }\n }\n }\n\n while (!q.isEmpty()) {\n //out.println(\"q:\" + q.peek());\n int now = q.pollFirst();\n for (int i = 0; i < 4; i++) {\n int x = now / w;\n int y = now % w;\n int nx = x + dx[i];\n int ny = y + dy[i];\n if (!(0 <= nx && nx < h && 0 <= ny && ny < w)) continue;\n if (!used[nx][ny]) {\n used[nx][ny] = true;\n man[nx][ny] = man[x][y] + 1;\n q.addLast(nx * w + ny);\n }\n }\n }\n\n int max = -1;\n for (int i = 0; i < h; i++) {\n // out.println(Arrays.toString(man[i]));\n for (int j = 0; j < w; j++) {\n max = Math.max(max, man[i][j]);\n }\n }\n\n out.println(max);\n\n }\n\n }\n}\n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a grid of squares with H horizontal rows and W vertical columns, where each square is painted white or black.\nHW characters from A_{11} to A_{HW} represent the colors of the squares.\nA_{ij} is # if the square at the i-th row from the top and the j-th column from the left is black, and A_{ij} is . if that square is white.\n\nWe will repeatedly perform the following operation until all the squares are black:\n\nEvery white square that shares a side with a black square, becomes black.\n\nFind the number of operations that will be performed.\nThe initial grid has at least one black square.\n\nConstraints\n\n1 \\leq H,W \\leq 1000\n\nA_{ij} is # or ..\n\nThe given grid has at least one black square.\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\nPrint the number of operations that will be performed.\n\nSample Input 1\n\n3 3\n...\n.#.\n...\n\nSample Output 1\n\n2\n\nAfter one operation, all but the corners of the grid will be black. After one more operation, all the squares will be black.\n\nSample Input 2\n\n6 6\n..#..#\n......\n#..#..\n......\n.#....\n....#.\n\nSample Output 2\n\n3", "sample_input": "3 3\n...\n.#.\n...\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03053", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a grid of squares with H horizontal rows and W vertical columns, where each square is painted white or black.\nHW characters from A_{11} to A_{HW} represent the colors of the squares.\nA_{ij} is # if the square at the i-th row from the top and the j-th column from the left is black, and A_{ij} is . if that square is white.\n\nWe will repeatedly perform the following operation until all the squares are black:\n\nEvery white square that shares a side with a black square, becomes black.\n\nFind the number of operations that will be performed.\nThe initial grid has at least one black square.\n\nConstraints\n\n1 \\leq H,W \\leq 1000\n\nA_{ij} is # or ..\n\nThe given grid has at least one black square.\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\nPrint the number of operations that will be performed.\n\nSample Input 1\n\n3 3\n...\n.#.\n...\n\nSample Output 1\n\n2\n\nAfter one operation, all but the corners of the grid will be black. After one more operation, all the squares will be black.\n\nSample Input 2\n\n6 6\n..#..#\n......\n#..#..\n......\n.#....\n....#.\n\nSample Output 2\n\n3", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2716, "cpu_time_ms": 401, "memory_kb": 62796}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s330228180", "group_id": "codeNet:p03053", "input_text": "import java.io.InputStream;\nimport java.io.IOException;\nimport java.io.PrintStream;\nimport java.util.*;\nimport java.util.function.BiPredicate;\nimport java.util.function.IntFunction;\nimport java.util.function.ToIntFunction;\nimport java.util.stream.Collectors;\nimport java.util.stream.IntStream;\nimport java.util.stream.Stream;\n\npublic class Main {\n\n public static void main(String[] args) {\n solve(System.in, System.out);\n }\n\n private static DistanceMemoBfsPathQuery query;\n private static EncodedGraph graph;\n\n static void solve(InputStream is, PrintStream os) {\n Scanner sc = new Scanner(is);\n\n /* read */\n int h = sc.nextInt();\n int w = sc.nextInt();\n\n List blacks = new ArrayList<>();\n GridPointEncoder encoder = new GridPointEncoder(h, w);\n for (int r = 0; r < h; r++) {\n String line = sc.next();\n for (int c = 0; c < w; c++) {\n if (line.charAt(c) == '#') {\n blacks.add(encoder.encode(new GridPoint(r, c)));\n }\n }\n }\n\n // reduce visited cells\n graph = new VerticalHorizontalNeighborGridPointGraph(h, w, (r, c) -> true);\n\n query = new DistanceMemoBfsPathQuery(graph.delegate);\n\n query.path(blacks.stream().mapToInt(i -> i).toArray(), -1);\n\n os.println(max);\n\n }\n\n// private static boolean predicate(int r, int c, int h, int w) {\n// return !query.visited[r * w + c];\n// }\n\n static long max = 0L;\n\n private static class DistanceMemoBfsPathQuery extends BfsPathQuery {\n\n\n public DistanceMemoBfsPathQuery(IntGraph graph) {\n super(graph);\n }\n\n @Override\n int mark(Path path, int to) {\n max = Math.max(max, path.getWeight() + graph.getWeight(path.getEnd(), to));\n return super.mark(path, to);\n }\n }\n\n private static class GridPointEncoder implements Encoder {\n\n public GridPointEncoder(int h, int w) {\n this.h = h;\n this.w = w;\n }\n\n private final int h;\n private final int w;\n\n @Override\n public int num() {\n return w * h;\n }\n\n @Override\n public int encode(GridPoint from) {\n if (from == null) {\n return -1;\n }\n return w * from.r + from.c;\n }\n\n @Override\n public GridPoint decode(int from) {\n if (from < 0) {\n return null;\n }\n return new GridPoint(from / w, from % w);\n }\n }\n\n private static class GridPoint implements Encoded {\n\n private final int r;\n private final int c;\n\n public GridPoint(int r, int c) {\n this.r = r;\n this.c = c;\n }\n }\n\n private static class VerticalHorizontalNeighborGridPointGraph extends GridPointGraph {\n\n private final BiPredicate predicate;\n protected List moves = Arrays.asList(\n new int[]{-1, 0},\n new int[]{1, 0},\n new int[]{0, -1},\n new int[]{0, 1}\n );\n\n public VerticalHorizontalNeighborGridPointGraph(int h, int w,\n BiPredicate predicate) {\n super(h, w);\n\n this.predicate = predicate;\n\n this.delegate = new IntGraph() {\n @Override\n public int getSize() {\n return w * h;\n }\n\n @Override\n public IntStream vertices() {\n return IntStream.range(0, w * h);\n }\n\n @Override\n public IntStream adjacentVertices(int from) {\n return neighbors(decoder.apply(from)).mapToInt(encoder);\n }\n\n @Override\n public int getWeight(int from, int to) {\n return 1;\n }\n };\n }\n\n protected boolean predicate(int r, int c) {\n if (r < 0 || h <= r) {\n return false;\n }\n if (c < 0 || w <= c) {\n return false;\n }\n return predicate.test(r, c);\n }\n\n protected Stream neighbors(GridPoint from) {\n\n return moves.stream().filter(move -> predicate(from.r + move[0], from.c + move[1]))\n .map(move -> new GridPoint(from.r + move[0], from.c + move[1]));\n }\n }\n\n// private static class AdjacencyMatrixGridPointGraph extends IntVertexGraph {\n//\n// private List vertexes;\n//\n// private final int n;\n// private final int[][] matrix;\n//\n// public AdjacencyMatrixGridPointGraph(int n, int[][] matrix) {\n// this.n = n;\n// this.matrix = matrix;\n// }\n//\n// @Override\n// public Collection getVertices() {\n// // lazy load\n// if (vertexes == null) {\n// vertexes = IntStream.range(0, n).boxed().collect(Collectors.toList());\n// }\n// return vertexes;\n// }\n//\n// @Override\n// public int getSize() {\n// return n;\n// }\n//\n// @Override\n// public List> getEdges(Integer from) {\n// return IntStream.range(0, n).mapToObj(to -> new Edge<>(from, to, matrix[from][to]))\n// .collect(Collectors.toList());\n// }\n// }\n//\n// private static class AdjacencyListGridPointGraph extends IntVertexGraph {\n//\n// private List vertexes;\n//\n// private final int n;\n// private final List>> edges;\n//\n// public AdjacencyListGridPointGraph(int n, List>> edges) {\n// this.n = n;\n// this.edges = edges;\n// }\n//\n// @Override\n// public Collection getVertices() {\n// // lazy load\n// if (vertexes == null) {\n// vertexes = IntStream.range(0, n).boxed().collect(Collectors.toList());\n// }\n// return vertexes;\n// }\n//\n// @Override\n// public int getSize() {\n// return n;\n// }\n//\n// @Override\n// public List> getEdges(Integer from) {\n// return edges.get(from);\n// }\n// }\n\n private static abstract class GridPointGraph extends EncodedGraph {\n\n public GridPointGraph(int h, int w) {\n super(new GridPointEncoder(h, w)::encode, new GridPointEncoder(h, w)::decode);\n this.h = h;\n this.w = w;\n }\n\n protected final int h;\n protected final int w;\n\n }\n\n private static interface Encoded {\n\n }\n\n private static interface Encoder {\n\n int num();\n\n int encode(E from);\n\n E decode(int from);\n }\n\n// private static abstract class EncodedGraph> implements Graph {\n//\n// public EncodedGraph(Encoder encoder) {\n// this.encoder = encoder;\n// this.delegate = new IntVertexGraph() {\n// @Override\n// public Collection getVertices() {\n// return EncodedGraph.this.getVertices().stream()\n// .map(encoder::encode)\n// .collect(Collectors.toList());\n// }\n//\n// @Override\n// public Collection getAdjacentVertices(Integer from) {\n// Collection adjacent = EncodedGraph.this.getAdjacentVertices(encoder.decode(from));\n//\n// List ans = new ArrayList<>(adjacent.size());\n// for (V v : adjacent) {\n// ans.add(encoder.encode(v));\n// }\n// return ans;\n// }\n//\n// @Override\n// public int getWeight(Integer from, Integer to) {\n// return EncodedGraph.this.getWeight(encoder.decode(from), encoder.decode(to));\n// }\n//\n// @Override\n// public int getSize() {\n// return EncodedGraph.this.getSize();\n// }\n//\n//// @Override\n//// public Collection> getEdges(Integer from) {\n//// Collection> edges = EncodedGraph.this.getEdges(encoder.decode(from));\n//// List> ans = new ArrayList<>(edges.size());\n//// for (Edge e : edges) {\n//// ans.add(new Edge<>(\n//// encoder.encode(e.getFrom()), encoder.encode(e.getTo()), e.getWeight()));\n//// }\n//// return ans;\n//// }\n// };\n// }\n//\n// final Encoder encoder;\n// final IntVertexGraph delegate;\n//\n// public PathQuery pathQuery(Function, PathQuery> delegate) {\n// return new EncodedPathQuery<>(delegate, this);\n// }\n//\n// public MultiPathQuery multiPathQuery(\n// Function, MultiPathQuery> delegate) {\n// return new EncodedMultiPathQuery<>(delegate, this);\n// }\n//\n// private static class EncodedPathQuery> implements PathQuery {\n//\n// EncodedGraph graph;\n// PathQuery delegate;\n//\n// private EncodedPathQuery(Function, PathQuery> delegate,\n// EncodedGraph graph) {\n// this.graph = graph;\n// this.delegate = delegate.apply(graph.delegate);\n// }\n//\n// @Override\n// public VertexPath path(V begin, V end) {\n// VertexPath path = delegate\n// .path(graph.encoder.encode(begin), graph.encoder.encode(end));\n// if (path == null) {\n// return null;\n// }\n// return new EfficientVertexPath<>(graph.encoder.decode(path.getBegin()),\n// graph.encoder.decode(path.getEnd()), path.getWeight());\n// }\n// }\n//\n// private static class EncodedMultiPathQuery> implements MultiPathQuery {\n//\n// EncodedGraph graph;\n// MultiPathQuery delegate;\n//\n// private EncodedMultiPathQuery(Function, MultiPathQuery> delegate,\n// EncodedGraph graph) {\n// this.graph = graph;\n// this.delegate = delegate.apply(graph.delegate);\n// }\n//\n// @Override\n// public VertexPath path(List begin, V end) {\n// List list = begin.stream().map(graph.encoder::encode)\n// .collect(Collectors.toList());\n// VertexPath path = delegate\n// .path(list, graph.encoder.encode(end));\n// if (path == null) {\n// return null;\n// }\n// return new EfficientVertexPath<>(graph.encoder.decode(path.getBegin()),\n// graph.encoder.decode(path.getEnd()), path.getWeight());\n// }\n// }\n//\n// }\n\n private static class EncodedGraph implements Graph {\n\n // protected\n IntGraph delegate;\n protected final ToIntFunction encoder;\n protected final IntFunction decoder;\n\n private EncodedGraph(ToIntFunction encoder, IntFunction decoder) {\n this.encoder = encoder;\n this.decoder = decoder;\n }\n\n @Override\n public int getSize() {\n return delegate.getSize();\n }\n\n @Override\n public Stream vertices() {\n return delegate.vertices().mapToObj(decoder);\n }\n\n @Override\n public Stream adjacentVertices(V from) {\n return delegate.adjacentVertices(encoder.applyAsInt(from)).mapToObj(decoder);\n }\n\n @Override\n public int getWeight(V from, V to) {\n return delegate.getWeight(encoder.applyAsInt(from), encoder.applyAsInt(to));\n }\n }\n\n private static interface EncodedPathQuery {\n\n VertexPath path(V begin, V end);\n }\n\n private static interface EncodedMultiPathQuery {\n\n VertexPath path(List begin, V end);\n }\n\n private static interface PathQuery {\n\n Path path(int begin, int end);\n }\n\n private static interface MultiPathQuery {\n\n Path path(int[] begin, int end);\n }\n\n private static abstract class QueuedPathQuery implements PathQuery {\n\n protected final IntGraph graph;\n protected final Queue queue;\n\n public QueuedPathQuery(IntGraph graph, Queue queue) {\n this.graph = graph;\n this.queue = queue;\n }\n\n public Path path(int begin, int end) {\n\n prepare(begin, end);\n queue.add(new IntPath(begin));\n return search(end);\n }\n\n protected Path search(int end) {\n while (!queue.isEmpty()) {\n Path path = queue.remove();\n int head = path.getEnd();\n\n if (head == end) {\n return new IntPath(path.getBegin(),\n path.getEnd(), path.getWeight());\n }\n\n graph.adjacentVertices(head).filter(to -> predicate(path, to))\n .map(to -> mark(path, to))\n .mapToObj(to -> path.append(to, graph.getWeight(head, to)))\n .forEach(queue::add);\n }\n return null;\n }\n\n abstract void prepare(int begin, int end);\n\n abstract boolean predicate(Path path, int to);\n\n abstract int mark(Path path, int to);\n }\n\n private static class BfsPathQuery extends QueuedPathQuery implements\n MultiPathQuery {\n\n final boolean[] visited;\n\n public BfsPathQuery(IntGraph graph) {\n super(graph, new ArrayDeque<>());\n visited = new boolean[graph.getSize()];\n }\n\n @Override\n void prepare(int begin, int end) {\n visited[begin] = true;\n }\n\n @Override\n boolean predicate(Path path, int to) {\n return !visited[to];\n }\n\n @Override\n int mark(Path path, int to) {\n visited[to] = true;\n return to;\n }\n\n @Override\n public Path path(int[] begins, int end) {\n\n for (int begin : begins) {\n prepare(begin, end);\n queue.add(new IntPath(begin));\n }\n return search(end);\n }\n\n }\n\n// private static abstract class QueuedPathQuery implements PathQuery {\n//\n// protected final IntGraph graph;\n// protected final Queue queue;\n//\n// private final ToIntFunction encoder;\n// private final IntFunction decoder;\n//\n// public QueuedPathQuery(IntGraph graph, Queue queue, ToIntFunction encoder,\n// IntFunction decoder) {\n// this.graph = graph;\n// this.queue = queue;\n// this.encoder = encoder;\n// this.decoder = decoder;\n// }\n//\n// public VertexPath path(V begin, V end) {\n//\n// prepare(encoder.applyAsInt(begin), encoder.applyAsInt(end));\n// queue.add(new IntPath<>(encoder.applyAsInt(begin)));\n// return search(encoder.applyAsInt(end));\n// }\n//\n// protected VertexPath search(int end) {\n// while (!queue.isEmpty()) {\n// Path path = queue.remove();\n// int head = path.getEnd();\n//\n// if (head == end) {\n// return new EfficientVertexPath<>(decoder.apply(path.getBegin()),\n// decoder.apply(path.getEnd()), path.getWeight());\n// }\n//\n// int[] adjacent = graph.getAdjacentVertices(head);\n// for (int to : adjacent) {\n// if (!predicate(path, to)) {\n// continue;\n// }\n// mark(path, to);\n// queue.add(path.append(to, graph.getWeight(head, to)));\n// }\n// }\n// return null;\n// }\n//\n// abstract void prepare(int begin, int end);\n//\n// abstract boolean predicate(Path path, int to);\n//\n// abstract void mark(Path path, int to);\n// }\n\n// private static class DijkstraPathQuery extends QueuedPathQuery {\n//\n// private final long[] distance;\n//\n// public DijkstraPathQuery(Graph graph) {\n// super(graph, new PriorityQueue<>(\n// Comparator.comparingLong(VertexPath::getWeight)));\n// distance = new long[graph.getSize()];\n// }\n//\n//\n// @Override\n// void prepare(Integer begin, Integer end) {\n// for (Integer v : graph.getVertices()) {\n// distance[v] = Integer.MAX_VALUE;\n// }\n// }\n//\n// @Override\n// boolean predicate(VertexPath path, Integer to) {\n// return distance[path.getEnd()] + graph.getWeight(path.getEnd(), to) < distance[to];\n// }\n//\n// @Override\n// void mark(VertexPath path, Integer to) {\n// distance[to] = distance[path.getEnd()] + graph.getWeight(path.getEnd(), to);\n// }\n// }\n\n// private static class BfsPathQuery extends QueuedPathQuery implements\n// MultiPathQuery {\n//\n// final boolean[] visited;\n//\n// public BfsPathQuery(IntGraph graph, ToIntFunction) {\n// super(graph, new ArrayDeque<>());\n// visited = new boolean[graph.getSize()];\n// }\n//\n// @Override\n// void prepare(Integer begin, Integer end) {\n// visited[begin] = true;\n// }\n//\n// @Override\n// boolean predicate(VertexPath path, Integer to) {\n// return !visited[to];\n// }\n//\n// @Override\n// void mark(VertexPath path, Integer to) {\n// visited[to] = true;\n// }\n//\n// public VertexPath path(List begins, Integer end) {\n//\n// for (int begin : begins) {\n// prepare(begin, end);\n// queue.add(new EfficientVertexPath<>(begin));\n// }\n// return search(end);\n// }\n//\n// }\n\n// private static class BfsPathQuery extends QueuedPathQuery implements\n// MultiPathQuery {\n//\n// final boolean[] visited;\n//\n// public BfsPathQuery(Graph graph) {\n// super(graph, new ArrayDeque<>());\n// visited = new boolean[graph.getSize()];\n// }\n//\n// @Override\n// void prepare(Integer begin, Integer end) {\n// visited[begin] = true;\n// }\n//\n// @Override\n// boolean predicate(Edge edge) {\n// return !visited[edge.getTo()];\n// }\n//\n// @Override\n// void mark(VertexPath path, Edge edge) {\n// visited[edge.getTo()] = true;\n// }\n//\n// public VertexPath path(List begins, Integer end) {\n//\n// for (int begin : begins) {\n// prepare(begin, end);\n// queue.add(new EfficientVertexPath<>(begin));\n// }\n// return search(end);\n// }\n//\n// }\n\n// private static abstract class MemoDfsPathQuery extends DfsPathQuery {\n//\n// public MemoDfsPathQuery(Graph graph) {\n// super(graph);\n// }\n//\n// abstract VertexPath memo(VertexPath path, V parent,\n// V end);\n//\n// @Override\n// public VertexPath path(VertexPath path, V parent,\n// V end) {\n// VertexPath memo = memo(path, parent, end);\n// if (memo != null) {\n// return memo;\n// }\n// return super.path(path, parent, end);\n// }\n// }\n\n// private static class DfsPathQuery implements PathQuery {\n//\n// protected final Graph graph;\n//\n// public DfsPathQuery(Graph graph) {\n// this.graph = graph;\n// }\n//\n// @Override\n// public VertexPath path(V begin, V end) {\n// return path(new EfficientVertexPath<>(begin), null, end);\n// }\n//\n// protected VertexPath path(VertexPath path, V parent,\n// V end) {\n// V head = path.getEnd();\n// if (path.getEnd().equals(end)) {\n// return path;\n// }\n// Collection adjacent = graph.getAdjacentVertices(head);\n// for (V to : adjacent) {\n// if (!to.equals(parent)) {\n// VertexPath next = path(path.append(to, graph.getWeight(head, to)), head, end);\n// if (next != null) {\n// return next;\n// }\n// }\n// }\n// return null;\n// }\n// }\n\n// private static class WarshallFloydQuery implements PathQuery {\n//\n// private VertexPath[][] shortest;\n//\n// private WarshallFloydQuery(Graph graph) {\n// Collection nodes = graph.getVertices();\n//\n// shortest = new VertexPath[nodes.size()][nodes.size()];\n//\n// for (int from : nodes) {\n// Collection> edges = graph.getEdges(from);\n// for (Edge e : edges) {\n// shortest[e.getFrom()][e.getTo()] = new EfficientVertexPath<>(e);\n// }\n// shortest[from][from] = new EfficientVertexPath<>(from);\n// }\n//\n// for (int relay : nodes) {\n// for (int from : nodes) {\n// for (int dest : nodes) {\n// VertexPath pathA = shortest[from][relay];\n// VertexPath pathB = shortest[relay][dest];\n// if (pathA != null && pathB != null) {\n// if (shortest[from][dest] == null\n// || pathA.getWeight() + pathB.getWeight() < shortest[from][dest]\n// .getWeight()) {\n// shortest[from][dest] = pathA.append(pathB);\n// }\n// }\n// }\n// }\n// }\n// }\n//\n// @Override\n// public VertexPath path(Integer begin, Integer end) {\n// return shortest[begin][end];\n// }\n// }\n\n// private static abstract class IntVertexGraph implements Graph {\n//\n// }\n\n// static class Edge {\n//\n// public Edge(V from, V to, int weight) {\n// this.from = from;\n// this.to = to;\n// this.weight = weight;\n// }\n//\n// private final V from;\n//\n// private final V to;\n// private final int weight;\n//\n//\n// V getFrom() {\n// return from;\n// }\n//\n// V getTo() {\n// return to;\n// }\n//\n// int getWeight() {\n// return weight;\n// }\n// }\n\n static interface VertexPath {\n\n V getBegin();\n\n V getEnd();\n\n int getWeight();\n\n VertexPath append(VertexPath other);\n\n void merge(VertexPath other);\n\n VertexPath append(V to, int weight);\n\n// void merge(Edge edge);\n }\n\n static class EfficientVertexPath implements VertexPath {\n\n private V begin;\n private V end;\n private int weight;\n\n public EfficientVertexPath(V begin) {\n this.begin = begin;\n this.end = begin;\n this.weight = 0;\n }\n\n public EfficientVertexPath(V begin, V end, int weight) {\n this.begin = begin;\n this.end = end;\n this.weight = weight;\n }\n\n// public EfficientVertexPath(Edge edge) {\n// this.begin = edge.getFrom();\n// this.end = edge.getTo();\n// this.weight = edge.getWeight();\n// }\n//\n// private EfficientVertexPath(VertexPath path, Edge append) {\n// this.begin = path.getBegin();\n// if (!path.getEnd().equals(append.getFrom())) {\n// throw new IllegalStateException(\"not correct edge.\");\n// }\n// this.end = append.getTo();\n// this.weight = path.getWeight() + append.getWeight();\n// }\n\n private EfficientVertexPath(VertexPath pathA, VertexPath pathB) {\n this.begin = pathA.getBegin();\n if (!pathA.getEnd().equals(pathB.getBegin())) {\n throw new IllegalStateException(\"not correct edge.\");\n }\n this.end = pathB.getEnd();\n this.weight = pathA.getWeight() + pathB.getWeight();\n }\n\n @Override\n public V getBegin() {\n return begin;\n }\n\n @Override\n public V getEnd() {\n return end;\n }\n\n @Override\n public int getWeight() {\n return weight;\n }\n\n @Override\n public VertexPath append(VertexPath other) {\n return new EfficientVertexPath<>(this, other);\n }\n\n @Override\n public void merge(VertexPath other) {\n this.end = other.getEnd();\n this.weight += other.getWeight();\n }\n\n @Override\n public VertexPath append(V to, int weight) {\n return new EfficientVertexPath<>(this.begin, to, this.weight + weight);\n }\n\n// @Override\n// public VertexPath append(Edge edge) {\n// return new EfficientVertexPath<>(this, edge);\n// }\n//\n// @Override\n// public void merge(Edge edge) {\n// this.end = edge.getTo();\n// this.weight += edge.getWeight();\n// }\n }\n\n private static interface Graph {\n\n int getSize();\n\n Stream vertices();\n\n Stream adjacentVertices(V from);\n\n int getWeight(V from, V to);\n }\n\n private static interface IntGraph {\n\n int getSize();\n\n IntStream vertices();\n\n IntStream adjacentVertices(int from);\n\n int getWeight(int from, int to);\n }\n\n static interface Path {\n\n int getBegin();\n\n int getEnd();\n\n int getWeight();\n\n Path append(Path other);\n\n void merge(Path other);\n\n Path append(int to, int weight);\n }\n\n static class IntPath implements Path {\n\n private int begin;\n private int end;\n private int weight;\n\n public IntPath(int begin) {\n this.begin = begin;\n this.end = begin;\n this.weight = 0;\n }\n\n public IntPath(int begin, int end, int weight) {\n this.begin = begin;\n this.end = end;\n this.weight = weight;\n }\n\n// public EfficientVertexPath(Edge edge) {\n// this.begin = edge.getFrom();\n// this.end = edge.getTo();\n// this.weight = edge.getWeight();\n// }\n//\n// private EfficientVertexPath(VertexPath path, Edge append) {\n// this.begin = path.getBegin();\n// if (!path.getEnd().equals(append.getFrom())) {\n// throw new IllegalStateException(\"not correct edge.\");\n// }\n// this.end = append.getTo();\n// this.weight = path.getWeight() + append.getWeight();\n// }\n\n private IntPath(Path pathA, Path pathB) {\n this.begin = pathA.getBegin();\n if (pathA.getEnd() != pathB.getBegin()) {\n throw new IllegalStateException(\"not correct edge.\");\n }\n this.end = pathB.getEnd();\n this.weight = pathA.getWeight() + pathB.getWeight();\n }\n\n @Override\n public int getBegin() {\n return begin;\n }\n\n @Override\n public int getEnd() {\n return end;\n }\n\n @Override\n public int getWeight() {\n return weight;\n }\n\n @Override\n public Path append(Path other) {\n return new IntPath(this, other);\n }\n\n @Override\n public void merge(Path other) {\n this.end = other.getEnd();\n this.weight += other.getWeight();\n }\n\n @Override\n public Path append(int to, int weight) {\n return new IntPath(this.begin, to, this.weight + weight);\n }\n }\n\n private static class Scanner {\n\n private final InputStream is;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n Scanner(InputStream is) {\n this.is = is;\n }\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = is.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte()) {\n return buffer[ptr++];\n } else {\n return -1;\n }\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr])) {\n ptr++;\n }\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {\n throw new NumberFormatException();\n }\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1579034800, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03053.html", "problem_id": "p03053", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03053/input.txt", "sample_output_relpath": "derived/input_output/data/p03053/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03053/Java/s330228180.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s330228180", "user_id": "u482226328"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.io.InputStream;\nimport java.io.IOException;\nimport java.io.PrintStream;\nimport java.util.*;\nimport java.util.function.BiPredicate;\nimport java.util.function.IntFunction;\nimport java.util.function.ToIntFunction;\nimport java.util.stream.Collectors;\nimport java.util.stream.IntStream;\nimport java.util.stream.Stream;\n\npublic class Main {\n\n public static void main(String[] args) {\n solve(System.in, System.out);\n }\n\n private static DistanceMemoBfsPathQuery query;\n private static EncodedGraph graph;\n\n static void solve(InputStream is, PrintStream os) {\n Scanner sc = new Scanner(is);\n\n /* read */\n int h = sc.nextInt();\n int w = sc.nextInt();\n\n List blacks = new ArrayList<>();\n GridPointEncoder encoder = new GridPointEncoder(h, w);\n for (int r = 0; r < h; r++) {\n String line = sc.next();\n for (int c = 0; c < w; c++) {\n if (line.charAt(c) == '#') {\n blacks.add(encoder.encode(new GridPoint(r, c)));\n }\n }\n }\n\n // reduce visited cells\n graph = new VerticalHorizontalNeighborGridPointGraph(h, w, (r, c) -> true);\n\n query = new DistanceMemoBfsPathQuery(graph.delegate);\n\n query.path(blacks.stream().mapToInt(i -> i).toArray(), -1);\n\n os.println(max);\n\n }\n\n// private static boolean predicate(int r, int c, int h, int w) {\n// return !query.visited[r * w + c];\n// }\n\n static long max = 0L;\n\n private static class DistanceMemoBfsPathQuery extends BfsPathQuery {\n\n\n public DistanceMemoBfsPathQuery(IntGraph graph) {\n super(graph);\n }\n\n @Override\n int mark(Path path, int to) {\n max = Math.max(max, path.getWeight() + graph.getWeight(path.getEnd(), to));\n return super.mark(path, to);\n }\n }\n\n private static class GridPointEncoder implements Encoder {\n\n public GridPointEncoder(int h, int w) {\n this.h = h;\n this.w = w;\n }\n\n private final int h;\n private final int w;\n\n @Override\n public int num() {\n return w * h;\n }\n\n @Override\n public int encode(GridPoint from) {\n if (from == null) {\n return -1;\n }\n return w * from.r + from.c;\n }\n\n @Override\n public GridPoint decode(int from) {\n if (from < 0) {\n return null;\n }\n return new GridPoint(from / w, from % w);\n }\n }\n\n private static class GridPoint implements Encoded {\n\n private final int r;\n private final int c;\n\n public GridPoint(int r, int c) {\n this.r = r;\n this.c = c;\n }\n }\n\n private static class VerticalHorizontalNeighborGridPointGraph extends GridPointGraph {\n\n private final BiPredicate predicate;\n protected List moves = Arrays.asList(\n new int[]{-1, 0},\n new int[]{1, 0},\n new int[]{0, -1},\n new int[]{0, 1}\n );\n\n public VerticalHorizontalNeighborGridPointGraph(int h, int w,\n BiPredicate predicate) {\n super(h, w);\n\n this.predicate = predicate;\n\n this.delegate = new IntGraph() {\n @Override\n public int getSize() {\n return w * h;\n }\n\n @Override\n public IntStream vertices() {\n return IntStream.range(0, w * h);\n }\n\n @Override\n public IntStream adjacentVertices(int from) {\n return neighbors(decoder.apply(from)).mapToInt(encoder);\n }\n\n @Override\n public int getWeight(int from, int to) {\n return 1;\n }\n };\n }\n\n protected boolean predicate(int r, int c) {\n if (r < 0 || h <= r) {\n return false;\n }\n if (c < 0 || w <= c) {\n return false;\n }\n return predicate.test(r, c);\n }\n\n protected Stream neighbors(GridPoint from) {\n\n return moves.stream().filter(move -> predicate(from.r + move[0], from.c + move[1]))\n .map(move -> new GridPoint(from.r + move[0], from.c + move[1]));\n }\n }\n\n// private static class AdjacencyMatrixGridPointGraph extends IntVertexGraph {\n//\n// private List vertexes;\n//\n// private final int n;\n// private final int[][] matrix;\n//\n// public AdjacencyMatrixGridPointGraph(int n, int[][] matrix) {\n// this.n = n;\n// this.matrix = matrix;\n// }\n//\n// @Override\n// public Collection getVertices() {\n// // lazy load\n// if (vertexes == null) {\n// vertexes = IntStream.range(0, n).boxed().collect(Collectors.toList());\n// }\n// return vertexes;\n// }\n//\n// @Override\n// public int getSize() {\n// return n;\n// }\n//\n// @Override\n// public List> getEdges(Integer from) {\n// return IntStream.range(0, n).mapToObj(to -> new Edge<>(from, to, matrix[from][to]))\n// .collect(Collectors.toList());\n// }\n// }\n//\n// private static class AdjacencyListGridPointGraph extends IntVertexGraph {\n//\n// private List vertexes;\n//\n// private final int n;\n// private final List>> edges;\n//\n// public AdjacencyListGridPointGraph(int n, List>> edges) {\n// this.n = n;\n// this.edges = edges;\n// }\n//\n// @Override\n// public Collection getVertices() {\n// // lazy load\n// if (vertexes == null) {\n// vertexes = IntStream.range(0, n).boxed().collect(Collectors.toList());\n// }\n// return vertexes;\n// }\n//\n// @Override\n// public int getSize() {\n// return n;\n// }\n//\n// @Override\n// public List> getEdges(Integer from) {\n// return edges.get(from);\n// }\n// }\n\n private static abstract class GridPointGraph extends EncodedGraph {\n\n public GridPointGraph(int h, int w) {\n super(new GridPointEncoder(h, w)::encode, new GridPointEncoder(h, w)::decode);\n this.h = h;\n this.w = w;\n }\n\n protected final int h;\n protected final int w;\n\n }\n\n private static interface Encoded {\n\n }\n\n private static interface Encoder {\n\n int num();\n\n int encode(E from);\n\n E decode(int from);\n }\n\n// private static abstract class EncodedGraph> implements Graph {\n//\n// public EncodedGraph(Encoder encoder) {\n// this.encoder = encoder;\n// this.delegate = new IntVertexGraph() {\n// @Override\n// public Collection getVertices() {\n// return EncodedGraph.this.getVertices().stream()\n// .map(encoder::encode)\n// .collect(Collectors.toList());\n// }\n//\n// @Override\n// public Collection getAdjacentVertices(Integer from) {\n// Collection adjacent = EncodedGraph.this.getAdjacentVertices(encoder.decode(from));\n//\n// List ans = new ArrayList<>(adjacent.size());\n// for (V v : adjacent) {\n// ans.add(encoder.encode(v));\n// }\n// return ans;\n// }\n//\n// @Override\n// public int getWeight(Integer from, Integer to) {\n// return EncodedGraph.this.getWeight(encoder.decode(from), encoder.decode(to));\n// }\n//\n// @Override\n// public int getSize() {\n// return EncodedGraph.this.getSize();\n// }\n//\n//// @Override\n//// public Collection> getEdges(Integer from) {\n//// Collection> edges = EncodedGraph.this.getEdges(encoder.decode(from));\n//// List> ans = new ArrayList<>(edges.size());\n//// for (Edge e : edges) {\n//// ans.add(new Edge<>(\n//// encoder.encode(e.getFrom()), encoder.encode(e.getTo()), e.getWeight()));\n//// }\n//// return ans;\n//// }\n// };\n// }\n//\n// final Encoder encoder;\n// final IntVertexGraph delegate;\n//\n// public PathQuery pathQuery(Function, PathQuery> delegate) {\n// return new EncodedPathQuery<>(delegate, this);\n// }\n//\n// public MultiPathQuery multiPathQuery(\n// Function, MultiPathQuery> delegate) {\n// return new EncodedMultiPathQuery<>(delegate, this);\n// }\n//\n// private static class EncodedPathQuery> implements PathQuery {\n//\n// EncodedGraph graph;\n// PathQuery delegate;\n//\n// private EncodedPathQuery(Function, PathQuery> delegate,\n// EncodedGraph graph) {\n// this.graph = graph;\n// this.delegate = delegate.apply(graph.delegate);\n// }\n//\n// @Override\n// public VertexPath path(V begin, V end) {\n// VertexPath path = delegate\n// .path(graph.encoder.encode(begin), graph.encoder.encode(end));\n// if (path == null) {\n// return null;\n// }\n// return new EfficientVertexPath<>(graph.encoder.decode(path.getBegin()),\n// graph.encoder.decode(path.getEnd()), path.getWeight());\n// }\n// }\n//\n// private static class EncodedMultiPathQuery> implements MultiPathQuery {\n//\n// EncodedGraph graph;\n// MultiPathQuery delegate;\n//\n// private EncodedMultiPathQuery(Function, MultiPathQuery> delegate,\n// EncodedGraph graph) {\n// this.graph = graph;\n// this.delegate = delegate.apply(graph.delegate);\n// }\n//\n// @Override\n// public VertexPath path(List begin, V end) {\n// List list = begin.stream().map(graph.encoder::encode)\n// .collect(Collectors.toList());\n// VertexPath path = delegate\n// .path(list, graph.encoder.encode(end));\n// if (path == null) {\n// return null;\n// }\n// return new EfficientVertexPath<>(graph.encoder.decode(path.getBegin()),\n// graph.encoder.decode(path.getEnd()), path.getWeight());\n// }\n// }\n//\n// }\n\n private static class EncodedGraph implements Graph {\n\n // protected\n IntGraph delegate;\n protected final ToIntFunction encoder;\n protected final IntFunction decoder;\n\n private EncodedGraph(ToIntFunction encoder, IntFunction decoder) {\n this.encoder = encoder;\n this.decoder = decoder;\n }\n\n @Override\n public int getSize() {\n return delegate.getSize();\n }\n\n @Override\n public Stream vertices() {\n return delegate.vertices().mapToObj(decoder);\n }\n\n @Override\n public Stream adjacentVertices(V from) {\n return delegate.adjacentVertices(encoder.applyAsInt(from)).mapToObj(decoder);\n }\n\n @Override\n public int getWeight(V from, V to) {\n return delegate.getWeight(encoder.applyAsInt(from), encoder.applyAsInt(to));\n }\n }\n\n private static interface EncodedPathQuery {\n\n VertexPath path(V begin, V end);\n }\n\n private static interface EncodedMultiPathQuery {\n\n VertexPath path(List begin, V end);\n }\n\n private static interface PathQuery {\n\n Path path(int begin, int end);\n }\n\n private static interface MultiPathQuery {\n\n Path path(int[] begin, int end);\n }\n\n private static abstract class QueuedPathQuery implements PathQuery {\n\n protected final IntGraph graph;\n protected final Queue queue;\n\n public QueuedPathQuery(IntGraph graph, Queue queue) {\n this.graph = graph;\n this.queue = queue;\n }\n\n public Path path(int begin, int end) {\n\n prepare(begin, end);\n queue.add(new IntPath(begin));\n return search(end);\n }\n\n protected Path search(int end) {\n while (!queue.isEmpty()) {\n Path path = queue.remove();\n int head = path.getEnd();\n\n if (head == end) {\n return new IntPath(path.getBegin(),\n path.getEnd(), path.getWeight());\n }\n\n graph.adjacentVertices(head).filter(to -> predicate(path, to))\n .map(to -> mark(path, to))\n .mapToObj(to -> path.append(to, graph.getWeight(head, to)))\n .forEach(queue::add);\n }\n return null;\n }\n\n abstract void prepare(int begin, int end);\n\n abstract boolean predicate(Path path, int to);\n\n abstract int mark(Path path, int to);\n }\n\n private static class BfsPathQuery extends QueuedPathQuery implements\n MultiPathQuery {\n\n final boolean[] visited;\n\n public BfsPathQuery(IntGraph graph) {\n super(graph, new ArrayDeque<>());\n visited = new boolean[graph.getSize()];\n }\n\n @Override\n void prepare(int begin, int end) {\n visited[begin] = true;\n }\n\n @Override\n boolean predicate(Path path, int to) {\n return !visited[to];\n }\n\n @Override\n int mark(Path path, int to) {\n visited[to] = true;\n return to;\n }\n\n @Override\n public Path path(int[] begins, int end) {\n\n for (int begin : begins) {\n prepare(begin, end);\n queue.add(new IntPath(begin));\n }\n return search(end);\n }\n\n }\n\n// private static abstract class QueuedPathQuery implements PathQuery {\n//\n// protected final IntGraph graph;\n// protected final Queue queue;\n//\n// private final ToIntFunction encoder;\n// private final IntFunction decoder;\n//\n// public QueuedPathQuery(IntGraph graph, Queue queue, ToIntFunction encoder,\n// IntFunction decoder) {\n// this.graph = graph;\n// this.queue = queue;\n// this.encoder = encoder;\n// this.decoder = decoder;\n// }\n//\n// public VertexPath path(V begin, V end) {\n//\n// prepare(encoder.applyAsInt(begin), encoder.applyAsInt(end));\n// queue.add(new IntPath<>(encoder.applyAsInt(begin)));\n// return search(encoder.applyAsInt(end));\n// }\n//\n// protected VertexPath search(int end) {\n// while (!queue.isEmpty()) {\n// Path path = queue.remove();\n// int head = path.getEnd();\n//\n// if (head == end) {\n// return new EfficientVertexPath<>(decoder.apply(path.getBegin()),\n// decoder.apply(path.getEnd()), path.getWeight());\n// }\n//\n// int[] adjacent = graph.getAdjacentVertices(head);\n// for (int to : adjacent) {\n// if (!predicate(path, to)) {\n// continue;\n// }\n// mark(path, to);\n// queue.add(path.append(to, graph.getWeight(head, to)));\n// }\n// }\n// return null;\n// }\n//\n// abstract void prepare(int begin, int end);\n//\n// abstract boolean predicate(Path path, int to);\n//\n// abstract void mark(Path path, int to);\n// }\n\n// private static class DijkstraPathQuery extends QueuedPathQuery {\n//\n// private final long[] distance;\n//\n// public DijkstraPathQuery(Graph graph) {\n// super(graph, new PriorityQueue<>(\n// Comparator.comparingLong(VertexPath::getWeight)));\n// distance = new long[graph.getSize()];\n// }\n//\n//\n// @Override\n// void prepare(Integer begin, Integer end) {\n// for (Integer v : graph.getVertices()) {\n// distance[v] = Integer.MAX_VALUE;\n// }\n// }\n//\n// @Override\n// boolean predicate(VertexPath path, Integer to) {\n// return distance[path.getEnd()] + graph.getWeight(path.getEnd(), to) < distance[to];\n// }\n//\n// @Override\n// void mark(VertexPath path, Integer to) {\n// distance[to] = distance[path.getEnd()] + graph.getWeight(path.getEnd(), to);\n// }\n// }\n\n// private static class BfsPathQuery extends QueuedPathQuery implements\n// MultiPathQuery {\n//\n// final boolean[] visited;\n//\n// public BfsPathQuery(IntGraph graph, ToIntFunction) {\n// super(graph, new ArrayDeque<>());\n// visited = new boolean[graph.getSize()];\n// }\n//\n// @Override\n// void prepare(Integer begin, Integer end) {\n// visited[begin] = true;\n// }\n//\n// @Override\n// boolean predicate(VertexPath path, Integer to) {\n// return !visited[to];\n// }\n//\n// @Override\n// void mark(VertexPath path, Integer to) {\n// visited[to] = true;\n// }\n//\n// public VertexPath path(List begins, Integer end) {\n//\n// for (int begin : begins) {\n// prepare(begin, end);\n// queue.add(new EfficientVertexPath<>(begin));\n// }\n// return search(end);\n// }\n//\n// }\n\n// private static class BfsPathQuery extends QueuedPathQuery implements\n// MultiPathQuery {\n//\n// final boolean[] visited;\n//\n// public BfsPathQuery(Graph graph) {\n// super(graph, new ArrayDeque<>());\n// visited = new boolean[graph.getSize()];\n// }\n//\n// @Override\n// void prepare(Integer begin, Integer end) {\n// visited[begin] = true;\n// }\n//\n// @Override\n// boolean predicate(Edge edge) {\n// return !visited[edge.getTo()];\n// }\n//\n// @Override\n// void mark(VertexPath path, Edge edge) {\n// visited[edge.getTo()] = true;\n// }\n//\n// public VertexPath path(List begins, Integer end) {\n//\n// for (int begin : begins) {\n// prepare(begin, end);\n// queue.add(new EfficientVertexPath<>(begin));\n// }\n// return search(end);\n// }\n//\n// }\n\n// private static abstract class MemoDfsPathQuery extends DfsPathQuery {\n//\n// public MemoDfsPathQuery(Graph graph) {\n// super(graph);\n// }\n//\n// abstract VertexPath memo(VertexPath path, V parent,\n// V end);\n//\n// @Override\n// public VertexPath path(VertexPath path, V parent,\n// V end) {\n// VertexPath memo = memo(path, parent, end);\n// if (memo != null) {\n// return memo;\n// }\n// return super.path(path, parent, end);\n// }\n// }\n\n// private static class DfsPathQuery implements PathQuery {\n//\n// protected final Graph graph;\n//\n// public DfsPathQuery(Graph graph) {\n// this.graph = graph;\n// }\n//\n// @Override\n// public VertexPath path(V begin, V end) {\n// return path(new EfficientVertexPath<>(begin), null, end);\n// }\n//\n// protected VertexPath path(VertexPath path, V parent,\n// V end) {\n// V head = path.getEnd();\n// if (path.getEnd().equals(end)) {\n// return path;\n// }\n// Collection adjacent = graph.getAdjacentVertices(head);\n// for (V to : adjacent) {\n// if (!to.equals(parent)) {\n// VertexPath next = path(path.append(to, graph.getWeight(head, to)), head, end);\n// if (next != null) {\n// return next;\n// }\n// }\n// }\n// return null;\n// }\n// }\n\n// private static class WarshallFloydQuery implements PathQuery {\n//\n// private VertexPath[][] shortest;\n//\n// private WarshallFloydQuery(Graph graph) {\n// Collection nodes = graph.getVertices();\n//\n// shortest = new VertexPath[nodes.size()][nodes.size()];\n//\n// for (int from : nodes) {\n// Collection> edges = graph.getEdges(from);\n// for (Edge e : edges) {\n// shortest[e.getFrom()][e.getTo()] = new EfficientVertexPath<>(e);\n// }\n// shortest[from][from] = new EfficientVertexPath<>(from);\n// }\n//\n// for (int relay : nodes) {\n// for (int from : nodes) {\n// for (int dest : nodes) {\n// VertexPath pathA = shortest[from][relay];\n// VertexPath pathB = shortest[relay][dest];\n// if (pathA != null && pathB != null) {\n// if (shortest[from][dest] == null\n// || pathA.getWeight() + pathB.getWeight() < shortest[from][dest]\n// .getWeight()) {\n// shortest[from][dest] = pathA.append(pathB);\n// }\n// }\n// }\n// }\n// }\n// }\n//\n// @Override\n// public VertexPath path(Integer begin, Integer end) {\n// return shortest[begin][end];\n// }\n// }\n\n// private static abstract class IntVertexGraph implements Graph {\n//\n// }\n\n// static class Edge {\n//\n// public Edge(V from, V to, int weight) {\n// this.from = from;\n// this.to = to;\n// this.weight = weight;\n// }\n//\n// private final V from;\n//\n// private final V to;\n// private final int weight;\n//\n//\n// V getFrom() {\n// return from;\n// }\n//\n// V getTo() {\n// return to;\n// }\n//\n// int getWeight() {\n// return weight;\n// }\n// }\n\n static interface VertexPath {\n\n V getBegin();\n\n V getEnd();\n\n int getWeight();\n\n VertexPath append(VertexPath other);\n\n void merge(VertexPath other);\n\n VertexPath append(V to, int weight);\n\n// void merge(Edge edge);\n }\n\n static class EfficientVertexPath implements VertexPath {\n\n private V begin;\n private V end;\n private int weight;\n\n public EfficientVertexPath(V begin) {\n this.begin = begin;\n this.end = begin;\n this.weight = 0;\n }\n\n public EfficientVertexPath(V begin, V end, int weight) {\n this.begin = begin;\n this.end = end;\n this.weight = weight;\n }\n\n// public EfficientVertexPath(Edge edge) {\n// this.begin = edge.getFrom();\n// this.end = edge.getTo();\n// this.weight = edge.getWeight();\n// }\n//\n// private EfficientVertexPath(VertexPath path, Edge append) {\n// this.begin = path.getBegin();\n// if (!path.getEnd().equals(append.getFrom())) {\n// throw new IllegalStateException(\"not correct edge.\");\n// }\n// this.end = append.getTo();\n// this.weight = path.getWeight() + append.getWeight();\n// }\n\n private EfficientVertexPath(VertexPath pathA, VertexPath pathB) {\n this.begin = pathA.getBegin();\n if (!pathA.getEnd().equals(pathB.getBegin())) {\n throw new IllegalStateException(\"not correct edge.\");\n }\n this.end = pathB.getEnd();\n this.weight = pathA.getWeight() + pathB.getWeight();\n }\n\n @Override\n public V getBegin() {\n return begin;\n }\n\n @Override\n public V getEnd() {\n return end;\n }\n\n @Override\n public int getWeight() {\n return weight;\n }\n\n @Override\n public VertexPath append(VertexPath other) {\n return new EfficientVertexPath<>(this, other);\n }\n\n @Override\n public void merge(VertexPath other) {\n this.end = other.getEnd();\n this.weight += other.getWeight();\n }\n\n @Override\n public VertexPath append(V to, int weight) {\n return new EfficientVertexPath<>(this.begin, to, this.weight + weight);\n }\n\n// @Override\n// public VertexPath append(Edge edge) {\n// return new EfficientVertexPath<>(this, edge);\n// }\n//\n// @Override\n// public void merge(Edge edge) {\n// this.end = edge.getTo();\n// this.weight += edge.getWeight();\n// }\n }\n\n private static interface Graph {\n\n int getSize();\n\n Stream vertices();\n\n Stream adjacentVertices(V from);\n\n int getWeight(V from, V to);\n }\n\n private static interface IntGraph {\n\n int getSize();\n\n IntStream vertices();\n\n IntStream adjacentVertices(int from);\n\n int getWeight(int from, int to);\n }\n\n static interface Path {\n\n int getBegin();\n\n int getEnd();\n\n int getWeight();\n\n Path append(Path other);\n\n void merge(Path other);\n\n Path append(int to, int weight);\n }\n\n static class IntPath implements Path {\n\n private int begin;\n private int end;\n private int weight;\n\n public IntPath(int begin) {\n this.begin = begin;\n this.end = begin;\n this.weight = 0;\n }\n\n public IntPath(int begin, int end, int weight) {\n this.begin = begin;\n this.end = end;\n this.weight = weight;\n }\n\n// public EfficientVertexPath(Edge edge) {\n// this.begin = edge.getFrom();\n// this.end = edge.getTo();\n// this.weight = edge.getWeight();\n// }\n//\n// private EfficientVertexPath(VertexPath path, Edge append) {\n// this.begin = path.getBegin();\n// if (!path.getEnd().equals(append.getFrom())) {\n// throw new IllegalStateException(\"not correct edge.\");\n// }\n// this.end = append.getTo();\n// this.weight = path.getWeight() + append.getWeight();\n// }\n\n private IntPath(Path pathA, Path pathB) {\n this.begin = pathA.getBegin();\n if (pathA.getEnd() != pathB.getBegin()) {\n throw new IllegalStateException(\"not correct edge.\");\n }\n this.end = pathB.getEnd();\n this.weight = pathA.getWeight() + pathB.getWeight();\n }\n\n @Override\n public int getBegin() {\n return begin;\n }\n\n @Override\n public int getEnd() {\n return end;\n }\n\n @Override\n public int getWeight() {\n return weight;\n }\n\n @Override\n public Path append(Path other) {\n return new IntPath(this, other);\n }\n\n @Override\n public void merge(Path other) {\n this.end = other.getEnd();\n this.weight += other.getWeight();\n }\n\n @Override\n public Path append(int to, int weight) {\n return new IntPath(this.begin, to, this.weight + weight);\n }\n }\n\n private static class Scanner {\n\n private final InputStream is;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n Scanner(InputStream is) {\n this.is = is;\n }\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = is.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte()) {\n return buffer[ptr++];\n } else {\n return -1;\n }\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr])) {\n ptr++;\n }\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {\n throw new NumberFormatException();\n }\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a grid of squares with H horizontal rows and W vertical columns, where each square is painted white or black.\nHW characters from A_{11} to A_{HW} represent the colors of the squares.\nA_{ij} is # if the square at the i-th row from the top and the j-th column from the left is black, and A_{ij} is . if that square is white.\n\nWe will repeatedly perform the following operation until all the squares are black:\n\nEvery white square that shares a side with a black square, becomes black.\n\nFind the number of operations that will be performed.\nThe initial grid has at least one black square.\n\nConstraints\n\n1 \\leq H,W \\leq 1000\n\nA_{ij} is # or ..\n\nThe given grid has at least one black square.\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\nPrint the number of operations that will be performed.\n\nSample Input 1\n\n3 3\n...\n.#.\n...\n\nSample Output 1\n\n2\n\nAfter one operation, all but the corners of the grid will be black. After one more operation, all the squares will be black.\n\nSample Input 2\n\n6 6\n..#..#\n......\n#..#..\n......\n.#....\n....#.\n\nSample Output 2\n\n3", "sample_input": "3 3\n...\n.#.\n...\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03053", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a grid of squares with H horizontal rows and W vertical columns, where each square is painted white or black.\nHW characters from A_{11} to A_{HW} represent the colors of the squares.\nA_{ij} is # if the square at the i-th row from the top and the j-th column from the left is black, and A_{ij} is . if that square is white.\n\nWe will repeatedly perform the following operation until all the squares are black:\n\nEvery white square that shares a side with a black square, becomes black.\n\nFind the number of operations that will be performed.\nThe initial grid has at least one black square.\n\nConstraints\n\n1 \\leq H,W \\leq 1000\n\nA_{ij} is # or ..\n\nThe given grid has at least one black square.\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\nPrint the number of operations that will be performed.\n\nSample Input 1\n\n3 3\n...\n.#.\n...\n\nSample Output 1\n\n2\n\nAfter one operation, all but the corners of the grid will be black. After one more operation, all the squares will be black.\n\nSample Input 2\n\n6 6\n..#..#\n......\n#..#..\n......\n.#....\n....#.\n\nSample Output 2\n\n3", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 27341, "cpu_time_ms": 1061, "memory_kb": 311248}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s308413196", "group_id": "codeNet:p03053", "input_text": "import java.io.InputStream;\nimport java.io.IOException;\nimport java.io.PrintStream;\nimport java.util.*;\nimport java.util.function.BiPredicate;\nimport java.util.function.Function;\nimport java.util.function.Predicate;\nimport java.util.stream.Collectors;\nimport java.util.stream.IntStream;\n\npublic class Main {\n\n public static void main(String[] args) {\n solve(System.in, System.out);\n }\n\n private static DistanceMemoBfsPathQuery query;\n private static EncodedGraph graph;\n\n static void solve(InputStream is, PrintStream os) {\n Scanner sc = new Scanner(is);\n\n /* read */\n int h = sc.nextInt();\n int w = sc.nextInt();\n\n List blacks = new ArrayList<>();\n for (int r = 0; r < h; r++) {\n String line = sc.next();\n for (int c = 0; c < w; c++) {\n if (line.charAt(c) == '#') {\n blacks.add(new GridPoint(r, c));\n }\n }\n }\n\n // reduce visited cells\n graph = new VerticalHorizontalNeighborGridPointGraph(h, w, (r, c) -> predicate(r, c, h, w));\n\n MultiPathQuery query = graph.multiPathQuery(Main::sneaky);\n\n query.path(blacks, null);\n\n os.println(max);\n\n }\n\n private static boolean predicate(int r, int c, int h, int w) {\n return !query.visited[r * w + c];\n }\n\n private static DistanceMemoBfsPathQuery sneaky(Graph delegate) {\n query = new DistanceMemoBfsPathQuery(delegate);\n return query;\n }\n\n static long max = 0L;\n\n private static class DistanceMemoBfsPathQuery extends BfsPathQuery {\n\n\n public DistanceMemoBfsPathQuery(Graph graph) {\n super(graph);\n }\n\n @Override\n void mark(Graph.VertexPath existing, Graph.Edge edge,\n Graph.VertexPath path) {\n super.mark(existing, edge, path);\n max = Math.max(max, path.getWeight());\n }\n }\n\n private static class GridPointEncoder implements Encoder {\n\n public GridPointEncoder(int h, int w) {\n this.h = h;\n this.w = w;\n }\n\n private final int h;\n private final int w;\n\n @Override\n public int num() {\n return w * h;\n }\n\n @Override\n public Integer encode(GridPoint from) {\n if (from == null) {\n return null;\n }\n return w * from.r + from.c;\n }\n\n @Override\n public GridPoint decode(Integer from) {\n if (from == null) {\n return null;\n }\n return new GridPoint(from / w, from % w);\n }\n }\n\n private static class GridPoint implements Encoded {\n\n private final int r;\n private final int c;\n\n public GridPoint(int r, int c) {\n this.r = r;\n this.c = c;\n }\n\n @Override\n public boolean equals(Object o) {\n if (this == o) {\n return true;\n }\n if (o == null || getClass() != o.getClass()) {\n return false;\n }\n GridPoint gridPoint = (GridPoint) o;\n return r == gridPoint.r &&\n c == gridPoint.c;\n }\n\n @Override\n public int hashCode() {\n return Objects.hash(r, c);\n }\n }\n\n private static class VerticalHorizontalNeighborGridPointGraph extends GridPointGraph {\n\n private final BiPredicate predicate;\n protected List moves = Arrays.asList(\n new int[]{-1, 0},\n new int[]{1, 0},\n new int[]{0, -1},\n new int[]{0, 1}\n );\n\n public VerticalHorizontalNeighborGridPointGraph(int h, int w,\n BiPredicate predicate) {\n super(h, w);\n this.predicate = predicate;\n }\n\n protected boolean predicate(int r, int c) {\n if (r < 0 || h <= r) {\n return false;\n }\n if (c < 0 || w <= c) {\n return false;\n }\n return predicate.test(r, c);\n }\n\n protected List> neighbors(GridPoint from) {\n\n List> ans = new ArrayList<>();\n\n for (int i = 0; i < 4; i++) {\n int[] move = moves.get(i);\n if (predicate(from.r + move[0], from.c + move[1])) {\n ans.add(new ConstantWeightEdge<>(from, new GridPoint(from.r + move[0], from.c + move[1])));\n }\n }\n\n return ans;\n }\n\n @Override\n public int getSize() {\n return h * w;\n }\n\n @Override\n public Collection> getEdges(GridPoint from) {\n return neighbors(from);\n }\n }\n\n private static class AdjacencyMatrixGridPointGraph extends IntVertexGraph {\n\n private List vertexes;\n\n private final int n;\n private final int[][] matrix;\n\n public AdjacencyMatrixGridPointGraph(int n, int[][] matrix) {\n this.n = n;\n this.matrix = matrix;\n }\n\n @Override\n public Collection getVertexes() {\n // lazy load\n if (vertexes == null) {\n vertexes = IntStream.range(0, n).boxed().collect(Collectors.toList());\n }\n return vertexes;\n }\n\n @Override\n public int getSize() {\n return n;\n }\n\n @Override\n public List> getEdges(Integer from) {\n return IntStream.range(0, n).mapToObj(to -> new Edge<>(from, to, matrix[from][to]))\n .collect(Collectors.toList());\n }\n }\n\n private static class AdjacencyListGridPointGraph extends IntVertexGraph {\n\n private List vertexes;\n\n private final int n;\n private final List>> edges;\n\n public AdjacencyListGridPointGraph(int n, List>> edges) {\n this.n = n;\n this.edges = edges;\n }\n\n @Override\n public Collection getVertexes() {\n // lazy load\n if (vertexes == null) {\n vertexes = IntStream.range(0, n).boxed().collect(Collectors.toList());\n }\n return vertexes;\n }\n\n @Override\n public int getSize() {\n return n;\n }\n\n @Override\n public List> getEdges(Integer from) {\n return edges.get(from);\n }\n }\n\n\n private static abstract class GridPointGraph extends EncodedGraph {\n\n public GridPointGraph(int h, int w) {\n super(new GridPointEncoder(h, w));\n this.h = h;\n this.w = w;\n }\n\n protected final int h;\n protected final int w;\n\n protected List vertexes;\n\n @Override\n public Collection getVertexes() {\n\n // lazy load\n if (vertexes == null) {\n vertexes = new ArrayList<>(w * h);\n for (int r = 0; r < h; r++) {\n for (int c = 0; c < w; c++) {\n vertexes.add(new GridPoint(r, c));\n }\n }\n }\n\n return vertexes;\n }\n }\n\n private static interface Encoded {\n\n }\n\n private static interface Encoder {\n\n int num();\n\n Integer encode(E from);\n\n E decode(Integer from);\n }\n\n private static abstract class EncodedGraph> implements Graph {\n\n public EncodedGraph(Encoder encoder) {\n this.encoder = encoder;\n this.delegate = new IntVertexGraph() {\n @Override\n public Collection getVertexes() {\n return EncodedGraph.this.getVertexes().stream()\n .map(encoder::encode)\n .collect(Collectors.toList());\n }\n\n @Override\n public int getSize() {\n return EncodedGraph.this.getSize();\n }\n\n @Override\n public Collection> getEdges(Integer from) {\n Collection> edges = EncodedGraph.this.getEdges(encoder.decode(from));\n List> ans = new ArrayList<>(edges.size());\n for (Edge e : edges) {\n ans.add(new Edge<>(\n encoder.encode(e.getFrom()), encoder.encode(e.getTo()), e.getWeight()));\n }\n return ans;\n }\n };\n }\n\n final Encoder encoder;\n final IntVertexGraph delegate;\n\n public PathQuery pathQuery(Function, PathQuery> delegate) {\n return new EncodedPathQuery<>(delegate, this);\n }\n\n public MultiPathQuery multiPathQuery(\n Function, MultiPathQuery> delegate) {\n return new EncodedMultiPathQuery<>(delegate, this);\n }\n\n private static class EncodedPathQuery> implements PathQuery {\n\n EncodedGraph graph;\n PathQuery delegate;\n\n private EncodedPathQuery(Function, PathQuery> delegate,\n EncodedGraph graph) {\n this.graph = graph;\n this.delegate = delegate.apply(graph.delegate);\n }\n\n @Override\n public VertexPath path(V begin, V end) {\n VertexPath path = delegate\n .path(graph.encoder.encode(begin), graph.encoder.encode(end));\n if (path == null) {\n return null;\n }\n return new EfficientVertexPath<>(graph.encoder.decode(path.getBegin()),\n graph.encoder.decode(path.getEnd()), path.getWeight());\n }\n }\n\n private static class EncodedMultiPathQuery> implements MultiPathQuery {\n\n EncodedGraph graph;\n MultiPathQuery delegate;\n\n private EncodedMultiPathQuery(Function, MultiPathQuery> delegate,\n EncodedGraph graph) {\n this.graph = graph;\n this.delegate = delegate.apply(graph.delegate);\n }\n\n @Override\n public VertexPath path(List begin, V end) {\n List list = begin.stream().map(graph.encoder::encode)\n .collect(Collectors.toList());\n VertexPath path = delegate\n .path(list, graph.encoder.encode(end));\n if (path == null) {\n return null;\n }\n return new EfficientVertexPath<>(graph.encoder.decode(path.getBegin()),\n graph.encoder.decode(path.getEnd()), path.getWeight());\n }\n }\n\n }\n\n private static interface PathQuery {\n\n Graph.VertexPath path(V begin, V end);\n }\n\n private static interface MultiPathQuery {\n\n Graph.VertexPath path(List begin, V end);\n }\n\n private static abstract class QueuedPathQuery implements PathQuery {\n\n protected final Graph graph;\n protected final Queue> queue;\n\n public QueuedPathQuery(Graph graph, Queue> queue) {\n this.graph = graph;\n this.queue = queue;\n }\n\n public Graph.VertexPath path(V begin, V end) {\n\n prepare(begin, end);\n queue.add(new Graph.EfficientVertexPath<>(begin));\n return search(end);\n }\n\n protected Graph.VertexPath search(V end) {\n while (!queue.isEmpty()) {\n Graph.VertexPath path = queue.remove();\n V head = path.getEnd();\n\n if (head.equals(end)) {\n return path;\n }\n\n for (Graph.Edge e : graph.getEdges(head)) {\n if (!predicate(e)) {\n continue;\n }\n Graph.VertexPath p = path.append(e);\n queue.add(p);\n mark(path, e, p);\n }\n }\n return null;\n }\n\n abstract void prepare(V begin, V end);\n\n abstract boolean predicate(Graph.Edge edge);\n\n abstract void mark(Graph.VertexPath existing, Graph.Edge edge,\n Graph.VertexPath path);\n }\n\n private static class DijkstraPathQuery extends QueuedPathQuery {\n\n private final long[] distance;\n\n public DijkstraPathQuery(Graph graph) {\n super(graph, new PriorityQueue<>(\n Comparator.comparingLong(Graph.VertexPath::getWeight)));\n distance = new long[graph.getSize()];\n }\n\n\n @Override\n void prepare(Integer begin, Integer end) {\n for (Integer v : graph.getVertexes()) {\n distance[v] = Integer.MAX_VALUE;\n }\n }\n\n @Override\n boolean predicate(Graph.Edge edge) {\n return distance[edge.getFrom()] + edge.getWeight() < distance[edge.getTo()];\n }\n\n @Override\n void mark(Graph.VertexPath existing, Graph.Edge edge,\n Graph.VertexPath path) {\n distance[path.getEnd()] = path.getWeight();\n }\n }\n\n private static class BfsPathQuery extends QueuedPathQuery implements\n MultiPathQuery {\n\n final boolean[] visited;\n\n public BfsPathQuery(Graph graph) {\n super(graph, new ArrayDeque<>());\n visited = new boolean[graph.getSize()];\n }\n\n @Override\n void prepare(Integer begin, Integer end) {\n visited[begin] = true;\n }\n\n @Override\n boolean predicate(Graph.Edge edge) {\n return !visited[edge.getTo()];\n }\n\n @Override\n void mark(Graph.VertexPath existing, Graph.Edge edge,\n Graph.VertexPath path) {\n visited[path.getEnd()] = true;\n }\n\n public Graph.VertexPath path(List begins, Integer end) {\n\n begins.forEach(begin -> prepare(begin, end));\n begins.forEach(begin -> queue.add(new Graph.EfficientVertexPath<>(begin)));\n return search(end);\n }\n\n }\n\n private static abstract class MemoDfsPathQuery extends DfsPathQuery {\n\n public MemoDfsPathQuery(Graph graph) {\n super(graph);\n }\n\n abstract Graph.VertexPath memo(Graph.VertexPath path, V parent,\n V end);\n\n @Override\n public Graph.VertexPath path(Graph.VertexPath path, V parent,\n V end) {\n Graph.VertexPath memo = memo(path, parent, end);\n if (memo != null) {\n return memo;\n }\n return super.path(path, parent, end);\n }\n }\n\n private static class DfsPathQuery implements PathQuery {\n\n protected final Graph graph;\n\n public DfsPathQuery(Graph graph) {\n this.graph = graph;\n }\n\n @Override\n public Graph.VertexPath path(V begin, V end) {\n return path(new Graph.EfficientVertexPath<>(begin), null, end);\n }\n\n protected Graph.VertexPath path(Graph.VertexPath path, V parent,\n V end) {\n V head = path.getEnd();\n if (path.getEnd().equals(end)) {\n return path;\n }\n for (Graph.Edge e : graph.getEdges(head)) {\n if (!e.getTo().equals(parent)) {\n Graph.VertexPath next = path(path.append(e), head, end);\n if (next != null) {\n return next;\n }\n }\n }\n return null;\n }\n }\n\n private static class WarshallFloydQuery implements PathQuery {\n\n private Graph.VertexPath[][] shortest;\n\n private WarshallFloydQuery(Graph graph) {\n Collection nodes = graph.getVertexes();\n\n shortest = new Graph.VertexPath[nodes.size()][nodes.size()];\n\n for (int from : nodes) {\n Collection> edges = graph.getEdges(from);\n for (Graph.Edge e : edges) {\n shortest[e.getFrom()][e.getTo()] = new Graph.EfficientVertexPath<>(e);\n }\n shortest[from][from] = new Graph.EfficientVertexPath<>(from);\n }\n\n for (int relay : nodes) {\n for (int from : nodes) {\n for (int dest : nodes) {\n Graph.VertexPath pathA = shortest[from][relay];\n Graph.VertexPath pathB = shortest[relay][dest];\n if (pathA != null && pathB != null) {\n if (shortest[from][dest] == null\n || pathA.getWeight() + pathB.getWeight() < shortest[from][dest]\n .getWeight()) {\n shortest[from][dest] = pathA.append(pathB);\n }\n }\n }\n }\n }\n }\n\n @Override\n public Graph.VertexPath path(Integer begin, Integer end) {\n return shortest[begin][end];\n }\n }\n\n private static abstract class IntVertexGraph implements Graph {\n\n }\n\n private static interface Graph {\n\n static class Edge {\n\n public Edge(V from, V to, long weight) {\n this.from = from;\n this.to = to;\n this.weight = weight;\n }\n\n private final V from;\n\n private final V to;\n private final long weight;\n\n\n V getFrom() {\n return from;\n }\n\n V getTo() {\n return to;\n }\n\n long getWeight() {\n return weight;\n }\n\n @Override\n public boolean equals(Object o) {\n if (this == o) {\n return true;\n }\n if (o == null || getClass() != o.getClass()) {\n return false;\n }\n Edge edge = (Edge) o;\n return weight == edge.weight &&\n Objects.equals(from, edge.from) &&\n Objects.equals(to, edge.to);\n }\n\n @Override\n public int hashCode() {\n return Objects.hash(from, to, weight);\n }\n }\n\n static class ConstantWeightEdge extends Edge {\n\n public ConstantWeightEdge(V from, V to) {\n super(from, to, 1);\n }\n }\n\n Collection getVertexes();\n\n int getSize();\n\n Collection> getEdges(V from);\n\n static interface VertexPath {\n\n V getBegin();\n\n V getEnd();\n\n long getWeight();\n\n VertexPath append(VertexPath other);\n\n VertexPath append(Edge edge);\n }\n\n static class EfficientVertexPath implements VertexPath {\n\n final V begin;\n final V end;\n final long weight;\n\n public EfficientVertexPath(V begin) {\n this.begin = begin;\n this.end = begin;\n this.weight = 0;\n }\n\n public EfficientVertexPath(V begin, V end, long weight) {\n this.begin = begin;\n this.end = end;\n this.weight = weight;\n }\n\n public EfficientVertexPath(Edge edge) {\n this.begin = edge.getFrom();\n this.end = edge.getTo();\n this.weight = edge.getWeight();\n }\n\n private EfficientVertexPath(VertexPath path, Edge append) {\n this.begin = path.getBegin();\n if (!path.getEnd().equals(append.getFrom())) {\n throw new IllegalStateException(\"not correct edge.\");\n }\n this.end = append.getTo();\n this.weight = path.getWeight() + append.getWeight();\n }\n\n private EfficientVertexPath(VertexPath pathA, VertexPath pathB) {\n this.begin = pathA.getBegin();\n if (!pathA.getEnd().equals(pathB.getBegin())) {\n throw new IllegalStateException(\"not correct edge.\");\n }\n this.end = pathB.getEnd();\n this.weight = pathA.getWeight() + pathB.getWeight();\n }\n\n @Override\n public V getBegin() {\n return begin;\n }\n\n @Override\n public V getEnd() {\n return end;\n }\n\n @Override\n public long getWeight() {\n return weight;\n }\n\n @Override\n public VertexPath append(VertexPath other) {\n return new EfficientVertexPath<>(this, other);\n }\n\n @Override\n public VertexPath append(Edge edge) {\n return new EfficientVertexPath<>(this, edge);\n }\n\n @Override\n public boolean equals(Object o) {\n if (this == o) {\n return true;\n }\n if (o == null || getClass() != o.getClass()) {\n return false;\n }\n EfficientVertexPath that = (EfficientVertexPath) o;\n return weight == that.weight &&\n Objects.equals(begin, that.begin) &&\n Objects.equals(end, that.end);\n }\n\n @Override\n public int hashCode() {\n return Objects.hash(begin, end, weight);\n }\n }\n }\n\n private static class Scanner {\n\n private final InputStream is;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n Scanner(InputStream is) {\n this.is = is;\n }\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = is.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte()) {\n return buffer[ptr++];\n } else {\n return -1;\n }\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr])) {\n ptr++;\n }\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {\n throw new NumberFormatException();\n }\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1578989450, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03053.html", "problem_id": "p03053", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03053/input.txt", "sample_output_relpath": "derived/input_output/data/p03053/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03053/Java/s308413196.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s308413196", "user_id": "u482226328"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.io.InputStream;\nimport java.io.IOException;\nimport java.io.PrintStream;\nimport java.util.*;\nimport java.util.function.BiPredicate;\nimport java.util.function.Function;\nimport java.util.function.Predicate;\nimport java.util.stream.Collectors;\nimport java.util.stream.IntStream;\n\npublic class Main {\n\n public static void main(String[] args) {\n solve(System.in, System.out);\n }\n\n private static DistanceMemoBfsPathQuery query;\n private static EncodedGraph graph;\n\n static void solve(InputStream is, PrintStream os) {\n Scanner sc = new Scanner(is);\n\n /* read */\n int h = sc.nextInt();\n int w = sc.nextInt();\n\n List blacks = new ArrayList<>();\n for (int r = 0; r < h; r++) {\n String line = sc.next();\n for (int c = 0; c < w; c++) {\n if (line.charAt(c) == '#') {\n blacks.add(new GridPoint(r, c));\n }\n }\n }\n\n // reduce visited cells\n graph = new VerticalHorizontalNeighborGridPointGraph(h, w, (r, c) -> predicate(r, c, h, w));\n\n MultiPathQuery query = graph.multiPathQuery(Main::sneaky);\n\n query.path(blacks, null);\n\n os.println(max);\n\n }\n\n private static boolean predicate(int r, int c, int h, int w) {\n return !query.visited[r * w + c];\n }\n\n private static DistanceMemoBfsPathQuery sneaky(Graph delegate) {\n query = new DistanceMemoBfsPathQuery(delegate);\n return query;\n }\n\n static long max = 0L;\n\n private static class DistanceMemoBfsPathQuery extends BfsPathQuery {\n\n\n public DistanceMemoBfsPathQuery(Graph graph) {\n super(graph);\n }\n\n @Override\n void mark(Graph.VertexPath existing, Graph.Edge edge,\n Graph.VertexPath path) {\n super.mark(existing, edge, path);\n max = Math.max(max, path.getWeight());\n }\n }\n\n private static class GridPointEncoder implements Encoder {\n\n public GridPointEncoder(int h, int w) {\n this.h = h;\n this.w = w;\n }\n\n private final int h;\n private final int w;\n\n @Override\n public int num() {\n return w * h;\n }\n\n @Override\n public Integer encode(GridPoint from) {\n if (from == null) {\n return null;\n }\n return w * from.r + from.c;\n }\n\n @Override\n public GridPoint decode(Integer from) {\n if (from == null) {\n return null;\n }\n return new GridPoint(from / w, from % w);\n }\n }\n\n private static class GridPoint implements Encoded {\n\n private final int r;\n private final int c;\n\n public GridPoint(int r, int c) {\n this.r = r;\n this.c = c;\n }\n\n @Override\n public boolean equals(Object o) {\n if (this == o) {\n return true;\n }\n if (o == null || getClass() != o.getClass()) {\n return false;\n }\n GridPoint gridPoint = (GridPoint) o;\n return r == gridPoint.r &&\n c == gridPoint.c;\n }\n\n @Override\n public int hashCode() {\n return Objects.hash(r, c);\n }\n }\n\n private static class VerticalHorizontalNeighborGridPointGraph extends GridPointGraph {\n\n private final BiPredicate predicate;\n protected List moves = Arrays.asList(\n new int[]{-1, 0},\n new int[]{1, 0},\n new int[]{0, -1},\n new int[]{0, 1}\n );\n\n public VerticalHorizontalNeighborGridPointGraph(int h, int w,\n BiPredicate predicate) {\n super(h, w);\n this.predicate = predicate;\n }\n\n protected boolean predicate(int r, int c) {\n if (r < 0 || h <= r) {\n return false;\n }\n if (c < 0 || w <= c) {\n return false;\n }\n return predicate.test(r, c);\n }\n\n protected List> neighbors(GridPoint from) {\n\n List> ans = new ArrayList<>();\n\n for (int i = 0; i < 4; i++) {\n int[] move = moves.get(i);\n if (predicate(from.r + move[0], from.c + move[1])) {\n ans.add(new ConstantWeightEdge<>(from, new GridPoint(from.r + move[0], from.c + move[1])));\n }\n }\n\n return ans;\n }\n\n @Override\n public int getSize() {\n return h * w;\n }\n\n @Override\n public Collection> getEdges(GridPoint from) {\n return neighbors(from);\n }\n }\n\n private static class AdjacencyMatrixGridPointGraph extends IntVertexGraph {\n\n private List vertexes;\n\n private final int n;\n private final int[][] matrix;\n\n public AdjacencyMatrixGridPointGraph(int n, int[][] matrix) {\n this.n = n;\n this.matrix = matrix;\n }\n\n @Override\n public Collection getVertexes() {\n // lazy load\n if (vertexes == null) {\n vertexes = IntStream.range(0, n).boxed().collect(Collectors.toList());\n }\n return vertexes;\n }\n\n @Override\n public int getSize() {\n return n;\n }\n\n @Override\n public List> getEdges(Integer from) {\n return IntStream.range(0, n).mapToObj(to -> new Edge<>(from, to, matrix[from][to]))\n .collect(Collectors.toList());\n }\n }\n\n private static class AdjacencyListGridPointGraph extends IntVertexGraph {\n\n private List vertexes;\n\n private final int n;\n private final List>> edges;\n\n public AdjacencyListGridPointGraph(int n, List>> edges) {\n this.n = n;\n this.edges = edges;\n }\n\n @Override\n public Collection getVertexes() {\n // lazy load\n if (vertexes == null) {\n vertexes = IntStream.range(0, n).boxed().collect(Collectors.toList());\n }\n return vertexes;\n }\n\n @Override\n public int getSize() {\n return n;\n }\n\n @Override\n public List> getEdges(Integer from) {\n return edges.get(from);\n }\n }\n\n\n private static abstract class GridPointGraph extends EncodedGraph {\n\n public GridPointGraph(int h, int w) {\n super(new GridPointEncoder(h, w));\n this.h = h;\n this.w = w;\n }\n\n protected final int h;\n protected final int w;\n\n protected List vertexes;\n\n @Override\n public Collection getVertexes() {\n\n // lazy load\n if (vertexes == null) {\n vertexes = new ArrayList<>(w * h);\n for (int r = 0; r < h; r++) {\n for (int c = 0; c < w; c++) {\n vertexes.add(new GridPoint(r, c));\n }\n }\n }\n\n return vertexes;\n }\n }\n\n private static interface Encoded {\n\n }\n\n private static interface Encoder {\n\n int num();\n\n Integer encode(E from);\n\n E decode(Integer from);\n }\n\n private static abstract class EncodedGraph> implements Graph {\n\n public EncodedGraph(Encoder encoder) {\n this.encoder = encoder;\n this.delegate = new IntVertexGraph() {\n @Override\n public Collection getVertexes() {\n return EncodedGraph.this.getVertexes().stream()\n .map(encoder::encode)\n .collect(Collectors.toList());\n }\n\n @Override\n public int getSize() {\n return EncodedGraph.this.getSize();\n }\n\n @Override\n public Collection> getEdges(Integer from) {\n Collection> edges = EncodedGraph.this.getEdges(encoder.decode(from));\n List> ans = new ArrayList<>(edges.size());\n for (Edge e : edges) {\n ans.add(new Edge<>(\n encoder.encode(e.getFrom()), encoder.encode(e.getTo()), e.getWeight()));\n }\n return ans;\n }\n };\n }\n\n final Encoder encoder;\n final IntVertexGraph delegate;\n\n public PathQuery pathQuery(Function, PathQuery> delegate) {\n return new EncodedPathQuery<>(delegate, this);\n }\n\n public MultiPathQuery multiPathQuery(\n Function, MultiPathQuery> delegate) {\n return new EncodedMultiPathQuery<>(delegate, this);\n }\n\n private static class EncodedPathQuery> implements PathQuery {\n\n EncodedGraph graph;\n PathQuery delegate;\n\n private EncodedPathQuery(Function, PathQuery> delegate,\n EncodedGraph graph) {\n this.graph = graph;\n this.delegate = delegate.apply(graph.delegate);\n }\n\n @Override\n public VertexPath path(V begin, V end) {\n VertexPath path = delegate\n .path(graph.encoder.encode(begin), graph.encoder.encode(end));\n if (path == null) {\n return null;\n }\n return new EfficientVertexPath<>(graph.encoder.decode(path.getBegin()),\n graph.encoder.decode(path.getEnd()), path.getWeight());\n }\n }\n\n private static class EncodedMultiPathQuery> implements MultiPathQuery {\n\n EncodedGraph graph;\n MultiPathQuery delegate;\n\n private EncodedMultiPathQuery(Function, MultiPathQuery> delegate,\n EncodedGraph graph) {\n this.graph = graph;\n this.delegate = delegate.apply(graph.delegate);\n }\n\n @Override\n public VertexPath path(List begin, V end) {\n List list = begin.stream().map(graph.encoder::encode)\n .collect(Collectors.toList());\n VertexPath path = delegate\n .path(list, graph.encoder.encode(end));\n if (path == null) {\n return null;\n }\n return new EfficientVertexPath<>(graph.encoder.decode(path.getBegin()),\n graph.encoder.decode(path.getEnd()), path.getWeight());\n }\n }\n\n }\n\n private static interface PathQuery {\n\n Graph.VertexPath path(V begin, V end);\n }\n\n private static interface MultiPathQuery {\n\n Graph.VertexPath path(List begin, V end);\n }\n\n private static abstract class QueuedPathQuery implements PathQuery {\n\n protected final Graph graph;\n protected final Queue> queue;\n\n public QueuedPathQuery(Graph graph, Queue> queue) {\n this.graph = graph;\n this.queue = queue;\n }\n\n public Graph.VertexPath path(V begin, V end) {\n\n prepare(begin, end);\n queue.add(new Graph.EfficientVertexPath<>(begin));\n return search(end);\n }\n\n protected Graph.VertexPath search(V end) {\n while (!queue.isEmpty()) {\n Graph.VertexPath path = queue.remove();\n V head = path.getEnd();\n\n if (head.equals(end)) {\n return path;\n }\n\n for (Graph.Edge e : graph.getEdges(head)) {\n if (!predicate(e)) {\n continue;\n }\n Graph.VertexPath p = path.append(e);\n queue.add(p);\n mark(path, e, p);\n }\n }\n return null;\n }\n\n abstract void prepare(V begin, V end);\n\n abstract boolean predicate(Graph.Edge edge);\n\n abstract void mark(Graph.VertexPath existing, Graph.Edge edge,\n Graph.VertexPath path);\n }\n\n private static class DijkstraPathQuery extends QueuedPathQuery {\n\n private final long[] distance;\n\n public DijkstraPathQuery(Graph graph) {\n super(graph, new PriorityQueue<>(\n Comparator.comparingLong(Graph.VertexPath::getWeight)));\n distance = new long[graph.getSize()];\n }\n\n\n @Override\n void prepare(Integer begin, Integer end) {\n for (Integer v : graph.getVertexes()) {\n distance[v] = Integer.MAX_VALUE;\n }\n }\n\n @Override\n boolean predicate(Graph.Edge edge) {\n return distance[edge.getFrom()] + edge.getWeight() < distance[edge.getTo()];\n }\n\n @Override\n void mark(Graph.VertexPath existing, Graph.Edge edge,\n Graph.VertexPath path) {\n distance[path.getEnd()] = path.getWeight();\n }\n }\n\n private static class BfsPathQuery extends QueuedPathQuery implements\n MultiPathQuery {\n\n final boolean[] visited;\n\n public BfsPathQuery(Graph graph) {\n super(graph, new ArrayDeque<>());\n visited = new boolean[graph.getSize()];\n }\n\n @Override\n void prepare(Integer begin, Integer end) {\n visited[begin] = true;\n }\n\n @Override\n boolean predicate(Graph.Edge edge) {\n return !visited[edge.getTo()];\n }\n\n @Override\n void mark(Graph.VertexPath existing, Graph.Edge edge,\n Graph.VertexPath path) {\n visited[path.getEnd()] = true;\n }\n\n public Graph.VertexPath path(List begins, Integer end) {\n\n begins.forEach(begin -> prepare(begin, end));\n begins.forEach(begin -> queue.add(new Graph.EfficientVertexPath<>(begin)));\n return search(end);\n }\n\n }\n\n private static abstract class MemoDfsPathQuery extends DfsPathQuery {\n\n public MemoDfsPathQuery(Graph graph) {\n super(graph);\n }\n\n abstract Graph.VertexPath memo(Graph.VertexPath path, V parent,\n V end);\n\n @Override\n public Graph.VertexPath path(Graph.VertexPath path, V parent,\n V end) {\n Graph.VertexPath memo = memo(path, parent, end);\n if (memo != null) {\n return memo;\n }\n return super.path(path, parent, end);\n }\n }\n\n private static class DfsPathQuery implements PathQuery {\n\n protected final Graph graph;\n\n public DfsPathQuery(Graph graph) {\n this.graph = graph;\n }\n\n @Override\n public Graph.VertexPath path(V begin, V end) {\n return path(new Graph.EfficientVertexPath<>(begin), null, end);\n }\n\n protected Graph.VertexPath path(Graph.VertexPath path, V parent,\n V end) {\n V head = path.getEnd();\n if (path.getEnd().equals(end)) {\n return path;\n }\n for (Graph.Edge e : graph.getEdges(head)) {\n if (!e.getTo().equals(parent)) {\n Graph.VertexPath next = path(path.append(e), head, end);\n if (next != null) {\n return next;\n }\n }\n }\n return null;\n }\n }\n\n private static class WarshallFloydQuery implements PathQuery {\n\n private Graph.VertexPath[][] shortest;\n\n private WarshallFloydQuery(Graph graph) {\n Collection nodes = graph.getVertexes();\n\n shortest = new Graph.VertexPath[nodes.size()][nodes.size()];\n\n for (int from : nodes) {\n Collection> edges = graph.getEdges(from);\n for (Graph.Edge e : edges) {\n shortest[e.getFrom()][e.getTo()] = new Graph.EfficientVertexPath<>(e);\n }\n shortest[from][from] = new Graph.EfficientVertexPath<>(from);\n }\n\n for (int relay : nodes) {\n for (int from : nodes) {\n for (int dest : nodes) {\n Graph.VertexPath pathA = shortest[from][relay];\n Graph.VertexPath pathB = shortest[relay][dest];\n if (pathA != null && pathB != null) {\n if (shortest[from][dest] == null\n || pathA.getWeight() + pathB.getWeight() < shortest[from][dest]\n .getWeight()) {\n shortest[from][dest] = pathA.append(pathB);\n }\n }\n }\n }\n }\n }\n\n @Override\n public Graph.VertexPath path(Integer begin, Integer end) {\n return shortest[begin][end];\n }\n }\n\n private static abstract class IntVertexGraph implements Graph {\n\n }\n\n private static interface Graph {\n\n static class Edge {\n\n public Edge(V from, V to, long weight) {\n this.from = from;\n this.to = to;\n this.weight = weight;\n }\n\n private final V from;\n\n private final V to;\n private final long weight;\n\n\n V getFrom() {\n return from;\n }\n\n V getTo() {\n return to;\n }\n\n long getWeight() {\n return weight;\n }\n\n @Override\n public boolean equals(Object o) {\n if (this == o) {\n return true;\n }\n if (o == null || getClass() != o.getClass()) {\n return false;\n }\n Edge edge = (Edge) o;\n return weight == edge.weight &&\n Objects.equals(from, edge.from) &&\n Objects.equals(to, edge.to);\n }\n\n @Override\n public int hashCode() {\n return Objects.hash(from, to, weight);\n }\n }\n\n static class ConstantWeightEdge extends Edge {\n\n public ConstantWeightEdge(V from, V to) {\n super(from, to, 1);\n }\n }\n\n Collection getVertexes();\n\n int getSize();\n\n Collection> getEdges(V from);\n\n static interface VertexPath {\n\n V getBegin();\n\n V getEnd();\n\n long getWeight();\n\n VertexPath append(VertexPath other);\n\n VertexPath append(Edge edge);\n }\n\n static class EfficientVertexPath implements VertexPath {\n\n final V begin;\n final V end;\n final long weight;\n\n public EfficientVertexPath(V begin) {\n this.begin = begin;\n this.end = begin;\n this.weight = 0;\n }\n\n public EfficientVertexPath(V begin, V end, long weight) {\n this.begin = begin;\n this.end = end;\n this.weight = weight;\n }\n\n public EfficientVertexPath(Edge edge) {\n this.begin = edge.getFrom();\n this.end = edge.getTo();\n this.weight = edge.getWeight();\n }\n\n private EfficientVertexPath(VertexPath path, Edge append) {\n this.begin = path.getBegin();\n if (!path.getEnd().equals(append.getFrom())) {\n throw new IllegalStateException(\"not correct edge.\");\n }\n this.end = append.getTo();\n this.weight = path.getWeight() + append.getWeight();\n }\n\n private EfficientVertexPath(VertexPath pathA, VertexPath pathB) {\n this.begin = pathA.getBegin();\n if (!pathA.getEnd().equals(pathB.getBegin())) {\n throw new IllegalStateException(\"not correct edge.\");\n }\n this.end = pathB.getEnd();\n this.weight = pathA.getWeight() + pathB.getWeight();\n }\n\n @Override\n public V getBegin() {\n return begin;\n }\n\n @Override\n public V getEnd() {\n return end;\n }\n\n @Override\n public long getWeight() {\n return weight;\n }\n\n @Override\n public VertexPath append(VertexPath other) {\n return new EfficientVertexPath<>(this, other);\n }\n\n @Override\n public VertexPath append(Edge edge) {\n return new EfficientVertexPath<>(this, edge);\n }\n\n @Override\n public boolean equals(Object o) {\n if (this == o) {\n return true;\n }\n if (o == null || getClass() != o.getClass()) {\n return false;\n }\n EfficientVertexPath that = (EfficientVertexPath) o;\n return weight == that.weight &&\n Objects.equals(begin, that.begin) &&\n Objects.equals(end, that.end);\n }\n\n @Override\n public int hashCode() {\n return Objects.hash(begin, end, weight);\n }\n }\n }\n\n private static class Scanner {\n\n private final InputStream is;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n Scanner(InputStream is) {\n this.is = is;\n }\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = is.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte()) {\n return buffer[ptr++];\n } else {\n return -1;\n }\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr])) {\n ptr++;\n }\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {\n throw new NumberFormatException();\n }\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a grid of squares with H horizontal rows and W vertical columns, where each square is painted white or black.\nHW characters from A_{11} to A_{HW} represent the colors of the squares.\nA_{ij} is # if the square at the i-th row from the top and the j-th column from the left is black, and A_{ij} is . if that square is white.\n\nWe will repeatedly perform the following operation until all the squares are black:\n\nEvery white square that shares a side with a black square, becomes black.\n\nFind the number of operations that will be performed.\nThe initial grid has at least one black square.\n\nConstraints\n\n1 \\leq H,W \\leq 1000\n\nA_{ij} is # or ..\n\nThe given grid has at least one black square.\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\nPrint the number of operations that will be performed.\n\nSample Input 1\n\n3 3\n...\n.#.\n...\n\nSample Output 1\n\n2\n\nAfter one operation, all but the corners of the grid will be black. After one more operation, all the squares will be black.\n\nSample Input 2\n\n6 6\n..#..#\n......\n#..#..\n......\n.#....\n....#.\n\nSample Output 2\n\n3", "sample_input": "3 3\n...\n.#.\n...\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03053", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a grid of squares with H horizontal rows and W vertical columns, where each square is painted white or black.\nHW characters from A_{11} to A_{HW} represent the colors of the squares.\nA_{ij} is # if the square at the i-th row from the top and the j-th column from the left is black, and A_{ij} is . if that square is white.\n\nWe will repeatedly perform the following operation until all the squares are black:\n\nEvery white square that shares a side with a black square, becomes black.\n\nFind the number of operations that will be performed.\nThe initial grid has at least one black square.\n\nConstraints\n\n1 \\leq H,W \\leq 1000\n\nA_{ij} is # or ..\n\nThe given grid has at least one black square.\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\nPrint the number of operations that will be performed.\n\nSample Input 1\n\n3 3\n...\n.#.\n...\n\nSample Output 1\n\n2\n\nAfter one operation, all but the corners of the grid will be black. After one more operation, all the squares will be black.\n\nSample Input 2\n\n6 6\n..#..#\n......\n#..#..\n......\n.#....\n....#.\n\nSample Output 2\n\n3", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 21443, "cpu_time_ms": 1061, "memory_kb": 198192}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s998222550", "group_id": "codeNet:p03053", "input_text": "import java.io.InputStream;\nimport java.io.IOException;\nimport java.io.PrintStream;\nimport java.util.*;\nimport java.util.function.BiPredicate;\nimport java.util.function.Function;\nimport java.util.function.Predicate;\nimport java.util.stream.Collectors;\nimport java.util.stream.IntStream;\n\npublic class Main {\n\n public static void main(String[] args) {\n solve(System.in, System.out);\n }\n\n private static DistanceMemoBfsPathQuery query;\n private static EncodedGraph graph;\n\n static void solve(InputStream is, PrintStream os) {\n Scanner sc = new Scanner(is);\n\n /* read */\n int h = sc.nextInt();\n int w = sc.nextInt();\n\n List blacks = new ArrayList<>();\n for (int r = 0; r < h; r++) {\n String line = sc.next();\n for (int c = 0; c < w; c++) {\n if (line.charAt(c) == '#') {\n blacks.add(new GridPoint(r, c));\n }\n }\n }\n\n // reduce visited cells\n graph = new VerticalHorizontalNeighborGridPointGraph(h, w, (r, c) -> predicate(r, c, h, w));\n\n MultiPathQuery query = graph.multiPathQuery(Main::sneaky);\n\n query.path(blacks, null);\n\n os.println(max);\n\n }\n\n private static boolean predicate(Integer r, Integer c, Integer h, Integer w) {\n return !query.visited[r * w + c];\n }\n\n private static DistanceMemoBfsPathQuery sneaky(Graph delegate) {\n query = new DistanceMemoBfsPathQuery(delegate);\n return query;\n }\n\n static long max = 0L;\n\n private static class DistanceMemoBfsPathQuery extends BfsPathQuery {\n\n\n public DistanceMemoBfsPathQuery(Graph graph) {\n super(graph);\n }\n\n @Override\n void mark(Graph.VertexPath existing, Graph.Edge edge,\n Graph.VertexPath path) {\n super.mark(existing, edge, path);\n max = Math.max(max, path.getWeight());\n }\n }\n\n private static class GridPointEncoder implements Encoder {\n\n public GridPointEncoder(int h, int w) {\n this.h = h;\n this.w = w;\n }\n\n private final int h;\n private final int w;\n\n @Override\n public int num() {\n return w * h;\n }\n\n @Override\n public Integer encode(GridPoint from) {\n if (from == null) {\n return null;\n }\n return w * from.r + from.c;\n }\n\n @Override\n public GridPoint decode(Integer from) {\n if (from == null) {\n return null;\n }\n return new GridPoint(from / w, from % w);\n }\n }\n\n private static class GridPoint implements Encoded {\n\n private final int r;\n private final int c;\n\n public GridPoint(int r, int c) {\n this.r = r;\n this.c = c;\n }\n\n @Override\n public boolean equals(Object o) {\n if (this == o) {\n return true;\n }\n if (o == null || getClass() != o.getClass()) {\n return false;\n }\n GridPoint gridPoint = (GridPoint) o;\n return r == gridPoint.r &&\n c == gridPoint.c;\n }\n\n @Override\n public int hashCode() {\n return Objects.hash(r, c);\n }\n }\n\n private static class VerticalHorizontalNeighborGridPointGraph extends GridPointGraph {\n\n private final BiPredicate predicate;\n protected List moves = Arrays.asList(\n new int[]{-1, 0},\n new int[]{1, 0},\n new int[]{0, -1},\n new int[]{0, 1}\n );\n\n public VerticalHorizontalNeighborGridPointGraph(int h, int w,\n BiPredicate predicate) {\n super(h, w);\n this.predicate = predicate;\n }\n\n protected boolean predicate(Integer r, Integer c) {\n if (r < 0 || h <= r) {\n return false;\n }\n if (c < 0 || w <= c) {\n return false;\n }\n return predicate.test(r, c);\n }\n\n protected List> neighbors(GridPoint from) {\n\n return moves.stream().filter(m -> predicate(from.r + m[0], from.c + m[1]))\n .map(m -> new ConstantWeightEdge<>(from, new GridPoint(from.r + m[0], from.c + m[1])))\n .collect(Collectors.toList());\n// List> ans = new ArrayList<>();\n//\n// for (int[] move : moves) {\n// if (predicate(from.r + move[0], from.c + move[1])) {\n// GridPoint to = new GridPoint(from.r + move[0], from.c + move[1]);\n// ans.add(new ConstantWeightEdge<>(from, to));\n// }\n// }\n// return ans;\n }\n\n @Override\n public int getSize() {\n return h * w;\n }\n\n @Override\n public Collection> getEdges(GridPoint from) {\n return neighbors(from);\n }\n }\n\n private static class AdjacencyMatrixGridPointGraph extends IntVertexGraph {\n\n private List vertexes;\n\n private final int n;\n private final int[][] matrix;\n\n public AdjacencyMatrixGridPointGraph(int n, int[][] matrix) {\n this.n = n;\n this.matrix = matrix;\n }\n\n @Override\n public Collection getVertexes() {\n // lazy load\n if (vertexes == null) {\n vertexes = IntStream.range(0, n).boxed().collect(Collectors.toList());\n }\n return vertexes;\n }\n\n @Override\n public int getSize() {\n return n;\n }\n\n @Override\n public List> getEdges(Integer from) {\n return IntStream.range(0, n).mapToObj(to -> new Edge<>(from, to, matrix[from][to]))\n .collect(Collectors.toList());\n }\n }\n\n private static class AdjacencyListGridPointGraph extends IntVertexGraph {\n\n private List vertexes;\n\n private final int n;\n private final List>> edges;\n\n public AdjacencyListGridPointGraph(int n, List>> edges) {\n this.n = n;\n this.edges = edges;\n }\n\n @Override\n public Collection getVertexes() {\n // lazy load\n if (vertexes == null) {\n vertexes = IntStream.range(0, n).boxed().collect(Collectors.toList());\n }\n return vertexes;\n }\n\n @Override\n public int getSize() {\n return n;\n }\n\n @Override\n public List> getEdges(Integer from) {\n return edges.get(from);\n }\n }\n\n\n private static abstract class GridPointGraph extends EncodedGraph {\n\n public GridPointGraph(int h, int w) {\n super(new GridPointEncoder(h, w));\n this.h = h;\n this.w = w;\n }\n\n protected final int h;\n protected final int w;\n\n protected List vertexes;\n\n @Override\n public Collection getVertexes() {\n\n // lazy load\n if (vertexes == null) {\n vertexes = new ArrayList<>(w * h);\n for (int r = 0; r < h; r++) {\n for (int c = 0; c < w; c++) {\n vertexes.add(new GridPoint(r, c));\n }\n }\n }\n\n return vertexes;\n }\n }\n\n private static interface Encoded {\n\n }\n\n private static interface Encoder {\n\n int num();\n\n Integer encode(E from);\n\n E decode(Integer from);\n }\n\n private static abstract class EncodedGraph> implements Graph {\n\n public EncodedGraph(Encoder encoder) {\n this.encoder = encoder;\n this.delegate = new IntVertexGraph() {\n @Override\n public Collection getVertexes() {\n return EncodedGraph.this.getVertexes().stream()\n .map(encoder::encode)\n .collect(Collectors.toList());\n }\n\n @Override\n public int getSize() {\n return EncodedGraph.this.getSize();\n }\n\n @Override\n public Collection> getEdges(Integer from) {\n Collection> edges = EncodedGraph.this.getEdges(encoder.decode(from));\n List> ans = new ArrayList<>(edges.size());\n for (Edge e : edges) {\n ans.add(new Edge<>(\n encoder.encode(e.getFrom()), encoder.encode(e.getTo()), e.getWeight()));\n }\n return ans;\n }\n };\n }\n\n final Encoder encoder;\n final IntVertexGraph delegate;\n\n public PathQuery pathQuery(Function, PathQuery> delegate) {\n return new EncodedPathQuery<>(delegate, this);\n }\n\n public MultiPathQuery multiPathQuery(\n Function, MultiPathQuery> delegate) {\n return new EncodedMultiPathQuery<>(delegate, this);\n }\n\n private static class EncodedPathQuery> implements PathQuery {\n\n EncodedGraph graph;\n PathQuery delegate;\n\n private EncodedPathQuery(Function, PathQuery> delegate,\n EncodedGraph graph) {\n this.graph = graph;\n this.delegate = delegate.apply(graph.delegate);\n }\n\n @Override\n public VertexPath path(V begin, V end) {\n VertexPath path = delegate\n .path(graph.encoder.encode(begin), graph.encoder.encode(end));\n if (path == null) {\n return null;\n }\n return new EfficientVertexPath<>(graph.encoder.decode(path.getBegin()),\n graph.encoder.decode(path.getEnd()), path.getWeight());\n }\n }\n\n private static class EncodedMultiPathQuery> implements MultiPathQuery {\n\n EncodedGraph graph;\n MultiPathQuery delegate;\n\n private EncodedMultiPathQuery(Function, MultiPathQuery> delegate,\n EncodedGraph graph) {\n this.graph = graph;\n this.delegate = delegate.apply(graph.delegate);\n }\n\n @Override\n public VertexPath path(List begin, V end) {\n List list = begin.stream().map(graph.encoder::encode)\n .collect(Collectors.toList());\n VertexPath path = delegate\n .path(list, graph.encoder.encode(end));\n if (path == null) {\n return null;\n }\n return new EfficientVertexPath<>(graph.encoder.decode(path.getBegin()),\n graph.encoder.decode(path.getEnd()), path.getWeight());\n }\n }\n\n }\n\n private static interface PathQuery {\n\n Graph.VertexPath path(V begin, V end);\n }\n\n private static interface MultiPathQuery {\n\n Graph.VertexPath path(List begin, V end);\n }\n\n private static abstract class QueuedPathQuery implements PathQuery {\n\n protected final Graph graph;\n protected final Queue> queue;\n\n public QueuedPathQuery(Graph graph, Queue> queue) {\n this.graph = graph;\n this.queue = queue;\n }\n\n public Graph.VertexPath path(V begin, V end) {\n\n prepare(begin, end);\n queue.add(new Graph.EfficientVertexPath<>(begin));\n return search(end);\n }\n\n protected Graph.VertexPath search(V end) {\n while (!queue.isEmpty()) {\n Graph.VertexPath path = queue.remove();\n V head = path.getEnd();\n\n if (head.equals(end)) {\n return path;\n }\n\n for (Graph.Edge e : graph.getEdges(head)) {\n if (!predicate(e)) {\n continue;\n }\n Graph.VertexPath p = path.append(e);\n queue.add(p);\n mark(path, e, p);\n }\n }\n return null;\n }\n\n abstract void prepare(V begin, V end);\n\n abstract boolean predicate(Graph.Edge edge);\n\n abstract void mark(Graph.VertexPath existing, Graph.Edge edge,\n Graph.VertexPath path);\n }\n\n private static class DijkstraPathQuery extends QueuedPathQuery {\n\n private final long[] distance;\n\n public DijkstraPathQuery(Graph graph) {\n super(graph, new PriorityQueue<>(\n Comparator.comparingLong(Graph.VertexPath::getWeight)));\n distance = new long[graph.getSize()];\n }\n\n\n @Override\n void prepare(Integer begin, Integer end) {\n for (Integer v : graph.getVertexes()) {\n distance[v] = Integer.MAX_VALUE;\n }\n }\n\n @Override\n boolean predicate(Graph.Edge edge) {\n return distance[edge.getFrom()] + edge.getWeight() < distance[edge.getTo()];\n }\n\n @Override\n void mark(Graph.VertexPath existing, Graph.Edge edge,\n Graph.VertexPath path) {\n distance[path.getEnd()] = path.getWeight();\n }\n }\n\n private static class BfsPathQuery extends QueuedPathQuery implements\n MultiPathQuery {\n\n final boolean[] visited;\n\n public BfsPathQuery(Graph graph) {\n super(graph, new ArrayDeque<>());\n visited = new boolean[graph.getSize()];\n }\n\n @Override\n void prepare(Integer begin, Integer end) {\n visited[begin] = true;\n }\n\n @Override\n boolean predicate(Graph.Edge edge) {\n return !visited[edge.getTo()];\n }\n\n @Override\n void mark(Graph.VertexPath existing, Graph.Edge edge,\n Graph.VertexPath path) {\n visited[path.getEnd()] = true;\n }\n\n public Graph.VertexPath path(List begins, Integer end) {\n\n begins.forEach(begin -> prepare(begin, end));\n begins.forEach(begin -> queue.add(new Graph.EfficientVertexPath<>(begin)));\n return search(end);\n }\n\n }\n\n private static abstract class MemoDfsPathQuery extends DfsPathQuery {\n\n public MemoDfsPathQuery(Graph graph) {\n super(graph);\n }\n\n abstract Graph.VertexPath memo(Graph.VertexPath path, V parent,\n V end);\n\n @Override\n public Graph.VertexPath path(Graph.VertexPath path, V parent,\n V end) {\n Graph.VertexPath memo = memo(path, parent, end);\n if (memo != null) {\n return memo;\n }\n return super.path(path, parent, end);\n }\n }\n\n private static class DfsPathQuery implements PathQuery {\n\n protected final Graph graph;\n\n public DfsPathQuery(Graph graph) {\n this.graph = graph;\n }\n\n @Override\n public Graph.VertexPath path(V begin, V end) {\n return path(new Graph.EfficientVertexPath<>(begin), null, end);\n }\n\n protected Graph.VertexPath path(Graph.VertexPath path, V parent,\n V end) {\n V head = path.getEnd();\n if (path.getEnd().equals(end)) {\n return path;\n }\n for (Graph.Edge e : graph.getEdges(head)) {\n if (!e.getTo().equals(parent)) {\n Graph.VertexPath next = path(path.append(e), head, end);\n if (next != null) {\n return next;\n }\n }\n }\n return null;\n }\n }\n\n private static class WarshallFloydQuery implements PathQuery {\n\n private Graph.VertexPath[][] shortest;\n\n private WarshallFloydQuery(Graph graph) {\n Collection nodes = graph.getVertexes();\n\n shortest = new Graph.VertexPath[nodes.size()][nodes.size()];\n\n for (int from : nodes) {\n Collection> edges = graph.getEdges(from);\n for (Graph.Edge e : edges) {\n shortest[e.getFrom()][e.getTo()] = new Graph.EfficientVertexPath<>(e);\n }\n shortest[from][from] = new Graph.EfficientVertexPath<>(from);\n }\n\n for (int relay : nodes) {\n for (int from : nodes) {\n for (int dest : nodes) {\n Graph.VertexPath pathA = shortest[from][relay];\n Graph.VertexPath pathB = shortest[relay][dest];\n if (pathA != null && pathB != null) {\n if (shortest[from][dest] == null\n || pathA.getWeight() + pathB.getWeight() < shortest[from][dest]\n .getWeight()) {\n shortest[from][dest] = pathA.append(pathB);\n }\n }\n }\n }\n }\n }\n\n @Override\n public Graph.VertexPath path(Integer begin, Integer end) {\n return shortest[begin][end];\n }\n }\n\n private static abstract class IntVertexGraph implements Graph {\n\n }\n\n private static interface Graph {\n\n static class Edge {\n\n public Edge(V from, V to, long weight) {\n this.from = from;\n this.to = to;\n this.weight = weight;\n }\n\n private final V from;\n\n private final V to;\n private final long weight;\n\n\n V getFrom() {\n return from;\n }\n\n V getTo() {\n return to;\n }\n\n long getWeight() {\n return weight;\n }\n\n @Override\n public boolean equals(Object o) {\n if (this == o) {\n return true;\n }\n if (o == null || getClass() != o.getClass()) {\n return false;\n }\n Edge edge = (Edge) o;\n return weight == edge.weight &&\n Objects.equals(from, edge.from) &&\n Objects.equals(to, edge.to);\n }\n\n @Override\n public int hashCode() {\n return Objects.hash(from, to, weight);\n }\n }\n\n static class ConstantWeightEdge extends Edge {\n\n public ConstantWeightEdge(V from, V to) {\n super(from, to, 1);\n }\n }\n\n Collection getVertexes();\n\n int getSize();\n\n Collection> getEdges(V from);\n\n static interface VertexPath {\n\n V getBegin();\n\n V getEnd();\n\n long getWeight();\n\n VertexPath append(VertexPath other);\n\n VertexPath append(Edge edge);\n }\n\n static class EfficientVertexPath implements VertexPath {\n\n final V begin;\n final V end;\n final long weight;\n\n public EfficientVertexPath(V begin) {\n this.begin = begin;\n this.end = begin;\n this.weight = 0;\n }\n\n public EfficientVertexPath(V begin, V end, long weight) {\n this.begin = begin;\n this.end = end;\n this.weight = weight;\n }\n\n public EfficientVertexPath(Edge edge) {\n this.begin = edge.getFrom();\n this.end = edge.getTo();\n this.weight = edge.getWeight();\n }\n\n private EfficientVertexPath(VertexPath path, Edge append) {\n this.begin = path.getBegin();\n if (!path.getEnd().equals(append.getFrom())) {\n throw new IllegalStateException(\"not correct edge.\");\n }\n this.end = append.getTo();\n this.weight = path.getWeight() + append.getWeight();\n }\n\n private EfficientVertexPath(VertexPath pathA, VertexPath pathB) {\n this.begin = pathA.getBegin();\n if (!pathA.getEnd().equals(pathB.getBegin())) {\n throw new IllegalStateException(\"not correct edge.\");\n }\n this.end = pathB.getEnd();\n this.weight = pathA.getWeight() + pathB.getWeight();\n }\n\n @Override\n public V getBegin() {\n return begin;\n }\n\n @Override\n public V getEnd() {\n return end;\n }\n\n @Override\n public long getWeight() {\n return weight;\n }\n\n @Override\n public VertexPath append(VertexPath other) {\n return new EfficientVertexPath<>(this, other);\n }\n\n @Override\n public VertexPath append(Edge edge) {\n return new EfficientVertexPath<>(this, edge);\n }\n\n @Override\n public boolean equals(Object o) {\n if (this == o) {\n return true;\n }\n if (o == null || getClass() != o.getClass()) {\n return false;\n }\n EfficientVertexPath that = (EfficientVertexPath) o;\n return weight == that.weight &&\n Objects.equals(begin, that.begin) &&\n Objects.equals(end, that.end);\n }\n\n @Override\n public int hashCode() {\n return Objects.hash(begin, end, weight);\n }\n }\n }\n\n private static class Scanner {\n\n private final InputStream is;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n Scanner(InputStream is) {\n this.is = is;\n }\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = is.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte()) {\n return buffer[ptr++];\n } else {\n return -1;\n }\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr])) {\n ptr++;\n }\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {\n throw new NumberFormatException();\n }\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n }\n}", "language": "Java", "metadata": {"date": 1578988178, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03053.html", "problem_id": "p03053", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03053/input.txt", "sample_output_relpath": "derived/input_output/data/p03053/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03053/Java/s998222550.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s998222550", "user_id": "u482226328"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.io.InputStream;\nimport java.io.IOException;\nimport java.io.PrintStream;\nimport java.util.*;\nimport java.util.function.BiPredicate;\nimport java.util.function.Function;\nimport java.util.function.Predicate;\nimport java.util.stream.Collectors;\nimport java.util.stream.IntStream;\n\npublic class Main {\n\n public static void main(String[] args) {\n solve(System.in, System.out);\n }\n\n private static DistanceMemoBfsPathQuery query;\n private static EncodedGraph graph;\n\n static void solve(InputStream is, PrintStream os) {\n Scanner sc = new Scanner(is);\n\n /* read */\n int h = sc.nextInt();\n int w = sc.nextInt();\n\n List blacks = new ArrayList<>();\n for (int r = 0; r < h; r++) {\n String line = sc.next();\n for (int c = 0; c < w; c++) {\n if (line.charAt(c) == '#') {\n blacks.add(new GridPoint(r, c));\n }\n }\n }\n\n // reduce visited cells\n graph = new VerticalHorizontalNeighborGridPointGraph(h, w, (r, c) -> predicate(r, c, h, w));\n\n MultiPathQuery query = graph.multiPathQuery(Main::sneaky);\n\n query.path(blacks, null);\n\n os.println(max);\n\n }\n\n private static boolean predicate(Integer r, Integer c, Integer h, Integer w) {\n return !query.visited[r * w + c];\n }\n\n private static DistanceMemoBfsPathQuery sneaky(Graph delegate) {\n query = new DistanceMemoBfsPathQuery(delegate);\n return query;\n }\n\n static long max = 0L;\n\n private static class DistanceMemoBfsPathQuery extends BfsPathQuery {\n\n\n public DistanceMemoBfsPathQuery(Graph graph) {\n super(graph);\n }\n\n @Override\n void mark(Graph.VertexPath existing, Graph.Edge edge,\n Graph.VertexPath path) {\n super.mark(existing, edge, path);\n max = Math.max(max, path.getWeight());\n }\n }\n\n private static class GridPointEncoder implements Encoder {\n\n public GridPointEncoder(int h, int w) {\n this.h = h;\n this.w = w;\n }\n\n private final int h;\n private final int w;\n\n @Override\n public int num() {\n return w * h;\n }\n\n @Override\n public Integer encode(GridPoint from) {\n if (from == null) {\n return null;\n }\n return w * from.r + from.c;\n }\n\n @Override\n public GridPoint decode(Integer from) {\n if (from == null) {\n return null;\n }\n return new GridPoint(from / w, from % w);\n }\n }\n\n private static class GridPoint implements Encoded {\n\n private final int r;\n private final int c;\n\n public GridPoint(int r, int c) {\n this.r = r;\n this.c = c;\n }\n\n @Override\n public boolean equals(Object o) {\n if (this == o) {\n return true;\n }\n if (o == null || getClass() != o.getClass()) {\n return false;\n }\n GridPoint gridPoint = (GridPoint) o;\n return r == gridPoint.r &&\n c == gridPoint.c;\n }\n\n @Override\n public int hashCode() {\n return Objects.hash(r, c);\n }\n }\n\n private static class VerticalHorizontalNeighborGridPointGraph extends GridPointGraph {\n\n private final BiPredicate predicate;\n protected List moves = Arrays.asList(\n new int[]{-1, 0},\n new int[]{1, 0},\n new int[]{0, -1},\n new int[]{0, 1}\n );\n\n public VerticalHorizontalNeighborGridPointGraph(int h, int w,\n BiPredicate predicate) {\n super(h, w);\n this.predicate = predicate;\n }\n\n protected boolean predicate(Integer r, Integer c) {\n if (r < 0 || h <= r) {\n return false;\n }\n if (c < 0 || w <= c) {\n return false;\n }\n return predicate.test(r, c);\n }\n\n protected List> neighbors(GridPoint from) {\n\n return moves.stream().filter(m -> predicate(from.r + m[0], from.c + m[1]))\n .map(m -> new ConstantWeightEdge<>(from, new GridPoint(from.r + m[0], from.c + m[1])))\n .collect(Collectors.toList());\n// List> ans = new ArrayList<>();\n//\n// for (int[] move : moves) {\n// if (predicate(from.r + move[0], from.c + move[1])) {\n// GridPoint to = new GridPoint(from.r + move[0], from.c + move[1]);\n// ans.add(new ConstantWeightEdge<>(from, to));\n// }\n// }\n// return ans;\n }\n\n @Override\n public int getSize() {\n return h * w;\n }\n\n @Override\n public Collection> getEdges(GridPoint from) {\n return neighbors(from);\n }\n }\n\n private static class AdjacencyMatrixGridPointGraph extends IntVertexGraph {\n\n private List vertexes;\n\n private final int n;\n private final int[][] matrix;\n\n public AdjacencyMatrixGridPointGraph(int n, int[][] matrix) {\n this.n = n;\n this.matrix = matrix;\n }\n\n @Override\n public Collection getVertexes() {\n // lazy load\n if (vertexes == null) {\n vertexes = IntStream.range(0, n).boxed().collect(Collectors.toList());\n }\n return vertexes;\n }\n\n @Override\n public int getSize() {\n return n;\n }\n\n @Override\n public List> getEdges(Integer from) {\n return IntStream.range(0, n).mapToObj(to -> new Edge<>(from, to, matrix[from][to]))\n .collect(Collectors.toList());\n }\n }\n\n private static class AdjacencyListGridPointGraph extends IntVertexGraph {\n\n private List vertexes;\n\n private final int n;\n private final List>> edges;\n\n public AdjacencyListGridPointGraph(int n, List>> edges) {\n this.n = n;\n this.edges = edges;\n }\n\n @Override\n public Collection getVertexes() {\n // lazy load\n if (vertexes == null) {\n vertexes = IntStream.range(0, n).boxed().collect(Collectors.toList());\n }\n return vertexes;\n }\n\n @Override\n public int getSize() {\n return n;\n }\n\n @Override\n public List> getEdges(Integer from) {\n return edges.get(from);\n }\n }\n\n\n private static abstract class GridPointGraph extends EncodedGraph {\n\n public GridPointGraph(int h, int w) {\n super(new GridPointEncoder(h, w));\n this.h = h;\n this.w = w;\n }\n\n protected final int h;\n protected final int w;\n\n protected List vertexes;\n\n @Override\n public Collection getVertexes() {\n\n // lazy load\n if (vertexes == null) {\n vertexes = new ArrayList<>(w * h);\n for (int r = 0; r < h; r++) {\n for (int c = 0; c < w; c++) {\n vertexes.add(new GridPoint(r, c));\n }\n }\n }\n\n return vertexes;\n }\n }\n\n private static interface Encoded {\n\n }\n\n private static interface Encoder {\n\n int num();\n\n Integer encode(E from);\n\n E decode(Integer from);\n }\n\n private static abstract class EncodedGraph> implements Graph {\n\n public EncodedGraph(Encoder encoder) {\n this.encoder = encoder;\n this.delegate = new IntVertexGraph() {\n @Override\n public Collection getVertexes() {\n return EncodedGraph.this.getVertexes().stream()\n .map(encoder::encode)\n .collect(Collectors.toList());\n }\n\n @Override\n public int getSize() {\n return EncodedGraph.this.getSize();\n }\n\n @Override\n public Collection> getEdges(Integer from) {\n Collection> edges = EncodedGraph.this.getEdges(encoder.decode(from));\n List> ans = new ArrayList<>(edges.size());\n for (Edge e : edges) {\n ans.add(new Edge<>(\n encoder.encode(e.getFrom()), encoder.encode(e.getTo()), e.getWeight()));\n }\n return ans;\n }\n };\n }\n\n final Encoder encoder;\n final IntVertexGraph delegate;\n\n public PathQuery pathQuery(Function, PathQuery> delegate) {\n return new EncodedPathQuery<>(delegate, this);\n }\n\n public MultiPathQuery multiPathQuery(\n Function, MultiPathQuery> delegate) {\n return new EncodedMultiPathQuery<>(delegate, this);\n }\n\n private static class EncodedPathQuery> implements PathQuery {\n\n EncodedGraph graph;\n PathQuery delegate;\n\n private EncodedPathQuery(Function, PathQuery> delegate,\n EncodedGraph graph) {\n this.graph = graph;\n this.delegate = delegate.apply(graph.delegate);\n }\n\n @Override\n public VertexPath path(V begin, V end) {\n VertexPath path = delegate\n .path(graph.encoder.encode(begin), graph.encoder.encode(end));\n if (path == null) {\n return null;\n }\n return new EfficientVertexPath<>(graph.encoder.decode(path.getBegin()),\n graph.encoder.decode(path.getEnd()), path.getWeight());\n }\n }\n\n private static class EncodedMultiPathQuery> implements MultiPathQuery {\n\n EncodedGraph graph;\n MultiPathQuery delegate;\n\n private EncodedMultiPathQuery(Function, MultiPathQuery> delegate,\n EncodedGraph graph) {\n this.graph = graph;\n this.delegate = delegate.apply(graph.delegate);\n }\n\n @Override\n public VertexPath path(List begin, V end) {\n List list = begin.stream().map(graph.encoder::encode)\n .collect(Collectors.toList());\n VertexPath path = delegate\n .path(list, graph.encoder.encode(end));\n if (path == null) {\n return null;\n }\n return new EfficientVertexPath<>(graph.encoder.decode(path.getBegin()),\n graph.encoder.decode(path.getEnd()), path.getWeight());\n }\n }\n\n }\n\n private static interface PathQuery {\n\n Graph.VertexPath path(V begin, V end);\n }\n\n private static interface MultiPathQuery {\n\n Graph.VertexPath path(List begin, V end);\n }\n\n private static abstract class QueuedPathQuery implements PathQuery {\n\n protected final Graph graph;\n protected final Queue> queue;\n\n public QueuedPathQuery(Graph graph, Queue> queue) {\n this.graph = graph;\n this.queue = queue;\n }\n\n public Graph.VertexPath path(V begin, V end) {\n\n prepare(begin, end);\n queue.add(new Graph.EfficientVertexPath<>(begin));\n return search(end);\n }\n\n protected Graph.VertexPath search(V end) {\n while (!queue.isEmpty()) {\n Graph.VertexPath path = queue.remove();\n V head = path.getEnd();\n\n if (head.equals(end)) {\n return path;\n }\n\n for (Graph.Edge e : graph.getEdges(head)) {\n if (!predicate(e)) {\n continue;\n }\n Graph.VertexPath p = path.append(e);\n queue.add(p);\n mark(path, e, p);\n }\n }\n return null;\n }\n\n abstract void prepare(V begin, V end);\n\n abstract boolean predicate(Graph.Edge edge);\n\n abstract void mark(Graph.VertexPath existing, Graph.Edge edge,\n Graph.VertexPath path);\n }\n\n private static class DijkstraPathQuery extends QueuedPathQuery {\n\n private final long[] distance;\n\n public DijkstraPathQuery(Graph graph) {\n super(graph, new PriorityQueue<>(\n Comparator.comparingLong(Graph.VertexPath::getWeight)));\n distance = new long[graph.getSize()];\n }\n\n\n @Override\n void prepare(Integer begin, Integer end) {\n for (Integer v : graph.getVertexes()) {\n distance[v] = Integer.MAX_VALUE;\n }\n }\n\n @Override\n boolean predicate(Graph.Edge edge) {\n return distance[edge.getFrom()] + edge.getWeight() < distance[edge.getTo()];\n }\n\n @Override\n void mark(Graph.VertexPath existing, Graph.Edge edge,\n Graph.VertexPath path) {\n distance[path.getEnd()] = path.getWeight();\n }\n }\n\n private static class BfsPathQuery extends QueuedPathQuery implements\n MultiPathQuery {\n\n final boolean[] visited;\n\n public BfsPathQuery(Graph graph) {\n super(graph, new ArrayDeque<>());\n visited = new boolean[graph.getSize()];\n }\n\n @Override\n void prepare(Integer begin, Integer end) {\n visited[begin] = true;\n }\n\n @Override\n boolean predicate(Graph.Edge edge) {\n return !visited[edge.getTo()];\n }\n\n @Override\n void mark(Graph.VertexPath existing, Graph.Edge edge,\n Graph.VertexPath path) {\n visited[path.getEnd()] = true;\n }\n\n public Graph.VertexPath path(List begins, Integer end) {\n\n begins.forEach(begin -> prepare(begin, end));\n begins.forEach(begin -> queue.add(new Graph.EfficientVertexPath<>(begin)));\n return search(end);\n }\n\n }\n\n private static abstract class MemoDfsPathQuery extends DfsPathQuery {\n\n public MemoDfsPathQuery(Graph graph) {\n super(graph);\n }\n\n abstract Graph.VertexPath memo(Graph.VertexPath path, V parent,\n V end);\n\n @Override\n public Graph.VertexPath path(Graph.VertexPath path, V parent,\n V end) {\n Graph.VertexPath memo = memo(path, parent, end);\n if (memo != null) {\n return memo;\n }\n return super.path(path, parent, end);\n }\n }\n\n private static class DfsPathQuery implements PathQuery {\n\n protected final Graph graph;\n\n public DfsPathQuery(Graph graph) {\n this.graph = graph;\n }\n\n @Override\n public Graph.VertexPath path(V begin, V end) {\n return path(new Graph.EfficientVertexPath<>(begin), null, end);\n }\n\n protected Graph.VertexPath path(Graph.VertexPath path, V parent,\n V end) {\n V head = path.getEnd();\n if (path.getEnd().equals(end)) {\n return path;\n }\n for (Graph.Edge e : graph.getEdges(head)) {\n if (!e.getTo().equals(parent)) {\n Graph.VertexPath next = path(path.append(e), head, end);\n if (next != null) {\n return next;\n }\n }\n }\n return null;\n }\n }\n\n private static class WarshallFloydQuery implements PathQuery {\n\n private Graph.VertexPath[][] shortest;\n\n private WarshallFloydQuery(Graph graph) {\n Collection nodes = graph.getVertexes();\n\n shortest = new Graph.VertexPath[nodes.size()][nodes.size()];\n\n for (int from : nodes) {\n Collection> edges = graph.getEdges(from);\n for (Graph.Edge e : edges) {\n shortest[e.getFrom()][e.getTo()] = new Graph.EfficientVertexPath<>(e);\n }\n shortest[from][from] = new Graph.EfficientVertexPath<>(from);\n }\n\n for (int relay : nodes) {\n for (int from : nodes) {\n for (int dest : nodes) {\n Graph.VertexPath pathA = shortest[from][relay];\n Graph.VertexPath pathB = shortest[relay][dest];\n if (pathA != null && pathB != null) {\n if (shortest[from][dest] == null\n || pathA.getWeight() + pathB.getWeight() < shortest[from][dest]\n .getWeight()) {\n shortest[from][dest] = pathA.append(pathB);\n }\n }\n }\n }\n }\n }\n\n @Override\n public Graph.VertexPath path(Integer begin, Integer end) {\n return shortest[begin][end];\n }\n }\n\n private static abstract class IntVertexGraph implements Graph {\n\n }\n\n private static interface Graph {\n\n static class Edge {\n\n public Edge(V from, V to, long weight) {\n this.from = from;\n this.to = to;\n this.weight = weight;\n }\n\n private final V from;\n\n private final V to;\n private final long weight;\n\n\n V getFrom() {\n return from;\n }\n\n V getTo() {\n return to;\n }\n\n long getWeight() {\n return weight;\n }\n\n @Override\n public boolean equals(Object o) {\n if (this == o) {\n return true;\n }\n if (o == null || getClass() != o.getClass()) {\n return false;\n }\n Edge edge = (Edge) o;\n return weight == edge.weight &&\n Objects.equals(from, edge.from) &&\n Objects.equals(to, edge.to);\n }\n\n @Override\n public int hashCode() {\n return Objects.hash(from, to, weight);\n }\n }\n\n static class ConstantWeightEdge extends Edge {\n\n public ConstantWeightEdge(V from, V to) {\n super(from, to, 1);\n }\n }\n\n Collection getVertexes();\n\n int getSize();\n\n Collection> getEdges(V from);\n\n static interface VertexPath {\n\n V getBegin();\n\n V getEnd();\n\n long getWeight();\n\n VertexPath append(VertexPath other);\n\n VertexPath append(Edge edge);\n }\n\n static class EfficientVertexPath implements VertexPath {\n\n final V begin;\n final V end;\n final long weight;\n\n public EfficientVertexPath(V begin) {\n this.begin = begin;\n this.end = begin;\n this.weight = 0;\n }\n\n public EfficientVertexPath(V begin, V end, long weight) {\n this.begin = begin;\n this.end = end;\n this.weight = weight;\n }\n\n public EfficientVertexPath(Edge edge) {\n this.begin = edge.getFrom();\n this.end = edge.getTo();\n this.weight = edge.getWeight();\n }\n\n private EfficientVertexPath(VertexPath path, Edge append) {\n this.begin = path.getBegin();\n if (!path.getEnd().equals(append.getFrom())) {\n throw new IllegalStateException(\"not correct edge.\");\n }\n this.end = append.getTo();\n this.weight = path.getWeight() + append.getWeight();\n }\n\n private EfficientVertexPath(VertexPath pathA, VertexPath pathB) {\n this.begin = pathA.getBegin();\n if (!pathA.getEnd().equals(pathB.getBegin())) {\n throw new IllegalStateException(\"not correct edge.\");\n }\n this.end = pathB.getEnd();\n this.weight = pathA.getWeight() + pathB.getWeight();\n }\n\n @Override\n public V getBegin() {\n return begin;\n }\n\n @Override\n public V getEnd() {\n return end;\n }\n\n @Override\n public long getWeight() {\n return weight;\n }\n\n @Override\n public VertexPath append(VertexPath other) {\n return new EfficientVertexPath<>(this, other);\n }\n\n @Override\n public VertexPath append(Edge edge) {\n return new EfficientVertexPath<>(this, edge);\n }\n\n @Override\n public boolean equals(Object o) {\n if (this == o) {\n return true;\n }\n if (o == null || getClass() != o.getClass()) {\n return false;\n }\n EfficientVertexPath that = (EfficientVertexPath) o;\n return weight == that.weight &&\n Objects.equals(begin, that.begin) &&\n Objects.equals(end, that.end);\n }\n\n @Override\n public int hashCode() {\n return Objects.hash(begin, end, weight);\n }\n }\n }\n\n private static class Scanner {\n\n private final InputStream is;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n Scanner(InputStream is) {\n this.is = is;\n }\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = is.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte()) {\n return buffer[ptr++];\n } else {\n return -1;\n }\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr])) {\n ptr++;\n }\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {\n throw new NumberFormatException();\n }\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a grid of squares with H horizontal rows and W vertical columns, where each square is painted white or black.\nHW characters from A_{11} to A_{HW} represent the colors of the squares.\nA_{ij} is # if the square at the i-th row from the top and the j-th column from the left is black, and A_{ij} is . if that square is white.\n\nWe will repeatedly perform the following operation until all the squares are black:\n\nEvery white square that shares a side with a black square, becomes black.\n\nFind the number of operations that will be performed.\nThe initial grid has at least one black square.\n\nConstraints\n\n1 \\leq H,W \\leq 1000\n\nA_{ij} is # or ..\n\nThe given grid has at least one black square.\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\nPrint the number of operations that will be performed.\n\nSample Input 1\n\n3 3\n...\n.#.\n...\n\nSample Output 1\n\n2\n\nAfter one operation, all but the corners of the grid will be black. After one more operation, all the squares will be black.\n\nSample Input 2\n\n6 6\n..#..#\n......\n#..#..\n......\n.#....\n....#.\n\nSample Output 2\n\n3", "sample_input": "3 3\n...\n.#.\n...\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03053", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a grid of squares with H horizontal rows and W vertical columns, where each square is painted white or black.\nHW characters from A_{11} to A_{HW} represent the colors of the squares.\nA_{ij} is # if the square at the i-th row from the top and the j-th column from the left is black, and A_{ij} is . if that square is white.\n\nWe will repeatedly perform the following operation until all the squares are black:\n\nEvery white square that shares a side with a black square, becomes black.\n\nFind the number of operations that will be performed.\nThe initial grid has at least one black square.\n\nConstraints\n\n1 \\leq H,W \\leq 1000\n\nA_{ij} is # or ..\n\nThe given grid has at least one black square.\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\nPrint the number of operations that will be performed.\n\nSample Input 1\n\n3 3\n...\n.#.\n...\n\nSample Output 1\n\n2\n\nAfter one operation, all but the corners of the grid will be black. After one more operation, all the squares will be black.\n\nSample Input 2\n\n6 6\n..#..#\n......\n#..#..\n......\n.#....\n....#.\n\nSample Output 2\n\n3", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 21693, "cpu_time_ms": 1062, "memory_kb": 322976}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s310363607", "group_id": "codeNet:p03053", "input_text": "import java.util.ArrayDeque;\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.Queue;\nimport java.util.Scanner;\nimport java.util.Set;\n\npublic class Main {\n static final Scanner sc = new Scanner(System.in);\n static final int MOD = (int) 1E9 + 7;\n static final int INF = Integer.MAX_VALUE;\n static final char BLACK = '#';\n static final char WHITE = '.';\n \n public static void main(String[] args) {\n int H = nint();\n int W = nint();\n char[][] A = nchars2(H, W);\n \n \n int countB = 0;\n Queue q = new ArrayDeque<>();\n for (int h = 0; h < H; h++) {\n for (int w = 0; w < W; w++) {\n if (A[h][w] == BLACK) {\n countB++;\n q.add(new Point(h, w));\n }\n }\n }\n \n Point minP = new Point(0, 0);\n Point maxP = new Point(H-1, W-1);\n int ans = 0;\n \n while (countB < H*W) {\n Set s = new HashSet<>();\n while (!q.isEmpty()) {\n s.add(q.poll());\n }\n \n for (Point p: s) {\n for (int i = 0; i < Point.mv4.length; i++) {\n Point next = p.add(Point.mv4[i]);\n if (next.isIn(minP, maxP) && A[next.h][next.w] == WHITE) {\n q.add(next);\n countB++;\n A[next.h][next.w] = BLACK;\n }\n }\n }\n ans++;\n }\n \n System.out.println(ans);\n }\n\n public static class Point {\n public int h;\n public int w;\n public Point(int h, int w) {\n this.h = h;\n this.w = w;\n }\n \n public boolean isIn(int minH, int maxH, int minW, int maxW) {\n return minH <= this.h && this.h <= maxH && minW <= this.w && this.w <= maxW;\n }\n \n public boolean isIn(Point min, Point max) {\n return isIn(min.h, max.h, min.w, max.w);\n }\n \n \n public Point add(Point mv) {\n return new Point(this.h + mv.h, this.w + mv.w);\n }\n \n @Override\n public boolean equals(Object obj) {\n Point that = (Point) obj;\n return this.h == that.h && this.w == that.w;\n }\n \n @Override\n public String toString() {\n return \"(\" + h + \", \" + w + \")\";\n }\n\n public static final Point[] mv8 = {\n new Point(1, 0), new Point( 0, 1), new Point(-1, 0), new Point(0, -1),\n new Point(1, 1), new Point(-1, 1), new Point(-1, -1), new Point(1, -1)};\n \n public static final Point[] mv4 = {\n new Point(1, 0), new Point( 0, 1), new Point(-1, 0), new Point(0, -1)};\n }\n \n private static int nint() {\n return sc.nextInt();\n }\n\n private static int[] nints(int n) {\n return nints(n, 0, 0);\n }\n\n private static int[] nints(int n, int padL, int padR) {\n int[] a = new int[padL + n + padR];\n for (int i = 0; i < n; i++)\n a[padL + i] = nint();\n return a;\n }\n\n private static long nlong() {\n return sc.nextLong();\n }\n\n private static long[] nlongs(int n) {\n return nlongs(n, 0, 0);\n }\n\n private static long[] nlongs(int n, int padL, int padR) {\n long[] a = new long[padL + n + padR];\n for (int i = 0; i < n; i++)\n a[padL + i] = nlong();\n return a;\n }\n\n private static double ndouble() {\n return sc.nextDouble();\n }\n \n private static double[] ndoubles(int n) {\n return ndoubles(n, 0, 0);\n }\n \n private static double[] ndoubles(int n, int padL, int padR) {\n double[] d = new double[n + padL + padR];\n for (int i = 0; i < n; i++) {\n d[padL + i] = ndouble();\n }\n return d;\n }\n\n private static String nstr() {\n return sc.next();\n }\n\n private static char[] nchars() {\n return sc.next().toCharArray();\n }\n\n private static char[] nchars(int padL, int padR) {\n char[] temp = sc.next().toCharArray();\n char[] ret = new char[temp.length + padL + padR];\n System.arraycopy(temp, 0, ret, padL, temp.length);\n return ret;\n }\n \n private static char[][] nchars2(int h, int w) {\n return nchars2(h, w, 0, 0);\n }\n\n private static char[][] nchars2(int h, int w, int padLU, int padRD) {\n char[][] a2 = new char[h + padLU + padRD][w + padLU + padRD];\n for (int i = 0; i < h; i++)\n System.arraycopy(nchars(), 0, a2[padLU + i], padLU, w);\n return a2;\n }\n \n private static long min(long... ls) {\n return Arrays.stream(ls).min().getAsLong();\n }\n \n private static long max(long... ls) {\n return Arrays.stream(ls).max().getAsLong();\n }\n}\n", "language": "Java", "metadata": {"date": 1569193217, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03053.html", "problem_id": "p03053", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03053/input.txt", "sample_output_relpath": "derived/input_output/data/p03053/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03053/Java/s310363607.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s310363607", "user_id": "u228127260"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.ArrayDeque;\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.Queue;\nimport java.util.Scanner;\nimport java.util.Set;\n\npublic class Main {\n static final Scanner sc = new Scanner(System.in);\n static final int MOD = (int) 1E9 + 7;\n static final int INF = Integer.MAX_VALUE;\n static final char BLACK = '#';\n static final char WHITE = '.';\n \n public static void main(String[] args) {\n int H = nint();\n int W = nint();\n char[][] A = nchars2(H, W);\n \n \n int countB = 0;\n Queue q = new ArrayDeque<>();\n for (int h = 0; h < H; h++) {\n for (int w = 0; w < W; w++) {\n if (A[h][w] == BLACK) {\n countB++;\n q.add(new Point(h, w));\n }\n }\n }\n \n Point minP = new Point(0, 0);\n Point maxP = new Point(H-1, W-1);\n int ans = 0;\n \n while (countB < H*W) {\n Set s = new HashSet<>();\n while (!q.isEmpty()) {\n s.add(q.poll());\n }\n \n for (Point p: s) {\n for (int i = 0; i < Point.mv4.length; i++) {\n Point next = p.add(Point.mv4[i]);\n if (next.isIn(minP, maxP) && A[next.h][next.w] == WHITE) {\n q.add(next);\n countB++;\n A[next.h][next.w] = BLACK;\n }\n }\n }\n ans++;\n }\n \n System.out.println(ans);\n }\n\n public static class Point {\n public int h;\n public int w;\n public Point(int h, int w) {\n this.h = h;\n this.w = w;\n }\n \n public boolean isIn(int minH, int maxH, int minW, int maxW) {\n return minH <= this.h && this.h <= maxH && minW <= this.w && this.w <= maxW;\n }\n \n public boolean isIn(Point min, Point max) {\n return isIn(min.h, max.h, min.w, max.w);\n }\n \n \n public Point add(Point mv) {\n return new Point(this.h + mv.h, this.w + mv.w);\n }\n \n @Override\n public boolean equals(Object obj) {\n Point that = (Point) obj;\n return this.h == that.h && this.w == that.w;\n }\n \n @Override\n public String toString() {\n return \"(\" + h + \", \" + w + \")\";\n }\n\n public static final Point[] mv8 = {\n new Point(1, 0), new Point( 0, 1), new Point(-1, 0), new Point(0, -1),\n new Point(1, 1), new Point(-1, 1), new Point(-1, -1), new Point(1, -1)};\n \n public static final Point[] mv4 = {\n new Point(1, 0), new Point( 0, 1), new Point(-1, 0), new Point(0, -1)};\n }\n \n private static int nint() {\n return sc.nextInt();\n }\n\n private static int[] nints(int n) {\n return nints(n, 0, 0);\n }\n\n private static int[] nints(int n, int padL, int padR) {\n int[] a = new int[padL + n + padR];\n for (int i = 0; i < n; i++)\n a[padL + i] = nint();\n return a;\n }\n\n private static long nlong() {\n return sc.nextLong();\n }\n\n private static long[] nlongs(int n) {\n return nlongs(n, 0, 0);\n }\n\n private static long[] nlongs(int n, int padL, int padR) {\n long[] a = new long[padL + n + padR];\n for (int i = 0; i < n; i++)\n a[padL + i] = nlong();\n return a;\n }\n\n private static double ndouble() {\n return sc.nextDouble();\n }\n \n private static double[] ndoubles(int n) {\n return ndoubles(n, 0, 0);\n }\n \n private static double[] ndoubles(int n, int padL, int padR) {\n double[] d = new double[n + padL + padR];\n for (int i = 0; i < n; i++) {\n d[padL + i] = ndouble();\n }\n return d;\n }\n\n private static String nstr() {\n return sc.next();\n }\n\n private static char[] nchars() {\n return sc.next().toCharArray();\n }\n\n private static char[] nchars(int padL, int padR) {\n char[] temp = sc.next().toCharArray();\n char[] ret = new char[temp.length + padL + padR];\n System.arraycopy(temp, 0, ret, padL, temp.length);\n return ret;\n }\n \n private static char[][] nchars2(int h, int w) {\n return nchars2(h, w, 0, 0);\n }\n\n private static char[][] nchars2(int h, int w, int padLU, int padRD) {\n char[][] a2 = new char[h + padLU + padRD][w + padLU + padRD];\n for (int i = 0; i < h; i++)\n System.arraycopy(nchars(), 0, a2[padLU + i], padLU, w);\n return a2;\n }\n \n private static long min(long... ls) {\n return Arrays.stream(ls).min().getAsLong();\n }\n \n private static long max(long... ls) {\n return Arrays.stream(ls).max().getAsLong();\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a grid of squares with H horizontal rows and W vertical columns, where each square is painted white or black.\nHW characters from A_{11} to A_{HW} represent the colors of the squares.\nA_{ij} is # if the square at the i-th row from the top and the j-th column from the left is black, and A_{ij} is . if that square is white.\n\nWe will repeatedly perform the following operation until all the squares are black:\n\nEvery white square that shares a side with a black square, becomes black.\n\nFind the number of operations that will be performed.\nThe initial grid has at least one black square.\n\nConstraints\n\n1 \\leq H,W \\leq 1000\n\nA_{ij} is # or ..\n\nThe given grid has at least one black square.\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\nPrint the number of operations that will be performed.\n\nSample Input 1\n\n3 3\n...\n.#.\n...\n\nSample Output 1\n\n2\n\nAfter one operation, all but the corners of the grid will be black. After one more operation, all the squares will be black.\n\nSample Input 2\n\n6 6\n..#..#\n......\n#..#..\n......\n.#....\n....#.\n\nSample Output 2\n\n3", "sample_input": "3 3\n...\n.#.\n...\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03053", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a grid of squares with H horizontal rows and W vertical columns, where each square is painted white or black.\nHW characters from A_{11} to A_{HW} represent the colors of the squares.\nA_{ij} is # if the square at the i-th row from the top and the j-th column from the left is black, and A_{ij} is . if that square is white.\n\nWe will repeatedly perform the following operation until all the squares are black:\n\nEvery white square that shares a side with a black square, becomes black.\n\nFind the number of operations that will be performed.\nThe initial grid has at least one black square.\n\nConstraints\n\n1 \\leq H,W \\leq 1000\n\nA_{ij} is # or ..\n\nThe given grid has at least one black square.\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\nPrint the number of operations that will be performed.\n\nSample Input 1\n\n3 3\n...\n.#.\n...\n\nSample Output 1\n\n2\n\nAfter one operation, all but the corners of the grid will be black. After one more operation, all the squares will be black.\n\nSample Input 2\n\n6 6\n..#..#\n......\n#..#..\n......\n.#....\n....#.\n\nSample Output 2\n\n3", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 4958, "cpu_time_ms": 1058, "memory_kb": 133244}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s880851342", "group_id": "codeNet:p03053", "input_text": "import java.util.Queue;\nimport java.util.ArrayDeque;\nimport java.util.Arrays;\nimport java.util.Scanner;\n\nclass Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int h = sc.nextInt();\n int w = sc.nextInt();\n\n int map[][] = new int[h + 2][w + 2];\n Queue queue = new ArrayDeque();\n for (int i = 0; i < h; i++) {\n String s = sc.next();\n for (int j = 0; j < w; j++) {\n char c = s.charAt(j);\n if (c == '#') {\n queue.add(new Pos(i + 1, j + 1));\n map[i + 1][j + 1] = 1;\n }\n }\n }\n Arrays.fill(map[0], -1);\n Arrays.fill(map[h + 1], -1);\n for (int i = 0; i < h + 1; i++) {\n map[i][0] = -1;\n map[i][w + 1] = -1;\n }\n int max = 0;\n while (!queue.isEmpty()) {\n Pos p = queue.poll();\n int dx[] = { 0, 1, 0, -1 };\n int dy[] = { -1, 0, 1, 0 };\n for (int i = 0; i < 4; i++) {\n int ni = p.i + dx[i];\n int nj = p.j + dy[i];\n if (map[ni][nj] == 0) {\n map[ni][nj] = map[p.i][p.j] + 1;\n max = Math.max(max, map[ni][nj]);\n queue.add((new Pos(ni, nj)));\n }\n }\n }\n\n System.out.println(max - 1);\n\n sc.close();\n }\n}\n\nclass Pos {\n int i, j;\n\n Pos(int i, int j) {\n this.i = i;\n this.j = j;\n }\n}\n", "language": "Java", "metadata": {"date": 1566758034, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03053.html", "problem_id": "p03053", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03053/input.txt", "sample_output_relpath": "derived/input_output/data/p03053/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03053/Java/s880851342.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s880851342", "user_id": "u045712871"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.Queue;\nimport java.util.ArrayDeque;\nimport java.util.Arrays;\nimport java.util.Scanner;\n\nclass Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int h = sc.nextInt();\n int w = sc.nextInt();\n\n int map[][] = new int[h + 2][w + 2];\n Queue queue = new ArrayDeque();\n for (int i = 0; i < h; i++) {\n String s = sc.next();\n for (int j = 0; j < w; j++) {\n char c = s.charAt(j);\n if (c == '#') {\n queue.add(new Pos(i + 1, j + 1));\n map[i + 1][j + 1] = 1;\n }\n }\n }\n Arrays.fill(map[0], -1);\n Arrays.fill(map[h + 1], -1);\n for (int i = 0; i < h + 1; i++) {\n map[i][0] = -1;\n map[i][w + 1] = -1;\n }\n int max = 0;\n while (!queue.isEmpty()) {\n Pos p = queue.poll();\n int dx[] = { 0, 1, 0, -1 };\n int dy[] = { -1, 0, 1, 0 };\n for (int i = 0; i < 4; i++) {\n int ni = p.i + dx[i];\n int nj = p.j + dy[i];\n if (map[ni][nj] == 0) {\n map[ni][nj] = map[p.i][p.j] + 1;\n max = Math.max(max, map[ni][nj]);\n queue.add((new Pos(ni, nj)));\n }\n }\n }\n\n System.out.println(max - 1);\n\n sc.close();\n }\n}\n\nclass Pos {\n int i, j;\n\n Pos(int i, int j) {\n this.i = i;\n this.j = j;\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a grid of squares with H horizontal rows and W vertical columns, where each square is painted white or black.\nHW characters from A_{11} to A_{HW} represent the colors of the squares.\nA_{ij} is # if the square at the i-th row from the top and the j-th column from the left is black, and A_{ij} is . if that square is white.\n\nWe will repeatedly perform the following operation until all the squares are black:\n\nEvery white square that shares a side with a black square, becomes black.\n\nFind the number of operations that will be performed.\nThe initial grid has at least one black square.\n\nConstraints\n\n1 \\leq H,W \\leq 1000\n\nA_{ij} is # or ..\n\nThe given grid has at least one black square.\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\nPrint the number of operations that will be performed.\n\nSample Input 1\n\n3 3\n...\n.#.\n...\n\nSample Output 1\n\n2\n\nAfter one operation, all but the corners of the grid will be black. After one more operation, all the squares will be black.\n\nSample Input 2\n\n6 6\n..#..#\n......\n#..#..\n......\n.#....\n....#.\n\nSample Output 2\n\n3", "sample_input": "3 3\n...\n.#.\n...\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03053", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a grid of squares with H horizontal rows and W vertical columns, where each square is painted white or black.\nHW characters from A_{11} to A_{HW} represent the colors of the squares.\nA_{ij} is # if the square at the i-th row from the top and the j-th column from the left is black, and A_{ij} is . if that square is white.\n\nWe will repeatedly perform the following operation until all the squares are black:\n\nEvery white square that shares a side with a black square, becomes black.\n\nFind the number of operations that will be performed.\nThe initial grid has at least one black square.\n\nConstraints\n\n1 \\leq H,W \\leq 1000\n\nA_{ij} is # or ..\n\nThe given grid has at least one black square.\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\nPrint the number of operations that will be performed.\n\nSample Input 1\n\n3 3\n...\n.#.\n...\n\nSample Output 1\n\n2\n\nAfter one operation, all but the corners of the grid will be black. After one more operation, all the squares will be black.\n\nSample Input 2\n\n6 6\n..#..#\n......\n#..#..\n......\n.#....\n....#.\n\nSample Output 2\n\n3", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1563, "cpu_time_ms": 492, "memory_kb": 100548}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s933540476", "group_id": "codeNet:p03053", "input_text": "import java.util.ArrayDeque;\nimport java.util.Queue;\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tnew Main().solve();\n\t}\n\n\tvoid solve() {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\t//上下左右\n\t\tint[] dx = {1, 0, -1, 0};\n\t\tint[] dy = {0, 1, 0, -1};\n\n\t\tint H = sc.nextInt();\n\t\tint W = sc.nextInt();\n\t\tSystem.out.println(H +\" \" + W);\n\n\t\tchar[][] charMap = new char[H][W];\n\t\tboolean[][] map = new boolean[H][W];\n\n\t\tQueue que = new ArrayDeque();\n\n\t\t// 入力文字列の抽出\n\t\tfor (int i = 0; i < H; i++) {\n\t\t\tString s = sc.next();\n\t\t\tSystem.out.println(s);\n\t\t\tcharMap[i] = s.toCharArray();\n\t\t\tfor (int j = 0; j < W; j++) {\n\t\t\t\tif (charMap[i][j] == '#') {\n\t\t\t\t\tque.add(new Place(i, j, 0));\n\t\t\t\t\tmap[i][j] = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tint max = 0;\n\t\twhile (que.size() != 0){\n\t\t\tPlace place = que.remove();\n\n\t\t\tfor (int i = 0; i < 4; i++) {\n\t\t\t\tint x = place.getX() + dx[i];\n\t\t\t\tint y = place.getY() + dy[i];\n\t\t\t\tif (x < 0 || x >= H || y < 0 || y >= W) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (! map[x][y]) {\n\t\t\t\t\tque.add(new Place(x,y, place.getCount() + 1));\n\t\t\t\t\tmap[x][y] = true;\n\t\t\t\t\tmax = place.getCount() + 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(max);\n\t}\n\n\t// 場所を記憶\n\tclass Place {\n\t\tprivate int x;\n\t\tprivate int y;\n\t\tprivate int count;\n\n\t\tpublic Place(int x, int y, int count) {\n\t\t\tthis.x = x;\n\t\t\tthis.y = y;\n\t\t\tthis.count = count;\n\t\t}\n\t\tpublic int getX() {\n\t\t\treturn this.x;\n\t\t}\n\n\t\tpublic int getY() {\n\t\t\treturn this.y;\n\t\t}\n\t\tpublic int getCount() {\n\t\t\treturn this.count;\n\t\t}\n\t}\n}\n", "language": "Java", "metadata": {"date": 1557625069, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03053.html", "problem_id": "p03053", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03053/input.txt", "sample_output_relpath": "derived/input_output/data/p03053/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03053/Java/s933540476.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s933540476", "user_id": "u354839000"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.ArrayDeque;\nimport java.util.Queue;\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tnew Main().solve();\n\t}\n\n\tvoid solve() {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\t//上下左右\n\t\tint[] dx = {1, 0, -1, 0};\n\t\tint[] dy = {0, 1, 0, -1};\n\n\t\tint H = sc.nextInt();\n\t\tint W = sc.nextInt();\n\t\tSystem.out.println(H +\" \" + W);\n\n\t\tchar[][] charMap = new char[H][W];\n\t\tboolean[][] map = new boolean[H][W];\n\n\t\tQueue que = new ArrayDeque();\n\n\t\t// 入力文字列の抽出\n\t\tfor (int i = 0; i < H; i++) {\n\t\t\tString s = sc.next();\n\t\t\tSystem.out.println(s);\n\t\t\tcharMap[i] = s.toCharArray();\n\t\t\tfor (int j = 0; j < W; j++) {\n\t\t\t\tif (charMap[i][j] == '#') {\n\t\t\t\t\tque.add(new Place(i, j, 0));\n\t\t\t\t\tmap[i][j] = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tint max = 0;\n\t\twhile (que.size() != 0){\n\t\t\tPlace place = que.remove();\n\n\t\t\tfor (int i = 0; i < 4; i++) {\n\t\t\t\tint x = place.getX() + dx[i];\n\t\t\t\tint y = place.getY() + dy[i];\n\t\t\t\tif (x < 0 || x >= H || y < 0 || y >= W) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (! map[x][y]) {\n\t\t\t\t\tque.add(new Place(x,y, place.getCount() + 1));\n\t\t\t\t\tmap[x][y] = true;\n\t\t\t\t\tmax = place.getCount() + 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(max);\n\t}\n\n\t// 場所を記憶\n\tclass Place {\n\t\tprivate int x;\n\t\tprivate int y;\n\t\tprivate int count;\n\n\t\tpublic Place(int x, int y, int count) {\n\t\t\tthis.x = x;\n\t\t\tthis.y = y;\n\t\t\tthis.count = count;\n\t\t}\n\t\tpublic int getX() {\n\t\t\treturn this.x;\n\t\t}\n\n\t\tpublic int getY() {\n\t\t\treturn this.y;\n\t\t}\n\t\tpublic int getCount() {\n\t\t\treturn this.count;\n\t\t}\n\t}\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a grid of squares with H horizontal rows and W vertical columns, where each square is painted white or black.\nHW characters from A_{11} to A_{HW} represent the colors of the squares.\nA_{ij} is # if the square at the i-th row from the top and the j-th column from the left is black, and A_{ij} is . if that square is white.\n\nWe will repeatedly perform the following operation until all the squares are black:\n\nEvery white square that shares a side with a black square, becomes black.\n\nFind the number of operations that will be performed.\nThe initial grid has at least one black square.\n\nConstraints\n\n1 \\leq H,W \\leq 1000\n\nA_{ij} is # or ..\n\nThe given grid has at least one black square.\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\nPrint the number of operations that will be performed.\n\nSample Input 1\n\n3 3\n...\n.#.\n...\n\nSample Output 1\n\n2\n\nAfter one operation, all but the corners of the grid will be black. After one more operation, all the squares will be black.\n\nSample Input 2\n\n6 6\n..#..#\n......\n#..#..\n......\n.#....\n....#.\n\nSample Output 2\n\n3", "sample_input": "3 3\n...\n.#.\n...\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03053", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a grid of squares with H horizontal rows and W vertical columns, where each square is painted white or black.\nHW characters from A_{11} to A_{HW} represent the colors of the squares.\nA_{ij} is # if the square at the i-th row from the top and the j-th column from the left is black, and A_{ij} is . if that square is white.\n\nWe will repeatedly perform the following operation until all the squares are black:\n\nEvery white square that shares a side with a black square, becomes black.\n\nFind the number of operations that will be performed.\nThe initial grid has at least one black square.\n\nConstraints\n\n1 \\leq H,W \\leq 1000\n\nA_{ij} is # or ..\n\nThe given grid has at least one black square.\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\nPrint the number of operations that will be performed.\n\nSample Input 1\n\n3 3\n...\n.#.\n...\n\nSample Output 1\n\n2\n\nAfter one operation, all but the corners of the grid will be black. After one more operation, all the squares will be black.\n\nSample Input 2\n\n6 6\n..#..#\n......\n#..#..\n......\n.#....\n....#.\n\nSample Output 2\n\n3", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1545, "cpu_time_ms": 433, "memory_kb": 67480}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s252012655", "group_id": "codeNet:p03053", "input_text": "import java.util.ArrayDeque;\nimport java.util.Arrays;\nimport java.util.Queue;\nimport java.util.Scanner;\nimport java.util.stream.IntStream;\n\npublic class Main {\n\n\tstatic final int INF = 9999999;\n\tstatic int h;\n\tstatic int w;\n\tstatic int[][] table;\n\tstatic Queue sq;\n\n\tpublic static void main(String... args) {\n\n\t\ttry (Scanner sc = new Scanner(System.in)) {\n\t\t\tString[] tmp = sc.nextLine().split(\" \");\n\t\t\th = Integer.parseInt(tmp[0]);\n\t\t\tw = Integer.parseInt(tmp[1]);\n\n\t\t\ttable = new int[h][w];\n\n\t\t\tIntStream.range(0, h).forEach(y -> {\n\t\t\t\tString s = sc.nextLine();\n\t\t\t\tIntStream.range(0, w).forEach(x -> {\n\t\t\t\t\ttable[y][x] = s.charAt(x) == '#' ? 0 : INF;\n\t\t\t\t});\n\t\t\t});\n\n\t\t}\n\t\tsq = new ArrayDeque<>(h * w);\n\n\t\tIntStream.range(0, h).forEach(y -> {\n\t\t\tIntStream.range(0, w).forEach(x -> {\n\t\t\t\tif (table[y][x] == 0) {\n\t\t\t\t\tsq.add(new int[] { y, x, 0 });\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\twhile (!sq.isEmpty()) {\n\t\t\tint[] b = sq.remove();\n\t\t\terosion(b[0], b[1], b[2]);\n\t\t}\n\t\t\n\t\tint maxDis = Arrays.stream(table)\n\t\t\t.map(row -> Arrays.stream(row))\n\t\t\t.mapToInt(rs -> rs.reduce(0, (a,b) -> Math.max(a, b)))\n\t\t\t.reduce(0, (a,b) -> Math.max(a, b));\n\t\t\n\t\tSystem.out.println(maxDis);\n\t}\n\n\tstatic void erosion(int y, int x, int n) {\n\t\tif (n < table[y][x] || n == 0) {\n\t\t\ttable[y][x] = n;\n\n\t\t\tif (y < h - 1) {\n\t\t\t\tsq.add(new int[] { y + 1, x, n + 1 });\n\t\t\t}\n\t\t\tif (y > 0) {\n\t\t\t\tsq.add(new int[] { y - 1, x, n + 1 });\n\t\t\t}\n\t\t\tif (x < w - 1) {\n\t\t\t\tsq.add(new int[] { y, x + 1, n + 1 });\n\t\t\t}\n\t\t\tif (x > 0) {\n\t\t\t\tsq.add(new int[] { y, x - 1, n + 1 });\n\t\t\t}\n\t\t}\n\t}\n}\n", "language": "Java", "metadata": {"date": 1557035847, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03053.html", "problem_id": "p03053", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03053/input.txt", "sample_output_relpath": "derived/input_output/data/p03053/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03053/Java/s252012655.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s252012655", "user_id": "u407160848"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.ArrayDeque;\nimport java.util.Arrays;\nimport java.util.Queue;\nimport java.util.Scanner;\nimport java.util.stream.IntStream;\n\npublic class Main {\n\n\tstatic final int INF = 9999999;\n\tstatic int h;\n\tstatic int w;\n\tstatic int[][] table;\n\tstatic Queue sq;\n\n\tpublic static void main(String... args) {\n\n\t\ttry (Scanner sc = new Scanner(System.in)) {\n\t\t\tString[] tmp = sc.nextLine().split(\" \");\n\t\t\th = Integer.parseInt(tmp[0]);\n\t\t\tw = Integer.parseInt(tmp[1]);\n\n\t\t\ttable = new int[h][w];\n\n\t\t\tIntStream.range(0, h).forEach(y -> {\n\t\t\t\tString s = sc.nextLine();\n\t\t\t\tIntStream.range(0, w).forEach(x -> {\n\t\t\t\t\ttable[y][x] = s.charAt(x) == '#' ? 0 : INF;\n\t\t\t\t});\n\t\t\t});\n\n\t\t}\n\t\tsq = new ArrayDeque<>(h * w);\n\n\t\tIntStream.range(0, h).forEach(y -> {\n\t\t\tIntStream.range(0, w).forEach(x -> {\n\t\t\t\tif (table[y][x] == 0) {\n\t\t\t\t\tsq.add(new int[] { y, x, 0 });\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\twhile (!sq.isEmpty()) {\n\t\t\tint[] b = sq.remove();\n\t\t\terosion(b[0], b[1], b[2]);\n\t\t}\n\t\t\n\t\tint maxDis = Arrays.stream(table)\n\t\t\t.map(row -> Arrays.stream(row))\n\t\t\t.mapToInt(rs -> rs.reduce(0, (a,b) -> Math.max(a, b)))\n\t\t\t.reduce(0, (a,b) -> Math.max(a, b));\n\t\t\n\t\tSystem.out.println(maxDis);\n\t}\n\n\tstatic void erosion(int y, int x, int n) {\n\t\tif (n < table[y][x] || n == 0) {\n\t\t\ttable[y][x] = n;\n\n\t\t\tif (y < h - 1) {\n\t\t\t\tsq.add(new int[] { y + 1, x, n + 1 });\n\t\t\t}\n\t\t\tif (y > 0) {\n\t\t\t\tsq.add(new int[] { y - 1, x, n + 1 });\n\t\t\t}\n\t\t\tif (x < w - 1) {\n\t\t\t\tsq.add(new int[] { y, x + 1, n + 1 });\n\t\t\t}\n\t\t\tif (x > 0) {\n\t\t\t\tsq.add(new int[] { y, x - 1, n + 1 });\n\t\t\t}\n\t\t}\n\t}\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a grid of squares with H horizontal rows and W vertical columns, where each square is painted white or black.\nHW characters from A_{11} to A_{HW} represent the colors of the squares.\nA_{ij} is # if the square at the i-th row from the top and the j-th column from the left is black, and A_{ij} is . if that square is white.\n\nWe will repeatedly perform the following operation until all the squares are black:\n\nEvery white square that shares a side with a black square, becomes black.\n\nFind the number of operations that will be performed.\nThe initial grid has at least one black square.\n\nConstraints\n\n1 \\leq H,W \\leq 1000\n\nA_{ij} is # or ..\n\nThe given grid has at least one black square.\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\nPrint the number of operations that will be performed.\n\nSample Input 1\n\n3 3\n...\n.#.\n...\n\nSample Output 1\n\n2\n\nAfter one operation, all but the corners of the grid will be black. After one more operation, all the squares will be black.\n\nSample Input 2\n\n6 6\n..#..#\n......\n#..#..\n......\n.#....\n....#.\n\nSample Output 2\n\n3", "sample_input": "3 3\n...\n.#.\n...\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03053", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a grid of squares with H horizontal rows and W vertical columns, where each square is painted white or black.\nHW characters from A_{11} to A_{HW} represent the colors of the squares.\nA_{ij} is # if the square at the i-th row from the top and the j-th column from the left is black, and A_{ij} is . if that square is white.\n\nWe will repeatedly perform the following operation until all the squares are black:\n\nEvery white square that shares a side with a black square, becomes black.\n\nFind the number of operations that will be performed.\nThe initial grid has at least one black square.\n\nConstraints\n\n1 \\leq H,W \\leq 1000\n\nA_{ij} is # or ..\n\nThe given grid has at least one black square.\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\nPrint the number of operations that will be performed.\n\nSample Input 1\n\n3 3\n...\n.#.\n...\n\nSample Output 1\n\n2\n\nAfter one operation, all but the corners of the grid will be black. After one more operation, all the squares will be black.\n\nSample Input 2\n\n6 6\n..#..#\n......\n#..#..\n......\n.#....\n....#.\n\nSample Output 2\n\n3", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1545, "cpu_time_ms": 1063, "memory_kb": 210992}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s469810144", "group_id": "codeNet:p03053", "input_text": "import java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.Scanner;\n\npublic class Main implements Runnable { //Runnableを実装する\n\n public static void main(String[] args) {\n\n new Thread(null, new Main(), \"\", 16 * 1024 * 1024).start(); //16MBスタックを確保して実行\n\n }\n\n public void run() {\n\t\tScanner sc = new Scanner(System.in);\n\t\t//Scanner sc = new Scanner(\"3 3 ... .#. ...\");\n\t\tint h = Integer.parseInt(sc.next());\n\t\tint w = Integer.parseInt(sc.next());\n\t\t//int b = Integer.parseInt(sc.next());\n\t\t//int t = Integer.parseInt(sc.next());\n\t\t//int k = 0;\n\t\t//int k = Integer.parseInt(sc.next());\n\t\t//String str = sc.next();\n\t\t//char c[] = str.toCharArray();\n\t\tchar a[][] = new char[h][w];\n\t\tchar anext[][] = new char[h][w];\n\t\tint atmp[] = new int[h];\n\t\tint max= 0;\n\t\tfor (int i = 0; i < h; i++)\n\t\t{\n\t\t\t\ta[i]= sc.next().toCharArray();\n\t\t}\n\t\tfor(int k = 0; k < 2000; k++)\n\t\t{\n\t\t for (int i=0; i < h; i++) {\n\t\t System.arraycopy(a[i], 0, anext[i], 0, w);\n\t\t }\n\t\t int hap = 0;\n\t\t\tfor (int i = 0; i < h; i++)\n\t\t\t{\n\t\t\t\tfor (int j = 0; j < w; j++)\n\t\t\t\t{\n\t\t\t\t\tif(a[i][j] == '.')\n\t\t\t\t\t{\n\t\t\t\t\t\tif(i-1>=0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (a[i-1][j] == '#')\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tanext[i][j] = '#';\n\t\t\t\t\t\t\t\thap=1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(j-1>=0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (a[i][j-1] == '#')\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tanext[i][j] = '#';\n\t\t\t\t\t\t\t\thap=1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(i+1=0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (a[i-1][j] == '#')\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tanext[i][j] = '#';\n\t\t\t\t\t\t\t\thap=1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(j-1>=0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (a[i][j-1] == '#')\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tanext[i][j] = '#';\n\t\t\t\t\t\t\t\thap=1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(i+1 0 && A[i-1][j].equals(\"#\")) {\n R[i][j] = \"#\";\n }\n if (i+1 < H && A[i+1][j].equals(\"#\")) {\n R[i][j] = \"#\";\n }\n if (j > 0 && A[i][j-1].equals(\"#\")) {\n R[i][j] = \"#\";\n }\n if (j+1 < W && A[i][j+1].equals(\"#\")) {\n R[i][j] = \"#\";\n }\n if (R[i][j].equals(\".\")) {\n fill++;\n }\n }\n }\n }\n if (fill == 0) {\n break;\n }\n }\n\n System.out.println(loop);\n }\n\n}", "language": "Java", "metadata": {"date": 1557020447, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03053.html", "problem_id": "p03053", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03053/input.txt", "sample_output_relpath": "derived/input_output/data/p03053/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03053/Java/s026915811.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s026915811", "user_id": "u156447999"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int H = sc.nextInt();\n int W = sc.nextInt();\n String[][] A = new String[H][W];\n String[][] R = new String[H][W];\n for (int i=0; i 0 && A[i-1][j].equals(\"#\")) {\n R[i][j] = \"#\";\n }\n if (i+1 < H && A[i+1][j].equals(\"#\")) {\n R[i][j] = \"#\";\n }\n if (j > 0 && A[i][j-1].equals(\"#\")) {\n R[i][j] = \"#\";\n }\n if (j+1 < W && A[i][j+1].equals(\"#\")) {\n R[i][j] = \"#\";\n }\n if (R[i][j].equals(\".\")) {\n fill++;\n }\n }\n }\n }\n if (fill == 0) {\n break;\n }\n }\n\n System.out.println(loop);\n }\n\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a grid of squares with H horizontal rows and W vertical columns, where each square is painted white or black.\nHW characters from A_{11} to A_{HW} represent the colors of the squares.\nA_{ij} is # if the square at the i-th row from the top and the j-th column from the left is black, and A_{ij} is . if that square is white.\n\nWe will repeatedly perform the following operation until all the squares are black:\n\nEvery white square that shares a side with a black square, becomes black.\n\nFind the number of operations that will be performed.\nThe initial grid has at least one black square.\n\nConstraints\n\n1 \\leq H,W \\leq 1000\n\nA_{ij} is # or ..\n\nThe given grid has at least one black square.\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\nPrint the number of operations that will be performed.\n\nSample Input 1\n\n3 3\n...\n.#.\n...\n\nSample Output 1\n\n2\n\nAfter one operation, all but the corners of the grid will be black. After one more operation, all the squares will be black.\n\nSample Input 2\n\n6 6\n..#..#\n......\n#..#..\n......\n.#....\n....#.\n\nSample Output 2\n\n3", "sample_input": "3 3\n...\n.#.\n...\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03053", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a grid of squares with H horizontal rows and W vertical columns, where each square is painted white or black.\nHW characters from A_{11} to A_{HW} represent the colors of the squares.\nA_{ij} is # if the square at the i-th row from the top and the j-th column from the left is black, and A_{ij} is . if that square is white.\n\nWe will repeatedly perform the following operation until all the squares are black:\n\nEvery white square that shares a side with a black square, becomes black.\n\nFind the number of operations that will be performed.\nThe initial grid has at least one black square.\n\nConstraints\n\n1 \\leq H,W \\leq 1000\n\nA_{ij} is # or ..\n\nThe given grid has at least one black square.\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\nPrint the number of operations that will be performed.\n\nSample Input 1\n\n3 3\n...\n.#.\n...\n\nSample Output 1\n\n2\n\nAfter one operation, all but the corners of the grid will be black. After one more operation, all the squares will be black.\n\nSample Input 2\n\n6 6\n..#..#\n......\n#..#..\n......\n.#....\n....#.\n\nSample Output 2\n\n3", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1724, "cpu_time_ms": 1061, "memory_kb": 161440}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s890754819", "group_id": "codeNet:p03053", "input_text": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.LinkedList;\nimport java.util.Queue;\n\npublic class Main {\n public static void main(String args[]) throws Exception{\n BufferedReader stdR = new BufferedReader(new InputStreamReader(System.in));\n String[] s = stdR.readLine().split(\" \");\n int H = Integer.parseInt(s[0]);\n int W = Integer.parseInt(s[1]);\n char [][] cr = new char[H][W];\n for(int i = 0 ; i < H ; i++) {\n String str = stdR.readLine();\n for(int j = 0 ; j < W ; j++) {\n cr[i][j] = str.charAt(j);\n }\n }\n int count = 0;\n Queue q = new LinkedList();\n for(int i = 0 ; i < H ; i++) {\n for(int j = 0 ; j < W ; j++) {\n if(cr[i][j] == '#') {\n count++;\n q.add(j+\",\"+i+\",\"+0);\n }\n }\n }\n while(true) {\n String[] st = q.poll().split(\",\");\n int nx = Integer.parseInt(st[0]);\n int ny = Integer.parseInt(st[1]);\n int nturn = Integer.parseInt(st[2]);\n if(nx - 1 >= 0 && cr[ny][nx - 1] == '.') {\n cr[ny][nx - 1] = '#';\n q.add((nx - 1)+\",\"+ny+\",\"+(nturn + 1));\n count++;\n }\n if(ny - 1 >= 0 && cr[ny - 1][nx] == '.') {\n cr[ny - 1][nx] = '#';\n q.add(nx+\",\"+(ny - 1)+\",\"+(nturn + 1));\n count++;\n }\n if(nx + 1 < W && cr[ny][nx + 1] == '.') {\n cr[ny][nx + 1] = '#';\n q.add((nx + 1)+\",\"+ny+\",\"+(nturn + 1));\n count++;\n }\n if(ny + 1 < H && cr[ny + 1][nx] == '.') {\n cr[ny + 1][nx] = '#';\n q.add(nx+\",\"+(ny + 1)+\",\"+(nturn + 1));\n count++;\n }\n if(count == H * W)break;\n }\n int max = 0;\n while(!q.isEmpty()) {\n max = Math.max(max, Integer.parseInt(q.poll().split(\",\")[2]));\n }\n System.out.println(max);\n }\n}\n", "language": "Java", "metadata": {"date": 1557019599, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03053.html", "problem_id": "p03053", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03053/input.txt", "sample_output_relpath": "derived/input_output/data/p03053/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03053/Java/s890754819.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s890754819", "user_id": "u992383196"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.LinkedList;\nimport java.util.Queue;\n\npublic class Main {\n public static void main(String args[]) throws Exception{\n BufferedReader stdR = new BufferedReader(new InputStreamReader(System.in));\n String[] s = stdR.readLine().split(\" \");\n int H = Integer.parseInt(s[0]);\n int W = Integer.parseInt(s[1]);\n char [][] cr = new char[H][W];\n for(int i = 0 ; i < H ; i++) {\n String str = stdR.readLine();\n for(int j = 0 ; j < W ; j++) {\n cr[i][j] = str.charAt(j);\n }\n }\n int count = 0;\n Queue q = new LinkedList();\n for(int i = 0 ; i < H ; i++) {\n for(int j = 0 ; j < W ; j++) {\n if(cr[i][j] == '#') {\n count++;\n q.add(j+\",\"+i+\",\"+0);\n }\n }\n }\n while(true) {\n String[] st = q.poll().split(\",\");\n int nx = Integer.parseInt(st[0]);\n int ny = Integer.parseInt(st[1]);\n int nturn = Integer.parseInt(st[2]);\n if(nx - 1 >= 0 && cr[ny][nx - 1] == '.') {\n cr[ny][nx - 1] = '#';\n q.add((nx - 1)+\",\"+ny+\",\"+(nturn + 1));\n count++;\n }\n if(ny - 1 >= 0 && cr[ny - 1][nx] == '.') {\n cr[ny - 1][nx] = '#';\n q.add(nx+\",\"+(ny - 1)+\",\"+(nturn + 1));\n count++;\n }\n if(nx + 1 < W && cr[ny][nx + 1] == '.') {\n cr[ny][nx + 1] = '#';\n q.add((nx + 1)+\",\"+ny+\",\"+(nturn + 1));\n count++;\n }\n if(ny + 1 < H && cr[ny + 1][nx] == '.') {\n cr[ny + 1][nx] = '#';\n q.add(nx+\",\"+(ny + 1)+\",\"+(nturn + 1));\n count++;\n }\n if(count == H * W)break;\n }\n int max = 0;\n while(!q.isEmpty()) {\n max = Math.max(max, Integer.parseInt(q.poll().split(\",\")[2]));\n }\n System.out.println(max);\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a grid of squares with H horizontal rows and W vertical columns, where each square is painted white or black.\nHW characters from A_{11} to A_{HW} represent the colors of the squares.\nA_{ij} is # if the square at the i-th row from the top and the j-th column from the left is black, and A_{ij} is . if that square is white.\n\nWe will repeatedly perform the following operation until all the squares are black:\n\nEvery white square that shares a side with a black square, becomes black.\n\nFind the number of operations that will be performed.\nThe initial grid has at least one black square.\n\nConstraints\n\n1 \\leq H,W \\leq 1000\n\nA_{ij} is # or ..\n\nThe given grid has at least one black square.\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\nPrint the number of operations that will be performed.\n\nSample Input 1\n\n3 3\n...\n.#.\n...\n\nSample Output 1\n\n2\n\nAfter one operation, all but the corners of the grid will be black. After one more operation, all the squares will be black.\n\nSample Input 2\n\n6 6\n..#..#\n......\n#..#..\n......\n.#....\n....#.\n\nSample Output 2\n\n3", "sample_input": "3 3\n...\n.#.\n...\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03053", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a grid of squares with H horizontal rows and W vertical columns, where each square is painted white or black.\nHW characters from A_{11} to A_{HW} represent the colors of the squares.\nA_{ij} is # if the square at the i-th row from the top and the j-th column from the left is black, and A_{ij} is . if that square is white.\n\nWe will repeatedly perform the following operation until all the squares are black:\n\nEvery white square that shares a side with a black square, becomes black.\n\nFind the number of operations that will be performed.\nThe initial grid has at least one black square.\n\nConstraints\n\n1 \\leq H,W \\leq 1000\n\nA_{ij} is # or ..\n\nThe given grid has at least one black square.\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\nPrint the number of operations that will be performed.\n\nSample Input 1\n\n3 3\n...\n.#.\n...\n\nSample Output 1\n\n2\n\nAfter one operation, all but the corners of the grid will be black. After one more operation, all the squares will be black.\n\nSample Input 2\n\n6 6\n..#..#\n......\n#..#..\n......\n.#....\n....#.\n\nSample Output 2\n\n3", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2162, "cpu_time_ms": 1062, "memory_kb": 193116}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s640649428", "group_id": "codeNet:p03053", "input_text": "import java.util.*;\nimport java.io.*;\n\npublic class Main {\n\tstatic BufferedReader br;\n\tstatic StringTokenizer tokenizer;\n\tstatic int[] xOff = {0, 0, 1, -1};\n\tstatic int[] yOff = {1, -1, 0, 0};\n\tpublic static void main(String[] args) throws Exception {\n\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = nextInt();\n\t\tint m = nextInt();\n\t\tboolean[][] black = new boolean[n][m];\n\t\tQueue rQ = new ArrayDeque();\n\t\tQueue cQ = new ArrayDeque();\n\t\tint curr = 0, next = 0, ans = 0;\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tString t = next();\n\t\t\tfor(int k = 0; k < m; k++) {\n\t\t\t\tblack[i][k] = t.charAt(k) == '#';\n\t\t\t\tif(black[i][k]) {\n\t\t\t\t\tcurr++;\n\t\t\t\t\trQ.add(i);\n\t\t\t\t\tcQ.add(k);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\twhile(!rQ.isEmpty()) {\n\t\t\tif(curr == 0) {\n\t\t\t\tcurr = next;\n\t\t\t\tnext = 0;\n\t\t\t\tans++;\n\t\t\t}\n\t\t\tcurr--;\n\t\t\tint r = rQ.poll();\n\t\t\tint c = cQ.poll();\n\t\t\tfor(int i = 0; i < 4; i++) {\n\t\t\t\tif(r + xOff[i] >= 0 && r + xOff[i] < n && c + yOff[i] >= 0 && c + yOff[i] < m && !black[r + xOff[i]][c + yOff[i]]) {\n\t\t\t\t\tnext++;\n\t\t\t\t\tblack[r + xOff[i]][c + yOff[i]] = true;\n\t\t\t\t\trQ.add(r + xOff[i]);\n\t\t\t\t\tcQ.add(c + yOff[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\n\t}\n\n\tpublic static String next() throws IOException {\n\t\twhile (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\tString line = br.readLine();\n\t\t\tif (line == null)\n\t\t\t\tthrow new IOException();\n\t\t\ttokenizer = new StringTokenizer(line);\n\t\t}\n\t\treturn tokenizer.nextToken();\n\t}\n\n\tpublic static int nextInt() throws IOException {\n\t\treturn Integer.parseInt(next());\n\t}\n\n\tpublic static long nextLong() throws IOException {\n\t\treturn Long.parseLong(next());\n\t}\n\n\tpublic static double nextDouble() throws IOException {\n\t\treturn Double.parseDouble(next());\n\t}\n}\n", "language": "Java", "metadata": {"date": 1557018883, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03053.html", "problem_id": "p03053", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03053/input.txt", "sample_output_relpath": "derived/input_output/data/p03053/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03053/Java/s640649428.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s640649428", "user_id": "u213776906"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\n\npublic class Main {\n\tstatic BufferedReader br;\n\tstatic StringTokenizer tokenizer;\n\tstatic int[] xOff = {0, 0, 1, -1};\n\tstatic int[] yOff = {1, -1, 0, 0};\n\tpublic static void main(String[] args) throws Exception {\n\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = nextInt();\n\t\tint m = nextInt();\n\t\tboolean[][] black = new boolean[n][m];\n\t\tQueue rQ = new ArrayDeque();\n\t\tQueue cQ = new ArrayDeque();\n\t\tint curr = 0, next = 0, ans = 0;\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tString t = next();\n\t\t\tfor(int k = 0; k < m; k++) {\n\t\t\t\tblack[i][k] = t.charAt(k) == '#';\n\t\t\t\tif(black[i][k]) {\n\t\t\t\t\tcurr++;\n\t\t\t\t\trQ.add(i);\n\t\t\t\t\tcQ.add(k);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\twhile(!rQ.isEmpty()) {\n\t\t\tif(curr == 0) {\n\t\t\t\tcurr = next;\n\t\t\t\tnext = 0;\n\t\t\t\tans++;\n\t\t\t}\n\t\t\tcurr--;\n\t\t\tint r = rQ.poll();\n\t\t\tint c = cQ.poll();\n\t\t\tfor(int i = 0; i < 4; i++) {\n\t\t\t\tif(r + xOff[i] >= 0 && r + xOff[i] < n && c + yOff[i] >= 0 && c + yOff[i] < m && !black[r + xOff[i]][c + yOff[i]]) {\n\t\t\t\t\tnext++;\n\t\t\t\t\tblack[r + xOff[i]][c + yOff[i]] = true;\n\t\t\t\t\trQ.add(r + xOff[i]);\n\t\t\t\t\tcQ.add(c + yOff[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\n\t}\n\n\tpublic static String next() throws IOException {\n\t\twhile (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\tString line = br.readLine();\n\t\t\tif (line == null)\n\t\t\t\tthrow new IOException();\n\t\t\ttokenizer = new StringTokenizer(line);\n\t\t}\n\t\treturn tokenizer.nextToken();\n\t}\n\n\tpublic static int nextInt() throws IOException {\n\t\treturn Integer.parseInt(next());\n\t}\n\n\tpublic static long nextLong() throws IOException {\n\t\treturn Long.parseLong(next());\n\t}\n\n\tpublic static double nextDouble() throws IOException {\n\t\treturn Double.parseDouble(next());\n\t}\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a grid of squares with H horizontal rows and W vertical columns, where each square is painted white or black.\nHW characters from A_{11} to A_{HW} represent the colors of the squares.\nA_{ij} is # if the square at the i-th row from the top and the j-th column from the left is black, and A_{ij} is . if that square is white.\n\nWe will repeatedly perform the following operation until all the squares are black:\n\nEvery white square that shares a side with a black square, becomes black.\n\nFind the number of operations that will be performed.\nThe initial grid has at least one black square.\n\nConstraints\n\n1 \\leq H,W \\leq 1000\n\nA_{ij} is # or ..\n\nThe given grid has at least one black square.\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\nPrint the number of operations that will be performed.\n\nSample Input 1\n\n3 3\n...\n.#.\n...\n\nSample Output 1\n\n2\n\nAfter one operation, all but the corners of the grid will be black. After one more operation, all the squares will be black.\n\nSample Input 2\n\n6 6\n..#..#\n......\n#..#..\n......\n.#....\n....#.\n\nSample Output 2\n\n3", "sample_input": "3 3\n...\n.#.\n...\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03053", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a grid of squares with H horizontal rows and W vertical columns, where each square is painted white or black.\nHW characters from A_{11} to A_{HW} represent the colors of the squares.\nA_{ij} is # if the square at the i-th row from the top and the j-th column from the left is black, and A_{ij} is . if that square is white.\n\nWe will repeatedly perform the following operation until all the squares are black:\n\nEvery white square that shares a side with a black square, becomes black.\n\nFind the number of operations that will be performed.\nThe initial grid has at least one black square.\n\nConstraints\n\n1 \\leq H,W \\leq 1000\n\nA_{ij} is # or ..\n\nThe given grid has at least one black square.\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\nPrint the number of operations that will be performed.\n\nSample Input 1\n\n3 3\n...\n.#.\n...\n\nSample Output 1\n\n2\n\nAfter one operation, all but the corners of the grid will be black. After one more operation, all the squares will be black.\n\nSample Input 2\n\n6 6\n..#..#\n......\n#..#..\n......\n.#....\n....#.\n\nSample Output 2\n\n3", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1740, "cpu_time_ms": 338, "memory_kb": 68160}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s318931744", "group_id": "codeNet:p03061", "input_text": "import java.util.*;\n\nclass Main{\n public static void main(String[] args){\n \n Scanner sc = new Scanner(System.in);\n\n int N = sc.nextInt();\n int[] A = new int[N];\n int[] L = new int[N + 1];\n int[] R = new int[N + 1];\n L[0] = 0;\n R[N] = 0;\n\n for(int i=0; ii; j--){\n if(j==N-1){\n R[j] = A[j];\n continue;\n }\n R[j] = getCommonDivisor(R[j + 1], A[j]);\n }\n if(i==0){\n max = Math.max(max, R[i + 1]);\n continue;\n }\n if(i==N-1){\n max = Math.max(max, L[i]);\n continue;\n }\n max = Math.max(max, getCommonDivisor(L[i], R[i + 1]));\n }\n System.out.println(max);\n }\n\n \n\n private static int getCommonDivisor(int x, int y){\n int bigger = Math.max(x, y);\n int smaller = Math.min(x, y);\n int surplus = bigger % smaller;\n \n if(surplus==0){\n return smaller;\n }\n surplus = getCommonDivisor(smaller, surplus);\n\n return surplus;\n }\n}", "language": "Java", "metadata": {"date": 1587605074, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03061.html", "problem_id": "p03061", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03061/input.txt", "sample_output_relpath": "derived/input_output/data/p03061/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03061/Java/s318931744.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s318931744", "user_id": "u572204849"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.*;\n\nclass Main{\n public static void main(String[] args){\n \n Scanner sc = new Scanner(System.in);\n\n int N = sc.nextInt();\n int[] A = new int[N];\n int[] L = new int[N + 1];\n int[] R = new int[N + 1];\n L[0] = 0;\n R[N] = 0;\n\n for(int i=0; ii; j--){\n if(j==N-1){\n R[j] = A[j];\n continue;\n }\n R[j] = getCommonDivisor(R[j + 1], A[j]);\n }\n if(i==0){\n max = Math.max(max, R[i + 1]);\n continue;\n }\n if(i==N-1){\n max = Math.max(max, L[i]);\n continue;\n }\n max = Math.max(max, getCommonDivisor(L[i], R[i + 1]));\n }\n System.out.println(max);\n }\n\n \n\n private static int getCommonDivisor(int x, int y){\n int bigger = Math.max(x, y);\n int smaller = Math.min(x, y);\n int surplus = bigger % smaller;\n \n if(surplus==0){\n return smaller;\n }\n surplus = getCommonDivisor(smaller, surplus);\n\n return surplus;\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, written on the blackboard.\n\nYou will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written.\n\nFind the maximum possible greatest common divisor of the N integers on the blackboard after your move.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nOutput\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 greatest common divisor of the N integers on the blackboard after your move.\n\nSample Input 1\n\n3\n7 6 8\n\nSample Output 1\n\n2\n\nIf we replace 7 with 4, the greatest common divisor of the three integers on the blackboard will be 2, which is the maximum possible value.\n\nSample Input 2\n\n3\n12 15 18\n\nSample Output 2\n\n6\n\nSample Input 3\n\n2\n1000000000 1000000000\n\nSample Output 3\n\n1000000000\n\nWe can replace an integer with itself.", "sample_input": "3\n7 6 8\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03061", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, written on the blackboard.\n\nYou will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written.\n\nFind the maximum possible greatest common divisor of the N integers on the blackboard after your move.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nOutput\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 greatest common divisor of the N integers on the blackboard after your move.\n\nSample Input 1\n\n3\n7 6 8\n\nSample Output 1\n\n2\n\nIf we replace 7 with 4, the greatest common divisor of the three integers on the blackboard will be 2, which is the maximum possible value.\n\nSample Input 2\n\n3\n12 15 18\n\nSample Output 2\n\n6\n\nSample Input 3\n\n2\n1000000000 1000000000\n\nSample Output 3\n\n1000000000\n\nWe can replace an integer with itself.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1527, "cpu_time_ms": 2113, "memory_kb": 49140}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s840554627", "group_id": "codeNet:p03061", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextInt();\n }\n sc.close();\n\n // 0からiまでの最大公約数\n int[] leftCache = new int[n];\n leftCache[0] = a[0];\n for (int i = 1; i < n; i++) {\n leftCache[i] = gcd(leftCache[i - 1], a[i]);\n// System.out.println(leftCache[i]);\n }\n\n // iからn-1までの最大公約数\n int[] rightCache = new int[n];\n rightCache[n - 1] = a[n - 1];\n for (int i = n - 2; i >= 0; i--) {\n rightCache[i] = gcd(rightCache[i + 1], a[i]);\n// System.out.println(rightCache[i]);\n }\n\n int ans = rightCache[1]; // 左端を除いた場合\n for (int i = 0; i < n - 2; i++) {\n int candidate = gcd(leftCache[i], rightCache[i + 2]);\n if (candidate > ans) {\n ans = candidate;\n }\n }\n // 右端を除いた場合\n if (leftCache[n - 2] > ans) {\n ans = leftCache[n - 2];\n }\n System.out.println(ans);\n }\n\n static int gcd(int a, int b) {\n// if (a == 0 || b == 0) {\n// return 1;\n// }\n if (a > b) {\n if (a % b == 0) {\n return b;\n } else {\n return gcd(b, a % b);\n }\n } else {\n if (b % a == 0) {\n return a;\n } else {\n return gcd(a, b % a);\n }\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1577587108, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03061.html", "problem_id": "p03061", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03061/input.txt", "sample_output_relpath": "derived/input_output/data/p03061/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03061/Java/s840554627.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s840554627", "user_id": "u752146446"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextInt();\n }\n sc.close();\n\n // 0からiまでの最大公約数\n int[] leftCache = new int[n];\n leftCache[0] = a[0];\n for (int i = 1; i < n; i++) {\n leftCache[i] = gcd(leftCache[i - 1], a[i]);\n// System.out.println(leftCache[i]);\n }\n\n // iからn-1までの最大公約数\n int[] rightCache = new int[n];\n rightCache[n - 1] = a[n - 1];\n for (int i = n - 2; i >= 0; i--) {\n rightCache[i] = gcd(rightCache[i + 1], a[i]);\n// System.out.println(rightCache[i]);\n }\n\n int ans = rightCache[1]; // 左端を除いた場合\n for (int i = 0; i < n - 2; i++) {\n int candidate = gcd(leftCache[i], rightCache[i + 2]);\n if (candidate > ans) {\n ans = candidate;\n }\n }\n // 右端を除いた場合\n if (leftCache[n - 2] > ans) {\n ans = leftCache[n - 2];\n }\n System.out.println(ans);\n }\n\n static int gcd(int a, int b) {\n// if (a == 0 || b == 0) {\n// return 1;\n// }\n if (a > b) {\n if (a % b == 0) {\n return b;\n } else {\n return gcd(b, a % b);\n }\n } else {\n if (b % a == 0) {\n return a;\n } else {\n return gcd(a, b % a);\n }\n }\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, written on the blackboard.\n\nYou will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written.\n\nFind the maximum possible greatest common divisor of the N integers on the blackboard after your move.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nOutput\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 greatest common divisor of the N integers on the blackboard after your move.\n\nSample Input 1\n\n3\n7 6 8\n\nSample Output 1\n\n2\n\nIf we replace 7 with 4, the greatest common divisor of the three integers on the blackboard will be 2, which is the maximum possible value.\n\nSample Input 2\n\n3\n12 15 18\n\nSample Output 2\n\n6\n\nSample Input 3\n\n2\n1000000000 1000000000\n\nSample Output 3\n\n1000000000\n\nWe can replace an integer with itself.", "sample_input": "3\n7 6 8\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03061", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, written on the blackboard.\n\nYou will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written.\n\nFind the maximum possible greatest common divisor of the N integers on the blackboard after your move.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nOutput\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 greatest common divisor of the N integers on the blackboard after your move.\n\nSample Input 1\n\n3\n7 6 8\n\nSample Output 1\n\n2\n\nIf we replace 7 with 4, the greatest common divisor of the three integers on the blackboard will be 2, which is the maximum possible value.\n\nSample Input 2\n\n3\n12 15 18\n\nSample Output 2\n\n6\n\nSample Input 3\n\n2\n1000000000 1000000000\n\nSample Output 3\n\n1000000000\n\nWe can replace an integer with itself.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1688, "cpu_time_ms": 501, "memory_kb": 50336}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s269332289", "group_id": "codeNet:p03061", "input_text": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int N = sc.nextInt();\n\n int[] A = new int[N];\n for (int i = 0; i < N; i++) {\n A[i] = sc.nextInt();\n }\n\n int res = 0;\n for (int i = 0; i < N; i++) {\n int tmpRes = gcdSkip(A, N, i);\n res = Math.max(tmpRes, res);\n }\n\n System.out.println(res);\n }\n\n public static int gcdSkip(int[] A, int N, int skip) {\n int res = 0;\n for (int i = 0; i < N; i++) {\n if (skip == i) continue;\n if (res == 0) {\n res = A[i];\n continue;\n }\n res = gcd(A[i], res);\n }\n return res;\n }\n\n public static int gcd(int a, int b) {\n if (b == 0) {\n return a;\n }\n return gcd(b, a % b);\n }\n}", "language": "Java", "metadata": {"date": 1560486701, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03061.html", "problem_id": "p03061", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03061/input.txt", "sample_output_relpath": "derived/input_output/data/p03061/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03061/Java/s269332289.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s269332289", "user_id": "u108980211"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int N = sc.nextInt();\n\n int[] A = new int[N];\n for (int i = 0; i < N; i++) {\n A[i] = sc.nextInt();\n }\n\n int res = 0;\n for (int i = 0; i < N; i++) {\n int tmpRes = gcdSkip(A, N, i);\n res = Math.max(tmpRes, res);\n }\n\n System.out.println(res);\n }\n\n public static int gcdSkip(int[] A, int N, int skip) {\n int res = 0;\n for (int i = 0; i < N; i++) {\n if (skip == i) continue;\n if (res == 0) {\n res = A[i];\n continue;\n }\n res = gcd(A[i], res);\n }\n return res;\n }\n\n public static int gcd(int a, int b) {\n if (b == 0) {\n return a;\n }\n return gcd(b, a % b);\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, written on the blackboard.\n\nYou will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written.\n\nFind the maximum possible greatest common divisor of the N integers on the blackboard after your move.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nOutput\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 greatest common divisor of the N integers on the blackboard after your move.\n\nSample Input 1\n\n3\n7 6 8\n\nSample Output 1\n\n2\n\nIf we replace 7 with 4, the greatest common divisor of the three integers on the blackboard will be 2, which is the maximum possible value.\n\nSample Input 2\n\n3\n12 15 18\n\nSample Output 2\n\n6\n\nSample Input 3\n\n2\n1000000000 1000000000\n\nSample Output 3\n\n1000000000\n\nWe can replace an integer with itself.", "sample_input": "3\n7 6 8\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03061", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, written on the blackboard.\n\nYou will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written.\n\nFind the maximum possible greatest common divisor of the N integers on the blackboard after your move.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nOutput\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 greatest common divisor of the N integers on the blackboard after your move.\n\nSample Input 1\n\n3\n7 6 8\n\nSample Output 1\n\n2\n\nIf we replace 7 with 4, the greatest common divisor of the three integers on the blackboard will be 2, which is the maximum possible value.\n\nSample Input 2\n\n3\n12 15 18\n\nSample Output 2\n\n6\n\nSample Input 3\n\n2\n1000000000 1000000000\n\nSample Output 3\n\n1000000000\n\nWe can replace an integer with itself.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 923, "cpu_time_ms": 2109, "memory_kb": 50544}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s182739572", "group_id": "codeNet:p03061", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n\n int[] values = new int[n];\n int[] lefts = new int[n];\n int[] rights = new int[n];\n\n for (int i = 0; i < n; i++) {\n values[i] = sc.nextInt();\n }\n\n int result = 0;\n\n for (int i = 0; i < n; i++) {\n int current = 0;\n for (int j = 0; j < n; j++) {\n if (i==j) {\n continue;\n }\n current = gcd(current, values[j]);\n }\n\n result = current > result ? current : result;\n }\n\n System.out.println(result);\n }\n\n private static int gcd(int m, int n) {\n if (n == 0) {\n return m;\n }\n int tmp = m % n;\n return gcd(n, tmp);\n }\n}", "language": "Java", "metadata": {"date": 1557722485, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03061.html", "problem_id": "p03061", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03061/input.txt", "sample_output_relpath": "derived/input_output/data/p03061/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03061/Java/s182739572.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s182739572", "user_id": "u246116521"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n\n int[] values = new int[n];\n int[] lefts = new int[n];\n int[] rights = new int[n];\n\n for (int i = 0; i < n; i++) {\n values[i] = sc.nextInt();\n }\n\n int result = 0;\n\n for (int i = 0; i < n; i++) {\n int current = 0;\n for (int j = 0; j < n; j++) {\n if (i==j) {\n continue;\n }\n current = gcd(current, values[j]);\n }\n\n result = current > result ? current : result;\n }\n\n System.out.println(result);\n }\n\n private static int gcd(int m, int n) {\n if (n == 0) {\n return m;\n }\n int tmp = m % n;\n return gcd(n, tmp);\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, written on the blackboard.\n\nYou will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written.\n\nFind the maximum possible greatest common divisor of the N integers on the blackboard after your move.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nOutput\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 greatest common divisor of the N integers on the blackboard after your move.\n\nSample Input 1\n\n3\n7 6 8\n\nSample Output 1\n\n2\n\nIf we replace 7 with 4, the greatest common divisor of the three integers on the blackboard will be 2, which is the maximum possible value.\n\nSample Input 2\n\n3\n12 15 18\n\nSample Output 2\n\n6\n\nSample Input 3\n\n2\n1000000000 1000000000\n\nSample Output 3\n\n1000000000\n\nWe can replace an integer with itself.", "sample_input": "3\n7 6 8\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03061", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, written on the blackboard.\n\nYou will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written.\n\nFind the maximum possible greatest common divisor of the N integers on the blackboard after your move.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nOutput\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 greatest common divisor of the N integers on the blackboard after your move.\n\nSample Input 1\n\n3\n7 6 8\n\nSample Output 1\n\n2\n\nIf we replace 7 with 4, the greatest common divisor of the three integers on the blackboard will be 2, which is the maximum possible value.\n\nSample Input 2\n\n3\n12 15 18\n\nSample Output 2\n\n6\n\nSample Input 3\n\n2\n1000000000 1000000000\n\nSample Output 3\n\n1000000000\n\nWe can replace an integer with itself.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2109, "memory_kb": 60812}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s470708356", "group_id": "codeNet:p03061", "input_text": "import java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Scanner;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = Integer.parseInt(sc.nextLine());\n\t\tString[] list = sc.nextLine().split(\" \",0);\n\t\tint gcd;\n\t\tint a1;\n\t\tint tmp;\n\t\tint x,y;\n\t\tList gcdList = new ArrayList<>();\n\t\tfor (int i=0;i gcdList = new ArrayList<>();\n\t\tfor (int i=0;i gcds = new ArrayList<>();\n\t\tgcds.add(gcd(A[A.length - 1], A[A.length - 2]));\n\t\tint index = A.length - 2;\n\t\tfor (int i = A.length - 3; i >= 0; --i) {\n\t\t\tlong last = gcds.get(gcds.size() - 1);\n\t\t\tlong g = gcd(last, A[i]);\n\t\t\tgcds.add(g);\n\t\t\tif (g < last) {\n\t\t\t\tindex = i;\n\t\t\t}\n\t\t}\n\n\t\tif (index <= A.length - 3) {\n\t\t\t// その数を置き換える\n\t\t\tlong r = A[A.length - 1];\n\t\t\tfor (int i = A.length - 2; i >= 0; --i) {\n\t\t\t\tif (i == index) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tr = gcd(r, A[i]);\n\t\t\t}\n\t\t\tthis.result = r;\n\t\t} else {\n\t\t\tlong r0 = A[A.length - 1];\n\t\t\tfor (int i = A.length - 3; i >= 0; --i) {\n\t\t\t\tr0 = gcd(r0, A[i]);\n\t\t\t}\n\t\t\tlong r1 = A[A.length - 2];\n\t\t\tfor (int i = A.length - 3; i >= 0; --i) {\n\t\t\t\tr1 = gcd(r1, A[i]);\n\t\t\t}\n\t\t\tthis.result = Math.max(r0, r1);\n\t\t}\n\t}\n\n\tMain() throws IOException {\n\t\tInputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);\n\t\tBufferedReader in = new BufferedReader(reader);\n\t\tN = Integer.parseInt(in.readLine());\n\t\tA = new long[N];\n\t\tString[] tokens = in.readLine().split(\" \");\n\t\tfor (int i = 0; i < N; ++i) {\n\t\t\tA[i] = Integer.parseInt(tokens[i]);\n\t\t}\n\t\tin.close();\n\t\tArrays.sort(A);\n\t\tcalc();\n\t}\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tMain ins = new Main();\n\t\tSystem.out.println(ins.result);\n\t}\n\n}", "language": "Java", "metadata": {"date": 1556429766, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03061.html", "problem_id": "p03061", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03061/input.txt", "sample_output_relpath": "derived/input_output/data/p03061/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03061/Java/s148311564.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s148311564", "user_id": "u655125439"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.nio.charset.StandardCharsets;\nimport java.util.*;\n\npublic class Main {\n\tint N;\n\tlong[] A;\n\tlong result = 0;\n\n\tlong gcd(long large, long small) {\n\t\tif (large < small) {\n\t\t\treturn gcd(small, large);\n\t\t}\n\t\tif (large == small) {\n\t\t\treturn large;\n\t\t}\n\t\tif (large % small == 0) {\n\t\t\treturn small;\n\t\t}\n\t\treturn gcd(small, large % small);\n\t}\n\n\tvoid calc() {\n\t\tList gcds = new ArrayList<>();\n\t\tgcds.add(gcd(A[A.length - 1], A[A.length - 2]));\n\t\tint index = A.length - 2;\n\t\tfor (int i = A.length - 3; i >= 0; --i) {\n\t\t\tlong last = gcds.get(gcds.size() - 1);\n\t\t\tlong g = gcd(last, A[i]);\n\t\t\tgcds.add(g);\n\t\t\tif (g < last) {\n\t\t\t\tindex = i;\n\t\t\t}\n\t\t}\n\n\t\tif (index <= A.length - 3) {\n\t\t\t// その数を置き換える\n\t\t\tlong r = A[A.length - 1];\n\t\t\tfor (int i = A.length - 2; i >= 0; --i) {\n\t\t\t\tif (i == index) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tr = gcd(r, A[i]);\n\t\t\t}\n\t\t\tthis.result = r;\n\t\t} else {\n\t\t\tlong r0 = A[A.length - 1];\n\t\t\tfor (int i = A.length - 3; i >= 0; --i) {\n\t\t\t\tr0 = gcd(r0, A[i]);\n\t\t\t}\n\t\t\tlong r1 = A[A.length - 2];\n\t\t\tfor (int i = A.length - 3; i >= 0; --i) {\n\t\t\t\tr1 = gcd(r1, A[i]);\n\t\t\t}\n\t\t\tthis.result = Math.max(r0, r1);\n\t\t}\n\t}\n\n\tMain() throws IOException {\n\t\tInputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);\n\t\tBufferedReader in = new BufferedReader(reader);\n\t\tN = Integer.parseInt(in.readLine());\n\t\tA = new long[N];\n\t\tString[] tokens = in.readLine().split(\" \");\n\t\tfor (int i = 0; i < N; ++i) {\n\t\t\tA[i] = Integer.parseInt(tokens[i]);\n\t\t}\n\t\tin.close();\n\t\tArrays.sort(A);\n\t\tcalc();\n\t}\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tMain ins = new Main();\n\t\tSystem.out.println(ins.result);\n\t}\n\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, written on the blackboard.\n\nYou will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written.\n\nFind the maximum possible greatest common divisor of the N integers on the blackboard after your move.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nOutput\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 greatest common divisor of the N integers on the blackboard after your move.\n\nSample Input 1\n\n3\n7 6 8\n\nSample Output 1\n\n2\n\nIf we replace 7 with 4, the greatest common divisor of the three integers on the blackboard will be 2, which is the maximum possible value.\n\nSample Input 2\n\n3\n12 15 18\n\nSample Output 2\n\n6\n\nSample Input 3\n\n2\n1000000000 1000000000\n\nSample Output 3\n\n1000000000\n\nWe can replace an integer with itself.", "sample_input": "3\n7 6 8\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03061", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, written on the blackboard.\n\nYou will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written.\n\nFind the maximum possible greatest common divisor of the N integers on the blackboard after your move.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nOutput\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 greatest common divisor of the N integers on the blackboard after your move.\n\nSample Input 1\n\n3\n7 6 8\n\nSample Output 1\n\n2\n\nIf we replace 7 with 4, the greatest common divisor of the three integers on the blackboard will be 2, which is the maximum possible value.\n\nSample Input 2\n\n3\n12 15 18\n\nSample Output 2\n\n6\n\nSample Input 3\n\n2\n1000000000 1000000000\n\nSample Output 3\n\n1000000000\n\nWe can replace an integer with itself.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1755, "cpu_time_ms": 250, "memory_kb": 50524}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s035556079", "group_id": "codeNet:p03061", "input_text": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\tstatic int n;\n\tstatic long r,a,b,ans;\n\tstatic Scanner sc = new Scanner(System.in);\n\tpublic static void main(String[] args) {\n\t\tn=sc.nextInt();\n\t\tlong A[]=new long[n];\n\t\tfor(int i=0;i a) {\n\t\t\ttmp = a;\n\t\t\ta = b;\n\t\t\tb = tmp;\n\t\t}\n\n\t int r = -1;\n\t while (r != 0) {\n\t r = a % b;\n\t a = b;\n\t b = r;\n\t }\n\n\t return a;\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1556417290, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03061.html", "problem_id": "p03061", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03061/input.txt", "sample_output_relpath": "derived/input_output/data/p03061/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03061/Java/s564785266.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s564785266", "user_id": "u850997975"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint N = sc.nextInt();\n\n\t\tint[] A = new int[N];\n\t\tfor(int i = 0; i < N ; i++) {\n\t\t\tA[i] = sc.nextInt();\n\t\t}\n\n\t\tA[0] = A[1];\n\n\t\tsc.close();\n\n\t\tint answer = gcd(A[0],A[1]);\n\n\t\tfor(int i = 1 ; i < N - 1 ;i ++) {\n\t\t\tanswer = gcd(answer, A[i+1]);\n\t\t}\n\n\t\tSystem.out.println(answer);\n\t}\n\n\tpublic static int gcd(int a, int b) {\n\t\tint tmp;\n\t\tif(b > a) {\n\t\t\ttmp = a;\n\t\t\ta = b;\n\t\t\tb = tmp;\n\t\t}\n\n\t int r = -1;\n\t while (r != 0) {\n\t r = a % b;\n\t a = b;\n\t b = r;\n\t }\n\n\t return a;\n\t}\n\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, written on the blackboard.\n\nYou will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written.\n\nFind the maximum possible greatest common divisor of the N integers on the blackboard after your move.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nOutput\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 greatest common divisor of the N integers on the blackboard after your move.\n\nSample Input 1\n\n3\n7 6 8\n\nSample Output 1\n\n2\n\nIf we replace 7 with 4, the greatest common divisor of the three integers on the blackboard will be 2, which is the maximum possible value.\n\nSample Input 2\n\n3\n12 15 18\n\nSample Output 2\n\n6\n\nSample Input 3\n\n2\n1000000000 1000000000\n\nSample Output 3\n\n1000000000\n\nWe can replace an integer with itself.", "sample_input": "3\n7 6 8\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03061", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, written on the blackboard.\n\nYou will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written.\n\nFind the maximum possible greatest common divisor of the N integers on the blackboard after your move.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nOutput\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 greatest common divisor of the N integers on the blackboard after your move.\n\nSample Input 1\n\n3\n7 6 8\n\nSample Output 1\n\n2\n\nIf we replace 7 with 4, the greatest common divisor of the three integers on the blackboard will be 2, which is the maximum possible value.\n\nSample Input 2\n\n3\n12 15 18\n\nSample Output 2\n\n6\n\nSample Input 3\n\n2\n1000000000 1000000000\n\nSample Output 3\n\n1000000000\n\nWe can replace an integer with itself.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 465, "memory_kb": 51720}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s577114835", "group_id": "codeNet:p03061", "input_text": "import java.util.Scanner; \n\npublic class Main {\n public static void main (String[] args) {\n Scanner in = new Scanner(System.in);\n\n while (in.hasNext()) {\n int N = in.nextInt();\n int[] A = new int[N];\n \n for (int i = 0; i < A.length; ++i) {\n A[i] = in.nextInt();\n }\n\n int[] gcdBefore = new int[N];\n gcdBefore[0] = 0;\n// gcdBefore[1] = A[0];\n for (int i = 1; i < gcdBefore.length; ++i) {\n gcdBefore[i] = gcd(gcdBefore[i - 1], A[i - 1]);\n }\n\n int[] gcdAfter = new int[N];\n gcdAfter[gcdAfter.length - 1] = 0;\n // gcdAfter[gcdAfter.length - 2] = A[A.length - 1];\n for (int i = gcdAfter.length - 2; i >= 0; --i) {\n gcdAfter[i] = gcd(gcdAfter[i + 1], A[i + 1]);\n }\n\n int ans = -1;\n for (int i = 0; i < A.length; ++i) {\n ans = Math.max(ans, gcd(gcdBefore[i], gcdAfter[i]));\n }\n\n System.out.println(ans);\n }\n }\n\n private static int gcd (int a, int b) {\n return b == 0 ? a : gcd(b, a % b);\n }\n}", "language": "Java", "metadata": {"date": 1556417238, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03061.html", "problem_id": "p03061", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03061/input.txt", "sample_output_relpath": "derived/input_output/data/p03061/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03061/Java/s577114835.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s577114835", "user_id": "u920836104"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.Scanner; \n\npublic class Main {\n public static void main (String[] args) {\n Scanner in = new Scanner(System.in);\n\n while (in.hasNext()) {\n int N = in.nextInt();\n int[] A = new int[N];\n \n for (int i = 0; i < A.length; ++i) {\n A[i] = in.nextInt();\n }\n\n int[] gcdBefore = new int[N];\n gcdBefore[0] = 0;\n// gcdBefore[1] = A[0];\n for (int i = 1; i < gcdBefore.length; ++i) {\n gcdBefore[i] = gcd(gcdBefore[i - 1], A[i - 1]);\n }\n\n int[] gcdAfter = new int[N];\n gcdAfter[gcdAfter.length - 1] = 0;\n // gcdAfter[gcdAfter.length - 2] = A[A.length - 1];\n for (int i = gcdAfter.length - 2; i >= 0; --i) {\n gcdAfter[i] = gcd(gcdAfter[i + 1], A[i + 1]);\n }\n\n int ans = -1;\n for (int i = 0; i < A.length; ++i) {\n ans = Math.max(ans, gcd(gcdBefore[i], gcdAfter[i]));\n }\n\n System.out.println(ans);\n }\n }\n\n private static int gcd (int a, int b) {\n return b == 0 ? a : gcd(b, a % b);\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, written on the blackboard.\n\nYou will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written.\n\nFind the maximum possible greatest common divisor of the N integers on the blackboard after your move.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nOutput\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 greatest common divisor of the N integers on the blackboard after your move.\n\nSample Input 1\n\n3\n7 6 8\n\nSample Output 1\n\n2\n\nIf we replace 7 with 4, the greatest common divisor of the three integers on the blackboard will be 2, which is the maximum possible value.\n\nSample Input 2\n\n3\n12 15 18\n\nSample Output 2\n\n6\n\nSample Input 3\n\n2\n1000000000 1000000000\n\nSample Output 3\n\n1000000000\n\nWe can replace an integer with itself.", "sample_input": "3\n7 6 8\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03061", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, written on the blackboard.\n\nYou will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written.\n\nFind the maximum possible greatest common divisor of the N integers on the blackboard after your move.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nOutput\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 greatest common divisor of the N integers on the blackboard after your move.\n\nSample Input 1\n\n3\n7 6 8\n\nSample Output 1\n\n2\n\nIf we replace 7 with 4, the greatest common divisor of the three integers on the blackboard will be 2, which is the maximum possible value.\n\nSample Input 2\n\n3\n12 15 18\n\nSample Output 2\n\n6\n\nSample Input 3\n\n2\n1000000000 1000000000\n\nSample Output 3\n\n1000000000\n\nWe can replace an integer with itself.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1017, "cpu_time_ms": 498, "memory_kb": 49620}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s662389652", "group_id": "codeNet:p03061", "input_text": "import java.util.*;\nclass Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = Integer.parseInt(sc.next());\n int[] a = new int[N];\n for(int i = 0; i gcda) {\n min = gcda;\n preMinI = minI;\n minI = i;\n }\n }\n // System.out.println(minI);\n gcda = a[0];\n for(int i = 0; i gcda) {\n min = gcda;\n preMinI = minI;\n minI = i;\n }\n }\n // System.out.println(minI);\n gcda = a[0];\n for(int i = 0; i 0){\n if((exp & 1) == 1){\n ret = ret * base %MOD;\n }\n base = base * base %MOD;\n exp >>= 1;\n }\n return ret;\n }\n\n}\n", "language": "Java", "metadata": {"date": 1555942277, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03070.html", "problem_id": "p03070", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03070/input.txt", "sample_output_relpath": "derived/input_output/data/p03070/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03070/Java/s872854557.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s872854557", "user_id": "u660444966"}, "prompt_components": {"gold_output": "18\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n\n static final long MOD = 998_244_353;\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] a = new int[n];\n int sum = 0;\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextInt();\n sum += a[i];\n }\n long[][] dp = new long[n+1][sum+1];\n long[][] dp2 = new long[n+1][sum+1];\n dp[0][0] = 1;\n dp2[0][0] = 1;\n int tmpSum = 0;\n for (int i = 1; i < n+1; i++) {\n tmpSum += a[i-1];\n for(int j = 0; j < tmpSum+1; j++){\n if(a[i-1] <= j) dp[i][j] += dp[i-1][j-a[i-1]];\n dp[i][j] %= MOD;\n dp[i][j] += dp[i-1][j]*2;\n dp[i][j] %= MOD;\n\n if(a[i-1] <= j) dp2[i][j] += dp2[i-1][j-a[i-1]];\n dp2[i][j] %= MOD;\n dp2[i][j] += dp2[i-1][j];\n dp2[i][j] %= MOD;\n }\n }\n long ans = modPow(3, n);\n for (int i = (sum+1)/2; i < sum+1; i++) {\n ans -= dp[n][i] * 3;\n if(ans < 0)ans += MOD;\n }\n if(sum % 2 == 0){\n ans += dp2[n][sum/2] * 3;\n ans %= MOD;\n }\n System.out.println(ans);\n sc.close();\n }\n\n public static long modPow(long base, int exp) {\n long ret = 1;\n while(exp > 0){\n if((exp & 1) == 1){\n ret = ret * base %MOD;\n }\n base = base * base %MOD;\n exp >>= 1;\n }\n return ret;\n }\n\n}\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nYou are given N integers. The i-th integer is a_i.\nFind the number, modulo 998244353, of ways to paint each of the integers red, green or blue so that the following condition is satisfied:\n\nLet R, G and B be the sums of the integers painted red, green and blue, respectively. There exists a triangle with positive area whose sides have lengths R, G and B.\n\nConstraints\n\n3 \\leq N \\leq 300\n\n1 \\leq a_i \\leq 300(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\na_1\n:\na_N\n\nOutput\n\nPrint the number, modulo 998244353, of ways to paint each of the integers red, green or blue so that the condition is satisfied.\n\nSample Input 1\n\n4\n1\n1\n1\n2\n\nSample Output 1\n\n18\n\nWe can only paint the integers so that the lengths of the sides of the triangle will be 1, 2 and 2, and there are 18 such ways.\n\nSample Input 2\n\n6\n1\n3\n2\n3\n5\n2\n\nSample Output 2\n\n150\n\nSample Input 3\n\n20\n3\n1\n4\n1\n5\n9\n2\n6\n5\n3\n5\n8\n9\n7\n9\n3\n2\n3\n8\n4\n\nSample Output 3\n\n563038556", "sample_input": "4\n1\n1\n1\n2\n"}, "reference_outputs": ["18\n"], "source_document_id": "p03070", "source_text": "Score : 600 points\n\nProblem Statement\n\nYou are given N integers. The i-th integer is a_i.\nFind the number, modulo 998244353, of ways to paint each of the integers red, green or blue so that the following condition is satisfied:\n\nLet R, G and B be the sums of the integers painted red, green and blue, respectively. There exists a triangle with positive area whose sides have lengths R, G and B.\n\nConstraints\n\n3 \\leq N \\leq 300\n\n1 \\leq a_i \\leq 300(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\na_1\n:\na_N\n\nOutput\n\nPrint the number, modulo 998244353, of ways to paint each of the integers red, green or blue so that the condition is satisfied.\n\nSample Input 1\n\n4\n1\n1\n1\n2\n\nSample Output 1\n\n18\n\nWe can only paint the integers so that the lengths of the sides of the triangle will be 1, 2 and 2, and there are 18 such ways.\n\nSample Input 2\n\n6\n1\n3\n2\n3\n5\n2\n\nSample Output 2\n\n150\n\nSample Input 3\n\n20\n3\n1\n4\n1\n5\n9\n2\n6\n5\n3\n5\n8\n9\n7\n9\n3\n2\n3\n8\n4\n\nSample Output 3\n\n563038556", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1608, "cpu_time_ms": 606, "memory_kb": 601040}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s260126313", "group_id": "codeNet:p03105", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint A = sc.nextInt();\n\t\tint B = sc.nextInt();\n\t\tint C = sc.nextInt();\n\t\tif (B>=A*C) {\n\t\t\tSystem.out.println(C);\n\t\t\treturn ;\n\t\t}\n\t\tSystem.out.println(B/A);\n\t}\n}", "language": "Java", "metadata": {"date": 1588791537, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03105.html", "problem_id": "p03105", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03105/input.txt", "sample_output_relpath": "derived/input_output/data/p03105/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03105/Java/s260126313.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s260126313", "user_id": "u476635134"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint A = sc.nextInt();\n\t\tint B = sc.nextInt();\n\t\tint C = sc.nextInt();\n\t\tif (B>=A*C) {\n\t\t\tSystem.out.println(C);\n\t\t\treturn ;\n\t\t}\n\t\tSystem.out.println(B/A);\n\t}\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi likes the sound when he buys a drink from a vending machine.\n\nThat sound can be heard by spending A yen (the currency of Japan) each time.\n\nTakahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time.\n\nHow many times will he hear the sound?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B, C \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the number of times Takahashi will hear his favorite sound.\n\nSample Input 1\n\n2 11 4\n\nSample Output 1\n\n4\n\nSince he has not less than 8 yen, he will hear the sound four times and be satisfied.\n\nSample Input 2\n\n3 9 5\n\nSample Output 2\n\n3\n\nHe may not be able to be satisfied.\n\nSample Input 3\n\n100 1 10\n\nSample Output 3\n\n0", "sample_input": "2 11 4\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03105", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi likes the sound when he buys a drink from a vending machine.\n\nThat sound can be heard by spending A yen (the currency of Japan) each time.\n\nTakahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time.\n\nHow many times will he hear the sound?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B, C \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the number of times Takahashi will hear his favorite sound.\n\nSample Input 1\n\n2 11 4\n\nSample Output 1\n\n4\n\nSince he has not less than 8 yen, he will hear the sound four times and be satisfied.\n\nSample Input 2\n\n3 9 5\n\nSample Output 2\n\n3\n\nHe may not be able to be satisfied.\n\nSample Input 3\n\n100 1 10\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 290, "cpu_time_ms": 110, "memory_kb": 23892}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s142678703", "group_id": "codeNet:p03105", "input_text": "import java.util.*;\npublic class Main {\n public static void main(String[] args){\n\n Scanner sc = new Scanner(System.in);\n int A = sc.nextInt();\n int B = sc.nextInt();\n int C = sc.nextInt();\n\n if ((B / A) < C) {\n System.out.println(B / A);\n } else {\n System.out.println(C);\n }\n\n }\n}", "language": "Java", "metadata": {"date": 1556357541, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03105.html", "problem_id": "p03105", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03105/input.txt", "sample_output_relpath": "derived/input_output/data/p03105/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03105/Java/s142678703.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s142678703", "user_id": "u046482892"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n public static void main(String[] args){\n\n Scanner sc = new Scanner(System.in);\n int A = sc.nextInt();\n int B = sc.nextInt();\n int C = sc.nextInt();\n\n if ((B / A) < C) {\n System.out.println(B / A);\n } else {\n System.out.println(C);\n }\n\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi likes the sound when he buys a drink from a vending machine.\n\nThat sound can be heard by spending A yen (the currency of Japan) each time.\n\nTakahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time.\n\nHow many times will he hear the sound?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B, C \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the number of times Takahashi will hear his favorite sound.\n\nSample Input 1\n\n2 11 4\n\nSample Output 1\n\n4\n\nSince he has not less than 8 yen, he will hear the sound four times and be satisfied.\n\nSample Input 2\n\n3 9 5\n\nSample Output 2\n\n3\n\nHe may not be able to be satisfied.\n\nSample Input 3\n\n100 1 10\n\nSample Output 3\n\n0", "sample_input": "2 11 4\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03105", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi likes the sound when he buys a drink from a vending machine.\n\nThat sound can be heard by spending A yen (the currency of Japan) each time.\n\nTakahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time.\n\nHow many times will he hear the sound?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B, C \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the number of times Takahashi will hear his favorite sound.\n\nSample Input 1\n\n2 11 4\n\nSample Output 1\n\n4\n\nSince he has not less than 8 yen, he will hear the sound four times and be satisfied.\n\nSample Input 2\n\n3 9 5\n\nSample Output 2\n\n3\n\nHe may not be able to be satisfied.\n\nSample Input 3\n\n100 1 10\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 313, "cpu_time_ms": 96, "memory_kb": 23764}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s313914113", "group_id": "codeNet:p03105", "input_text": "\nimport java.io.*;\n import java.util.Scanner;\n\npublic class Main{\n public static void main(String []args) throws IOException\n {\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n int b = sc.nextInt();\n int c = sc.nextInt();\n int x = a/b;\n if(x>c)\n System.out.println(c);\n else\n System.out.println(x);\n\n }\n}", "language": "Java", "metadata": {"date": 1552816707, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03105.html", "problem_id": "p03105", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03105/input.txt", "sample_output_relpath": "derived/input_output/data/p03105/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03105/Java/s313914113.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s313914113", "user_id": "u914330210"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "\nimport java.io.*;\n import java.util.Scanner;\n\npublic class Main{\n public static void main(String []args) throws IOException\n {\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n int b = sc.nextInt();\n int c = sc.nextInt();\n int x = a/b;\n if(x>c)\n System.out.println(c);\n else\n System.out.println(x);\n\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi likes the sound when he buys a drink from a vending machine.\n\nThat sound can be heard by spending A yen (the currency of Japan) each time.\n\nTakahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time.\n\nHow many times will he hear the sound?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B, C \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the number of times Takahashi will hear his favorite sound.\n\nSample Input 1\n\n2 11 4\n\nSample Output 1\n\n4\n\nSince he has not less than 8 yen, he will hear the sound four times and be satisfied.\n\nSample Input 2\n\n3 9 5\n\nSample Output 2\n\n3\n\nHe may not be able to be satisfied.\n\nSample Input 3\n\n100 1 10\n\nSample Output 3\n\n0", "sample_input": "2 11 4\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03105", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi likes the sound when he buys a drink from a vending machine.\n\nThat sound can be heard by spending A yen (the currency of Japan) each time.\n\nTakahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time.\n\nHow many times will he hear the sound?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B, C \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the number of times Takahashi will hear his favorite sound.\n\nSample Input 1\n\n2 11 4\n\nSample Output 1\n\n4\n\nSince he has not less than 8 yen, he will hear the sound four times and be satisfied.\n\nSample Input 2\n\n3 9 5\n\nSample Output 2\n\n3\n\nHe may not be able to be satisfied.\n\nSample Input 3\n\n100 1 10\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 407, "cpu_time_ms": 93, "memory_kb": 22740}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s841611251", "group_id": "codeNet:p03105", "input_text": "import java.util.*;\n\npublic class Main {\n \n public static void main (String[] args){\n \n Main main = new Main();\n main.solve();\n }\n \n private void solve (){\n \n Scanner scanner = new Scanner (System.in);\n \n int A = scanner.nextInt();\n int B = scanner.nextInt();\n int C = scanner.nextInt();\n \n int kaisuu = B/A;\n \n if (kaisuu>=C){\n System.out.println(C);\n } else {\n System.out.println(kaisuu);\n }\n }\n}", "language": "Java", "metadata": {"date": 1552010964, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03105.html", "problem_id": "p03105", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03105/input.txt", "sample_output_relpath": "derived/input_output/data/p03105/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03105/Java/s841611251.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s841611251", "user_id": "u505115437"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n \n public static void main (String[] args){\n \n Main main = new Main();\n main.solve();\n }\n \n private void solve (){\n \n Scanner scanner = new Scanner (System.in);\n \n int A = scanner.nextInt();\n int B = scanner.nextInt();\n int C = scanner.nextInt();\n \n int kaisuu = B/A;\n \n if (kaisuu>=C){\n System.out.println(C);\n } else {\n System.out.println(kaisuu);\n }\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi likes the sound when he buys a drink from a vending machine.\n\nThat sound can be heard by spending A yen (the currency of Japan) each time.\n\nTakahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time.\n\nHow many times will he hear the sound?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B, C \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the number of times Takahashi will hear his favorite sound.\n\nSample Input 1\n\n2 11 4\n\nSample Output 1\n\n4\n\nSince he has not less than 8 yen, he will hear the sound four times and be satisfied.\n\nSample Input 2\n\n3 9 5\n\nSample Output 2\n\n3\n\nHe may not be able to be satisfied.\n\nSample Input 3\n\n100 1 10\n\nSample Output 3\n\n0", "sample_input": "2 11 4\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03105", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi likes the sound when he buys a drink from a vending machine.\n\nThat sound can be heard by spending A yen (the currency of Japan) each time.\n\nTakahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time.\n\nHow many times will he hear the sound?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B, C \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the number of times Takahashi will hear his favorite sound.\n\nSample Input 1\n\n2 11 4\n\nSample Output 1\n\n4\n\nSince he has not less than 8 yen, he will hear the sound four times and be satisfied.\n\nSample Input 2\n\n3 9 5\n\nSample Output 2\n\n3\n\nHe may not be able to be satisfied.\n\nSample Input 3\n\n100 1 10\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 459, "cpu_time_ms": 96, "memory_kb": 23764}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s817600715", "group_id": "codeNet:p03105", "input_text": "import java.util.ArrayList;\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String args[]) {\n\t\tScanner scn = new Scanner(System.in);\n\t\tint a = scn.nextInt();\n\t\tint b = scn.nextInt();\n\t\tint k = scn.nextInt();\n\n\t\tArrayList list = new ArrayList<>();\n\n\t\tint i = 1;\n\t\tdo {\n\t\t\tif (a % i == 0 && b % i == 0) {\n\t\t\t\tSystem.out.println(i);\n\t\t\t\tlist.add(i);\n\t\t\t}\n\t\t\ti++;\n\t\t} while (i <= a);\n\n\t\tSystem.out.println(list.get((list.size()-k)));\n\t}\n}", "language": "Java", "metadata": {"date": 1551739634, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03105.html", "problem_id": "p03105", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03105/input.txt", "sample_output_relpath": "derived/input_output/data/p03105/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03105/Java/s817600715.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s817600715", "user_id": "u091010228"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "import java.util.ArrayList;\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String args[]) {\n\t\tScanner scn = new Scanner(System.in);\n\t\tint a = scn.nextInt();\n\t\tint b = scn.nextInt();\n\t\tint k = scn.nextInt();\n\n\t\tArrayList list = new ArrayList<>();\n\n\t\tint i = 1;\n\t\tdo {\n\t\t\tif (a % i == 0 && b % i == 0) {\n\t\t\t\tSystem.out.println(i);\n\t\t\t\tlist.add(i);\n\t\t\t}\n\t\t\ti++;\n\t\t} while (i <= a);\n\n\t\tSystem.out.println(list.get((list.size()-k)));\n\t}\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi likes the sound when he buys a drink from a vending machine.\n\nThat sound can be heard by spending A yen (the currency of Japan) each time.\n\nTakahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time.\n\nHow many times will he hear the sound?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B, C \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the number of times Takahashi will hear his favorite sound.\n\nSample Input 1\n\n2 11 4\n\nSample Output 1\n\n4\n\nSince he has not less than 8 yen, he will hear the sound four times and be satisfied.\n\nSample Input 2\n\n3 9 5\n\nSample Output 2\n\n3\n\nHe may not be able to be satisfied.\n\nSample Input 3\n\n100 1 10\n\nSample Output 3\n\n0", "sample_input": "2 11 4\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03105", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi likes the sound when he buys a drink from a vending machine.\n\nThat sound can be heard by spending A yen (the currency of Japan) each time.\n\nTakahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time.\n\nHow many times will he hear the sound?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B, C \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the number of times Takahashi will hear his favorite sound.\n\nSample Input 1\n\n2 11 4\n\nSample Output 1\n\n4\n\nSince he has not less than 8 yen, he will hear the sound four times and be satisfied.\n\nSample Input 2\n\n3 9 5\n\nSample Output 2\n\n3\n\nHe may not be able to be satisfied.\n\nSample Input 3\n\n100 1 10\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 467, "cpu_time_ms": 99, "memory_kb": 21460}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s259438413", "group_id": "codeNet:p03105", "input_text": "\n//import java.util.List;\nimport java.util.Scanner;\n//import java.util.Stack;\n\npublic class Main {\n\t\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint A = sc.nextInt();\n\t\tint B = sc.nextInt();\n\t\tint K = sc.nextInt();\n\t\t\n\t\tint times = 0;\n\t\tint max = Math.max(A, B);\n\t\tint output = max;\n\t\tfor(int i = max; i >= 1; i--) {\n\t\t\tif(A%i == 0 && B%i == 0) {\n\t\t\t\ttimes++;\n\t\t\t\toutput = i;\n\t\t\t\tif(times == K) {\t\t\t\t\t\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(output);\n\t\t\n\t}\n\t\n\n}\n", "language": "Java", "metadata": {"date": 1551650542, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03105.html", "problem_id": "p03105", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03105/input.txt", "sample_output_relpath": "derived/input_output/data/p03105/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03105/Java/s259438413.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s259438413", "user_id": "u006971340"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "\n//import java.util.List;\nimport java.util.Scanner;\n//import java.util.Stack;\n\npublic class Main {\n\t\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint A = sc.nextInt();\n\t\tint B = sc.nextInt();\n\t\tint K = sc.nextInt();\n\t\t\n\t\tint times = 0;\n\t\tint max = Math.max(A, B);\n\t\tint output = max;\n\t\tfor(int i = max; i >= 1; i--) {\n\t\t\tif(A%i == 0 && B%i == 0) {\n\t\t\t\ttimes++;\n\t\t\t\toutput = i;\n\t\t\t\tif(times == K) {\t\t\t\t\t\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(output);\n\t\t\n\t}\n\t\n\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi likes the sound when he buys a drink from a vending machine.\n\nThat sound can be heard by spending A yen (the currency of Japan) each time.\n\nTakahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time.\n\nHow many times will he hear the sound?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B, C \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the number of times Takahashi will hear his favorite sound.\n\nSample Input 1\n\n2 11 4\n\nSample Output 1\n\n4\n\nSince he has not less than 8 yen, he will hear the sound four times and be satisfied.\n\nSample Input 2\n\n3 9 5\n\nSample Output 2\n\n3\n\nHe may not be able to be satisfied.\n\nSample Input 3\n\n100 1 10\n\nSample Output 3\n\n0", "sample_input": "2 11 4\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03105", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi likes the sound when he buys a drink from a vending machine.\n\nThat sound can be heard by spending A yen (the currency of Japan) each time.\n\nTakahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time.\n\nHow many times will he hear the sound?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B, C \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the number of times Takahashi will hear his favorite sound.\n\nSample Input 1\n\n2 11 4\n\nSample Output 1\n\n4\n\nSince he has not less than 8 yen, he will hear the sound four times and be satisfied.\n\nSample Input 2\n\n3 9 5\n\nSample Output 2\n\n3\n\nHe may not be able to be satisfied.\n\nSample Input 3\n\n100 1 10\n\nSample Output 3\n\n0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 509, "cpu_time_ms": 93, "memory_kb": 23764}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s705432870", "group_id": "codeNet:p03105", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint a = sc.nextInt();\n\t\tint b = sc.nextInt();\n\t\tint c = sc.nextInt();\n\t\t\n\t\tif(a>b) {\n\t\t\tSystem.out.println(0);\n\t\t}else {\n\t\t\tif(a*cb) {\n\t\t\tSystem.out.println(0);\n\t\t}else {\n\t\t\tif(a*c 0) {\n\t\t\tnum /= 2;\n\t\t\tcount++;\n\t\t}\n\t\treturn count;\n\t}\n}\n\nclass InputReader {\n\tBufferedReader br;\n\tStringTokenizer st;\n\n\tpublic InputReader(InputStream in) {\n\t\tbr = new BufferedReader(new InputStreamReader(in));\n\t\tst = null;\n\t}\n\n\tpublic String next() {\n\t\twhile (st == null || !st.hasMoreTokens()) {\n\t\t\ttry {\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}\n\t\t}\n\t\treturn st.nextToken();\n\t}\n\n\tpublic int nextInt() {\n\t\treturn Integer.parseInt(next());\n\t}\n\n\tpublic long nextLong() {\n\t\treturn Long.parseLong(next());\n\t}\n\n\tpublic double nextDouble() {\n\t\treturn Double.parseDouble(next());\n\t}\n}\n", "language": "Java", "metadata": {"date": 1592587712, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03160.html", "problem_id": "p03160", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03160/input.txt", "sample_output_relpath": "derived/input_output/data/p03160/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03160/Java/s632192652.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s632192652", "user_id": "u497722438"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.BufferedWriter;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.OutputStreamWriter;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\n\n/**\n * Built using CHelper plug-in Actual solution is at the top\n */\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tInputReader in = new InputReader(System.in);\n\t\tPrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), true);\n\t\tTaskB solver = new TaskB();\n\t\tsolver.solve(1, in, out);\n\t\tout.flush();\n\t\tout.close();\n\t}\n}\n\nclass Pair {\n\tlong first;\n\tlong second;\n\tlong third;\n\n\tPair(long first, long second, long third) {\n\t\tthis.first = first;\n\t\tthis.second = second;\n\t\tthis.third = third;\n\t}\n}\n\nclass TaskB {\n\n\tpublic void solve(int testNumber, InputReader in, PrintWriter pw) {\n\t\tint N = in.nextInt();\n\t\tint h[] = new int[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\th[i] = in.nextInt();\n\t\t}\n\t\tint dp[] = new int[N];\n\t\tArrays.fill(dp, Integer.MAX_VALUE);\n\t\tdp[0] = 0;\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tfor (int j : new int[] { i + 1, i + 2 }) {\n\t\t\t\tif (j < N) {\n\t\t\t\t\tdp[j] = Math.min(dp[j], dp[i] + Math.abs(h[i] - h[j]));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tpw.println(dp[N - 1]);\n\n\t}\n\n\tint __gcd(int a, int b) {\n\t\tif (b == 0)\n\t\t\treturn a;\n\t\treturn __gcd(b, a % b);\n\n\t}\n\n\tpublic int getInt(int num) {\n\t\tint ret = -1;\n\t\tswitch (num) {\n\t\tcase 0:\n\t\t\tret = 6;\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tret = 2;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tret = 5;\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tret = 5;\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tret = 4;\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tret = 5;\n\t\t\tbreak;\n\t\tcase 6:\n\t\t\tret = 6;\n\t\t\tbreak;\n\t\tcase 7:\n\t\t\tret = 3;\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\tret = 7;\n\t\t\tbreak;\n\t\tcase 9:\n\t\t\tret = 6;\n\t\t\tbreak;\n\t\t}\n\t\treturn ret;\n\t}\n\n\tpublic int isPow(long num) {\n\t\tint count = 0;\n\t\twhile (num > 0) {\n\t\t\tnum /= 2;\n\t\t\tcount++;\n\t\t}\n\t\treturn count;\n\t}\n}\n\nclass InputReader {\n\tBufferedReader br;\n\tStringTokenizer st;\n\n\tpublic InputReader(InputStream in) {\n\t\tbr = new BufferedReader(new InputStreamReader(in));\n\t\tst = null;\n\t}\n\n\tpublic String next() {\n\t\twhile (st == null || !st.hasMoreTokens()) {\n\t\t\ttry {\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}\n\t\t}\n\t\treturn st.nextToken();\n\t}\n\n\tpublic int nextInt() {\n\t\treturn Integer.parseInt(next());\n\t}\n\n\tpublic long nextLong() {\n\t\treturn Long.parseLong(next());\n\t}\n\n\tpublic double nextDouble() {\n\t\treturn Double.parseDouble(next());\n\t}\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to Stone i + 1 or Stone i + 2. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n4\n10 30 40 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 4, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n2\n10 10\n\nSample Output 2\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 3\n\n6\n30 10 60 10 60 50\n\nSample Output 3\n\n40\n\nIf we follow the path 1 → 3 → 5 → 6, the total cost incurred would be |30 - 60| + |60 - 60| + |60 - 50| = 40.", "sample_input": "4\n10 30 40 20\n"}, "reference_outputs": ["30\n"], "source_document_id": "p03160", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to Stone i + 1 or Stone i + 2. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n4\n10 30 40 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 4, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n2\n10 10\n\nSample Output 2\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 3\n\n6\n30 10 60 10 60 50\n\nSample Output 3\n\n40\n\nIf we follow the path 1 → 3 → 5 → 6, the total cost incurred would be |30 - 60| + |60 - 60| + |60 - 50| = 40.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2491, "cpu_time_ms": 174, "memory_kb": 39332}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s032107066", "group_id": "codeNet:p03160", "input_text": "import java.util.*;\npublic class Main{\n public static void main(String[] args) {\n Scanner ob=new Scanner(System.in);\n int n=ob.nextInt();\n int a[]=new int[n];\n for(int i=0;i1) cost[num] = Math.min(cost[num], reSolve(num-2)+Math.abs(h[num]-h[num-2]));\n\t\tchecked[num] = true;\n\t\treturn cost[num];\n\t}\n}\n", "language": "Java", "metadata": {"date": 1587119013, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03160.html", "problem_id": "p03160", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03160/input.txt", "sample_output_relpath": "derived/input_output/data/p03160/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03160/Java/s725510242.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s725510242", "user_id": "u123503119"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "import java.util.Scanner;\n \nclass Main {\n\tint n;\n\tint[] h;\n\tint[] cost;\n\t\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tMain m = new Main(sc);\n\t\tm.solve();\n\t}\n\tMain(Scanner sc){\n\t\tn = sc.nextInt();\n\t\th = new int[n];\n\t\tcost = new int[n];\n\t\tfor(int i = 0; i < n;i++){\n\t\t\th[i] = sc.nextInt();\n\t\t\tcost[i] = Integer.MAX_VALUE;\n\t\t}\n\t\tcost[0] = 0;\n\t}\n\tint cntString(String str,char target){\n\t\tint cnt = 0;\n\t\tfor(char s : str.toCharArray()){\n\t\t\tif(s == target){\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t\treturn cnt;\n\t}\n\tboolean[] checked;\n\tvoid solve(){\n\t\tchecked = new boolean[n];\n\t\tfor(int i=1;i1) cost[num] = Math.min(cost[num], reSolve(num-2)+Math.abs(h[num]-h[num-2]));\n\t\tchecked[num] = true;\n\t\treturn cost[num];\n\t}\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to Stone i + 1 or Stone i + 2. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n4\n10 30 40 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 4, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n2\n10 10\n\nSample Output 2\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 3\n\n6\n30 10 60 10 60 50\n\nSample Output 3\n\n40\n\nIf we follow the path 1 → 3 → 5 → 6, the total cost incurred would be |30 - 60| + |60 - 60| + |60 - 50| = 40.", "sample_input": "4\n10 30 40 20\n"}, "reference_outputs": ["30\n"], "source_document_id": "p03160", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to Stone i + 1 or Stone i + 2. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n4\n10 30 40 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 4, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n2\n10 10\n\nSample Output 2\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 3\n\n6\n30 10 60 10 60 50\n\nSample Output 3\n\n40\n\nIf we follow the path 1 → 3 → 5 → 6, the total cost incurred would be |30 - 60| + |60 - 60| + |60 - 50| = 40.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 966, "cpu_time_ms": 448, "memory_kb": 75056}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s888847015", "group_id": "codeNet:p03160", "input_text": "import java.util.Scanner;\nimport java.lang.Math;\n\npublic class Main {\n\n public static void main(String[] args) {\n\n Scanner scanner = new Scanner(System.in);\n int N = scanner.nextInt();\n int[] stones = new int[N];\n for(int i = 0; i < N; i++) stones[i] = scanner.nextInt();\n\n int[] dp = new int[N];\n dp[1] = Math.abs(stones[1] - stones[0]);\n for(int i = 2; i < N; i++) {\n dp[i] = Math.min(Math.abs(stones[i] - stones[i - 2]) + dp[i - 2],\n Math.abs(stones[i] - stones[i - 1]) + dp[i - 1]);\n }\n System.out.println(dp[N - 1]);\n }\n}", "language": "Java", "metadata": {"date": 1586333420, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03160.html", "problem_id": "p03160", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03160/input.txt", "sample_output_relpath": "derived/input_output/data/p03160/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03160/Java/s888847015.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s888847015", "user_id": "u015326641"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "import java.util.Scanner;\nimport java.lang.Math;\n\npublic class Main {\n\n public static void main(String[] args) {\n\n Scanner scanner = new Scanner(System.in);\n int N = scanner.nextInt();\n int[] stones = new int[N];\n for(int i = 0; i < N; i++) stones[i] = scanner.nextInt();\n\n int[] dp = new int[N];\n dp[1] = Math.abs(stones[1] - stones[0]);\n for(int i = 2; i < N; i++) {\n dp[i] = Math.min(Math.abs(stones[i] - stones[i - 2]) + dp[i - 2],\n Math.abs(stones[i] - stones[i - 1]) + dp[i - 1]);\n }\n System.out.println(dp[N - 1]);\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to Stone i + 1 or Stone i + 2. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n4\n10 30 40 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 4, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n2\n10 10\n\nSample Output 2\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 3\n\n6\n30 10 60 10 60 50\n\nSample Output 3\n\n40\n\nIf we follow the path 1 → 3 → 5 → 6, the total cost incurred would be |30 - 60| + |60 - 60| + |60 - 50| = 40.", "sample_input": "4\n10 30 40 20\n"}, "reference_outputs": ["30\n"], "source_document_id": "p03160", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to Stone i + 1 or Stone i + 2. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n4\n10 30 40 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 4, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n2\n10 10\n\nSample Output 2\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 3\n\n6\n30 10 60 10 60 50\n\nSample Output 3\n\n40\n\nIf we follow the path 1 → 3 → 5 → 6, the total cost incurred would be |30 - 60| + |60 - 60| + |60 - 50| = 40.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 431, "memory_kb": 49932}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s644555561", "group_id": "codeNet:p03160", "input_text": "/*package whatever //do not write package name here */\n\nimport java.io.*;\nimport java.util.*;\nimport java.lang.*;\n\nclass Main {\n static class FastReader \n { \n BufferedReader br; \n StringTokenizer st; \n \n public FastReader() \n { \n br = new BufferedReader(new\n InputStreamReader(System.in)); \n } \n \n String next() \n { \n while (st == null || !st.hasMoreElements()) \n { \n try\n { \n st = new StringTokenizer(br.readLine()); \n } \n catch (IOException e) \n { \n e.printStackTrace(); \n } \n } \n return st.nextToken(); \n } \n \n int nextInt() \n { \n return Integer.parseInt(next()); \n } \n \n long nextLong() \n { \n return Long.parseLong(next()); \n } \n \n double nextDouble() \n { \n return Double.parseDouble(next()); \n } \n \n String nextLine() \n { \n String str = \"\"; \n try\n { \n str = br.readLine(); \n } \n catch (IOException e) \n { \n e.printStackTrace(); \n } \n return str; \n } \n } \n \n static boolean is_palindrome(String s){\n for (int i=0;i<=s.length()/2 ;i++ ) {\n if(s.charAt(i)!=s.charAt(s.length()-1-i)){\n return false;\n }\n }\n return true;\n }\n\tpublic static void main (String[] args) {\n\t FastReader ob = new FastReader();\n\t int n = ob.nextInt();\n\t int arr[] = new int[n];\n\t for (int i=0;i= '0' && c <= '9');\n\n if (neg) {\n return -ret;\n }\n return ret;\n }\n\n private void fillBuffer() {\n try {\n bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);\n if (bytesRead == -1) {\n buffer[0] = -1;\n }\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n\n private byte read() {\n if (bufferPointer == bytesRead) {\n fillBuffer();\n }\n return buffer[bufferPointer++];\n }\n\n }\n}\n\n", "language": "Java", "metadata": {"date": 1567058268, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03160.html", "problem_id": "p03160", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03160/input.txt", "sample_output_relpath": "derived/input_output/data/p03160/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03160/Java/s504986857.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s504986857", "user_id": "u401141372"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.io.DataInputStream;\nimport java.io.IOException;\nimport java.io.FileInputStream;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Reader in = new Reader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n AFrog1 solver = new AFrog1();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class AFrog1 {\n public void solve(int testNumber, Reader in, PrintWriter out) {\n int n = in.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; ++i) {\n a[i] = in.nextInt();\n }\n int c = 0;\n int d = Math.abs(a[1] - a[0]);\n for (int i = 2; i < n; ++i) {\n int x = Math.abs(a[i] - a[i - 1]) + d;\n int y = Math.abs(a[i] - a[i - 2]) + c;\n int z = Math.min(x, y);\n c = d;\n d = z;\n }\n out.println(d);\n }\n\n }\n\n static class Reader {\n final private int BUFFER_SIZE = 1 << 16;\n private DataInputStream din;\n private byte[] buffer;\n private int bufferPointer;\n private int bytesRead;\n\n public Reader(InputStream in) {\n din = new DataInputStream(in);\n buffer = new byte[BUFFER_SIZE];\n bufferPointer = bytesRead = 0;\n }\n\n public Reader(String file_name) {\n try {\n din = new DataInputStream(new FileInputStream(file_name));\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n buffer = new byte[BUFFER_SIZE];\n bufferPointer = bytesRead = 0;\n }\n\n public int nextInt() {\n int ret = 0;\n byte c = read();\n while (c <= ' ') {\n c = read();\n }\n boolean neg = (c == '-');\n if (neg) {\n c = read();\n }\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n\n if (neg) {\n return -ret;\n }\n return ret;\n }\n\n private void fillBuffer() {\n try {\n bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);\n if (bytesRead == -1) {\n buffer[0] = -1;\n }\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n\n private byte read() {\n if (bufferPointer == bytesRead) {\n fillBuffer();\n }\n return buffer[bufferPointer++];\n }\n\n }\n}\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to Stone i + 1 or Stone i + 2. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n4\n10 30 40 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 4, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n2\n10 10\n\nSample Output 2\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 3\n\n6\n30 10 60 10 60 50\n\nSample Output 3\n\n40\n\nIf we follow the path 1 → 3 → 5 → 6, the total cost incurred would be |30 - 60| + |60 - 60| + |60 - 50| = 40.", "sample_input": "4\n10 30 40 20\n"}, "reference_outputs": ["30\n"], "source_document_id": "p03160", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to Stone i + 1 or Stone i + 2. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n4\n10 30 40 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 4, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n2\n10 10\n\nSample Output 2\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 3\n\n6\n30 10 60 10 60 50\n\nSample Output 3\n\n40\n\nIf we follow the path 1 → 3 → 5 → 6, the total cost incurred would be |30 - 60| + |60 - 60| + |60 - 50| = 40.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3008, "cpu_time_ms": 98, "memory_kb": 21716}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s326291119", "group_id": "codeNet:p03160", "input_text": "import java.util.*;\nimport java.lang.Math;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint number_of_elements = sc.nextInt();\n \tint intArray[] = new int[number_of_elements];\n \tint index = 0;\n \twhile(sc.hasNextInt()){\n intArray[index++] = sc.nextInt();\n }\n int dpArray[] = new int[intArray.length];\n int cost = 0;\n dpArray[0]=0;\n dpArray[1]=Math.abs(intArray[1]-intArray[0]);\n for(int i =2 ;i map = new HashMap<>();\n \n public static int swap1(int[][] student, int[][] professor, int[] student_list, int[] professor_list,int curr_prof,int stud, int prof, int n, int flag){\n\n int j3=1;\n \n // int flag=0;\n \n while(j3 list = new ArrayList();\n\n while(j2n || j>n){\n // int sum = 0;\n return 0;\n }else if(array2[i][j]==true){\n // System.out.println(i+\" \"+j);\n return sum;\n }else{\n array[i][j]=Math.max(max_sum(array,i+1,j,n,array2),max_sum(array,i,j+1,n,array2));\n array2[i][j]=true;\n return array[i][j];\n }\n \n }\n\n public static void filling3(long[] array1,long[] array,long[] aux,long right){\n while(array1[1]n || start2>m){\n return -1;\n }else{\n long a,b;\n if(horse_path(n,m,start1+2,start2+1)==-1){\n a = 0+horse_path(n,m,start1+2,start2+1);\n }else{\n a=1+horse_path(n,m,start1+2,start2+1);\n }\n if(horse_path(n,m,start1+1,start2+2)==-1){\n b = 0+horse_path(n,m,start1+1,start2+2);\n }else{\n b=1+horse_path(n,m,start1+1,start2+2);\n }\n return min_val(a,b);\n }\n }\n\n public static long looping(long[] array, int n, int i, long maximum, long value1, long value2){\n while(ib){\n return a;\n }else{\n return b;\n }\n }\n\n\n \n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] array =new int[n];\n for(int i=0;i=n-1){\n return 0;\n }else if(indx==n-2){\n return Math.abs(array[indx]-array[indx+1]);\n }\n else{\n return Math.min(Math.abs(array[indx]-array[indx+1])+height(array,n,indx+1),Math.abs(array[indx]-array[indx+2])+height(array,n,indx+2));\n }\n }\n\n public static boolean comparing(String s,int odd, int k){\n if(odd<=k && s.length()>=k){\n return true;\n }else{\n return false;\n }\n } \n\n public static int oddcount(int[] array, String s, int n){\n for(int i=0;i=0;k--){\n i1++;\n array[k]=array[k]%1000000007;\n sum=(sum+(array[k]*((i1*i2)%1000000007)))%1000000007;\n i2=(i1*i2)%1000000007;\n }\n\n return sum;\n }\n\n public static int largestsum(int[][] array,int i,int j,int n){\n if(i>n || j>n){\n return 0;\n }\n else{\n return array[i][j]+Math.max(largestsum(array,i+1,j,n),largestsum(array,i+1,j+1,n));\n }\n }\n\n public static void LongestIncreasingSubsequence(long[] array, long n){\n boolean flag=true;\n for(int i=2;i<=n;i++){\n if(array[i]>=array[i-1])\n {\n flag=false;\n break;\n }\n }\n if(flag)\n System.out.println(0);\n else{\n long count=0;\n long maximum=0;\n for(int i1=1;i1<=n;i1++){\n long m1=0;\n long l1=0;\n for(int i2=1;i2=array[i1]){\n l2++;\n if(m2<=l2){\n m2=l2;\n l2=0;\n }\n }\n else if(i2==n && array[i2]=array[i1]){\n l2++;\n }\n else{\n l2++;\n if(m2n || j>n){\n // int sum = 0;\n return 0;\n }\n return array[i][j]+Math.max(max_sum(array,i+1,j,n),max_sum(array,i,j+1,n));\n }\n\n public static boolean isPrime(long num){\n if ( num > 2 && num%2 == 0 ) {\n // System.out.println(num + \" is not prime\");\n return false;\n }\n long top = (long)Math.sqrt(num) + 1;\n for(int i = 3; i < top; i+=2){\n if(num % i == 0){\n // System.out.println(num + \" is not prime\");\n return false;\n }\n }\n // System.out.println(num + \" is prime\");\n return true; \n}\n\n public static BigInteger gcd(BigInteger a, BigInteger b) \n { \n BigInteger b1 = new BigInteger(\"0\");\n // Everything divides 0 \n if (a.equals(b1) || b.equals(b1)) \n return b1; \n \n // base case \n if (a.equals(b)) \n return a; \n \n // a is greater \n if (a.compareTo(b)==1) \n return gcd(a.subtract(b), b); \n return gcd(a, b.subtract(a)); \n } \n \n // method to return LCM of two numbers \n public static BigInteger lcm(BigInteger a, BigInteger b) \n { \n \n return (a.multiply(b)).divide(gcd(a, b)); \n }\n\n public static void filling2(long[] array1,long[] array,long[] aux,long mid){\n while(array1[0]b){\n return true;\n }else{\n return false;\n }\n }\n\n public static long modu(long n, long a, long b, long temp){\n long m = n/2;\n if(m<1){\n return 0;\n }else if(m>temp){\n return 0;\n }\n else{\n if(m%a==0 && m%b!=0 || m%b==0 && m%a!=0){\n return 1+modu(m-1,a,b,temp)+modu(m+1,a,b,temp);\n }else{\n return modu(m-1,a,b,temp)+modu(m+1,a,b,temp);\n }\n }\n }\n \n public static double distance(double a, double b, double c, double d){\n double d1 = (a-c)*(a-c);\n double d2 = (b-d)*(b-d);\n double d3 = d1+d2;\n double d4 = Math.sqrt(d3);\n return d4;\n }\n\n public static void merge(long[] array,long left,long mid,long right,long size,long[] aux){\n long[] array1 = new long[3];\n array1[0]=left;\n array1[1]=mid;\n array1[2]=left;\n long count=0;\n while((array1[0]30 && n<51){\n return 55;\n }else{\n if(n%50==0){\n long temp = n/50;\n long value = 25*(temp-1);\n return value+55;\n }else{\n long temp = n/50;\n temp++;\n // System.out.println(temp);\n long value = 25*(temp-1);\n return value+55;\n }\n }\n }\n\n public static long max_val(long[] array, int n, int start, int end){\n long maximum=0;\n long value1=array[0];\n long value2=0;\n int i=1;\n long result = looping(array,n,i,maximum,value1,value2);\n return result;\n }\n\n public static long max(long a , long b){\n if(a>b){\n return a;\n }else{\n return b;\n }\n }\n \n public static void counting(int[] array, int a, int b, int n){\n int indx1 = Binary(array,1,n,a);\n \n int indx2 = Binary(array,1,n,b);\n \n int diff = indx2-indx1;\n \n int result = diff+1;\n \n Result(result); \n }\n\n public static long result(long n, long m){\n long value = horse_path(n,m,1,1);\n return value;\n }\n\n public static int permutations(int n,int i, int count){\n while(i0 && n==0){\n return false;\n }else if(sum==0){\n return true;\n }else if(array[n-1]>sum){\n return check(array,n-1,sum,curr,temp);\n }\n else{\n return check(array,n-1,sum,curr,temp) || check(array,n-1,sum-array[n-1],curr,temp);\n }\n }\n\n public static int swap4(int[] professor_list, int[] student_list, int prof, int stud, int total){\n\n professor_list[prof]=1;\n \n student_list[stud]=prof;\n\n total--;\n\n return total;\n \n }\n\n\n public static void show(int[] array,int n){\n \n for(int i=1;inum){\n \n return Binary(array,min,mid-1,num);\n \n }\n else\n {\n \n return Binary(array,mid+1,max,num);\n \n }\n }\n }\n\n}", "language": "Java", "metadata": {"date": 1552950142, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03160.html", "problem_id": "p03160", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03160/input.txt", "sample_output_relpath": "derived/input_output/data/p03160/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03160/Java/s752033223.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s752033223", "user_id": "u346531902"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "\n//Pradeep Ghosh 2017076;Lab5-Q-3;\n\nimport java.util.*;\n\nimport java.lang.*;\n\nimport java.io.*;\n\nimport java.math.*;\n\npublic class Main\n{ \n public static long[] array = new long[1000001];\n\n // public static HashMap map = new HashMap<>();\n \n public static int swap1(int[][] student, int[][] professor, int[] student_list, int[] professor_list,int curr_prof,int stud, int prof, int n, int flag){\n\n int j3=1;\n \n // int flag=0;\n \n while(j3 list = new ArrayList();\n\n while(j2n || j>n){\n // int sum = 0;\n return 0;\n }else if(array2[i][j]==true){\n // System.out.println(i+\" \"+j);\n return sum;\n }else{\n array[i][j]=Math.max(max_sum(array,i+1,j,n,array2),max_sum(array,i,j+1,n,array2));\n array2[i][j]=true;\n return array[i][j];\n }\n \n }\n\n public static void filling3(long[] array1,long[] array,long[] aux,long right){\n while(array1[1]n || start2>m){\n return -1;\n }else{\n long a,b;\n if(horse_path(n,m,start1+2,start2+1)==-1){\n a = 0+horse_path(n,m,start1+2,start2+1);\n }else{\n a=1+horse_path(n,m,start1+2,start2+1);\n }\n if(horse_path(n,m,start1+1,start2+2)==-1){\n b = 0+horse_path(n,m,start1+1,start2+2);\n }else{\n b=1+horse_path(n,m,start1+1,start2+2);\n }\n return min_val(a,b);\n }\n }\n\n public static long looping(long[] array, int n, int i, long maximum, long value1, long value2){\n while(ib){\n return a;\n }else{\n return b;\n }\n }\n\n\n \n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] array =new int[n];\n for(int i=0;i=n-1){\n return 0;\n }else if(indx==n-2){\n return Math.abs(array[indx]-array[indx+1]);\n }\n else{\n return Math.min(Math.abs(array[indx]-array[indx+1])+height(array,n,indx+1),Math.abs(array[indx]-array[indx+2])+height(array,n,indx+2));\n }\n }\n\n public static boolean comparing(String s,int odd, int k){\n if(odd<=k && s.length()>=k){\n return true;\n }else{\n return false;\n }\n } \n\n public static int oddcount(int[] array, String s, int n){\n for(int i=0;i=0;k--){\n i1++;\n array[k]=array[k]%1000000007;\n sum=(sum+(array[k]*((i1*i2)%1000000007)))%1000000007;\n i2=(i1*i2)%1000000007;\n }\n\n return sum;\n }\n\n public static int largestsum(int[][] array,int i,int j,int n){\n if(i>n || j>n){\n return 0;\n }\n else{\n return array[i][j]+Math.max(largestsum(array,i+1,j,n),largestsum(array,i+1,j+1,n));\n }\n }\n\n public static void LongestIncreasingSubsequence(long[] array, long n){\n boolean flag=true;\n for(int i=2;i<=n;i++){\n if(array[i]>=array[i-1])\n {\n flag=false;\n break;\n }\n }\n if(flag)\n System.out.println(0);\n else{\n long count=0;\n long maximum=0;\n for(int i1=1;i1<=n;i1++){\n long m1=0;\n long l1=0;\n for(int i2=1;i2=array[i1]){\n l2++;\n if(m2<=l2){\n m2=l2;\n l2=0;\n }\n }\n else if(i2==n && array[i2]=array[i1]){\n l2++;\n }\n else{\n l2++;\n if(m2n || j>n){\n // int sum = 0;\n return 0;\n }\n return array[i][j]+Math.max(max_sum(array,i+1,j,n),max_sum(array,i,j+1,n));\n }\n\n public static boolean isPrime(long num){\n if ( num > 2 && num%2 == 0 ) {\n // System.out.println(num + \" is not prime\");\n return false;\n }\n long top = (long)Math.sqrt(num) + 1;\n for(int i = 3; i < top; i+=2){\n if(num % i == 0){\n // System.out.println(num + \" is not prime\");\n return false;\n }\n }\n // System.out.println(num + \" is prime\");\n return true; \n}\n\n public static BigInteger gcd(BigInteger a, BigInteger b) \n { \n BigInteger b1 = new BigInteger(\"0\");\n // Everything divides 0 \n if (a.equals(b1) || b.equals(b1)) \n return b1; \n \n // base case \n if (a.equals(b)) \n return a; \n \n // a is greater \n if (a.compareTo(b)==1) \n return gcd(a.subtract(b), b); \n return gcd(a, b.subtract(a)); \n } \n \n // method to return LCM of two numbers \n public static BigInteger lcm(BigInteger a, BigInteger b) \n { \n \n return (a.multiply(b)).divide(gcd(a, b)); \n }\n\n public static void filling2(long[] array1,long[] array,long[] aux,long mid){\n while(array1[0]b){\n return true;\n }else{\n return false;\n }\n }\n\n public static long modu(long n, long a, long b, long temp){\n long m = n/2;\n if(m<1){\n return 0;\n }else if(m>temp){\n return 0;\n }\n else{\n if(m%a==0 && m%b!=0 || m%b==0 && m%a!=0){\n return 1+modu(m-1,a,b,temp)+modu(m+1,a,b,temp);\n }else{\n return modu(m-1,a,b,temp)+modu(m+1,a,b,temp);\n }\n }\n }\n \n public static double distance(double a, double b, double c, double d){\n double d1 = (a-c)*(a-c);\n double d2 = (b-d)*(b-d);\n double d3 = d1+d2;\n double d4 = Math.sqrt(d3);\n return d4;\n }\n\n public static void merge(long[] array,long left,long mid,long right,long size,long[] aux){\n long[] array1 = new long[3];\n array1[0]=left;\n array1[1]=mid;\n array1[2]=left;\n long count=0;\n while((array1[0]30 && n<51){\n return 55;\n }else{\n if(n%50==0){\n long temp = n/50;\n long value = 25*(temp-1);\n return value+55;\n }else{\n long temp = n/50;\n temp++;\n // System.out.println(temp);\n long value = 25*(temp-1);\n return value+55;\n }\n }\n }\n\n public static long max_val(long[] array, int n, int start, int end){\n long maximum=0;\n long value1=array[0];\n long value2=0;\n int i=1;\n long result = looping(array,n,i,maximum,value1,value2);\n return result;\n }\n\n public static long max(long a , long b){\n if(a>b){\n return a;\n }else{\n return b;\n }\n }\n \n public static void counting(int[] array, int a, int b, int n){\n int indx1 = Binary(array,1,n,a);\n \n int indx2 = Binary(array,1,n,b);\n \n int diff = indx2-indx1;\n \n int result = diff+1;\n \n Result(result); \n }\n\n public static long result(long n, long m){\n long value = horse_path(n,m,1,1);\n return value;\n }\n\n public static int permutations(int n,int i, int count){\n while(i0 && n==0){\n return false;\n }else if(sum==0){\n return true;\n }else if(array[n-1]>sum){\n return check(array,n-1,sum,curr,temp);\n }\n else{\n return check(array,n-1,sum,curr,temp) || check(array,n-1,sum-array[n-1],curr,temp);\n }\n }\n\n public static int swap4(int[] professor_list, int[] student_list, int prof, int stud, int total){\n\n professor_list[prof]=1;\n \n student_list[stud]=prof;\n\n total--;\n\n return total;\n \n }\n\n\n public static void show(int[] array,int n){\n \n for(int i=1;inum){\n \n return Binary(array,min,mid-1,num);\n \n }\n else\n {\n \n return Binary(array,mid+1,max,num);\n \n }\n }\n }\n\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to Stone i + 1 or Stone i + 2. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n4\n10 30 40 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 4, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n2\n10 10\n\nSample Output 2\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 3\n\n6\n30 10 60 10 60 50\n\nSample Output 3\n\n40\n\nIf we follow the path 1 → 3 → 5 → 6, the total cost incurred would be |30 - 60| + |60 - 60| + |60 - 50| = 40.", "sample_input": "4\n10 30 40 20\n"}, "reference_outputs": ["30\n"], "source_document_id": "p03160", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to Stone i + 1 or Stone i + 2. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n4\n10 30 40 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 4, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n2\n10 10\n\nSample Output 2\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 3\n\n6\n30 10 60 10 60 50\n\nSample Output 3\n\n40\n\nIf we follow the path 1 → 3 → 5 → 6, the total cost incurred would be |30 - 60| + |60 - 60| + |60 - 50| = 40.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 19616, "cpu_time_ms": 2109, "memory_kb": 82508}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s660814236", "group_id": "codeNet:p03160", "input_text": "import java.util.*;\npublic class Main{\n public static long[] memo;\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int[] h = new int[N];\n memo = new long[N];\n Arrays.fill(memo, -1L);\n for(int i = 0; i < N; i++){\n h[i] = sc.nextInt();\n }\n System.out.println(solve(h));\n }\n \n public static long solve(int[] array){\n long[] ans = new long[array.length];\n ans[0] = 0L;\n ans[1] = Math.abs(array[1] - array[0]);\n for(int i = 2; i < array.length; i++){\n long tmp1 = ans[i-1] + Math.abs(array[i] - array[i-1]);\n long tmp2 = ans[i-2] + Math.abs(array[i] - array[i-2]);\n ans[i] = Math.min(tmp1, tmp2);\n }\n return ans[array.length - 1];\n }\n}", "language": "Java", "metadata": {"date": 1546845709, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03160.html", "problem_id": "p03160", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03160/input.txt", "sample_output_relpath": "derived/input_output/data/p03160/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03160/Java/s660814236.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s660814236", "user_id": "u952491523"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "import java.util.*;\npublic class Main{\n public static long[] memo;\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int[] h = new int[N];\n memo = new long[N];\n Arrays.fill(memo, -1L);\n for(int i = 0; i < N; i++){\n h[i] = sc.nextInt();\n }\n System.out.println(solve(h));\n }\n \n public static long solve(int[] array){\n long[] ans = new long[array.length];\n ans[0] = 0L;\n ans[1] = Math.abs(array[1] - array[0]);\n for(int i = 2; i < array.length; i++){\n long tmp1 = ans[i-1] + Math.abs(array[i] - array[i-1]);\n long tmp2 = ans[i-2] + Math.abs(array[i] - array[i-2]);\n ans[i] = Math.min(tmp1, tmp2);\n }\n return ans[array.length - 1];\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to Stone i + 1 or Stone i + 2. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n4\n10 30 40 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 4, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n2\n10 10\n\nSample Output 2\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 3\n\n6\n30 10 60 10 60 50\n\nSample Output 3\n\n40\n\nIf we follow the path 1 → 3 → 5 → 6, the total cost incurred would be |30 - 60| + |60 - 60| + |60 - 50| = 40.", "sample_input": "4\n10 30 40 20\n"}, "reference_outputs": ["30\n"], "source_document_id": "p03160", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to Stone i + 1 or Stone i + 2. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n4\n10 30 40 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 4, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n2\n10 10\n\nSample Output 2\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 3\n\n6\n30 10 60 10 60 50\n\nSample Output 3\n\n40\n\nIf we follow the path 1 → 3 → 5 → 6, the total cost incurred would be |30 - 60| + |60 - 60| + |60 - 50| = 40.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 446, "memory_kb": 62000}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s473245472", "group_id": "codeNet:p03160", "input_text": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\tstatic final int INF = Integer.MAX_VALUE;\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint n = scan.nextInt();\n\t\tint[] arr = new int[n];\n\t\t\n\t\tfor(int i = 0 ; i < n ; ++i) {\n\t\t\tarr[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tint[] dp = new int[n];\n\t\tArrays.fill(dp, INF);\n\t\tdp[0] = 0;\n\t\tdp[1] = Math.abs(arr[1] - arr[0]);\n\t\tfor(int i = 2 ; i < n ; ++i) {\n\t\t\tdp[i] = Math.min(Math.abs(arr[i] - arr[i-1]) + dp[i-1], Math.abs(arr[i] - arr[i-2]) + dp[i-2]);\n\t\t}\n\t\tSystem.out.println(dp[n-1]);\n\t}\n}\n", "language": "Java", "metadata": {"date": 1546805113, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03160.html", "problem_id": "p03160", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03160/input.txt", "sample_output_relpath": "derived/input_output/data/p03160/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03160/Java/s473245472.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s473245472", "user_id": "u536176320"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\tstatic final int INF = Integer.MAX_VALUE;\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint n = scan.nextInt();\n\t\tint[] arr = new int[n];\n\t\t\n\t\tfor(int i = 0 ; i < n ; ++i) {\n\t\t\tarr[i] = scan.nextInt();\n\t\t}\n\t\t\n\t\tint[] dp = new int[n];\n\t\tArrays.fill(dp, INF);\n\t\tdp[0] = 0;\n\t\tdp[1] = Math.abs(arr[1] - arr[0]);\n\t\tfor(int i = 2 ; i < n ; ++i) {\n\t\t\tdp[i] = Math.min(Math.abs(arr[i] - arr[i-1]) + dp[i-1], Math.abs(arr[i] - arr[i-2]) + dp[i-2]);\n\t\t}\n\t\tSystem.out.println(dp[n-1]);\n\t}\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to Stone i + 1 or Stone i + 2. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n4\n10 30 40 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 4, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n2\n10 10\n\nSample Output 2\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 3\n\n6\n30 10 60 10 60 50\n\nSample Output 3\n\n40\n\nIf we follow the path 1 → 3 → 5 → 6, the total cost incurred would be |30 - 60| + |60 - 60| + |60 - 50| = 40.", "sample_input": "4\n10 30 40 20\n"}, "reference_outputs": ["30\n"], "source_document_id": "p03160", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to Stone i + 1 or Stone i + 2. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n4\n10 30 40 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 4, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n2\n10 10\n\nSample Output 2\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 3\n\n6\n30 10 60 10 60 50\n\nSample Output 3\n\n40\n\nIf we follow the path 1 → 3 → 5 → 6, the total cost incurred would be |30 - 60| + |60 - 60| + |60 - 50| = 40.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 429, "memory_kb": 51008}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s948409078", "group_id": "codeNet:p03161", "input_text": "import java.util.*;\nimport java.io.*;\n\nclass Main {\n\n public static void main(String []args){\n FastReader sc = new FastReader();\n \n int n = sc.nextInt(), k = sc.nextInt();\n int [] heights = new int [n];\n for (int i = 0; i < n; i++) {\n heights[i] = sc.nextInt();\n }\n int [] dp = new int [n];\n \n for (int i = 1; i < n; i++) {\n dp[i] = dp[i - 1] + Math.abs(heights[i] - heights[i - 1]);\n for (int j = i - 2; j >= Math.max(0, i - k); j--) {\n dp[i] = Math.min(dp[i], dp[j] + Math.abs(heights[i] - heights[j]));\n }\n }\n \n System.out.println(dp[n - 1]);\n }\n \n static class FastReader \n { \n BufferedReader br; \n StringTokenizer st; \n \n public FastReader() \n { \n br = new BufferedReader(new\n InputStreamReader(System.in)); \n } \n \n String next() \n { \n while (st == null || !st.hasMoreElements()) \n { \n try\n { \n st = new StringTokenizer(br.readLine()); \n } \n catch (IOException e) \n { \n e.printStackTrace(); \n } \n } \n return st.nextToken(); \n } \n \n int nextInt() \n { \n return Integer.parseInt(next()); \n } \n \n long nextLong() \n { \n return Long.parseLong(next()); \n } \n \n double nextDouble() \n { \n return Double.parseDouble(next()); \n } \n \n String nextLine() \n { \n String str = \"\"; \n try\n { \n str = br.readLine(); \n } \n catch (IOException e) \n { \n e.printStackTrace(); \n } \n return str; \n } \n } \n \n}", "language": "Java", "metadata": {"date": 1598493362, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03161.html", "problem_id": "p03161", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03161/input.txt", "sample_output_relpath": "derived/input_output/data/p03161/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03161/Java/s948409078.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s948409078", "user_id": "u353919145"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\n\nclass Main {\n\n public static void main(String []args){\n FastReader sc = new FastReader();\n \n int n = sc.nextInt(), k = sc.nextInt();\n int [] heights = new int [n];\n for (int i = 0; i < n; i++) {\n heights[i] = sc.nextInt();\n }\n int [] dp = new int [n];\n \n for (int i = 1; i < n; i++) {\n dp[i] = dp[i - 1] + Math.abs(heights[i] - heights[i - 1]);\n for (int j = i - 2; j >= Math.max(0, i - k); j--) {\n dp[i] = Math.min(dp[i], dp[j] + Math.abs(heights[i] - heights[j]));\n }\n }\n \n System.out.println(dp[n - 1]);\n }\n \n static class FastReader \n { \n BufferedReader br; \n StringTokenizer st; \n \n public FastReader() \n { \n br = new BufferedReader(new\n InputStreamReader(System.in)); \n } \n \n String next() \n { \n while (st == null || !st.hasMoreElements()) \n { \n try\n { \n st = new StringTokenizer(br.readLine()); \n } \n catch (IOException e) \n { \n e.printStackTrace(); \n } \n } \n return st.nextToken(); \n } \n \n int nextInt() \n { \n return Integer.parseInt(next()); \n } \n \n long nextLong() \n { \n return Long.parseLong(next()); \n } \n \n double nextDouble() \n { \n return Double.parseDouble(next()); \n } \n \n String nextLine() \n { \n String str = \"\"; \n try\n { \n str = br.readLine(); \n } \n catch (IOException e) \n { \n e.printStackTrace(); \n } \n return str; \n } \n } \n \n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to one of the following: Stone i + 1, i + 2, \\ldots, i + K. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 100\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n5 3\n10 30 40 50 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 5, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n3 1\n10 20 10\n\nSample Output 2\n\n20\n\nIf we follow the path 1 → 2 → 3, the total cost incurred would be |10 - 20| + |20 - 10| = 20.\n\nSample Input 3\n\n2 100\n10 10\n\nSample Output 3\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 4\n\n10 4\n40 10 20 70 80 10 20 70 80 60\n\nSample Output 4\n\n40\n\nIf we follow the path 1 → 4 → 8 → 10, the total cost incurred would be |40 - 70| + |70 - 70| + |70 - 60| = 40.", "sample_input": "5 3\n10 30 40 50 20\n"}, "reference_outputs": ["30\n"], "source_document_id": "p03161", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to one of the following: Stone i + 1, i + 2, \\ldots, i + K. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 100\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n5 3\n10 30 40 50 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 5, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n3 1\n10 20 10\n\nSample Output 2\n\n20\n\nIf we follow the path 1 → 2 → 3, the total cost incurred would be |10 - 20| + |20 - 10| = 20.\n\nSample Input 3\n\n2 100\n10 10\n\nSample Output 3\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 4\n\n10 4\n40 10 20 70 80 10 20 70 80 60\n\nSample Output 4\n\n40\n\nIf we follow the path 1 → 4 → 8 → 10, the total cost incurred would be |40 - 70| + |70 - 70| + |70 - 60| = 40.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1953, "cpu_time_ms": 199, "memory_kb": 39400}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s715037524", "group_id": "codeNet:p03161", "input_text": "import java.util.*; \nimport java.io.*;\n\npublic class Main {\n\tstatic int n = 0 , k = 0; \n\tstatic int a[] = new int[(int) 1e5 + 7];\n\tstatic int dp[] = new int[(int) 1e5 + 7]; \n\tpublic static int fun(int ind) {\n\t\tif(ind == n-1) return 0; \n\t\t\n\t\tif(dp[ind] != -1) return dp[ind]; \n\t\t\n\t\telse {\n\t\t int max = (int) 1e5 + 7; \n\t\t\n\t\t for(int i = 1; i<=k; i++) {\n\t\t\t if(ind + i < n)\n\t\t\t max = Math.min(max, Math.abs(a[ind + i] - a[ind]) + fun(ind + i)); \n\t\t }\n\t\t return dp[ind] = max; \n\t\t}\n\t}\n\tpublic static void solve(InputReader in) {\n\t\tn = in.readInt(); \n\t\tk = in.readInt(); \n for(int i = 0; i 0) {\n\t\t\tsolve(in); \n\t\t}\n\t}\n}\n\nclass InputReader{\n\tprivate InputStream stream;\n\tprivate byte[] buf = new byte[1024];\n\tprivate int curChar;\n\tprivate int numChars;\n\tprivate SpaceCharFilter filter;\n\n\t public InputReader(InputStream stream) {\n\t\tthis.stream = stream;\n\t}\n\n public int read() {\n\t\tif (numChars == -1)\n\t\t\tthrow new InputMismatchException();\n\t\tif (curChar >= numChars) {\n\t\t\tcurChar = 0;\n\t\t\ttry {\n\t\t\t\tnumChars = stream.read(buf);\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new InputMismatchException();\n\t\t\t}\n\t\t\tif (numChars <= 0)\n\t\t\t\treturn -1;\n\t\t}\n\t\treturn buf[curChar++];\n\t}\n\n public int readInt() {\n\t\tint c = read();\n\t\twhile (isSpaceChar(c))\n\t\t\tc = read();\n\t\tint sgn = 1;\n\t\tif (c == '-') {\n\t\t\tsgn = -1;\n\t\t\tc = read();\n\t\t}\n\t\tint res = 0;\n\t\tdo {\n\t\t\tif (c < '0' || c > '9')\n\t\t\t\tthrow new InputMismatchException();\n\t\t\tres *= 10;\n\t\t\tres += c - '0';\n\t\t\tc = read();\n\t\t} while (!isSpaceChar(c));\n\t\treturn res * sgn;\n\t}\n\n public String readString() {\n\t\tint c = read();\n\t\twhile (isSpaceChar(c))\n\t\t\tc = read();\n\t\tStringBuilder res = new StringBuilder();\n\t\tdo {\n\t\t\tres.appendCodePoint(c);\n\t\t\tc = read();\n\t\t} while (!isSpaceChar(c));\n\t\treturn res.toString();\n\t}\n\n public long readLong() {\n\t\tint c = read();\n\t\twhile (isSpaceChar(c)) {\n\t\t\tc = read();\n\t\t}\n\t\tint sgn = 1;\n\t\tif (c == '-') {\n\t\t\tsgn = -1;\n\t\t\tc = read();\n\t\t}\n\t\tlong res = 0;\n\t\tdo {\n\t\t\tif (c < '0' || c > '9') {\n\t\t\t\tthrow new InputMismatchException();\n\t\t\t}\n\t\t\tres *= 10;\n\t\t\tres += c - '0';\n\t\t\tc = read();\n\t\t} while (!isSpaceChar(c));\n\t\treturn res * sgn;\n\t}\n\t\n public boolean isSpaceChar(int c) {\n\t\tif (filter != null)\n\t\t\treturn filter.isSpaceChar(c);\n\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t}\n \n public String next() {\n\t\treturn readString();\n\t}\n \n public interface SpaceCharFilter {\n\t\tpublic boolean isSpaceChar(int ch);\n\t}\n}\n", "language": "Java", "metadata": {"date": 1594932401, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p03161.html", "problem_id": "p03161", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03161/input.txt", "sample_output_relpath": "derived/input_output/data/p03161/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03161/Java/s715037524.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s715037524", "user_id": "u686751625"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "import java.util.*; \nimport java.io.*;\n\npublic class Main {\n\tstatic int n = 0 , k = 0; \n\tstatic int a[] = new int[(int) 1e5 + 7];\n\tstatic int dp[] = new int[(int) 1e5 + 7]; \n\tpublic static int fun(int ind) {\n\t\tif(ind == n-1) return 0; \n\t\t\n\t\tif(dp[ind] != -1) return dp[ind]; \n\t\t\n\t\telse {\n\t\t int max = (int) 1e5 + 7; \n\t\t\n\t\t for(int i = 1; i<=k; i++) {\n\t\t\t if(ind + i < n)\n\t\t\t max = Math.min(max, Math.abs(a[ind + i] - a[ind]) + fun(ind + i)); \n\t\t }\n\t\t return dp[ind] = max; \n\t\t}\n\t}\n\tpublic static void solve(InputReader in) {\n\t\tn = in.readInt(); \n\t\tk = in.readInt(); \n for(int i = 0; i 0) {\n\t\t\tsolve(in); \n\t\t}\n\t}\n}\n\nclass InputReader{\n\tprivate InputStream stream;\n\tprivate byte[] buf = new byte[1024];\n\tprivate int curChar;\n\tprivate int numChars;\n\tprivate SpaceCharFilter filter;\n\n\t public InputReader(InputStream stream) {\n\t\tthis.stream = stream;\n\t}\n\n public int read() {\n\t\tif (numChars == -1)\n\t\t\tthrow new InputMismatchException();\n\t\tif (curChar >= numChars) {\n\t\t\tcurChar = 0;\n\t\t\ttry {\n\t\t\t\tnumChars = stream.read(buf);\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new InputMismatchException();\n\t\t\t}\n\t\t\tif (numChars <= 0)\n\t\t\t\treturn -1;\n\t\t}\n\t\treturn buf[curChar++];\n\t}\n\n public int readInt() {\n\t\tint c = read();\n\t\twhile (isSpaceChar(c))\n\t\t\tc = read();\n\t\tint sgn = 1;\n\t\tif (c == '-') {\n\t\t\tsgn = -1;\n\t\t\tc = read();\n\t\t}\n\t\tint res = 0;\n\t\tdo {\n\t\t\tif (c < '0' || c > '9')\n\t\t\t\tthrow new InputMismatchException();\n\t\t\tres *= 10;\n\t\t\tres += c - '0';\n\t\t\tc = read();\n\t\t} while (!isSpaceChar(c));\n\t\treturn res * sgn;\n\t}\n\n public String readString() {\n\t\tint c = read();\n\t\twhile (isSpaceChar(c))\n\t\t\tc = read();\n\t\tStringBuilder res = new StringBuilder();\n\t\tdo {\n\t\t\tres.appendCodePoint(c);\n\t\t\tc = read();\n\t\t} while (!isSpaceChar(c));\n\t\treturn res.toString();\n\t}\n\n public long readLong() {\n\t\tint c = read();\n\t\twhile (isSpaceChar(c)) {\n\t\t\tc = read();\n\t\t}\n\t\tint sgn = 1;\n\t\tif (c == '-') {\n\t\t\tsgn = -1;\n\t\t\tc = read();\n\t\t}\n\t\tlong res = 0;\n\t\tdo {\n\t\t\tif (c < '0' || c > '9') {\n\t\t\t\tthrow new InputMismatchException();\n\t\t\t}\n\t\t\tres *= 10;\n\t\t\tres += c - '0';\n\t\t\tc = read();\n\t\t} while (!isSpaceChar(c));\n\t\treturn res * sgn;\n\t}\n\t\n public boolean isSpaceChar(int c) {\n\t\tif (filter != null)\n\t\t\treturn filter.isSpaceChar(c);\n\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t}\n \n public String next() {\n\t\treturn readString();\n\t}\n \n public interface SpaceCharFilter {\n\t\tpublic boolean isSpaceChar(int ch);\n\t}\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to one of the following: Stone i + 1, i + 2, \\ldots, i + K. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 100\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n5 3\n10 30 40 50 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 5, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n3 1\n10 20 10\n\nSample Output 2\n\n20\n\nIf we follow the path 1 → 2 → 3, the total cost incurred would be |10 - 20| + |20 - 10| = 20.\n\nSample Input 3\n\n2 100\n10 10\n\nSample Output 3\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 4\n\n10 4\n40 10 20 70 80 10 20 70 80 60\n\nSample Output 4\n\n40\n\nIf we follow the path 1 → 4 → 8 → 10, the total cost incurred would be |40 - 70| + |70 - 70| + |70 - 60| = 40.", "sample_input": "5 3\n10 30 40 50 20\n"}, "reference_outputs": ["30\n"], "source_document_id": "p03161", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to one of the following: Stone i + 1, i + 2, \\ldots, i + K. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 100\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n5 3\n10 30 40 50 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 5, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n3 1\n10 20 10\n\nSample Output 2\n\n20\n\nIf we follow the path 1 → 2 → 3, the total cost incurred would be |10 - 20| + |20 - 10| = 20.\n\nSample Input 3\n\n2 100\n10 10\n\nSample Output 3\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 4\n\n10 4\n40 10 20 70 80 10 20 70 80 60\n\nSample Output 4\n\n40\n\nIf we follow the path 1 → 4 → 8 → 10, the total cost incurred would be |40 - 70| + |70 - 70| + |70 - 60| = 40.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2723, "cpu_time_ms": 1484, "memory_kb": 37404}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s890352616", "group_id": "codeNet:p03161", "input_text": "import java.util.*;\npublic class Main{\npublic static void main(String args[]){\nScanner sc=new Scanner(System.in);\n int n=sc.nextInt();\n int k=sc.nextInt();\n int arr[]=new int[n];\n for(int i=0;i=1 ;j--){\n sto[i]=Math.min(sto[i],sto[j]+Math.abs(arr[i]-arr[j]));\n }\n }\n System.out.println(sto[n-1]);\n}\n\n\n}", "language": "Java", "metadata": {"date": 1590820289, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03161.html", "problem_id": "p03161", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03161/input.txt", "sample_output_relpath": "derived/input_output/data/p03161/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03161/Java/s890352616.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s890352616", "user_id": "u498752475"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "import java.util.*;\npublic class Main{\npublic static void main(String args[]){\nScanner sc=new Scanner(System.in);\n int n=sc.nextInt();\n int k=sc.nextInt();\n int arr[]=new int[n];\n for(int i=0;i=1 ;j--){\n sto[i]=Math.min(sto[i],sto[j]+Math.abs(arr[i]-arr[j]));\n }\n }\n System.out.println(sto[n-1]);\n}\n\n\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to one of the following: Stone i + 1, i + 2, \\ldots, i + K. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 100\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n5 3\n10 30 40 50 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 5, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n3 1\n10 20 10\n\nSample Output 2\n\n20\n\nIf we follow the path 1 → 2 → 3, the total cost incurred would be |10 - 20| + |20 - 10| = 20.\n\nSample Input 3\n\n2 100\n10 10\n\nSample Output 3\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 4\n\n10 4\n40 10 20 70 80 10 20 70 80 60\n\nSample Output 4\n\n40\n\nIf we follow the path 1 → 4 → 8 → 10, the total cost incurred would be |40 - 70| + |70 - 70| + |70 - 60| = 40.", "sample_input": "5 3\n10 30 40 50 20\n"}, "reference_outputs": ["30\n"], "source_document_id": "p03161", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to one of the following: Stone i + 1, i + 2, \\ldots, i + K. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 100\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n5 3\n10 30 40 50 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 5, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n3 1\n10 20 10\n\nSample Output 2\n\n20\n\nIf we follow the path 1 → 2 → 3, the total cost incurred would be |10 - 20| + |20 - 10| = 20.\n\nSample Input 3\n\n2 100\n10 10\n\nSample Output 3\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 4\n\n10 4\n40 10 20 70 80 10 20 70 80 60\n\nSample Output 4\n\n40\n\nIf we follow the path 1 → 4 → 8 → 10, the total cost incurred would be |40 - 70| + |70 - 70| + |70 - 60| = 40.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2109, "memory_kb": 52768}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s175873500", "group_id": "codeNet:p03161", "input_text": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int k = sc.nextInt();\n int[] h = new int[n];\n for (int i = 0; i < n; i++) {\n h[i] = sc.nextInt();\n }\n\n int[] dp = new int[n];\n for (int i = 0; i < n; i++) {\n dp[i] = Integer.MAX_VALUE;\n }\n\n dp[0] = 0;\n for (int i = 0; i < n; i++) {\n for (int j = 1; j <= k; j++) {\n int a = dp[i + j] + Math.abs(h[i] - h[i + j]);\n if (dp[i] > a) {\n dp[i] = a;\n }\n }\n }\n\n System.out.println(dp[n - 1]);\n }\n}\n", "language": "Java", "metadata": {"date": 1590768705, "filename_ext": "java", "original_language": "Java7 (OpenJDK 1.7.0)", "problem_description_relpath": "problem_descriptions/p03161.html", "problem_id": "p03161", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03161/input.txt", "sample_output_relpath": "derived/input_output/data/p03161/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03161/Java/s175873500.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s175873500", "user_id": "u278691874"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int k = sc.nextInt();\n int[] h = new int[n];\n for (int i = 0; i < n; i++) {\n h[i] = sc.nextInt();\n }\n\n int[] dp = new int[n];\n for (int i = 0; i < n; i++) {\n dp[i] = Integer.MAX_VALUE;\n }\n\n dp[0] = 0;\n for (int i = 0; i < n; i++) {\n for (int j = 1; j <= k; j++) {\n int a = dp[i + j] + Math.abs(h[i] - h[i + j]);\n if (dp[i] > a) {\n dp[i] = a;\n }\n }\n }\n\n System.out.println(dp[n - 1]);\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to one of the following: Stone i + 1, i + 2, \\ldots, i + K. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 100\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n5 3\n10 30 40 50 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 5, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n3 1\n10 20 10\n\nSample Output 2\n\n20\n\nIf we follow the path 1 → 2 → 3, the total cost incurred would be |10 - 20| + |20 - 10| = 20.\n\nSample Input 3\n\n2 100\n10 10\n\nSample Output 3\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 4\n\n10 4\n40 10 20 70 80 10 20 70 80 60\n\nSample Output 4\n\n40\n\nIf we follow the path 1 → 4 → 8 → 10, the total cost incurred would be |40 - 70| + |70 - 70| + |70 - 60| = 40.", "sample_input": "5 3\n10 30 40 50 20\n"}, "reference_outputs": ["30\n"], "source_document_id": "p03161", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to one of the following: Stone i + 1, i + 2, \\ldots, i + K. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 100\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n5 3\n10 30 40 50 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 5, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n3 1\n10 20 10\n\nSample Output 2\n\n20\n\nIf we follow the path 1 → 2 → 3, the total cost incurred would be |10 - 20| + |20 - 10| = 20.\n\nSample Input 3\n\n2 100\n10 10\n\nSample Output 3\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 4\n\n10 4\n40 10 20 70 80 10 20 70 80 60\n\nSample Output 4\n\n40\n\nIf we follow the path 1 → 4 → 8 → 10, the total cost incurred would be |40 - 70| + |70 - 70| + |70 - 60| = 40.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 756, "cpu_time_ms": 430, "memory_kb": 52016}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s068235671", "group_id": "codeNet:p03161", "input_text": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.PrintStream;\nimport java.io.PrintWriter;\nimport java.util.*;\n\n// import \nclass Main {\n\n\n static int min(int a,int b)\n {\n return Math.min(a, b);\n }\n\n static int abs(int a)\n {\n return Math.abs(a);\n }\n\n public static void main(String[] args) throws Exception {\n PrintWriter p = new PrintWriter(System.out);\n // Scanner sc = new Scanner(System.in);\n // int n = sc.nextInt();\n // sc.nextLine();\n BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n \n Object[] nk =Arrays.stream(bf.readLine().split(\" \")).map(Integer::parseInt).toArray();\n\n int n = (int)nk[0];\n int k = (int)nk[1];\n\n\n Integer arr[] = Arrays.stream(bf.readLine().split(\" \")).map(Integer::parseInt).toArray(Integer[]::new);\n \n int dp[] = new int[n+1];\n // int mod = 100000000+7;\n Arrays.fill(dp, Integer.MAX_VALUE); //fill large values in dp \n dp[0] = 0;\n for (int i = 0; i < n; i++) \n {\n for (int j = 1; j <= k; j++)\n {\n if(i+j< n) dp[i+j] = min(dp[i+j],dp[i]+abs(arr[i]-arr[i+j])); \n }\n }\n // System.out.println(Arrays.toString(dp));\n // System.out.println(dp[n-1]);\n p.println(dp[n-1]);\n p.flush();\n }\n}", "language": "Java", "metadata": {"date": 1588621781, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03161.html", "problem_id": "p03161", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03161/input.txt", "sample_output_relpath": "derived/input_output/data/p03161/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03161/Java/s068235671.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s068235671", "user_id": "u517762329"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.PrintStream;\nimport java.io.PrintWriter;\nimport java.util.*;\n\n// import \nclass Main {\n\n\n static int min(int a,int b)\n {\n return Math.min(a, b);\n }\n\n static int abs(int a)\n {\n return Math.abs(a);\n }\n\n public static void main(String[] args) throws Exception {\n PrintWriter p = new PrintWriter(System.out);\n // Scanner sc = new Scanner(System.in);\n // int n = sc.nextInt();\n // sc.nextLine();\n BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n \n Object[] nk =Arrays.stream(bf.readLine().split(\" \")).map(Integer::parseInt).toArray();\n\n int n = (int)nk[0];\n int k = (int)nk[1];\n\n\n Integer arr[] = Arrays.stream(bf.readLine().split(\" \")).map(Integer::parseInt).toArray(Integer[]::new);\n \n int dp[] = new int[n+1];\n // int mod = 100000000+7;\n Arrays.fill(dp, Integer.MAX_VALUE); //fill large values in dp \n dp[0] = 0;\n for (int i = 0; i < n; i++) \n {\n for (int j = 1; j <= k; j++)\n {\n if(i+j< n) dp[i+j] = min(dp[i+j],dp[i]+abs(arr[i]-arr[i+j])); \n }\n }\n // System.out.println(Arrays.toString(dp));\n // System.out.println(dp[n-1]);\n p.println(dp[n-1]);\n p.flush();\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to one of the following: Stone i + 1, i + 2, \\ldots, i + K. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 100\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n5 3\n10 30 40 50 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 5, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n3 1\n10 20 10\n\nSample Output 2\n\n20\n\nIf we follow the path 1 → 2 → 3, the total cost incurred would be |10 - 20| + |20 - 10| = 20.\n\nSample Input 3\n\n2 100\n10 10\n\nSample Output 3\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 4\n\n10 4\n40 10 20 70 80 10 20 70 80 60\n\nSample Output 4\n\n40\n\nIf we follow the path 1 → 4 → 8 → 10, the total cost incurred would be |40 - 70| + |70 - 70| + |70 - 60| = 40.", "sample_input": "5 3\n10 30 40 50 20\n"}, "reference_outputs": ["30\n"], "source_document_id": "p03161", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to one of the following: Stone i + 1, i + 2, \\ldots, i + K. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 100\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n5 3\n10 30 40 50 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 5, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n3 1\n10 20 10\n\nSample Output 2\n\n20\n\nIf we follow the path 1 → 2 → 3, the total cost incurred would be |10 - 20| + |20 - 10| = 20.\n\nSample Input 3\n\n2 100\n10 10\n\nSample Output 3\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 4\n\n10 4\n40 10 20 70 80 10 20 70 80 60\n\nSample Output 4\n\n40\n\nIf we follow the path 1 → 4 → 8 → 10, the total cost incurred would be |40 - 70| + |70 - 70| + |70 - 60| = 40.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1410, "cpu_time_ms": 326, "memory_kb": 49012}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s202659703", "group_id": "codeNet:p03161", "input_text": "\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\n void run() {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int k = sc.nextInt();\n int[] hArr = new int[n + 1000];\n for (int i = 0; i < n; i++) {\n hArr[i] = sc.nextInt();\n }\n\n int[] dp = new int[n + 1000];\n Arrays.fill(dp, Integer.MAX_VALUE);\n dp[0] = 0;\n for (int i = 0; i < n; i++) {\n for (int j = 1; j <= k; j++) {\n dp[i + j] = Math.min(dp[i + j], dp[i] + Math.abs(hArr[i] - hArr[i + j]));\n }\n }\n //debug(dp);\n System.out.println(dp[n - 1]);\n }\n\n\n void debug(Object... os) {\n System.err.println(Arrays.deepToString(os));\n }\n\n public static void main(String[] args) {\n new Main().run();\n }\n}\n", "language": "Java", "metadata": {"date": 1586292941, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03161.html", "problem_id": "p03161", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03161/input.txt", "sample_output_relpath": "derived/input_output/data/p03161/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03161/Java/s202659703.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s202659703", "user_id": "u149419355"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\n void run() {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int k = sc.nextInt();\n int[] hArr = new int[n + 1000];\n for (int i = 0; i < n; i++) {\n hArr[i] = sc.nextInt();\n }\n\n int[] dp = new int[n + 1000];\n Arrays.fill(dp, Integer.MAX_VALUE);\n dp[0] = 0;\n for (int i = 0; i < n; i++) {\n for (int j = 1; j <= k; j++) {\n dp[i + j] = Math.min(dp[i + j], dp[i] + Math.abs(hArr[i] - hArr[i + j]));\n }\n }\n //debug(dp);\n System.out.println(dp[n - 1]);\n }\n\n\n void debug(Object... os) {\n System.err.println(Arrays.deepToString(os));\n }\n\n public static void main(String[] args) {\n new Main().run();\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to one of the following: Stone i + 1, i + 2, \\ldots, i + K. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 100\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n5 3\n10 30 40 50 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 5, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n3 1\n10 20 10\n\nSample Output 2\n\n20\n\nIf we follow the path 1 → 2 → 3, the total cost incurred would be |10 - 20| + |20 - 10| = 20.\n\nSample Input 3\n\n2 100\n10 10\n\nSample Output 3\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 4\n\n10 4\n40 10 20 70 80 10 20 70 80 60\n\nSample Output 4\n\n40\n\nIf we follow the path 1 → 4 → 8 → 10, the total cost incurred would be |40 - 70| + |70 - 70| + |70 - 60| = 40.", "sample_input": "5 3\n10 30 40 50 20\n"}, "reference_outputs": ["30\n"], "source_document_id": "p03161", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to one of the following: Stone i + 1, i + 2, \\ldots, i + K. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 100\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n5 3\n10 30 40 50 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 5, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n3 1\n10 20 10\n\nSample Output 2\n\n20\n\nIf we follow the path 1 → 2 → 3, the total cost incurred would be |10 - 20| + |20 - 10| = 20.\n\nSample Input 3\n\n2 100\n10 10\n\nSample Output 3\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 4\n\n10 4\n40 10 20 70 80 10 20 70 80 60\n\nSample Output 4\n\n40\n\nIf we follow the path 1 → 4 → 8 → 10, the total cost incurred would be |40 - 70| + |70 - 70| + |70 - 60| = 40.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 855, "cpu_time_ms": 471, "memory_kb": 50480}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s980581257", "group_id": "codeNet:p03161", "input_text": "import java.util.*;\nimport java.io.*;\nimport java.math.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int k = sc.nextInt();\n int[] nums = new int[n];\n int[] dp = new int[n];\n for (int i = 0; i < n; i++) {\n nums[i] = sc.nextInt();\n }\n Arrays.fill(dp, 1000000);\n dp[0] = 0;\n for (int i = 1; i < n; i++) {\n for (int j = 1; j <= k; j++) {\n if (i >= j) {\n dp[i] = Math.min(dp[i], dp[i - j] + Math.abs(nums[i] - nums[i - j]));\n }\n }\n }\n System.out.println(dp[n - 1]);\n }\n}", "language": "Java", "metadata": {"date": 1578083150, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03161.html", "problem_id": "p03161", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03161/input.txt", "sample_output_relpath": "derived/input_output/data/p03161/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03161/Java/s980581257.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s980581257", "user_id": "u233586402"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\nimport java.math.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int k = sc.nextInt();\n int[] nums = new int[n];\n int[] dp = new int[n];\n for (int i = 0; i < n; i++) {\n nums[i] = sc.nextInt();\n }\n Arrays.fill(dp, 1000000);\n dp[0] = 0;\n for (int i = 1; i < n; i++) {\n for (int j = 1; j <= k; j++) {\n if (i >= j) {\n dp[i] = Math.min(dp[i], dp[i - j] + Math.abs(nums[i] - nums[i - j]));\n }\n }\n }\n System.out.println(dp[n - 1]);\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to one of the following: Stone i + 1, i + 2, \\ldots, i + K. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 100\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n5 3\n10 30 40 50 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 5, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n3 1\n10 20 10\n\nSample Output 2\n\n20\n\nIf we follow the path 1 → 2 → 3, the total cost incurred would be |10 - 20| + |20 - 10| = 20.\n\nSample Input 3\n\n2 100\n10 10\n\nSample Output 3\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 4\n\n10 4\n40 10 20 70 80 10 20 70 80 60\n\nSample Output 4\n\n40\n\nIf we follow the path 1 → 4 → 8 → 10, the total cost incurred would be |40 - 70| + |70 - 70| + |70 - 60| = 40.", "sample_input": "5 3\n10 30 40 50 20\n"}, "reference_outputs": ["30\n"], "source_document_id": "p03161", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to one of the following: Stone i + 1, i + 2, \\ldots, i + K. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 100\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n5 3\n10 30 40 50 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 5, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n3 1\n10 20 10\n\nSample Output 2\n\n20\n\nIf we follow the path 1 → 2 → 3, the total cost incurred would be |10 - 20| + |20 - 10| = 20.\n\nSample Input 3\n\n2 100\n10 10\n\nSample Output 3\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 4\n\n10 4\n40 10 20 70 80 10 20 70 80 60\n\nSample Output 4\n\n40\n\nIf we follow the path 1 → 4 → 8 → 10, the total cost incurred would be |40 - 70| + |70 - 70| + |70 - 60| = 40.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 623, "cpu_time_ms": 507, "memory_kb": 59320}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s545116386", "group_id": "codeNet:p03161", "input_text": "import java.util.*;\nimport java.io.*;\nimport java.math.BigInteger;\n \npublic class Main {\n\tstatic PrintWriter out;\n\tstatic StringBuilder sb;\n\tstatic final double EPS = 1e-9;\n\tstatic long mod = (int) 1e9 + 7;\n\tstatic int inf = (int) 1e9 + 2;\n\tstatic long[] fac;\n\tstatic int[] si;\n\tstatic ArrayList primes;\n\tstatic ArrayList[] ad;\n\tstatic ArrayList[] d;\n\tstatic edge[] ed;\n\tstatic boolean []vis;\n\tstatic int[] l, ch;\n\tstatic int[] occ;\n\tstatic Queue[] can;\n\tstatic String s;\n\tstatic int n,m;\n\tstatic long []memo;\n\tpublic static void main(String[] args) throws Exception {\n\t\tScanner sc = new Scanner(System.in);\n\t\tout = new PrintWriter(System.out);\n\t n=sc.nextInt();\n\t int k=sc.nextInt();\n\t memo=new long [n];\n\t long []a=new long [n];\n\t for(int i=0;i=0;i--) {\n\t \tfor(int j=1;j<=k;j++) {\n\t \t\tif(i+j>n-1)\n\t \t\t\tbreak;\n\t \t\tmemo[i]=Math.min(memo[i], memo[j+i]+Math.abs(a[i]-a[j+i]));\n\t \t}\n\t }\n\t out.print(memo[0]);\n\t\tout.flush();\n\t}\n\tstatic long inver(long x,long kk) {\n\t\tint a = (int) x;\n\t\tlong e = (kk - 2);\n\t\tlong res = 1;\n\t\twhile (e > 0) {\n\t\t\tif ((e & 1) == 1) {\n\t\t\t\t// System.out.println(res*a);\n\t\t\t\tres = (int) ((1l * res * a) % kk);\n\t\t\t}\n\t\t\ta = (int) ((1l * a * a) % kk);\n\t\t\te >>= 1;\n\t\t}\n\t\t// out.println(res+\" \"+x);\n\t\treturn res % kk;\n\t}\n \n\tstatic TreeSet trr;\n\n\tstatic class qu implements Comparable{\n\t\tint i,j;\n\t\tqu(int a, int s) {\n\t\t\ti=a;\n\t\t\tj=s;\n\t\t}\n public String toString() {\n \t return i+\" \"+j;\n }\n public int compareTo(qu o) {\n \t if(i==o.i)\n \t\t return j-o.j;\n \t return i-o.i;\n }\n\t}\n \n\tstatic class pair {\n\t\tint to;\n\t\tint number;\n \n\t\tpair(int t, int n) {\n\t\t\tnumber = n;\n\t\t\tto = t;\n\t\t}\n \n\t\tpublic String toString() {\n\t\t\treturn to + \" \" + number;\n\t\t}\n\t}\n \n\tstatic double modPow(double a, int e)\n \n\t{\n\t\tdouble res = 1;\n\t\twhile (e > 0) {\n\t\t\tif ((e & 1) == 1)\n\t\t\t\tres = (res * a);\n\t\t\ta = (a * a);\n\t\t\te >>= 1;\n\t\t}\n\t\treturn res;\n\t}\n \n\tstatic boolean[] in;\n \n\t/*\n\t * static void mst() { Arrays.sort(ed); UnionFind uf=new UnionFind(n); for(int\n\t * i=0;i {\n\t\tint from;\n\t\tint to;\n\t\tint number;\n \n\t\tedge(int f, int t, int n) {\n\t\t\tfrom = f;\n\t\t\tto = t;\n\t\t\tnumber = n;\n\t\t}\n \n\t\tpublic String toString() {\n\t\t\treturn from + \" \" + to + \" \" + number;\n\t\t}\n \n\t\tpublic int compareTo(edge f) {\n\t\t\treturn number - f.number;\n\t\t}\n\t}\n \n\tstatic class seg implements Comparable {\n\t\tint a;\n\t\tint b;\n \n\t\tseg(int s, int e) {\n\t\t\ta = s;\n\t\t\tb = e;\n\t\t}\n \n\t\tpublic String toString() {\n\t\t\treturn a + \" \" + b;\n\t\t}\n \n\t\tpublic int compareTo(seg o) {\n\t\t\t// if(a==o.a)\n\t\t\treturn o.b - b;\n\t\t\t// return\n\t\t}\n\t}\n \n\tstatic long power(int i) {\n\t\t// if(i==0)\n\t\t// return 1;\n\t\tlong a = 1;\n\t\tfor (int k = 0; k < i; k++)\n\t\t\ta *= i;\n\t\treturn a;\n\t}\n \n\tstatic void seive(int N) {\n\t\tsi = new int[N];\n\t\tprimes = new ArrayList<>();\n\t\tsi[1] = 1;\n\t\tfor (int i = 2; i < N; i++) {\n\t\t\tif (si[i] == 0) {\n\t\t\t\tsi[i] = i;\n\t\t\t\tprimes.add(i);\n\t\t\t}\n\t\t\tfor (int j = 0; j < primes.size() && primes.get(j) <= si[i] && (i * primes.get(j)) < N; j++)\n\t\t\t\tsi[primes.get(j) * i] = primes.get(j);\n \n\t\t}\n\t}\n\tstatic long fac(int n) {\n\t\tif (n == 0)\n\t\t\treturn fac[n] = 1;\n\t\tif (n == 1)\n\t\t\treturn fac[n] = 1;\n\t\tlong ans = 1;\n\t\tfor (int i = 1; i <= n; i++)\n\t\t\tfac[i] = ans = (i % mod * ans % mod) % mod;\n\t\treturn ans % mod;\n\t}\n \n\tstatic long gcd(long a, long b) {\n \n\t\tif (b == 0)\n\t\t\treturn a;\n\t\treturn gcd(b, a % b);\n\t}\n \n\tstatic class unionfind {\n\t\tint[] p;\n\t\tint[] size;\n \n\t\tunionfind(int n) {\n\t\t\tp = new int[n];\n\t\t\tsize = new int[n];\n \n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tp[i] = i;\n\t\t\t}\n\t\t\tArrays.fill(size, 1);\n\t\t}\n \n\t\tint findSet(int v) {\n\t\t\tif (v == p[v])\n\t\t\t\treturn v;\n\t\t\treturn p[v] = findSet(p[v]);\n\t\t}\n \n\t\tboolean sameSet(int a, int b) {\n\t\t\ta = findSet(a);\n\t\t\tb = findSet(b);\n\t\t\tif (a == b)\n\t\t\t\treturn true;\n\t\t\treturn false;\n\t\t}\n \n\t\tint max() {\n\t\t\tint max = 0;\n\t\t\tfor (int i = 0; i < size.length; i++)\n\t\t\t\tif (size[i] > max)\n\t\t\t\t\tmax = size[i];\n\t\t\treturn max;\n\t\t}\n \n\t\tboolean combine(int a, int b) {\n\t\t\ta = findSet(a);\n\t\t\tb = findSet(b);\n\t\t\tif (a == b)\n\t\t\t\treturn true;\n\t\t\tif (size[a] > size[b]) {\n\t\t\t\tp[b] = a;\n\t\t\t\tsize[a] += size[b];\n \n\t\t\t} else {\n\t\t\t\tp[a] = b;\n\t\t\t\tsize[b] += size[a];\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t}\n \n\tstatic class Scanner {\n\t\tStringTokenizer st;\n\t\tBufferedReader br;\n \n\t\tpublic Scanner(InputStream system) {\n\t\t\tbr = new BufferedReader(new InputStreamReader(system));\n\t\t}\n \n\t\tpublic Scanner(String file) throws Exception {\n\t\t\tbr = new BufferedReader(new FileReader(file));\n\t\t}\n \n\t\tpublic String next() throws IOException {\n\t\t\twhile (st == null || !st.hasMoreTokens())\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\treturn st.nextToken();\n\t\t}\n \n\t\tpublic String nextLine() throws IOException {\n\t\t\treturn br.readLine();\n\t\t}\n \n\t\tpublic int nextInt() throws IOException {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n \n\t\tpublic double nextDouble() throws IOException {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n \n\t\tpublic char nextChar() throws IOException {\n\t\t\treturn next().charAt(0);\n\t\t}\n \n\t\tpublic Long nextLong() throws IOException {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n \n\t\tpublic boolean ready() throws IOException {\n\t\t\treturn br.ready();\n\t\t}\n \n\t\tpublic void waitForInput() throws InterruptedException {\n\t\t\tThread.sleep(3000);\n\t\t}\n\t}\n}", "language": "Java", "metadata": {"date": 1572367113, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03161.html", "problem_id": "p03161", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03161/input.txt", "sample_output_relpath": "derived/input_output/data/p03161/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03161/Java/s545116386.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s545116386", "user_id": "u217252547"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\nimport java.math.BigInteger;\n \npublic class Main {\n\tstatic PrintWriter out;\n\tstatic StringBuilder sb;\n\tstatic final double EPS = 1e-9;\n\tstatic long mod = (int) 1e9 + 7;\n\tstatic int inf = (int) 1e9 + 2;\n\tstatic long[] fac;\n\tstatic int[] si;\n\tstatic ArrayList primes;\n\tstatic ArrayList[] ad;\n\tstatic ArrayList[] d;\n\tstatic edge[] ed;\n\tstatic boolean []vis;\n\tstatic int[] l, ch;\n\tstatic int[] occ;\n\tstatic Queue[] can;\n\tstatic String s;\n\tstatic int n,m;\n\tstatic long []memo;\n\tpublic static void main(String[] args) throws Exception {\n\t\tScanner sc = new Scanner(System.in);\n\t\tout = new PrintWriter(System.out);\n\t n=sc.nextInt();\n\t int k=sc.nextInt();\n\t memo=new long [n];\n\t long []a=new long [n];\n\t for(int i=0;i=0;i--) {\n\t \tfor(int j=1;j<=k;j++) {\n\t \t\tif(i+j>n-1)\n\t \t\t\tbreak;\n\t \t\tmemo[i]=Math.min(memo[i], memo[j+i]+Math.abs(a[i]-a[j+i]));\n\t \t}\n\t }\n\t out.print(memo[0]);\n\t\tout.flush();\n\t}\n\tstatic long inver(long x,long kk) {\n\t\tint a = (int) x;\n\t\tlong e = (kk - 2);\n\t\tlong res = 1;\n\t\twhile (e > 0) {\n\t\t\tif ((e & 1) == 1) {\n\t\t\t\t// System.out.println(res*a);\n\t\t\t\tres = (int) ((1l * res * a) % kk);\n\t\t\t}\n\t\t\ta = (int) ((1l * a * a) % kk);\n\t\t\te >>= 1;\n\t\t}\n\t\t// out.println(res+\" \"+x);\n\t\treturn res % kk;\n\t}\n \n\tstatic TreeSet trr;\n\n\tstatic class qu implements Comparable{\n\t\tint i,j;\n\t\tqu(int a, int s) {\n\t\t\ti=a;\n\t\t\tj=s;\n\t\t}\n public String toString() {\n \t return i+\" \"+j;\n }\n public int compareTo(qu o) {\n \t if(i==o.i)\n \t\t return j-o.j;\n \t return i-o.i;\n }\n\t}\n \n\tstatic class pair {\n\t\tint to;\n\t\tint number;\n \n\t\tpair(int t, int n) {\n\t\t\tnumber = n;\n\t\t\tto = t;\n\t\t}\n \n\t\tpublic String toString() {\n\t\t\treturn to + \" \" + number;\n\t\t}\n\t}\n \n\tstatic double modPow(double a, int e)\n \n\t{\n\t\tdouble res = 1;\n\t\twhile (e > 0) {\n\t\t\tif ((e & 1) == 1)\n\t\t\t\tres = (res * a);\n\t\t\ta = (a * a);\n\t\t\te >>= 1;\n\t\t}\n\t\treturn res;\n\t}\n \n\tstatic boolean[] in;\n \n\t/*\n\t * static void mst() { Arrays.sort(ed); UnionFind uf=new UnionFind(n); for(int\n\t * i=0;i {\n\t\tint from;\n\t\tint to;\n\t\tint number;\n \n\t\tedge(int f, int t, int n) {\n\t\t\tfrom = f;\n\t\t\tto = t;\n\t\t\tnumber = n;\n\t\t}\n \n\t\tpublic String toString() {\n\t\t\treturn from + \" \" + to + \" \" + number;\n\t\t}\n \n\t\tpublic int compareTo(edge f) {\n\t\t\treturn number - f.number;\n\t\t}\n\t}\n \n\tstatic class seg implements Comparable {\n\t\tint a;\n\t\tint b;\n \n\t\tseg(int s, int e) {\n\t\t\ta = s;\n\t\t\tb = e;\n\t\t}\n \n\t\tpublic String toString() {\n\t\t\treturn a + \" \" + b;\n\t\t}\n \n\t\tpublic int compareTo(seg o) {\n\t\t\t// if(a==o.a)\n\t\t\treturn o.b - b;\n\t\t\t// return\n\t\t}\n\t}\n \n\tstatic long power(int i) {\n\t\t// if(i==0)\n\t\t// return 1;\n\t\tlong a = 1;\n\t\tfor (int k = 0; k < i; k++)\n\t\t\ta *= i;\n\t\treturn a;\n\t}\n \n\tstatic void seive(int N) {\n\t\tsi = new int[N];\n\t\tprimes = new ArrayList<>();\n\t\tsi[1] = 1;\n\t\tfor (int i = 2; i < N; i++) {\n\t\t\tif (si[i] == 0) {\n\t\t\t\tsi[i] = i;\n\t\t\t\tprimes.add(i);\n\t\t\t}\n\t\t\tfor (int j = 0; j < primes.size() && primes.get(j) <= si[i] && (i * primes.get(j)) < N; j++)\n\t\t\t\tsi[primes.get(j) * i] = primes.get(j);\n \n\t\t}\n\t}\n\tstatic long fac(int n) {\n\t\tif (n == 0)\n\t\t\treturn fac[n] = 1;\n\t\tif (n == 1)\n\t\t\treturn fac[n] = 1;\n\t\tlong ans = 1;\n\t\tfor (int i = 1; i <= n; i++)\n\t\t\tfac[i] = ans = (i % mod * ans % mod) % mod;\n\t\treturn ans % mod;\n\t}\n \n\tstatic long gcd(long a, long b) {\n \n\t\tif (b == 0)\n\t\t\treturn a;\n\t\treturn gcd(b, a % b);\n\t}\n \n\tstatic class unionfind {\n\t\tint[] p;\n\t\tint[] size;\n \n\t\tunionfind(int n) {\n\t\t\tp = new int[n];\n\t\t\tsize = new int[n];\n \n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tp[i] = i;\n\t\t\t}\n\t\t\tArrays.fill(size, 1);\n\t\t}\n \n\t\tint findSet(int v) {\n\t\t\tif (v == p[v])\n\t\t\t\treturn v;\n\t\t\treturn p[v] = findSet(p[v]);\n\t\t}\n \n\t\tboolean sameSet(int a, int b) {\n\t\t\ta = findSet(a);\n\t\t\tb = findSet(b);\n\t\t\tif (a == b)\n\t\t\t\treturn true;\n\t\t\treturn false;\n\t\t}\n \n\t\tint max() {\n\t\t\tint max = 0;\n\t\t\tfor (int i = 0; i < size.length; i++)\n\t\t\t\tif (size[i] > max)\n\t\t\t\t\tmax = size[i];\n\t\t\treturn max;\n\t\t}\n \n\t\tboolean combine(int a, int b) {\n\t\t\ta = findSet(a);\n\t\t\tb = findSet(b);\n\t\t\tif (a == b)\n\t\t\t\treturn true;\n\t\t\tif (size[a] > size[b]) {\n\t\t\t\tp[b] = a;\n\t\t\t\tsize[a] += size[b];\n \n\t\t\t} else {\n\t\t\t\tp[a] = b;\n\t\t\t\tsize[b] += size[a];\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t}\n \n\tstatic class Scanner {\n\t\tStringTokenizer st;\n\t\tBufferedReader br;\n \n\t\tpublic Scanner(InputStream system) {\n\t\t\tbr = new BufferedReader(new InputStreamReader(system));\n\t\t}\n \n\t\tpublic Scanner(String file) throws Exception {\n\t\t\tbr = new BufferedReader(new FileReader(file));\n\t\t}\n \n\t\tpublic String next() throws IOException {\n\t\t\twhile (st == null || !st.hasMoreTokens())\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\treturn st.nextToken();\n\t\t}\n \n\t\tpublic String nextLine() throws IOException {\n\t\t\treturn br.readLine();\n\t\t}\n \n\t\tpublic int nextInt() throws IOException {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n \n\t\tpublic double nextDouble() throws IOException {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n \n\t\tpublic char nextChar() throws IOException {\n\t\t\treturn next().charAt(0);\n\t\t}\n \n\t\tpublic Long nextLong() throws IOException {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n \n\t\tpublic boolean ready() throws IOException {\n\t\t\treturn br.ready();\n\t\t}\n \n\t\tpublic void waitForInput() throws InterruptedException {\n\t\t\tThread.sleep(3000);\n\t\t}\n\t}\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to one of the following: Stone i + 1, i + 2, \\ldots, i + K. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 100\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n5 3\n10 30 40 50 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 5, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n3 1\n10 20 10\n\nSample Output 2\n\n20\n\nIf we follow the path 1 → 2 → 3, the total cost incurred would be |10 - 20| + |20 - 10| = 20.\n\nSample Input 3\n\n2 100\n10 10\n\nSample Output 3\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 4\n\n10 4\n40 10 20 70 80 10 20 70 80 60\n\nSample Output 4\n\n40\n\nIf we follow the path 1 → 4 → 8 → 10, the total cost incurred would be |40 - 70| + |70 - 70| + |70 - 60| = 40.", "sample_input": "5 3\n10 30 40 50 20\n"}, "reference_outputs": ["30\n"], "source_document_id": "p03161", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to one of the following: Stone i + 1, i + 2, \\ldots, i + K. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 100\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n5 3\n10 30 40 50 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 5, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n3 1\n10 20 10\n\nSample Output 2\n\n20\n\nIf we follow the path 1 → 2 → 3, the total cost incurred would be |10 - 20| + |20 - 10| = 20.\n\nSample Input 3\n\n2 100\n10 10\n\nSample Output 3\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 4\n\n10 4\n40 10 20 70 80 10 20 70 80 60\n\nSample Output 4\n\n40\n\nIf we follow the path 1 → 4 → 8 → 10, the total cost incurred would be |40 - 70| + |70 - 70| + |70 - 60| = 40.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 5462, "cpu_time_ms": 216, "memory_kb": 37428}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s953739863", "group_id": "codeNet:p03161", "input_text": "import java.util.*;\n\nclass Main {\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = in.nextInt();\n\t\tint k = in.nextInt();\n\t\tint[] a = new int[n];\n\t\tint[] h = new int[n];\n\t\tfor(int i=0;i=97 && n<=122;\n }\n public static void main(String[] args) throws IOException {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n InputReader.OutputWriter out = new InputReader.OutputWriter(outputStream);\n\n int n = in.nextInt();\n int k = in.nextInt();\n int [] a = new int[n];\n for(int i=0;i map = new TreeMap<>(Comparator.reverseOrder());\n for(int n:a) {\n map.put(n,map.getOrDefault(n,0)+1);\n }\n for(Map.Entry m:map.entrySet()) {\n if(m.getValue()%2==1) return \"Conan\";\n }\n return \"Agasa\";\n }\n\n\n private static int [] prefixSum(int [] a) {\n int [] prefix = new int[a.length+1];\n for(int i=1;i < prefix.length;i++) {\n prefix[i] = prefix[i-1] + a[i-1];\n }\n return prefix;\n }\n private static int [] charFrequency(String a) {\n int [] freq = new int[26];\n char [] cc = a.toCharArray();\n for(char c : cc) {\n freq[c-'a']++;\n }\n return freq;\n }\n}\n\nclass InputReader extends BufferedReader {\n StringTokenizer tokenizer;\n\n public InputReader(InputStream inputStream) {\n super(new InputStreamReader(inputStream), 32768);\n }\n\n public InputReader(String filename) {\n super(new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream(filename)));\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(readLine());\n } catch (IOException e) {\n throw new RuntimeException();\n }\n }\n return tokenizer.nextToken();\n }\n\n public Integer nextInt() {\n return Integer.valueOf(next());\n }\n public Long nextLong() {return Long.valueOf(next());}\n\n static class OutputWriter extends PrintWriter {\n public OutputWriter(OutputStream outputStream) {\n super(outputStream);\n }\n\n public OutputWriter(Writer writer) {\n super(writer);\n }\n\n public OutputWriter(String filename) throws FileNotFoundException {\n super(filename);\n }\n\n public void close() {\n super.close();\n }\n }\n}\n\n\n", "language": "Java", "metadata": {"date": 1551041057, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03161.html", "problem_id": "p03161", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03161/input.txt", "sample_output_relpath": "derived/input_output/data/p03161/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03161/Java/s979092917.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s979092917", "user_id": "u156092528"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "import java.io.*;\nimport java.math.BigInteger;\nimport java.util.*;\n\npublic class Main {\n static BigInteger[] dp = new BigInteger[10000];\n\n static BigInteger fib(int n) {\n n -= 1;\n if (n <= 1) return BigInteger.ONE;\n if (dp[n] != null) return dp[n];\n dp[0] = BigInteger.ONE;\n dp[1] = BigInteger.ONE;\n dp[n] = dp[n-1].add(dp[n-2]);\n return dp[n];\n }\n static long solve(int n) {\n if(n<=2) return n*2;\n long [] dp = new long[n];\n dp[0] = 2;\n dp[1] = 4;\n dp[2] = 7;\n int numberOfWhite = 1;\n for (int i = 3; i < n; i++) {\n dp[i] = (dp[i-1]-numberOfWhite)*2 + 1;\n numberOfWhite*=2;\n }\n return dp[n-1];\n }\n private static int convert(int first, int second) {\n int k = 1;\n int equation = second-first+k*26;\n while(equation<97) {\n k++;\n equation = second-first+k*26;\n }\n return equation;\n }\n private static boolean check(int n) {\n return n>=97 && n<=122;\n }\n public static void main(String[] args) throws IOException {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n InputReader.OutputWriter out = new InputReader.OutputWriter(outputStream);\n\n int n = in.nextInt();\n int k = in.nextInt();\n int [] a = new int[n];\n for(int i=0;i map = new TreeMap<>(Comparator.reverseOrder());\n for(int n:a) {\n map.put(n,map.getOrDefault(n,0)+1);\n }\n for(Map.Entry m:map.entrySet()) {\n if(m.getValue()%2==1) return \"Conan\";\n }\n return \"Agasa\";\n }\n\n\n private static int [] prefixSum(int [] a) {\n int [] prefix = new int[a.length+1];\n for(int i=1;i < prefix.length;i++) {\n prefix[i] = prefix[i-1] + a[i-1];\n }\n return prefix;\n }\n private static int [] charFrequency(String a) {\n int [] freq = new int[26];\n char [] cc = a.toCharArray();\n for(char c : cc) {\n freq[c-'a']++;\n }\n return freq;\n }\n}\n\nclass InputReader extends BufferedReader {\n StringTokenizer tokenizer;\n\n public InputReader(InputStream inputStream) {\n super(new InputStreamReader(inputStream), 32768);\n }\n\n public InputReader(String filename) {\n super(new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream(filename)));\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(readLine());\n } catch (IOException e) {\n throw new RuntimeException();\n }\n }\n return tokenizer.nextToken();\n }\n\n public Integer nextInt() {\n return Integer.valueOf(next());\n }\n public Long nextLong() {return Long.valueOf(next());}\n\n static class OutputWriter extends PrintWriter {\n public OutputWriter(OutputStream outputStream) {\n super(outputStream);\n }\n\n public OutputWriter(Writer writer) {\n super(writer);\n }\n\n public OutputWriter(String filename) throws FileNotFoundException {\n super(filename);\n }\n\n public void close() {\n super.close();\n }\n }\n}\n\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to one of the following: Stone i + 1, i + 2, \\ldots, i + K. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 100\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n5 3\n10 30 40 50 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 5, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n3 1\n10 20 10\n\nSample Output 2\n\n20\n\nIf we follow the path 1 → 2 → 3, the total cost incurred would be |10 - 20| + |20 - 10| = 20.\n\nSample Input 3\n\n2 100\n10 10\n\nSample Output 3\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 4\n\n10 4\n40 10 20 70 80 10 20 70 80 60\n\nSample Output 4\n\n40\n\nIf we follow the path 1 → 4 → 8 → 10, the total cost incurred would be |40 - 70| + |70 - 70| + |70 - 60| = 40.", "sample_input": "5 3\n10 30 40 50 20\n"}, "reference_outputs": ["30\n"], "source_document_id": "p03161", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to one of the following: Stone i + 1, i + 2, \\ldots, i + K. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 100\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n5 3\n10 30 40 50 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 5, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n3 1\n10 20 10\n\nSample Output 2\n\n20\n\nIf we follow the path 1 → 2 → 3, the total cost incurred would be |10 - 20| + |20 - 10| = 20.\n\nSample Input 3\n\n2 100\n10 10\n\nSample Output 3\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 4\n\n10 4\n40 10 20 70 80 10 20 70 80 60\n\nSample Output 4\n\n40\n\nIf we follow the path 1 → 4 → 8 → 10, the total cost incurred would be |40 - 70| + |70 - 70| + |70 - 60| = 40.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 5088, "cpu_time_ms": 209, "memory_kb": 35980}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s489603991", "group_id": "codeNet:p03161", "input_text": "\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\t//\t\tnew Main().dPA();\n\t\tnew Main().dPA2();\n\n\t}\n\n\tprivate void dPA() {\n\t\tScanner scanner = null;\n\t\tint numFrog = 0;\n\n\t\ttry {\n\t\t\tscanner = new Scanner(System.in);\n\t\t\tnumFrog = scanner.nextInt();\n\t\t\tint[] heightArray = new int[numFrog];\n\n\t\t\tfor (int i = 0; i < numFrog; i++) {\n\t\t\t\theightArray[i] = scanner.nextInt();\n\t\t\t}\n\n\t\t\tint[] koufukuArray = new int[numFrog];\n\t\t\tfor (int i = 0; i < heightArray.length; i++) {\n\t\t\t\tif (i != 0 && i != 1) {\n\t\t\t\t\tint val1 = Math.abs(heightArray[i] - heightArray[i - 1]);\n\t\t\t\t\tint val2 = Math.abs(heightArray[i] - heightArray[i - 2]);\n\t\t\t\t\tkoufukuArray[i] = Math.min(koufukuArray[i - 1] + val1, koufukuArray[i - 2] + val2);\n\t\t\t\t} else if (i == 0) {\n\t\t\t\t\tkoufukuArray[i] = 0;\n\t\t\t\t} else if (i == 1) {\n\t\t\t\t\tkoufukuArray[i] = koufukuArray[i - 1] + Math.abs(heightArray[i] - heightArray[i - 1]);\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tSystem.out.println(koufukuArray[koufukuArray.length - 1]);\n\n\t\t} finally {\n\t\t\tif (scanner != null) {\n\t\t\t\tscanner.close();\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate void dPA2() {\n\t\tScanner scanner = null;\n\t\tint numFrog = 0;\n\t\tint jump = 2;\n\n\t\ttry {\n\t\t\tscanner = new Scanner(System.in);\n\t\t\tnumFrog = scanner.nextInt();\n\t\t\tint[] heightArray = new int[numFrog];\n\n\t\t\tfor (int i = 0; i < numFrog; i++) {\n\t\t\t\theightArray[i] = scanner.nextInt();\n\t\t\t}\n\n\t\t\tint[] cost = new int[numFrog];\n\t\t\tArrays.fill(cost, Integer.MAX_VALUE);\n\n\t\t\tcost[0] = 0;\n\n\t\t\tfor (int i = 0; i < heightArray.length; i++) {\n\n\t\t\t\tfor (int j = 1; j <= jump; j++) {\n\t\t\t\t\tif (i + j < heightArray.length) {\n\t\t\t\t\t\tcost[i + j] = Math.min(cost[i + j], Math.abs(heightArray[i + j] - heightArray[i]) + cost[i]);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tSystem.out.println(cost[cost.length - 1]);\n\t\t} finally {\n\t\t\tif (scanner != null) {\n\t\t\t\tscanner.close();\n\t\t\t}\n\t\t}\n\t}\n}", "language": "Java", "metadata": {"date": 1550666949, "filename_ext": "java", "original_language": "Java7 (OpenJDK 1.7.0)", "problem_description_relpath": "problem_descriptions/p03161.html", "problem_id": "p03161", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03161/input.txt", "sample_output_relpath": "derived/input_output/data/p03161/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03161/Java/s489603991.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s489603991", "user_id": "u345932819"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\t//\t\tnew Main().dPA();\n\t\tnew Main().dPA2();\n\n\t}\n\n\tprivate void dPA() {\n\t\tScanner scanner = null;\n\t\tint numFrog = 0;\n\n\t\ttry {\n\t\t\tscanner = new Scanner(System.in);\n\t\t\tnumFrog = scanner.nextInt();\n\t\t\tint[] heightArray = new int[numFrog];\n\n\t\t\tfor (int i = 0; i < numFrog; i++) {\n\t\t\t\theightArray[i] = scanner.nextInt();\n\t\t\t}\n\n\t\t\tint[] koufukuArray = new int[numFrog];\n\t\t\tfor (int i = 0; i < heightArray.length; i++) {\n\t\t\t\tif (i != 0 && i != 1) {\n\t\t\t\t\tint val1 = Math.abs(heightArray[i] - heightArray[i - 1]);\n\t\t\t\t\tint val2 = Math.abs(heightArray[i] - heightArray[i - 2]);\n\t\t\t\t\tkoufukuArray[i] = Math.min(koufukuArray[i - 1] + val1, koufukuArray[i - 2] + val2);\n\t\t\t\t} else if (i == 0) {\n\t\t\t\t\tkoufukuArray[i] = 0;\n\t\t\t\t} else if (i == 1) {\n\t\t\t\t\tkoufukuArray[i] = koufukuArray[i - 1] + Math.abs(heightArray[i] - heightArray[i - 1]);\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tSystem.out.println(koufukuArray[koufukuArray.length - 1]);\n\n\t\t} finally {\n\t\t\tif (scanner != null) {\n\t\t\t\tscanner.close();\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate void dPA2() {\n\t\tScanner scanner = null;\n\t\tint numFrog = 0;\n\t\tint jump = 2;\n\n\t\ttry {\n\t\t\tscanner = new Scanner(System.in);\n\t\t\tnumFrog = scanner.nextInt();\n\t\t\tint[] heightArray = new int[numFrog];\n\n\t\t\tfor (int i = 0; i < numFrog; i++) {\n\t\t\t\theightArray[i] = scanner.nextInt();\n\t\t\t}\n\n\t\t\tint[] cost = new int[numFrog];\n\t\t\tArrays.fill(cost, Integer.MAX_VALUE);\n\n\t\t\tcost[0] = 0;\n\n\t\t\tfor (int i = 0; i < heightArray.length; i++) {\n\n\t\t\t\tfor (int j = 1; j <= jump; j++) {\n\t\t\t\t\tif (i + j < heightArray.length) {\n\t\t\t\t\t\tcost[i + j] = Math.min(cost[i + j], Math.abs(heightArray[i + j] - heightArray[i]) + cost[i]);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tSystem.out.println(cost[cost.length - 1]);\n\t\t} finally {\n\t\t\tif (scanner != null) {\n\t\t\t\tscanner.close();\n\t\t\t}\n\t\t}\n\t}\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to one of the following: Stone i + 1, i + 2, \\ldots, i + K. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 100\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n5 3\n10 30 40 50 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 5, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n3 1\n10 20 10\n\nSample Output 2\n\n20\n\nIf we follow the path 1 → 2 → 3, the total cost incurred would be |10 - 20| + |20 - 10| = 20.\n\nSample Input 3\n\n2 100\n10 10\n\nSample Output 3\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 4\n\n10 4\n40 10 20 70 80 10 20 70 80 60\n\nSample Output 4\n\n40\n\nIf we follow the path 1 → 4 → 8 → 10, the total cost incurred would be |40 - 70| + |70 - 70| + |70 - 60| = 40.", "sample_input": "5 3\n10 30 40 50 20\n"}, "reference_outputs": ["30\n"], "source_document_id": "p03161", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to one of the following: Stone i + 1, i + 2, \\ldots, i + K. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 100\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n5 3\n10 30 40 50 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 5, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n3 1\n10 20 10\n\nSample Output 2\n\n20\n\nIf we follow the path 1 → 2 → 3, the total cost incurred would be |10 - 20| + |20 - 10| = 20.\n\nSample Input 3\n\n2 100\n10 10\n\nSample Output 3\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 4\n\n10 4\n40 10 20 70 80 10 20 70 80 60\n\nSample Output 4\n\n40\n\nIf we follow the path 1 → 4 → 8 → 10, the total cost incurred would be |40 - 70| + |70 - 70| + |70 - 60| = 40.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1840, "cpu_time_ms": 426, "memory_kb": 51872}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s666248943", "group_id": "codeNet:p03161", "input_text": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\nimport java.io.IOException;\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author Azhan Khan\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastScanner in = new FastScanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n BFrog2 solver = new BFrog2();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class BFrog2 {\n public void solve(int testNumber, FastScanner in, PrintWriter out) {\n int n = in.nextInt();\n int k = in.nextInt();\n int[] arr = new int[n];\n for (int i = 0; i < n; i++) {\n arr[i] = in.nextInt();\n }\n\n int[] dp = new int[n];\n //dp[0] = 0;\n dp[1] = Math.abs(arr[1] - arr[0]);\n for (int i = 1; i < n; i++) {\n dp[i] = dp[i - 1] + Math.abs(arr[i] - arr[i - 1]);\n for (int j = Math.max(0, i - k); j < i; j++) {\n dp[i] = Math.min(dp[i], dp[j] + Math.abs(arr[i] - arr[j]));\n }\n //dp[i] = Math.min(dp[i - 2] + value2, dp[i - 1] + value1);\n }\n\n out.print(dp[n - 1]);\n }\n\n }\n\n static class FastScanner {\n BufferedReader br;\n StringTokenizer st;\n\n public FastScanner(InputStream inputStream) {\n br = new BufferedReader(new InputStreamReader(inputStream));\n }\n\n public String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n }\n}\n\n", "language": "Java", "metadata": {"date": 1549821283, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03161.html", "problem_id": "p03161", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03161/input.txt", "sample_output_relpath": "derived/input_output/data/p03161/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03161/Java/s666248943.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s666248943", "user_id": "u767801071"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\nimport java.io.IOException;\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author Azhan Khan\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastScanner in = new FastScanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n BFrog2 solver = new BFrog2();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class BFrog2 {\n public void solve(int testNumber, FastScanner in, PrintWriter out) {\n int n = in.nextInt();\n int k = in.nextInt();\n int[] arr = new int[n];\n for (int i = 0; i < n; i++) {\n arr[i] = in.nextInt();\n }\n\n int[] dp = new int[n];\n //dp[0] = 0;\n dp[1] = Math.abs(arr[1] - arr[0]);\n for (int i = 1; i < n; i++) {\n dp[i] = dp[i - 1] + Math.abs(arr[i] - arr[i - 1]);\n for (int j = Math.max(0, i - k); j < i; j++) {\n dp[i] = Math.min(dp[i], dp[j] + Math.abs(arr[i] - arr[j]));\n }\n //dp[i] = Math.min(dp[i - 2] + value2, dp[i - 1] + value1);\n }\n\n out.print(dp[n - 1]);\n }\n\n }\n\n static class FastScanner {\n BufferedReader br;\n StringTokenizer st;\n\n public FastScanner(InputStream inputStream) {\n br = new BufferedReader(new InputStreamReader(inputStream));\n }\n\n public String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n }\n}\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to one of the following: Stone i + 1, i + 2, \\ldots, i + K. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 100\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n5 3\n10 30 40 50 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 5, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n3 1\n10 20 10\n\nSample Output 2\n\n20\n\nIf we follow the path 1 → 2 → 3, the total cost incurred would be |10 - 20| + |20 - 10| = 20.\n\nSample Input 3\n\n2 100\n10 10\n\nSample Output 3\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 4\n\n10 4\n40 10 20 70 80 10 20 70 80 60\n\nSample Output 4\n\n40\n\nIf we follow the path 1 → 4 → 8 → 10, the total cost incurred would be |40 - 70| + |70 - 70| + |70 - 60| = 40.", "sample_input": "5 3\n10 30 40 50 20\n"}, "reference_outputs": ["30\n"], "source_document_id": "p03161", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to one of the following: Stone i + 1, i + 2, \\ldots, i + K. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 100\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n5 3\n10 30 40 50 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 5, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n3 1\n10 20 10\n\nSample Output 2\n\n20\n\nIf we follow the path 1 → 2 → 3, the total cost incurred would be |10 - 20| + |20 - 10| = 20.\n\nSample Input 3\n\n2 100\n10 10\n\nSample Output 3\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 4\n\n10 4\n40 10 20 70 80 10 20 70 80 60\n\nSample Output 4\n\n40\n\nIf we follow the path 1 → 4 → 8 → 10, the total cost incurred would be |40 - 70| + |70 - 70| + |70 - 60| = 40.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2213, "cpu_time_ms": 222, "memory_kb": 35716}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s123792261", "group_id": "codeNet:p03161", "input_text": "import java.util.*;\nimport java.io.*;\n\npublic class Main {\n\n private static void solve() {\n int n = nextInt();\n int K = nextInt();\n int[] h = new int[n];\n\n for (int i = 0; i < n; i++) {\n h[i] = nextInt();\n }\n\n int[] dp = new int[n];\n\n Arrays.fill(dp, Integer.MAX_VALUE);\n dp[0] = 0;\n for (int i = 0; i < n; i++) {\n for (int k = 1; k <= K; k++) {\n if (i + k < n) {\n dp[i + k] = Math.min(dp[i + k], dp[i] + Math.abs(h[i + k] - h[i]));\n }\n }\n }\n\n System.out.println(dp[n - 1]);\n }\n\n private static void run() {\n br = new BufferedReader(new InputStreamReader(System.in));\n out = new PrintWriter(System.out);\n\n solve();\n\n out.close();\n }\n\n private static StringTokenizer st;\n private static BufferedReader br;\n private static PrintWriter out;\n\n private static String next() {\n while (st == null || !st.hasMoreElements()) {\n String s;\n try {\n s = br.readLine();\n } catch (IOException e) {\n return null;\n }\n st = new StringTokenizer(s);\n }\n return st.nextToken();\n }\n\n private static int nextInt() {\n return Integer.parseInt(next());\n }\n\n private static long nextLong() {\n return Long.parseLong(next());\n }\n\n public static void main(String[] args) {\n run();\n }\n}", "language": "Java", "metadata": {"date": 1547226747, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03161.html", "problem_id": "p03161", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03161/input.txt", "sample_output_relpath": "derived/input_output/data/p03161/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03161/Java/s123792261.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s123792261", "user_id": "u497436519"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\n\npublic class Main {\n\n private static void solve() {\n int n = nextInt();\n int K = nextInt();\n int[] h = new int[n];\n\n for (int i = 0; i < n; i++) {\n h[i] = nextInt();\n }\n\n int[] dp = new int[n];\n\n Arrays.fill(dp, Integer.MAX_VALUE);\n dp[0] = 0;\n for (int i = 0; i < n; i++) {\n for (int k = 1; k <= K; k++) {\n if (i + k < n) {\n dp[i + k] = Math.min(dp[i + k], dp[i] + Math.abs(h[i + k] - h[i]));\n }\n }\n }\n\n System.out.println(dp[n - 1]);\n }\n\n private static void run() {\n br = new BufferedReader(new InputStreamReader(System.in));\n out = new PrintWriter(System.out);\n\n solve();\n\n out.close();\n }\n\n private static StringTokenizer st;\n private static BufferedReader br;\n private static PrintWriter out;\n\n private static String next() {\n while (st == null || !st.hasMoreElements()) {\n String s;\n try {\n s = br.readLine();\n } catch (IOException e) {\n return null;\n }\n st = new StringTokenizer(s);\n }\n return st.nextToken();\n }\n\n private static int nextInt() {\n return Integer.parseInt(next());\n }\n\n private static long nextLong() {\n return Long.parseLong(next());\n }\n\n public static void main(String[] args) {\n run();\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to one of the following: Stone i + 1, i + 2, \\ldots, i + K. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 100\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n5 3\n10 30 40 50 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 5, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n3 1\n10 20 10\n\nSample Output 2\n\n20\n\nIf we follow the path 1 → 2 → 3, the total cost incurred would be |10 - 20| + |20 - 10| = 20.\n\nSample Input 3\n\n2 100\n10 10\n\nSample Output 3\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 4\n\n10 4\n40 10 20 70 80 10 20 70 80 60\n\nSample Output 4\n\n40\n\nIf we follow the path 1 → 4 → 8 → 10, the total cost incurred would be |40 - 70| + |70 - 70| + |70 - 60| = 40.", "sample_input": "5 3\n10 30 40 50 20\n"}, "reference_outputs": ["30\n"], "source_document_id": "p03161", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to one of the following: Stone i + 1, i + 2, \\ldots, i + K. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 100\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n5 3\n10 30 40 50 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 5, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n3 1\n10 20 10\n\nSample Output 2\n\n20\n\nIf we follow the path 1 → 2 → 3, the total cost incurred would be |10 - 20| + |20 - 10| = 20.\n\nSample Input 3\n\n2 100\n10 10\n\nSample Output 3\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 4\n\n10 4\n40 10 20 70 80 10 20 70 80 60\n\nSample Output 4\n\n40\n\nIf we follow the path 1 → 4 → 8 → 10, the total cost incurred would be |40 - 70| + |70 - 70| + |70 - 60| = 40.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1310, "cpu_time_ms": 223, "memory_kb": 36532}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s800531730", "group_id": "codeNet:p03161", "input_text": "import java.util.*;\nimport java.io.*;\n\npublic class Main {\n\tstatic BufferedReader br;\n\tstatic StringTokenizer tokenizer;\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = nextInt();\n\t\tint m = nextInt();\n\t\tint[] arr = new int[n];\n\t\tint[] dp = new int[n];\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tarr[i] = nextInt();\n\t\t\tdp[i] = Integer.MAX_VALUE;\n\t\t}\n\t\tdp[0] = 0;\n\t\tfor(int i = 0; i < n - 1; i++) {\n\t\t\tint max = Math.min(i + m, n - 1) - i;\n\t\t\tfor(int k = 1; k <= max; k++) {\n\t\t\tdp[i + k] = Math.min(dp[i + k], Math.abs(arr[i] - arr[i + k]) + dp[i]);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(dp[n - 1]);\n\t}\n\n\tpublic static String next() throws IOException {\n\t\twhile (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\tString line = br.readLine();\n\t\t\tif (line == null)\n\t\t\t\tthrow new IOException();\n\t\t\ttokenizer = new StringTokenizer(line);\n\t\t}\n\t\treturn tokenizer.nextToken();\n\t}\n\n\tpublic static int nextInt() throws IOException {\n\t\treturn Integer.parseInt(next());\n\t}\n}\n", "language": "Java", "metadata": {"date": 1546925152, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03161.html", "problem_id": "p03161", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03161/input.txt", "sample_output_relpath": "derived/input_output/data/p03161/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03161/Java/s800531730.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s800531730", "user_id": "u213776906"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\n\npublic class Main {\n\tstatic BufferedReader br;\n\tstatic StringTokenizer tokenizer;\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = nextInt();\n\t\tint m = nextInt();\n\t\tint[] arr = new int[n];\n\t\tint[] dp = new int[n];\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tarr[i] = nextInt();\n\t\t\tdp[i] = Integer.MAX_VALUE;\n\t\t}\n\t\tdp[0] = 0;\n\t\tfor(int i = 0; i < n - 1; i++) {\n\t\t\tint max = Math.min(i + m, n - 1) - i;\n\t\t\tfor(int k = 1; k <= max; k++) {\n\t\t\tdp[i + k] = Math.min(dp[i + k], Math.abs(arr[i] - arr[i + k]) + dp[i]);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(dp[n - 1]);\n\t}\n\n\tpublic static String next() throws IOException {\n\t\twhile (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t\t\tString line = br.readLine();\n\t\t\tif (line == null)\n\t\t\t\tthrow new IOException();\n\t\t\ttokenizer = new StringTokenizer(line);\n\t\t}\n\t\treturn tokenizer.nextToken();\n\t}\n\n\tpublic static int nextInt() throws IOException {\n\t\treturn Integer.parseInt(next());\n\t}\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to one of the following: Stone i + 1, i + 2, \\ldots, i + K. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 100\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n5 3\n10 30 40 50 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 5, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n3 1\n10 20 10\n\nSample Output 2\n\n20\n\nIf we follow the path 1 → 2 → 3, the total cost incurred would be |10 - 20| + |20 - 10| = 20.\n\nSample Input 3\n\n2 100\n10 10\n\nSample Output 3\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 4\n\n10 4\n40 10 20 70 80 10 20 70 80 60\n\nSample Output 4\n\n40\n\nIf we follow the path 1 → 4 → 8 → 10, the total cost incurred would be |40 - 70| + |70 - 70| + |70 - 60| = 40.", "sample_input": "5 3\n10 30 40 50 20\n"}, "reference_outputs": ["30\n"], "source_document_id": "p03161", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N stones, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1.\nHe will repeat the following action some number of times to reach Stone N:\n\nIf the frog is currently on Stone i, jump to one of the following: Stone i + 1, i + 2, \\ldots, i + K. Here, a cost of |h_i - h_j| is incurred, where j is the stone to land on.\n\nFind the minimum possible total cost incurred before the frog reaches Stone N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 100\n\n1 \\leq h_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the minimum possible total cost incurred.\n\nSample Input 1\n\n5 3\n10 30 40 50 20\n\nSample Output 1\n\n30\n\nIf we follow the path 1 → 2 → 5, the total cost incurred would be |10 - 30| + |30 - 20| = 30.\n\nSample Input 2\n\n3 1\n10 20 10\n\nSample Output 2\n\n20\n\nIf we follow the path 1 → 2 → 3, the total cost incurred would be |10 - 20| + |20 - 10| = 20.\n\nSample Input 3\n\n2 100\n10 10\n\nSample Output 3\n\n0\n\nIf we follow the path 1 → 2, the total cost incurred would be |10 - 10| = 0.\n\nSample Input 4\n\n10 4\n40 10 20 70 80 10 20 70 80 60\n\nSample Output 4\n\n40\n\nIf we follow the path 1 → 4 → 8 → 10, the total cost incurred would be |40 - 70| + |70 - 70| + |70 - 60| = 40.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1032, "cpu_time_ms": 206, "memory_kb": 32056}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s600194160", "group_id": "codeNet:p03163", "input_text": "package main;\n\nimport java.io.PrintWriter;\nimport java.util.*;\npublic class Main {\n \n\tstatic int c;\n\tstatic int []w;\n\tstatic int []v;\n\tstatic long [][]dp;\n\tstatic int n;\n\t\n\tpublic static long KnapSack(int idx,int remw) {\n\t\tif(remw<0)\n\t\t\treturn -(int) 1e9;\n\t\tif(idx==n)\n\t\t\treturn 0;\n\t\tif(dp[idx][remw]!=-1)\n\t\t\treturn dp[idx][remw];\n\t\tlong take=v[idx]+KnapSack(idx+1,remw-w[idx]);\n\t\tlong leave=KnapSack(idx+1,remw);\n\t\treturn dp[idx][remw]=Math.max(take, leave);\n\t}\n\t\n\tpublic static void main(String[] args) {\n Scanner sc=new Scanner (System.in);\n PrintWriter pw=new PrintWriter(System.out);\n n=sc.nextInt();\n c=sc.nextInt();\n w=new int[n];\n v=new int[n];\n dp=new long[n][c+1];\n for(long[] x:dp)\n Arrays.fill(x, -1);\n for(int i=0;i= wt.length)\n return 0;\n \n // if(prevSelected!=-1 && dp[pos][prevSelected] != Integer.MIN_VALUE)\n // return dp[pos][prevSelected];\n \n int sum = 0;\n if(wt[pos] > W)\n return maxSum(wt, v, W, pos+1);\n \n return Math.max(v[pos]+ maxSum(wt, v, W-wt[pos], pos+1), maxSum(wt, v, W, pos+1));\n \n }\n}\n", "language": "Java", "metadata": {"date": 1595094812, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03163.html", "problem_id": "p03163", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03163/input.txt", "sample_output_relpath": "derived/input_output/data/p03163/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03163/Java/s047802783.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s047802783", "user_id": "u916055599"}, "prompt_components": {"gold_output": "90\n", "input_to_evaluate": "import java.io.*;\nimport java.util.*;\npublic class Main{\n \t/*public int minRec(int a[],int dp[],int i,int j)\n {\n if(i==n && j==n)\n \treturn dp[n][n];\n if(\n return Math.min( Math.abs(a[]\n }*/\n\tpublic static void main(String args[]) throws IOException{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n\t int W = sc.nextInt();\n int w[]=new int[n];\n int v[] = new int[n];\n \n for(int i=0; i= wt.length)\n return 0;\n \n // if(prevSelected!=-1 && dp[pos][prevSelected] != Integer.MIN_VALUE)\n // return dp[pos][prevSelected];\n \n int sum = 0;\n if(wt[pos] > W)\n return maxSum(wt, v, W, pos+1);\n \n return Math.max(v[pos]+ maxSum(wt, v, W-wt[pos], pos+1), maxSum(wt, v, W, pos+1));\n \n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^5\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^9\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\n5 5\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 2\n\n5000000000\n\nThe answer may not fit into a 32-bit integer type.\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": "p03163", "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^5\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^9\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\n5 5\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 2\n\n5000000000\n\nThe answer may not fit into a 32-bit integer type.\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1136, "cpu_time_ms": 2206, "memory_kb": 27320}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s705440361", "group_id": "codeNet:p03163", "input_text": "\n//package cf;\nimport java.io.*;\nimport java.util.*;\npublic class Main {\n static int p=1000000007;\n public static void main(String[] args) throws Exception{\n BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(java.io.FileDescriptor.out), \"ASCII\"), 512);\n FastReader sc=new FastReader();\n int n = sc.nextInt();\n int W = sc.nextInt();\n int w[]=new int[n];\n int v[]=new int[n];\n for(int i=0;i=0)\n {\n dp[i][j]=Math.max(dp[i-1][j],v[i-1]+dp[i-1][j-w[i-1]]);\n // System.out.println(i+\" \"+j+\" \"+dp[i][j]);\n }\n else\n {\n dp[i][j]=Math.max(dp[i][j],dp[i-1][j]);\n }\n }\n }\n sb.append(dp[n][W]);\n out.write(sb.toString());\n out.flush();\n }\n\n\nstatic class pair\n{\n long a,d;\n StringBuilder sb;\n\n public pair(long a, long d, StringBuilder sb) {\n this.a = a;\n this.d = d;\n this.sb = sb;\n }\n}\n\n\n\n ///////////////////////////////////////////////////////////////////////////////////\n//////////////////////////////////////////////////////////////////////////////////////////////\n static class FastReader {\n\n BufferedReader br;\n StringTokenizer st;\n\n public FastReader() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n String nextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n }\n\n\n}\n", "language": "Java", "metadata": {"date": 1593674436, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p03163.html", "problem_id": "p03163", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03163/input.txt", "sample_output_relpath": "derived/input_output/data/p03163/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03163/Java/s705440361.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s705440361", "user_id": "u621733701"}, "prompt_components": {"gold_output": "90\n", "input_to_evaluate": "\n//package cf;\nimport java.io.*;\nimport java.util.*;\npublic class Main {\n static int p=1000000007;\n public static void main(String[] args) throws Exception{\n BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(java.io.FileDescriptor.out), \"ASCII\"), 512);\n FastReader sc=new FastReader();\n int n = sc.nextInt();\n int W = sc.nextInt();\n int w[]=new int[n];\n int v[]=new int[n];\n for(int i=0;i=0)\n {\n dp[i][j]=Math.max(dp[i-1][j],v[i-1]+dp[i-1][j-w[i-1]]);\n // System.out.println(i+\" \"+j+\" \"+dp[i][j]);\n }\n else\n {\n dp[i][j]=Math.max(dp[i][j],dp[i-1][j]);\n }\n }\n }\n sb.append(dp[n][W]);\n out.write(sb.toString());\n out.flush();\n }\n\n\nstatic class pair\n{\n long a,d;\n StringBuilder sb;\n\n public pair(long a, long d, StringBuilder sb) {\n this.a = a;\n this.d = d;\n this.sb = sb;\n }\n}\n\n\n\n ///////////////////////////////////////////////////////////////////////////////////\n//////////////////////////////////////////////////////////////////////////////////////////////\n static class FastReader {\n\n BufferedReader br;\n StringTokenizer st;\n\n public FastReader() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n String nextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n }\n\n\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^5\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^9\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\n5 5\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 2\n\n5000000000\n\nThe answer may not fit into a 32-bit integer type.\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": "p03163", "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^5\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^9\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\n5 5\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 2\n\n5000000000\n\nThe answer may not fit into a 32-bit integer type.\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2567, "cpu_time_ms": 204, "memory_kb": 138644}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s901929321", "group_id": "codeNet:p03163", "input_text": "import java.util.*;\nimport java.io.*;\n\nclass Main {\n\n static class Reader {\n final private int BUFFER_SIZE = 1 << 16;\n private DataInputStream din;\n private byte[] buffer;\n private int bufferPointer, bytesRead;\n\n public Reader() {\n din = new DataInputStream(System.in);\n buffer = new byte[BUFFER_SIZE];\n bufferPointer = bytesRead = 0;\n }\n\n public Reader(String file_name) throws IOException {\n din = new DataInputStream(new FileInputStream(file_name));\n buffer = new byte[BUFFER_SIZE];\n bufferPointer = bytesRead = 0;\n }\n\n public String readLine() throws IOException {\n byte[] buf = new byte[64]; // line length\n int cnt = 0, c;\n while ((c = read()) != -1) {\n if (c == '\\n')\n break;\n buf[cnt++] = (byte) c;\n }\n return new String(buf, 0, cnt);\n }\n\n public int nextInt() throws IOException {\n int ret = 0;\n byte c = read();\n while (c <= ' ')\n c = read();\n boolean neg = (c == '-');\n if (neg)\n c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n\n if (neg)\n return -ret;\n return ret;\n }\n\n public long nextLong() throws IOException {\n long ret = 0;\n byte c = read();\n while (c <= ' ')\n c = read();\n boolean neg = (c == '-');\n if (neg)\n c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (neg)\n return -ret;\n return ret;\n }\n\n public double nextDouble() throws IOException {\n double ret = 0, div = 1;\n byte c = read();\n while (c <= ' ')\n c = read();\n boolean neg = (c == '-');\n if (neg)\n c = read();\n\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n\n if (c == '.') {\n while ((c = read()) >= '0' && c <= '9') {\n ret += (c - '0') / (div *= 10);\n }\n }\n\n if (neg)\n return -ret;\n return ret;\n }\n\n private void fillBuffer() throws IOException {\n bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);\n if (bytesRead == -1)\n buffer[0] = -1;\n }\n\n private byte read() throws IOException {\n if (bufferPointer == bytesRead)\n fillBuffer();\n return buffer[bufferPointer++];\n }\n\n public void close() throws IOException {\n if (din == null)\n return;\n din.close();\n }\n }\n\n static final Reader in = new Reader();\n static int N, W; // ..maximum capacity of knapsack\n static int[] w; // ..weight array\n static int[] v; // .. value or price array\n static HashSet items_set = new HashSet<>();\n\n static long[][] dp;\n\n public static void main(String[] args) throws Exception {\n N = in.nextInt();\n W = in.nextInt();\n w = new int[N + 1];\n v = new int[N + 1];\n\n dp = new long[N + 1][W + 1];\n\n for (int i = 1; i <= N; i++) {\n w[i] = in.nextInt();\n v[i] = in.nextInt();\n items_set.add(i);\n Arrays.fill(dp[i], -1); \n }\n\n System.out.println(knapSack(W, N));\n }\n\n static long knapSack(int c, int i) {\n // base condition\n if (i < 0)\n return 0;\n\n //..if value already exists directly return \n if (dp[i][c] != -1)\n return dp[i][c];\n\n if (w[i] <= c) {\n //..ignore ith element and consider rest of i-1 elements\n long temp1 = knapSack(c, i - 1);\n //..consider ith element so reduce capacity\n long temp2 = v[i] + knapSack(c - w[i], i - 1);\n\n //..store it\n dp[i][c] = Math.max(temp1,temp2);\n\n return dp[i][c];\n\n } else { // ..weight of ith element is more than c\n dp[i][c] = knapSack(c, i - 1);\n return dp[i][c];\n }\n }\n\n static long k(int W, int i) {\n // base condition\n if (i < 0)\n return 0;\n \n if (dp[i][W] != -1)\n return dp[i][W];\n \n if (w[i] <= W) {\n dp[i][W] = Math.max(v[i] + knapSack(W - w[i],i - 1), knapSack(W,i - 1));\n return dp[i][W];\n \n } else {\n dp[i][W] = knapSack(W,i - 1);\n return dp[i][W];\n }\n }\n\n \n\n}\n", "language": "Java", "metadata": {"date": 1593617301, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p03163.html", "problem_id": "p03163", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03163/input.txt", "sample_output_relpath": "derived/input_output/data/p03163/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03163/Java/s901929321.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s901929321", "user_id": "u505022189"}, "prompt_components": {"gold_output": "90\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\n\nclass Main {\n\n static class Reader {\n final private int BUFFER_SIZE = 1 << 16;\n private DataInputStream din;\n private byte[] buffer;\n private int bufferPointer, bytesRead;\n\n public Reader() {\n din = new DataInputStream(System.in);\n buffer = new byte[BUFFER_SIZE];\n bufferPointer = bytesRead = 0;\n }\n\n public Reader(String file_name) throws IOException {\n din = new DataInputStream(new FileInputStream(file_name));\n buffer = new byte[BUFFER_SIZE];\n bufferPointer = bytesRead = 0;\n }\n\n public String readLine() throws IOException {\n byte[] buf = new byte[64]; // line length\n int cnt = 0, c;\n while ((c = read()) != -1) {\n if (c == '\\n')\n break;\n buf[cnt++] = (byte) c;\n }\n return new String(buf, 0, cnt);\n }\n\n public int nextInt() throws IOException {\n int ret = 0;\n byte c = read();\n while (c <= ' ')\n c = read();\n boolean neg = (c == '-');\n if (neg)\n c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n\n if (neg)\n return -ret;\n return ret;\n }\n\n public long nextLong() throws IOException {\n long ret = 0;\n byte c = read();\n while (c <= ' ')\n c = read();\n boolean neg = (c == '-');\n if (neg)\n c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (neg)\n return -ret;\n return ret;\n }\n\n public double nextDouble() throws IOException {\n double ret = 0, div = 1;\n byte c = read();\n while (c <= ' ')\n c = read();\n boolean neg = (c == '-');\n if (neg)\n c = read();\n\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n\n if (c == '.') {\n while ((c = read()) >= '0' && c <= '9') {\n ret += (c - '0') / (div *= 10);\n }\n }\n\n if (neg)\n return -ret;\n return ret;\n }\n\n private void fillBuffer() throws IOException {\n bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);\n if (bytesRead == -1)\n buffer[0] = -1;\n }\n\n private byte read() throws IOException {\n if (bufferPointer == bytesRead)\n fillBuffer();\n return buffer[bufferPointer++];\n }\n\n public void close() throws IOException {\n if (din == null)\n return;\n din.close();\n }\n }\n\n static final Reader in = new Reader();\n static int N, W; // ..maximum capacity of knapsack\n static int[] w; // ..weight array\n static int[] v; // .. value or price array\n static HashSet items_set = new HashSet<>();\n\n static long[][] dp;\n\n public static void main(String[] args) throws Exception {\n N = in.nextInt();\n W = in.nextInt();\n w = new int[N + 1];\n v = new int[N + 1];\n\n dp = new long[N + 1][W + 1];\n\n for (int i = 1; i <= N; i++) {\n w[i] = in.nextInt();\n v[i] = in.nextInt();\n items_set.add(i);\n Arrays.fill(dp[i], -1); \n }\n\n System.out.println(knapSack(W, N));\n }\n\n static long knapSack(int c, int i) {\n // base condition\n if (i < 0)\n return 0;\n\n //..if value already exists directly return \n if (dp[i][c] != -1)\n return dp[i][c];\n\n if (w[i] <= c) {\n //..ignore ith element and consider rest of i-1 elements\n long temp1 = knapSack(c, i - 1);\n //..consider ith element so reduce capacity\n long temp2 = v[i] + knapSack(c - w[i], i - 1);\n\n //..store it\n dp[i][c] = Math.max(temp1,temp2);\n\n return dp[i][c];\n\n } else { // ..weight of ith element is more than c\n dp[i][c] = knapSack(c, i - 1);\n return dp[i][c];\n }\n }\n\n static long k(int W, int i) {\n // base condition\n if (i < 0)\n return 0;\n \n if (dp[i][W] != -1)\n return dp[i][W];\n \n if (w[i] <= W) {\n dp[i][W] = Math.max(v[i] + knapSack(W - w[i],i - 1), knapSack(W,i - 1));\n return dp[i][W];\n \n } else {\n dp[i][W] = knapSack(W,i - 1);\n return dp[i][W];\n }\n }\n\n \n\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^5\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^9\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\n5 5\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 2\n\n5000000000\n\nThe answer may not fit into a 32-bit integer type.\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": "p03163", "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^5\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^9\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\n5 5\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 2\n\n5000000000\n\nThe answer may not fit into a 32-bit integer type.\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 4928, "cpu_time_ms": 414, "memory_kb": 137300}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s804769710", "group_id": "codeNet:p03163", "input_text": "import java.util.*;\nimport java.io.*;\nclass Main {\n public static long solve(int[] weight, int[] value, int w, int i, long[][] dp){\n if(i >= weight.length || w <= 0){\n return 0;\n }\n if(dp[i][w] != -1){\n return dp[i][w];\n }\n long ans = Long.MIN_VALUE;\n ans = Math.max(ans, solve(weight, value, w, i+1, dp));\n if(w-weight[i] >= 0){\n ans = Math.max(ans, value[i] + solve(weight, value, w-weight[i], i+1, dp));\n }\n dp[i][w] = ans;\n return ans;\n }\n public static void main(String args[] ) throws Exception {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n \tString[] s = br.readLine().trim().split(\" \");\n \t\tint n = Integer.parseInt(s[0]);\n int w = Integer.parseInt(s[1]);\n \tint[] weight = new int[n];\n int[] value = new int[n];\n for(int i = 0; i < n; i++){\n \tString[] str = br.readLine().trim().split(\" \");\n \tweight[i] = Integer.parseInt(str[0]);\n \tvalue[i] = Integer.parseInt(str[1]);\n }\n \n long[][] dp = new long[n+1][w+1];\n for(int j = 0; j < dp.length; j++){\n for(int k = 0; k < dp[0].length; k++){\n dp[j][k] = -1;\n }\n }\n System.out.println(solve(weight, value, w, 0, dp));\n }\n}\n", "language": "Java", "metadata": {"date": 1590582421, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03163.html", "problem_id": "p03163", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03163/input.txt", "sample_output_relpath": "derived/input_output/data/p03163/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03163/Java/s804769710.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s804769710", "user_id": "u410758678"}, "prompt_components": {"gold_output": "90\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\nclass Main {\n public static long solve(int[] weight, int[] value, int w, int i, long[][] dp){\n if(i >= weight.length || w <= 0){\n return 0;\n }\n if(dp[i][w] != -1){\n return dp[i][w];\n }\n long ans = Long.MIN_VALUE;\n ans = Math.max(ans, solve(weight, value, w, i+1, dp));\n if(w-weight[i] >= 0){\n ans = Math.max(ans, value[i] + solve(weight, value, w-weight[i], i+1, dp));\n }\n dp[i][w] = ans;\n return ans;\n }\n public static void main(String args[] ) throws Exception {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n \tString[] s = br.readLine().trim().split(\" \");\n \t\tint n = Integer.parseInt(s[0]);\n int w = Integer.parseInt(s[1]);\n \tint[] weight = new int[n];\n int[] value = new int[n];\n for(int i = 0; i < n; i++){\n \tString[] str = br.readLine().trim().split(\" \");\n \tweight[i] = Integer.parseInt(str[0]);\n \tvalue[i] = Integer.parseInt(str[1]);\n }\n \n long[][] dp = new long[n+1][w+1];\n for(int j = 0; j < dp.length; j++){\n for(int k = 0; k < dp[0].length; k++){\n dp[j][k] = -1;\n }\n }\n System.out.println(solve(weight, value, w, 0, dp));\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^5\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^9\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\n5 5\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 2\n\n5000000000\n\nThe answer may not fit into a 32-bit integer type.\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": "p03163", "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^5\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^9\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\n5 5\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 2\n\n5000000000\n\nThe answer may not fit into a 32-bit integer type.\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1355, "cpu_time_ms": 346, "memory_kb": 126420}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s829994766", "group_id": "codeNet:p03163", "input_text": "\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt(), W = sc.nextInt(), w[] = new int[N], v[] = new int[N];\n\t\tlong dp[][] = new long[N][W + 1];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tw[i] = sc.nextInt();\n\t\t\tv[i] = sc.nextInt();\n\t\t}\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tfor (int j = 0; j < W + 1; j++) {\n\t\t\t\tlong temp = (i > 0 && j >= w[i]) ? dp[i - 1][j - w[i]] : 0;\n\t\t\t\tlong temp2 = (i > 0) ? dp[i - 1][j] : 0;\n\t\t\t\tif (j >= w[i])\n\t\t\t\t\tdp[i][j] = Long.max(temp + v[i], temp2);\n\t\t\t\telse\n\t\t\t\t\tdp[i][j] = temp2;\n\t\t\t}\n\t\t}\n\t\tsc.close();\n\t\tSystem.out.println(dp[N - 1][W]);\n\t}\n}\n", "language": "Java", "metadata": {"date": 1589645899, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03163.html", "problem_id": "p03163", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03163/input.txt", "sample_output_relpath": "derived/input_output/data/p03163/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03163/Java/s829994766.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s829994766", "user_id": "u773565827"}, "prompt_components": {"gold_output": "90\n", "input_to_evaluate": "\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt(), W = sc.nextInt(), w[] = new int[N], v[] = new int[N];\n\t\tlong dp[][] = new long[N][W + 1];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tw[i] = sc.nextInt();\n\t\t\tv[i] = sc.nextInt();\n\t\t}\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tfor (int j = 0; j < W + 1; j++) {\n\t\t\t\tlong temp = (i > 0 && j >= w[i]) ? dp[i - 1][j - w[i]] : 0;\n\t\t\t\tlong temp2 = (i > 0) ? dp[i - 1][j] : 0;\n\t\t\t\tif (j >= w[i])\n\t\t\t\t\tdp[i][j] = Long.max(temp + v[i], temp2);\n\t\t\t\telse\n\t\t\t\t\tdp[i][j] = temp2;\n\t\t\t}\n\t\t}\n\t\tsc.close();\n\t\tSystem.out.println(dp[N - 1][W]);\n\t}\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^5\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^9\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\n5 5\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 2\n\n5000000000\n\nThe answer may not fit into a 32-bit integer type.\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": "p03163", "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^5\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^9\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\n5 5\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 2\n\n5000000000\n\nThe answer may not fit into a 32-bit integer type.\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 666, "cpu_time_ms": 235, "memory_kb": 126164}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s403239514", "group_id": "codeNet:p03163", "input_text": "import java.util.*;\nimport java.io.*;\nclass Main {\n public static void main(String[] args) throws IOException{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st = new StringTokenizer(br.readLine());\n\n int N = Integer.parseInt(st.nextToken());\n int C = Integer.parseInt(st.nextToken());\n int[] wt = new int[N];\n int[] val = new int[N];\n\n for (int i=0; i=0)\n dp[i][j] = Math.max(dp[i][j], dp[i-1][j-wt[i-1]]+val[i-1]);\n// System.out.print(dp[i][j]+\" \");\n }\n// System.out.println();\n }\n\n System.out.println(dp[N][C]);\n\n\n }\n}\n", "language": "Java", "metadata": {"date": 1589187523, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03163.html", "problem_id": "p03163", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03163/input.txt", "sample_output_relpath": "derived/input_output/data/p03163/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03163/Java/s403239514.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s403239514", "user_id": "u266007445"}, "prompt_components": {"gold_output": "90\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\nclass Main {\n public static void main(String[] args) throws IOException{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st = new StringTokenizer(br.readLine());\n\n int N = Integer.parseInt(st.nextToken());\n int C = Integer.parseInt(st.nextToken());\n int[] wt = new int[N];\n int[] val = new int[N];\n\n for (int i=0; i=0)\n dp[i][j] = Math.max(dp[i][j], dp[i-1][j-wt[i-1]]+val[i-1]);\n// System.out.print(dp[i][j]+\" \");\n }\n// System.out.println();\n }\n\n System.out.println(dp[N][C]);\n\n\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^5\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^9\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\n5 5\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 2\n\n5000000000\n\nThe answer may not fit into a 32-bit integer type.\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": "p03163", "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^5\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^9\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\n5 5\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 2\n\n5000000000\n\nThe answer may not fit into a 32-bit integer type.\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1083, "cpu_time_ms": 186, "memory_kb": 126928}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s806174816", "group_id": "codeNet:p03163", "input_text": "import java.io.*;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\n public static void main(String[] args) throws IOException {\n\t// write your code here\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));\n StringTokenizer st;\n //knapsack probk\n st = new StringTokenizer(br.readLine());\n int N = Integer.parseInt(st.nextToken());\n int [] val = new int[N+1];\n int [] wt = new int[N+1];\n int W = Integer.parseInt(st.nextToken());\n long [][] K = new long[N+1][W+1];\n for (int i=0;i0)\n//\t\t{\n//\t\t int totItems = Integer.parseInt(br.readLine()); //no.of items.\n//\t\t int n = Integer.parseInt(br.readLine()); //capacity of knapsack.\n//\t\t int val[] = new int[totItems]; //values of items.\n//\t\t int wt[] = new int[totItems]; //weights of items.\n//\t\t \n//\t\t \n//\t\t for(int i=0;i Capacity from 0....to n. Draw graph to visualise.\n\t // Y-axis - > Items from 0...to totItems.\n\t \n\t //First row and first column is filled with 0's.\n\t \n\t for(int i=1;i<=n;i++)\n\t {\n\t for(int j=1;j<=totItems;j++)\n\t {\n\t //If the weight of the item is less than or equal to the capacity.\n\t if(wt[j-1]<=i) {\n\t /*IMP:- Take the max of(val of cur_item + (DP answer -> [cur_capacity \n\t -weight of cur_item][above item/cell]) \n\t AND \n\t (DP answer -> dp[same capacity][above item/cell] */\n \n\t dp[i][j] = Math.max(val[j-1]+dp[i-wt[j-1]][j-1] , dp[i][j-1]); }\n\t \n\t else\n\t dp[i][j] = dp[i][j-1];\n\t }\n\t }\n\t //Gives the max value obtained for the capacity n considering all the items.\n\t System.out.println(dp[n][totItems]) ; \n\t}\n}", "language": "Java", "metadata": {"date": 1586542923, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03163.html", "problem_id": "p03163", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03163/input.txt", "sample_output_relpath": "derived/input_output/data/p03163/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03163/Java/s340042910.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s340042910", "user_id": "u486524014"}, "prompt_components": {"gold_output": "90\n", "input_to_evaluate": "//package src;\nimport java.io.*;\n//import javafx.util.*;\nimport java.math.*;\nimport java.security.*;\nimport java.text.*;\nimport java.util.*;\nimport java.util.concurrent.*;\nimport java.util.regex.*;\nimport java.util.*;\nimport java.lang.*;\nimport java.io.*;\npublic class Main\n{\n\tpublic static void main (String[] args) {\n//\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n//\t\tint t = Integer.parseInt(br.readLine());\n//\t\twhile(t-->0)\n//\t\t{\n//\t\t int totItems = Integer.parseInt(br.readLine()); //no.of items.\n//\t\t int n = Integer.parseInt(br.readLine()); //capacity of knapsack.\n//\t\t int val[] = new int[totItems]; //values of items.\n//\t\t int wt[] = new int[totItems]; //weights of items.\n//\t\t \n//\t\t \n//\t\t for(int i=0;i Capacity from 0....to n. Draw graph to visualise.\n\t // Y-axis - > Items from 0...to totItems.\n\t \n\t //First row and first column is filled with 0's.\n\t \n\t for(int i=1;i<=n;i++)\n\t {\n\t for(int j=1;j<=totItems;j++)\n\t {\n\t //If the weight of the item is less than or equal to the capacity.\n\t if(wt[j-1]<=i) {\n\t /*IMP:- Take the max of(val of cur_item + (DP answer -> [cur_capacity \n\t -weight of cur_item][above item/cell]) \n\t AND \n\t (DP answer -> dp[same capacity][above item/cell] */\n \n\t dp[i][j] = Math.max(val[j-1]+dp[i-wt[j-1]][j-1] , dp[i][j-1]); }\n\t \n\t else\n\t dp[i][j] = dp[i][j-1];\n\t }\n\t }\n\t //Gives the max value obtained for the capacity n considering all the items.\n\t System.out.println(dp[n][totItems]) ; \n\t}\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^5\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^9\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\n5 5\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 2\n\n5000000000\n\nThe answer may not fit into a 32-bit integer type.\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": "p03163", "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^5\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^9\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\n5 5\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 2\n\n5000000000\n\nThe answer may not fit into a 32-bit integer type.\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2362, "cpu_time_ms": 274, "memory_kb": 82892}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s929763152", "group_id": "codeNet:p03163", "input_text": "import java.io.*;\nimport java.util.*;\n\nclass Main {\n\n public static long solve(int[] weights, int[] val, int W, int n, long[][] memo){\n if(n <= 0 || W <= 0)\n return 0;\n if(memo[n][W] > -1){\n return memo[n][W];\n }\n long ans = Long.MIN_VALUE;\n if(W - weights[n-1] >= 0)\n ans = Math.max(ans,val[n-1] + solve( weights,val,W-weights[n-1],n-1,memo));\n \n ans = Math.max(ans, solve( weights,val,W,n-1,memo));\n \n return memo[n][W] = ans;\n\n\n }\n\n public static void main(String[] args) throws Exception {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n String[] nw = br.readLine().trim().split(\" \");\n int n = Integer.parseInt(nw[0]);\n int W = Integer.parseInt(nw[1]);\n int weights[] = new int[n];\n int val[] = new int[n];\n\n for(int i = 0; i < n; i++){\n String[] input = br.readLine().trim().split(\" \");\n\n weights[i] = Integer.parseInt(input[0]);\n val[i] = Integer.parseInt(input[1]);\n }\n\n long[][] memo = new long[n+1][W+1];\n for(int i = 0; i < memo.length; i++)\n Arrays.fill(memo[i],-1);\n System.out.println(solve(weights,val,W,n,memo));\n\n }\n}", "language": "Java", "metadata": {"date": 1583727930, "filename_ext": "java", "original_language": "Java7 (OpenJDK 1.7.0)", "problem_description_relpath": "problem_descriptions/p03163.html", "problem_id": "p03163", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03163/input.txt", "sample_output_relpath": "derived/input_output/data/p03163/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03163/Java/s929763152.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s929763152", "user_id": "u238904265"}, "prompt_components": {"gold_output": "90\n", "input_to_evaluate": "import java.io.*;\nimport java.util.*;\n\nclass Main {\n\n public static long solve(int[] weights, int[] val, int W, int n, long[][] memo){\n if(n <= 0 || W <= 0)\n return 0;\n if(memo[n][W] > -1){\n return memo[n][W];\n }\n long ans = Long.MIN_VALUE;\n if(W - weights[n-1] >= 0)\n ans = Math.max(ans,val[n-1] + solve( weights,val,W-weights[n-1],n-1,memo));\n \n ans = Math.max(ans, solve( weights,val,W,n-1,memo));\n \n return memo[n][W] = ans;\n\n\n }\n\n public static void main(String[] args) throws Exception {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n String[] nw = br.readLine().trim().split(\" \");\n int n = Integer.parseInt(nw[0]);\n int W = Integer.parseInt(nw[1]);\n int weights[] = new int[n];\n int val[] = new int[n];\n\n for(int i = 0; i < n; i++){\n String[] input = br.readLine().trim().split(\" \");\n\n weights[i] = Integer.parseInt(input[0]);\n val[i] = Integer.parseInt(input[1]);\n }\n\n long[][] memo = new long[n+1][W+1];\n for(int i = 0; i < memo.length; i++)\n Arrays.fill(memo[i],-1);\n System.out.println(solve(weights,val,W,n,memo));\n\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^5\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^9\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\n5 5\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 2\n\n5000000000\n\nThe answer may not fit into a 32-bit integer type.\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": "p03163", "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^5\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^9\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\n5 5\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 2\n\n5000000000\n\nThe answer may not fit into a 32-bit integer type.\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1293, "cpu_time_ms": 317, "memory_kb": 133460}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s010638285", "group_id": "codeNet:p03163", "input_text": "import java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) throws Exception {\n Scanner reader = new Scanner(System.in);\n int n = reader.nextInt();\n int W = reader.nextInt();\n int[] w = new int[n];\n int[] v = new int[n];\n for (int i = 0; i < n; ++i) {\n w[i] = reader.nextInt();\n v[i] = reader.nextInt();\n }\n System.out.println(solve(w, v, W));\n }\n\n private static long solve(int[] w, int[] v, int W) {\n boolean[] taken = new boolean[w.length];\n long[][] dp = new long[w.length][W + 1];\n for (int i = 0; i < w.length; ++i)\n Arrays.fill(dp[i], -1);\n long max = calcMax(-1, w, v, W, w.length, taken, dp);\n// System.out.println(Arrays.toString(dp));\n return max;\n\n }\n\n private static long calcMax(int ind, int[] w, int[] v, int W, int n, boolean[] taken, long[][] dp) {\n if (ind >= 0 && dp[ind][W] >= 0)\n return dp[ind][W];\n long max = 0;\n for (int i = 0; i < taken.length; ++i) {\n if (!taken[i] && (W - w[i] >= 0)) {\n taken[i] = true;\n max = Math.max(calcMax(i, w, v, W - w[i], n - 1, taken, dp), max);\n dp[i][W] = max;\n taken[i] = false;\n }\n }\n long res = max;\n if (ind >= 0) {\n res += v[ind];\n// dp[ind] = res;\n }\n return res;\n// return res;\n }\n}\n", "language": "Java", "metadata": {"date": 1577606880, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03163.html", "problem_id": "p03163", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03163/input.txt", "sample_output_relpath": "derived/input_output/data/p03163/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03163/Java/s010638285.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s010638285", "user_id": "u698539640"}, "prompt_components": {"gold_output": "90\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) throws Exception {\n Scanner reader = new Scanner(System.in);\n int n = reader.nextInt();\n int W = reader.nextInt();\n int[] w = new int[n];\n int[] v = new int[n];\n for (int i = 0; i < n; ++i) {\n w[i] = reader.nextInt();\n v[i] = reader.nextInt();\n }\n System.out.println(solve(w, v, W));\n }\n\n private static long solve(int[] w, int[] v, int W) {\n boolean[] taken = new boolean[w.length];\n long[][] dp = new long[w.length][W + 1];\n for (int i = 0; i < w.length; ++i)\n Arrays.fill(dp[i], -1);\n long max = calcMax(-1, w, v, W, w.length, taken, dp);\n// System.out.println(Arrays.toString(dp));\n return max;\n\n }\n\n private static long calcMax(int ind, int[] w, int[] v, int W, int n, boolean[] taken, long[][] dp) {\n if (ind >= 0 && dp[ind][W] >= 0)\n return dp[ind][W];\n long max = 0;\n for (int i = 0; i < taken.length; ++i) {\n if (!taken[i] && (W - w[i] >= 0)) {\n taken[i] = true;\n max = Math.max(calcMax(i, w, v, W - w[i], n - 1, taken, dp), max);\n dp[i][W] = max;\n taken[i] = false;\n }\n }\n long res = max;\n if (ind >= 0) {\n res += v[ind];\n// dp[ind] = res;\n }\n return res;\n// return res;\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^5\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^9\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\n5 5\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 2\n\n5000000000\n\nThe answer may not fit into a 32-bit integer type.\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": "p03163", "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^5\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^9\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\n5 5\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 2\n\n5000000000\n\nThe answer may not fit into a 32-bit integer type.\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1495, "cpu_time_ms": 2110, "memory_kb": 126036}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s281539905", "group_id": "codeNet:p03163", "input_text": "import java.io.DataInputStream;\nimport java.io.FileInputStream;\nimport java.io.IOException;\nimport java.io.PrintWriter;\nimport java.util.Scanner;\n\npublic class Main {\n static int N, W;\n static int[][] item;\n static long[][] dp;\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n// Reader sc = Reader();\n N = sc.nextInt();\n W = sc.nextInt();\n PrintWriter pw = new PrintWriter(System.out);\n\n item = new int[N+1][2];\n\n for(int i=1; i<=N; ++i) {\n item[i][0] = sc.nextInt();\n item[i][1] = sc.nextInt();\n }\n\n pw.println(Knapsack_1(N, W, item));\n pw.close();\n }\n\n public static void d0(long[][] dp) {\n System.out.print(\" \");\n\n for(int j=0; jb)\n return a;\n\n return b;\n }\n\n public static long Knapsack_1(int N, int W, int[][] item) {\n dp = new long[N+1][W+1];\n\n for(int i=1; i<=N; ++i) {\n for(int w=1; w<=W; ++w) {\n if(item[i][0] <= w) {\n dp[i][w] = Math.max(dp[i-1][w], dp[i-1][w-item[i][0]] + item[i][1]);\n// dp[i][w] = myMax(dp[i-1][w], dp[i-1][w-item[i][0]] + item[i][1]);\n }\n else {\n dp[i][w] = dp[i-1][w];\n }\n }\n }\n\n// d0(dp);\n\n return dp[N][W];\n }\n}\n", "language": "Java", "metadata": {"date": 1577468009, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03163.html", "problem_id": "p03163", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03163/input.txt", "sample_output_relpath": "derived/input_output/data/p03163/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03163/Java/s281539905.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s281539905", "user_id": "u618088741"}, "prompt_components": {"gold_output": "90\n", "input_to_evaluate": "import java.io.DataInputStream;\nimport java.io.FileInputStream;\nimport java.io.IOException;\nimport java.io.PrintWriter;\nimport java.util.Scanner;\n\npublic class Main {\n static int N, W;\n static int[][] item;\n static long[][] dp;\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n// Reader sc = Reader();\n N = sc.nextInt();\n W = sc.nextInt();\n PrintWriter pw = new PrintWriter(System.out);\n\n item = new int[N+1][2];\n\n for(int i=1; i<=N; ++i) {\n item[i][0] = sc.nextInt();\n item[i][1] = sc.nextInt();\n }\n\n pw.println(Knapsack_1(N, W, item));\n pw.close();\n }\n\n public static void d0(long[][] dp) {\n System.out.print(\" \");\n\n for(int j=0; jb)\n return a;\n\n return b;\n }\n\n public static long Knapsack_1(int N, int W, int[][] item) {\n dp = new long[N+1][W+1];\n\n for(int i=1; i<=N; ++i) {\n for(int w=1; w<=W; ++w) {\n if(item[i][0] <= w) {\n dp[i][w] = Math.max(dp[i-1][w], dp[i-1][w-item[i][0]] + item[i][1]);\n// dp[i][w] = myMax(dp[i-1][w], dp[i-1][w-item[i][0]] + item[i][1]);\n }\n else {\n dp[i][w] = dp[i-1][w];\n }\n }\n }\n\n// d0(dp);\n\n return dp[N][W];\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^5\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^9\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\n5 5\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 2\n\n5000000000\n\nThe answer may not fit into a 32-bit integer type.\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": "p03163", "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^5\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^9\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\n5 5\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 2\n\n5000000000\n\nThe answer may not fit into a 32-bit integer type.\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1815, "cpu_time_ms": 213, "memory_kb": 129108}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s163693077", "group_id": "codeNet:p03163", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int w = scanner.nextInt();\n int[] weights = new int[n];\n int[] values = new int[n];\n\n for (int i = 0; i < n; i++) {\n weights[i] = scanner.nextInt();\n values[i] = scanner.nextInt();\n }\n\n long[][] dp = new long[2][n];\n System.out.println(maxValue(weights, values, dp, w, n - 1));\n }\n\n\n public static long maxValue(int[] weights, int[] values, long[][] dp, int w, int n) {\n\n if (n == -1) {\n return 0;\n }\n\n long rp = -1;\n //放\n if (weights[n] <= w) {\n if (dp[0][n] > 0) {\n rp = dp[0][n];\n } else {\n rp = maxValue(weights, values, dp, w - weights[n], n - 1) + values[n];\n }\n }\n //不放\n long rnp = -1;\n if (dp[1][n] > 0) {\n rnp = dp[1][n];\n }else {\n rnp = maxValue(weights, values, dp, w, n - 1);\n }\n\n if (rp > rnp) {\n dp[0][n] = rp;\n return rp;\n } else {\n dp[1][n] = rnp;\n return rnp;\n }\n }\n}", "language": "Java", "metadata": {"date": 1574095787, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03163.html", "problem_id": "p03163", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03163/input.txt", "sample_output_relpath": "derived/input_output/data/p03163/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03163/Java/s163693077.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s163693077", "user_id": "u713641282"}, "prompt_components": {"gold_output": "90\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int w = scanner.nextInt();\n int[] weights = new int[n];\n int[] values = new int[n];\n\n for (int i = 0; i < n; i++) {\n weights[i] = scanner.nextInt();\n values[i] = scanner.nextInt();\n }\n\n long[][] dp = new long[2][n];\n System.out.println(maxValue(weights, values, dp, w, n - 1));\n }\n\n\n public static long maxValue(int[] weights, int[] values, long[][] dp, int w, int n) {\n\n if (n == -1) {\n return 0;\n }\n\n long rp = -1;\n //放\n if (weights[n] <= w) {\n if (dp[0][n] > 0) {\n rp = dp[0][n];\n } else {\n rp = maxValue(weights, values, dp, w - weights[n], n - 1) + values[n];\n }\n }\n //不放\n long rnp = -1;\n if (dp[1][n] > 0) {\n rnp = dp[1][n];\n }else {\n rnp = maxValue(weights, values, dp, w, n - 1);\n }\n\n if (rp > rnp) {\n dp[0][n] = rp;\n return rp;\n } else {\n dp[1][n] = rnp;\n return rnp;\n }\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^5\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^9\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\n5 5\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 2\n\n5000000000\n\nThe answer may not fit into a 32-bit integer type.\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": "p03163", "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^5\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^9\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\n5 5\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 2\n\n5000000000\n\nThe answer may not fit into a 32-bit integer type.\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1295, "cpu_time_ms": 117, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s407545239", "group_id": "codeNet:p03163", "input_text": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\npublic class Main {\n private static final BufferedReader READER = new BufferedReader(new InputStreamReader(System.in));\n\n private static int getInt() {\n try {\n return Integer.parseInt(READER.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n\n private static int[] getIntArr(int n) {\n int[] ans = new int[n];\n\n StringTokenizer stringTokenizer = null;\n try {\n stringTokenizer = new StringTokenizer(READER.readLine(), \" \");\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n for (int i = 0; i < n && stringTokenizer.hasMoreTokens(); i++) {\n ans[i] = Integer.parseInt(stringTokenizer.nextToken());\n }\n\n return ans;\n }\n\n private static long solve() {\n int[] nw = getIntArr(2);\n int n = nw[0];\n int w = nw[1];\n\n Item[] items = new Item[n];\n for (int i = 0; i < n; i++) {\n items[i] = Item.of(getIntArr(2));\n }\n return solveInternal(n, w, items);\n }\n\n private static long solveInternal(int n, int W, Item[] items) {\n long[][] dp = new long[n + 1][W + 1];\n\n for (int i = 1; i <= n; i++) {\n for (int w = 1; w <= W; w++) {\n Item item = items[i - 1];\n if (item.w > w) {\n dp[i][w] = dp[i - 1][w];\n } else {\n dp[i][w] = Math.max(dp[i - 1][w], dp[i - 1][w - item.w] + item.v);\n }\n }\n }\n\n// for (int i = 0; i <= n; i++) {\n// for (int w = 0; w <= W; w++) {\n// System.out.println(String.format(\"dp[%s,%s]=%s\", i, w, dp[i][w]));\n// }\n// }\n\n return dp[n][W];\n }\n\n\n public static final class Item {\n public final int v;\n public final int w;\n\n private Item(int w, int v) {\n this.v = v;\n this.w = w;\n }\n\n public static Item of(int[] arr) {\n return new Item(arr[0], arr[1]);\n }\n }\n\n public static void main(String... args) {\n System.out.println(solve());\n// System.out.println(\n// solveInternal(6, 5, new Item[]{\n// new Item(1, 1000000000),\n// new Item(1, 1000000000),\n// new Item(1, 1000000000),\n// new Item(1, 1000000000),\n// new Item(1, 1000000000)\n// })\n// );\n }\n}", "language": "Java", "metadata": {"date": 1564626037, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03163.html", "problem_id": "p03163", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03163/input.txt", "sample_output_relpath": "derived/input_output/data/p03163/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03163/Java/s407545239.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s407545239", "user_id": "u201043154"}, "prompt_components": {"gold_output": "90\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\npublic class Main {\n private static final BufferedReader READER = new BufferedReader(new InputStreamReader(System.in));\n\n private static int getInt() {\n try {\n return Integer.parseInt(READER.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n\n private static int[] getIntArr(int n) {\n int[] ans = new int[n];\n\n StringTokenizer stringTokenizer = null;\n try {\n stringTokenizer = new StringTokenizer(READER.readLine(), \" \");\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n for (int i = 0; i < n && stringTokenizer.hasMoreTokens(); i++) {\n ans[i] = Integer.parseInt(stringTokenizer.nextToken());\n }\n\n return ans;\n }\n\n private static long solve() {\n int[] nw = getIntArr(2);\n int n = nw[0];\n int w = nw[1];\n\n Item[] items = new Item[n];\n for (int i = 0; i < n; i++) {\n items[i] = Item.of(getIntArr(2));\n }\n return solveInternal(n, w, items);\n }\n\n private static long solveInternal(int n, int W, Item[] items) {\n long[][] dp = new long[n + 1][W + 1];\n\n for (int i = 1; i <= n; i++) {\n for (int w = 1; w <= W; w++) {\n Item item = items[i - 1];\n if (item.w > w) {\n dp[i][w] = dp[i - 1][w];\n } else {\n dp[i][w] = Math.max(dp[i - 1][w], dp[i - 1][w - item.w] + item.v);\n }\n }\n }\n\n// for (int i = 0; i <= n; i++) {\n// for (int w = 0; w <= W; w++) {\n// System.out.println(String.format(\"dp[%s,%s]=%s\", i, w, dp[i][w]));\n// }\n// }\n\n return dp[n][W];\n }\n\n\n public static final class Item {\n public final int v;\n public final int w;\n\n private Item(int w, int v) {\n this.v = v;\n this.w = w;\n }\n\n public static Item of(int[] arr) {\n return new Item(arr[0], arr[1]);\n }\n }\n\n public static void main(String... args) {\n System.out.println(solve());\n// System.out.println(\n// solveInternal(6, 5, new Item[]{\n// new Item(1, 1000000000),\n// new Item(1, 1000000000),\n// new Item(1, 1000000000),\n// new Item(1, 1000000000),\n// new Item(1, 1000000000)\n// })\n// );\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^5\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^9\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\n5 5\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 2\n\n5000000000\n\nThe answer may not fit into a 32-bit integer type.\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": "p03163", "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^5\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^9\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\n5 5\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 2\n\n5000000000\n\nThe answer may not fit into a 32-bit integer type.\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2683, "cpu_time_ms": 170, "memory_kb": 125780}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s816568999", "group_id": "codeNet:p03163", "input_text": "\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\tstatic FastReader input = new FastReader();\n\tstatic PrintWriter out = new PrintWriter(System.out);\n\n\tstatic int n, w;\n\tstatic int[][] wV;\n\tstatic long[][] memo;\n\tstatic final int _INF = (int)-1e9;\n\t\n\tstatic long solve (int n, int w) {\n\t\t\n\t\tif (n<0) return 0;\n\t\t\n\t\tif (w<0) \n\t\t\treturn _INF;\n\t\t\n\t\n\t\t\n\t\tif (memo[n][w]!=-1) return memo[n][w];\n\t\tlong x = wV[n][1]+solve(n-1, w-wV[n][0]); \n\t\tlong y = solve(n-1, w); \n\t\t\n\t\treturn memo[n][w] = Math.max(x, y);\n\t\t\n\t}\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\n\t\tn = input.nextInt();\n\t\tw = input.nextInt();\n\n\t\twV = new int[n][2];\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\twV[i][0] = input.nextInt();\n\t\t\twV[i][1] = input.nextInt();\n\t\t}\n\n\t\tmemo = new long[n + 5][(int) 1e5 + 100];\n\n\t\tfor (int i = 0; i < memo.length; i++)\n\t\t\tArrays.fill(memo[i], -1);\n\t\t\n\t\t\n\t\tSystem.out.println(solve (n-1,w));\n\t}\n\n\tstatic class FastReader {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\n\t\tpublic FastReader() {\n\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\t}\n\n\t\tString next() throws IOException {\n\t\t\twhile (st == null || !st.hasMoreElements()) {\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tint nextInt() throws NumberFormatException, IOException {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tlong nextLong() throws NumberFormatException, IOException {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tdouble nextDouble() throws NumberFormatException, IOException {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tString nextLine() throws IOException {\n\t\t\tString str = \"\";\n\t\t\tstr = br.readLine();\n\t\t\treturn str;\n\t\t}\n\t}\n}\n", "language": "Java", "metadata": {"date": 1555339387, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03163.html", "problem_id": "p03163", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03163/input.txt", "sample_output_relpath": "derived/input_output/data/p03163/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03163/Java/s816568999.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s816568999", "user_id": "u847890000"}, "prompt_components": {"gold_output": "90\n", "input_to_evaluate": "\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\tstatic FastReader input = new FastReader();\n\tstatic PrintWriter out = new PrintWriter(System.out);\n\n\tstatic int n, w;\n\tstatic int[][] wV;\n\tstatic long[][] memo;\n\tstatic final int _INF = (int)-1e9;\n\t\n\tstatic long solve (int n, int w) {\n\t\t\n\t\tif (n<0) return 0;\n\t\t\n\t\tif (w<0) \n\t\t\treturn _INF;\n\t\t\n\t\n\t\t\n\t\tif (memo[n][w]!=-1) return memo[n][w];\n\t\tlong x = wV[n][1]+solve(n-1, w-wV[n][0]); \n\t\tlong y = solve(n-1, w); \n\t\t\n\t\treturn memo[n][w] = Math.max(x, y);\n\t\t\n\t}\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\n\t\tn = input.nextInt();\n\t\tw = input.nextInt();\n\n\t\twV = new int[n][2];\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\twV[i][0] = input.nextInt();\n\t\t\twV[i][1] = input.nextInt();\n\t\t}\n\n\t\tmemo = new long[n + 5][(int) 1e5 + 100];\n\n\t\tfor (int i = 0; i < memo.length; i++)\n\t\t\tArrays.fill(memo[i], -1);\n\t\t\n\t\t\n\t\tSystem.out.println(solve (n-1,w));\n\t}\n\n\tstatic class FastReader {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\n\t\tpublic FastReader() {\n\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\t}\n\n\t\tString next() throws IOException {\n\t\t\twhile (st == null || !st.hasMoreElements()) {\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tint nextInt() throws NumberFormatException, IOException {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tlong nextLong() throws NumberFormatException, IOException {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tdouble nextDouble() throws NumberFormatException, IOException {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tString nextLine() throws IOException {\n\t\t\tString str = \"\";\n\t\t\tstr = br.readLine();\n\t\t\treturn str;\n\t\t}\n\t}\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^5\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^9\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\n5 5\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 2\n\n5000000000\n\nThe answer may not fit into a 32-bit integer type.\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": "p03163", "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^5\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^9\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\n5 5\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 2\n\n5000000000\n\nThe answer may not fit into a 32-bit integer type.\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1828, "cpu_time_ms": 274, "memory_kb": 126548}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s139683965", "group_id": "codeNet:p03163", "input_text": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\nimport java.io.IOException;\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastScanner in = new FastScanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n D solver = new D();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class D {\n public void solve(int testNumber, FastScanner in, PrintWriter out) {\n int n = in.ni(), W = in.ni();\n int[] w = new int[n];\n int[] v = new int[n];\n for (int i = 0; i < n; i++) {\n w[i] = in.ni();\n v[i] = in.ni();\n }\n long[][] dp = new long[n + 1][W + 1];\n for (int i = 0; i < n; i++) {\n for (int ww = 0; ww < W; ww++) {\n dp[i + 1][ww] = Math.max(dp[i + 1][ww], dp[i][ww]);\n if (ww + w[i] <= W)\n dp[i + 1][ww + w[i]] = Math.max(dp[i + 1][ww + w[i]], dp[i][ww] + v[i]);\n }\n }\n long max = 0;\n for (int ww = 0; ww <= W; ww++) {\n max = Math.max(max, dp[n][ww]);\n }\n out.println(max);\n\n }\n\n }\n\n static class FastScanner {\n private BufferedReader in;\n private StringTokenizer st;\n\n public FastScanner(InputStream stream) {\n in = new BufferedReader(new InputStreamReader(stream));\n }\n\n public String ns() {\n while (st == null || !st.hasMoreTokens()) {\n try {\n String rl = in.readLine();\n if (rl == null) {\n return null;\n }\n st = new StringTokenizer(rl);\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return st.nextToken();\n }\n\n public int ni() {\n return Integer.parseInt(ns());\n }\n\n }\n}\n\n", "language": "Java", "metadata": {"date": 1548023243, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03163.html", "problem_id": "p03163", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03163/input.txt", "sample_output_relpath": "derived/input_output/data/p03163/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03163/Java/s139683965.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s139683965", "user_id": "u299670417"}, "prompt_components": {"gold_output": "90\n", "input_to_evaluate": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\nimport java.io.IOException;\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastScanner in = new FastScanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n D solver = new D();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class D {\n public void solve(int testNumber, FastScanner in, PrintWriter out) {\n int n = in.ni(), W = in.ni();\n int[] w = new int[n];\n int[] v = new int[n];\n for (int i = 0; i < n; i++) {\n w[i] = in.ni();\n v[i] = in.ni();\n }\n long[][] dp = new long[n + 1][W + 1];\n for (int i = 0; i < n; i++) {\n for (int ww = 0; ww < W; ww++) {\n dp[i + 1][ww] = Math.max(dp[i + 1][ww], dp[i][ww]);\n if (ww + w[i] <= W)\n dp[i + 1][ww + w[i]] = Math.max(dp[i + 1][ww + w[i]], dp[i][ww] + v[i]);\n }\n }\n long max = 0;\n for (int ww = 0; ww <= W; ww++) {\n max = Math.max(max, dp[n][ww]);\n }\n out.println(max);\n\n }\n\n }\n\n static class FastScanner {\n private BufferedReader in;\n private StringTokenizer st;\n\n public FastScanner(InputStream stream) {\n in = new BufferedReader(new InputStreamReader(stream));\n }\n\n public String ns() {\n while (st == null || !st.hasMoreTokens()) {\n try {\n String rl = in.readLine();\n if (rl == null) {\n return null;\n }\n st = new StringTokenizer(rl);\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return st.nextToken();\n }\n\n public int ni() {\n return Integer.parseInt(ns());\n }\n\n }\n}\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^5\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^9\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\n5 5\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 2\n\n5000000000\n\nThe answer may not fit into a 32-bit integer type.\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": "p03163", "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^5\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^9\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\n5 5\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 2\n\n5000000000\n\nThe answer may not fit into a 32-bit integer type.\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2386, "cpu_time_ms": 269, "memory_kb": 126548}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s147934262", "group_id": "codeNet:p03163", "input_text": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n\n int N = scanner.nextInt();\n int W = scanner.nextInt();\n int[] w = new int[N + 1];\n int[] v = new int[N + 1];\n for (int i = 1; i <= N; i++) {\n w[i] = scanner.nextInt();\n v[i] = scanner.nextInt();\n }\n\n long[][] dp = new long[N + 1][W + 1];\n for (int i = 1; i <= N; i++) {\n for (int j = 1; j <= W; j++) {\n dp[i][j] = dp[i - 1][j];\n if (j >= w[i]) dp[i][j] = Math.max(dp[i][j], dp[i - 1][j - w[i]] + v[i]);\n }\n }\n System.out.println(dp[N][W]);\n }\n}\n", "language": "Java", "metadata": {"date": 1546807363, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03163.html", "problem_id": "p03163", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03163/input.txt", "sample_output_relpath": "derived/input_output/data/p03163/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03163/Java/s147934262.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s147934262", "user_id": "u189832798"}, "prompt_components": {"gold_output": "90\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n\n int N = scanner.nextInt();\n int W = scanner.nextInt();\n int[] w = new int[N + 1];\n int[] v = new int[N + 1];\n for (int i = 1; i <= N; i++) {\n w[i] = scanner.nextInt();\n v[i] = scanner.nextInt();\n }\n\n long[][] dp = new long[N + 1][W + 1];\n for (int i = 1; i <= N; i++) {\n for (int j = 1; j <= W; j++) {\n dp[i][j] = dp[i - 1][j];\n if (j >= w[i]) dp[i][j] = Math.max(dp[i][j], dp[i - 1][j - w[i]] + v[i]);\n }\n }\n System.out.println(dp[N][W]);\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^5\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^9\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\n5 5\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 2\n\n5000000000\n\nThe answer may not fit into a 32-bit integer type.\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": "p03163", "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^5\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^9\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\n5 5\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 2\n\n5000000000\n\nThe answer may not fit into a 32-bit integer type.\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 209, "memory_kb": 127316}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s824442646", "group_id": "codeNet:p03165", "input_text": "import java.io.*;\nimport java.util.*;\nimport java.math.*;\nimport java.math.BigInteger;\nclass Main\n{ \n public static void main(String args[])\n {\n StringBuilder ans=new StringBuilder();\n FastReader in=new FastReader(); \n String X=in.next();\n String Y=in.next();\n int n=X.length();\n int m=Y.length();\n int dp[][]=new int[n+1][m+1];\n for(int i=0; i<=n; i++)\n {\n for(int j=0; j<=m; j++)\n {\n if(i==0 || j==0)dp[i][j]=0;\n else\n {\n if(X.charAt(i-1)==Y.charAt(j-1))dp[i][j]=1+dp[i-1][j-1];\n else dp[i][j]=Math.max(dp[i-1][j],dp[i][j-1]);\n }\n \n }//System.out.println();\n }\n for(int i=0; i=1||j>=1)\n {\n \t if(i>=1&&j>=1&&s1.charAt(i-1)==s2.charAt(j-1)&&dp[i][j]==dp[i-1][j-1]+1)\n \t {\n \t \t ans = ans + s1.charAt(i-1);\n \t }\n\n \t if(i>=0&&j>=1&&dp[i][j]==dp[i][j-1])\n \t {\n j=j-1;\n \t }\n \t else\n \t {\n i=i-1;\n \t }\n \t \n }\n StringBuilder str = new StringBuilder();\n str.append(ans);\n\n System.out.println(str.reverse());\n \t}\n}", "language": "Java", "metadata": {"date": 1599431186, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p03165.html", "problem_id": "p03165", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03165/input.txt", "sample_output_relpath": "derived/input_output/data/p03165/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03165/Java/s344678863.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s344678863", "user_id": "u901700332"}, "prompt_components": {"gold_output": "axb\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main\n{\n\tpublic static void main(String[] args)\n\t{\n\t\tScanner sc = new Scanner(System.in);\n\t\tString s1 = sc.next();\n\t\tString s2 = sc.next();\n\n\t\tint[][] dp = new int[s1.length()+1][s2.length()+1];\n\n\t\tfor(int i=1;i<=s1.length();i++)\n\t\t{\n\t\t\tfor(int j=1;j<=s2.length();j++)\n\t\t\t{\n\t\t\t\tdp[i][j] = Math.max(dp[i-1][j],dp[i][j-1]);\n\n\t\t\t\t\tif(s1.charAt(i-1)==s2.charAt(j-1))\n\t\t\t\t\t{\n\t\t\t\t\t\tdp[i][j] = 1 + dp[i-1][j-1];\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t}\n\t\t}\n \n \n\n String ans = \"\";\n int i =dp.length-1;\n int j =dp[0].length-1;\n\n while(i>=1||j>=1)\n {\n \t if(i>=1&&j>=1&&s1.charAt(i-1)==s2.charAt(j-1)&&dp[i][j]==dp[i-1][j-1]+1)\n \t {\n \t \t ans = ans + s1.charAt(i-1);\n \t }\n\n \t if(i>=0&&j>=1&&dp[i][j]==dp[i][j-1])\n \t {\n j=j-1;\n \t }\n \t else\n \t {\n i=i-1;\n \t }\n \t \n }\n StringBuilder str = new StringBuilder();\n str.append(ans);\n\n System.out.println(str.reverse());\n \t}\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given strings s and t.\nFind one longest string that is a subsequence of both s and t.\n\nNotes\n\nA subsequence of a string x is the string obtained by removing zero or more characters from x and concatenating the remaining characters without changing the order.\n\nConstraints\n\ns and t are strings consisting of lowercase English letters.\n\n1 \\leq |s|, |t| \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nPrint one longest string that is a subsequence of both s and t.\nIf there are multiple such strings, any of them will be accepted.\n\nSample Input 1\n\naxyb\nabyxb\n\nSample Output 1\n\naxb\n\nThe answer is axb or ayb; either will be accepted.\n\nSample Input 2\n\naa\nxayaz\n\nSample Output 2\n\naa\n\nSample Input 3\n\na\nz\n\nSample Output 3\n\nThe answer is (an empty string).\n\nSample Input 4\n\nabracadabra\navadakedavra\n\nSample Output 4\n\naaadara", "sample_input": "axyb\nabyxb\n"}, "reference_outputs": ["axb\n"], "source_document_id": "p03165", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given strings s and t.\nFind one longest string that is a subsequence of both s and t.\n\nNotes\n\nA subsequence of a string x is the string obtained by removing zero or more characters from x and concatenating the remaining characters without changing the order.\n\nConstraints\n\ns and t are strings consisting of lowercase English letters.\n\n1 \\leq |s|, |t| \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nPrint one longest string that is a subsequence of both s and t.\nIf there are multiple such strings, any of them will be accepted.\n\nSample Input 1\n\naxyb\nabyxb\n\nSample Output 1\n\naxb\n\nThe answer is axb or ayb; either will be accepted.\n\nSample Input 2\n\naa\nxayaz\n\nSample Output 2\n\naa\n\nSample Input 3\n\na\nz\n\nSample Output 3\n\nThe answer is (an empty string).\n\nSample Input 4\n\nabracadabra\navadakedavra\n\nSample Output 4\n\naaadara", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1027, "cpu_time_ms": 303, "memory_kb": 93008}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s313613704", "group_id": "codeNet:p03165", "input_text": "import javax.swing.*;\nimport java.io.*;\nimport java.math.BigInteger;\nimport java.util.*;\n\n\npublic class Main {\n static PrintWriter out = new PrintWriter(System.out);\n static long[] tree;\n static int m = 100000000;\n static int k1,k2;\n static boolean[] vis;\n static tuple[] tuples;\n static char[] a,b;\n public static void main(String[] args) throws IOException {\n //BufferedReader reader=new BufferedReader(new FileReader(\"input.txt\"));\n //PrintWriter pw=new PrintWriter(new BufferedWriter(new FileWriter(\"output.txt\")));\n BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));\n //Scanner sc=new Scanner(System.in);\n //Reader sc = new Reader();\n //String[] in=reader.readLine().split(\" \");\n\n a=reader.readLine().toCharArray();\n b=reader.readLine().toCharArray();\n int[][] dp=new int[a.length+1][b.length+1];\n for (int i = 1; i <=a.length ; i++) {\n for (int j = 1; j <=b.length ; j++) {\n if (a[i-1]==b[j-1])\n dp[i][j]=dp[i-1][j-1]+1;\n else\n dp[i][j]=Math.max(dp[i-1][j],dp[i][j-1]);\n }\n }\n int i=a.length,j=b.length;\n //System.out.println(Arrays.deepToString(dp));\n //StringBuilder ans=new StringBuilder(\"\");\n StringBuilder ans= new StringBuilder();\n while (i>0 && j>0){\n if (dp[i][j]==dp[i-1][j]){\n i--;\n }\n else if (dp[i][j]==dp[i][j-1]){\n j--;\n }\n else{\n ans.append(a[i - 1]);\n i--;\n j--;\n }\n }\n System.out.println(ans.reverse());\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n out.close();\n }\n static Integer[][] memo ;\n static int lcs(int i,int j){\n if (i==a.length || j==b.length)\n return 0;\n else if (memo[i][j]!=null)return memo[i][j];\n else if (a[i]==b[j])\n return memo[i][j]=1+lcs(i+1,j+1);\n else\n return Math.max(lcs(i+1,j),lcs(i,j+1));\n }\n\n\n\n static boolean bfs(int a,int b){\n Queue queue=new LinkedList<>();\n queue.add(a);\n\n while (!queue.isEmpty()){\n int now=queue.poll();\n vis[now]=true;\n\n for (int i = 0; i r)return;\n\n if (l==r){\n tree[at]=v;\n }\n else {\n int mid=(l+r)/2;\n int right=2*at;\n int left=(2*at)+1;\n update(left,l,mid,i,v,n-1);\n update(right,mid+1,r,i,v,n-1);\n if (n%2==0)\n tree[at]=tree[left]^tree[right];\n else\n tree[at]=tree[left]|tree[right];\n }\n }\n\n\n\n\n}\n\n class node implements Comparable {\n Integer no;\n Integer cost;\n Vector adj = new Vector<>();\n\n public node(Integer no, Integer cost) {\n this.no = no;\n this.cost = cost;\n }\n\n @Override\n public String toString() {\n return \"node{\" +\n \"no=\" + no +\n \", cost=\" + cost +\n '}';\n }\n\n @Override\n public int compareTo(node o) {\n return o.cost - this.cost;\n }\n }\n\n class edge implements Comparable {\n tuple u;\n Double cost;\n\n public edge(tuple u, Double cost) {\n this.u = u;\n this.cost = cost;\n }\n\n @Override\n public int compareTo(edge o) {\n return this.cost.compareTo(o.cost);\n }\n\n @Override\n public String toString() {\n return \"edge{\" +\n \"u=\" + u +\n \", cost=\" + cost +\n '}';\n }\n }\n\n ///*\n class tuple implements Comparable {\n Integer a;\n Integer b;\n\n public tuple(Integer a, Integer b) {\n this.a = a;\n this.b = b;\n }\n\n @Override\n public int compareTo(tuple o) {\n return (int) (this.b - o.b);\n }\n\n @Override\n public String toString() {\n return \"tuple{\" +\n \"a=\" + a +\n \", b=\" + b +\n '}';\n }\n }\n\n\n //*/\n class Reader {\n final private int BUFFER_SIZE = 1 << 16;\n private DataInputStream din;\n private byte[] buffer;\n private int bufferPointer, bytesRead;\n\n public Reader() {\n din = new DataInputStream(System.in);\n buffer = new byte[BUFFER_SIZE];\n bufferPointer = bytesRead = 0;\n }\n\n public Reader(String file_name) throws IOException {\n din = new DataInputStream(new FileInputStream(file_name));\n buffer = new byte[BUFFER_SIZE];\n bufferPointer = bytesRead = 0;\n }\n\n public String readLine() throws IOException {\n byte[] buf = new byte[64];\n int cnt = 0, c;\n while ((c = read()) != -1) {\n if (c == '\\n') break;\n buf[cnt++] = (byte) c;\n }\n return new String(buf, 0, cnt);\n }\n\n public int nextInt() throws IOException {\n int ret = 0;\n byte c = read();\n while (c <= ' ') c = read();\n boolean neg = (c == '-');\n if (neg) c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (neg) return -ret;\n return ret;\n }\n\n public long nextLong() throws IOException {\n long ret = 0;\n byte c = read();\n while (c <= ' ') c = read();\n boolean neg = (c == '-');\n if (neg) c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (neg) return -ret;\n return ret;\n }\n\n public double nextDouble() throws IOException {\n double ret = 0, div = 1;\n byte c = read();\n while (c <= ' ') c = read();\n boolean neg = (c == '-');\n if (neg) c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (c == '.') while ((c = read()) >= '0' && c <= '9') ret += (c - '0') / (div *= 10);\n if (neg) return -ret;\n return ret;\n }\n\n private void fillBuffer() throws IOException {\n bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);\n if (bytesRead == -1) buffer[0] = -1;\n }\n\n private byte read() throws IOException {\n if (bufferPointer == bytesRead) fillBuffer();\n return buffer[bufferPointer++];\n }\n\n public void close() throws IOException {\n if (din == null) return;\n din.close();\n }\n }", "language": "Java", "metadata": {"date": 1596129184, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p03165.html", "problem_id": "p03165", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03165/input.txt", "sample_output_relpath": "derived/input_output/data/p03165/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03165/Java/s313613704.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s313613704", "user_id": "u825102492"}, "prompt_components": {"gold_output": "axb\n", "input_to_evaluate": "import javax.swing.*;\nimport java.io.*;\nimport java.math.BigInteger;\nimport java.util.*;\n\n\npublic class Main {\n static PrintWriter out = new PrintWriter(System.out);\n static long[] tree;\n static int m = 100000000;\n static int k1,k2;\n static boolean[] vis;\n static tuple[] tuples;\n static char[] a,b;\n public static void main(String[] args) throws IOException {\n //BufferedReader reader=new BufferedReader(new FileReader(\"input.txt\"));\n //PrintWriter pw=new PrintWriter(new BufferedWriter(new FileWriter(\"output.txt\")));\n BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));\n //Scanner sc=new Scanner(System.in);\n //Reader sc = new Reader();\n //String[] in=reader.readLine().split(\" \");\n\n a=reader.readLine().toCharArray();\n b=reader.readLine().toCharArray();\n int[][] dp=new int[a.length+1][b.length+1];\n for (int i = 1; i <=a.length ; i++) {\n for (int j = 1; j <=b.length ; j++) {\n if (a[i-1]==b[j-1])\n dp[i][j]=dp[i-1][j-1]+1;\n else\n dp[i][j]=Math.max(dp[i-1][j],dp[i][j-1]);\n }\n }\n int i=a.length,j=b.length;\n //System.out.println(Arrays.deepToString(dp));\n //StringBuilder ans=new StringBuilder(\"\");\n StringBuilder ans= new StringBuilder();\n while (i>0 && j>0){\n if (dp[i][j]==dp[i-1][j]){\n i--;\n }\n else if (dp[i][j]==dp[i][j-1]){\n j--;\n }\n else{\n ans.append(a[i - 1]);\n i--;\n j--;\n }\n }\n System.out.println(ans.reverse());\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n out.close();\n }\n static Integer[][] memo ;\n static int lcs(int i,int j){\n if (i==a.length || j==b.length)\n return 0;\n else if (memo[i][j]!=null)return memo[i][j];\n else if (a[i]==b[j])\n return memo[i][j]=1+lcs(i+1,j+1);\n else\n return Math.max(lcs(i+1,j),lcs(i,j+1));\n }\n\n\n\n static boolean bfs(int a,int b){\n Queue queue=new LinkedList<>();\n queue.add(a);\n\n while (!queue.isEmpty()){\n int now=queue.poll();\n vis[now]=true;\n\n for (int i = 0; i r)return;\n\n if (l==r){\n tree[at]=v;\n }\n else {\n int mid=(l+r)/2;\n int right=2*at;\n int left=(2*at)+1;\n update(left,l,mid,i,v,n-1);\n update(right,mid+1,r,i,v,n-1);\n if (n%2==0)\n tree[at]=tree[left]^tree[right];\n else\n tree[at]=tree[left]|tree[right];\n }\n }\n\n\n\n\n}\n\n class node implements Comparable {\n Integer no;\n Integer cost;\n Vector adj = new Vector<>();\n\n public node(Integer no, Integer cost) {\n this.no = no;\n this.cost = cost;\n }\n\n @Override\n public String toString() {\n return \"node{\" +\n \"no=\" + no +\n \", cost=\" + cost +\n '}';\n }\n\n @Override\n public int compareTo(node o) {\n return o.cost - this.cost;\n }\n }\n\n class edge implements Comparable {\n tuple u;\n Double cost;\n\n public edge(tuple u, Double cost) {\n this.u = u;\n this.cost = cost;\n }\n\n @Override\n public int compareTo(edge o) {\n return this.cost.compareTo(o.cost);\n }\n\n @Override\n public String toString() {\n return \"edge{\" +\n \"u=\" + u +\n \", cost=\" + cost +\n '}';\n }\n }\n\n ///*\n class tuple implements Comparable {\n Integer a;\n Integer b;\n\n public tuple(Integer a, Integer b) {\n this.a = a;\n this.b = b;\n }\n\n @Override\n public int compareTo(tuple o) {\n return (int) (this.b - o.b);\n }\n\n @Override\n public String toString() {\n return \"tuple{\" +\n \"a=\" + a +\n \", b=\" + b +\n '}';\n }\n }\n\n\n //*/\n class Reader {\n final private int BUFFER_SIZE = 1 << 16;\n private DataInputStream din;\n private byte[] buffer;\n private int bufferPointer, bytesRead;\n\n public Reader() {\n din = new DataInputStream(System.in);\n buffer = new byte[BUFFER_SIZE];\n bufferPointer = bytesRead = 0;\n }\n\n public Reader(String file_name) throws IOException {\n din = new DataInputStream(new FileInputStream(file_name));\n buffer = new byte[BUFFER_SIZE];\n bufferPointer = bytesRead = 0;\n }\n\n public String readLine() throws IOException {\n byte[] buf = new byte[64];\n int cnt = 0, c;\n while ((c = read()) != -1) {\n if (c == '\\n') break;\n buf[cnt++] = (byte) c;\n }\n return new String(buf, 0, cnt);\n }\n\n public int nextInt() throws IOException {\n int ret = 0;\n byte c = read();\n while (c <= ' ') c = read();\n boolean neg = (c == '-');\n if (neg) c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (neg) return -ret;\n return ret;\n }\n\n public long nextLong() throws IOException {\n long ret = 0;\n byte c = read();\n while (c <= ' ') c = read();\n boolean neg = (c == '-');\n if (neg) c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (neg) return -ret;\n return ret;\n }\n\n public double nextDouble() throws IOException {\n double ret = 0, div = 1;\n byte c = read();\n while (c <= ' ') c = read();\n boolean neg = (c == '-');\n if (neg) c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (c == '.') while ((c = read()) >= '0' && c <= '9') ret += (c - '0') / (div *= 10);\n if (neg) return -ret;\n return ret;\n }\n\n private void fillBuffer() throws IOException {\n bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);\n if (bytesRead == -1) buffer[0] = -1;\n }\n\n private byte read() throws IOException {\n if (bufferPointer == bytesRead) fillBuffer();\n return buffer[bufferPointer++];\n }\n\n public void close() throws IOException {\n if (din == null) return;\n din.close();\n }\n }", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given strings s and t.\nFind one longest string that is a subsequence of both s and t.\n\nNotes\n\nA subsequence of a string x is the string obtained by removing zero or more characters from x and concatenating the remaining characters without changing the order.\n\nConstraints\n\ns and t are strings consisting of lowercase English letters.\n\n1 \\leq |s|, |t| \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nPrint one longest string that is a subsequence of both s and t.\nIf there are multiple such strings, any of them will be accepted.\n\nSample Input 1\n\naxyb\nabyxb\n\nSample Output 1\n\naxb\n\nThe answer is axb or ayb; either will be accepted.\n\nSample Input 2\n\naa\nxayaz\n\nSample Output 2\n\naa\n\nSample Input 3\n\na\nz\n\nSample Output 3\n\nThe answer is (an empty string).\n\nSample Input 4\n\nabracadabra\navadakedavra\n\nSample Output 4\n\naaadara", "sample_input": "axyb\nabyxb\n"}, "reference_outputs": ["axb\n"], "source_document_id": "p03165", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given strings s and t.\nFind one longest string that is a subsequence of both s and t.\n\nNotes\n\nA subsequence of a string x is the string obtained by removing zero or more characters from x and concatenating the remaining characters without changing the order.\n\nConstraints\n\ns and t are strings consisting of lowercase English letters.\n\n1 \\leq |s|, |t| \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nPrint one longest string that is a subsequence of both s and t.\nIf there are multiple such strings, any of them will be accepted.\n\nSample Input 1\n\naxyb\nabyxb\n\nSample Output 1\n\naxb\n\nThe answer is axb or ayb; either will be accepted.\n\nSample Input 2\n\naa\nxayaz\n\nSample Output 2\n\naa\n\nSample Input 3\n\na\nz\n\nSample Output 3\n\nThe answer is (an empty string).\n\nSample Input 4\n\nabracadabra\navadakedavra\n\nSample Output 4\n\naaadara", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 8257, "cpu_time_ms": 170, "memory_kb": 83628}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s599148328", "group_id": "codeNet:p03165", "input_text": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n static PrintWriter pw;\n static Scanner sc;\n static int inf=(int)1e9;\n static String a, b;\n static int[] arr;\n static int[][] dp;\n static HashMap map= new HashMap();\n static long ceildiv(long x, long y){ return (x+y-1)/y;}\n public static void main(String[] args) throws Exception {\n sc = new Scanner(System.in);\n pw = new PrintWriter(System.out);\n a=sc.nextLine(); b=sc.nextLine();\n dp=new int[a.length()][b.length()];\n for(int i=0; idp[i][j+1])\n i++;\n else\n j++;\n }else if(i!=a.length()-1){\n i++;\n }else if(j!=b.length()-1){\n j++;\n }else{\n break;\n }\n }\n }\n pw.println(ans);\n }\n static boolean test(char[][] arr){\n for(int i=1; i{\n int x;\n int y;\n public Pair(int x, int y) {\n this.x=x;\n this.y=y;\n }\n public int hashCode() {\n return this.x*1000+this.y;\n }\n public int compareTo(Pair p) {\n int st1=p.x==0?arr[p.y+1]:arr[p.x-1];\n int end1=p.y==arr.length-1?arr[p.x-1]:arr[p.y+1];\n int st2=this.x==0?arr[this.y+1]:arr[this.x-1];\n int end2=this.y==arr.length-1?arr[this.x-1]:arr[this.y+1];\n int a=st1%2==end1%2?1:0;\n int b=st2%2==end2%2?1:0;\n if(a>b)\n return 1;\n if(a{\n int x;\n int y;\n char c;\n public Triple(int x, int y, char c){\n this.x=x;\n this.y=y;\n this.c=c;\n }\n public int compareTo(Triple t){\n return this.y-t.y;\n }\n public String toString(){\n if(this.x==1)\n return \"INSERT \"+(this.y+1)+\" \"+this.c;\n else if(this.x==0)\n return \"REPLACE \"+(this.y+1)+\" \"+this.c;\n else\n return \"DELETE \"+(this.y+1);\n }\n }\n static class decimal{\n int x;\n int dec;\n public decimal(String s){\n x=Integer.parseInt(s.substring(0, s.length()-3));\n dec=Integer.parseInt(s.substring(s.length()-2));\n }\n public decimal(int x, int dec){\n this.x=x;\n this.dec=dec;\n }\n public decimal plus(decimal a){\n return new decimal(this.x+a.x+(this.dec+a.dec)/100, (this.dec+a.dec)%100);\n }\n public decimal minus(decimal a){\n return new decimal(this.x-a.x-(this.dec>=a.dec?0:1), (this.dec+100-a.dec)%100);\n }\n public decimal min(decimal a){\n if(a.x>this.x)\n return this;\n if(this.x>a.x)\n return a;\n if(a.dec>this.dec)\n return this;\n return a;\n }\n public String toString(){\n return this.x+\".\"+this.dec;\n }\n public decimal clone(){\n return new decimal(this.x, this.dec);\n }\n public boolean equal(decimal a){\n return a.x==this.x && a.dec==this.dec;\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1595955936, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03165.html", "problem_id": "p03165", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03165/input.txt", "sample_output_relpath": "derived/input_output/data/p03165/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03165/Java/s599148328.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s599148328", "user_id": "u353919145"}, "prompt_components": {"gold_output": "axb\n", "input_to_evaluate": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n static PrintWriter pw;\n static Scanner sc;\n static int inf=(int)1e9;\n static String a, b;\n static int[] arr;\n static int[][] dp;\n static HashMap map= new HashMap();\n static long ceildiv(long x, long y){ return (x+y-1)/y;}\n public static void main(String[] args) throws Exception {\n sc = new Scanner(System.in);\n pw = new PrintWriter(System.out);\n a=sc.nextLine(); b=sc.nextLine();\n dp=new int[a.length()][b.length()];\n for(int i=0; idp[i][j+1])\n i++;\n else\n j++;\n }else if(i!=a.length()-1){\n i++;\n }else if(j!=b.length()-1){\n j++;\n }else{\n break;\n }\n }\n }\n pw.println(ans);\n }\n static boolean test(char[][] arr){\n for(int i=1; i{\n int x;\n int y;\n public Pair(int x, int y) {\n this.x=x;\n this.y=y;\n }\n public int hashCode() {\n return this.x*1000+this.y;\n }\n public int compareTo(Pair p) {\n int st1=p.x==0?arr[p.y+1]:arr[p.x-1];\n int end1=p.y==arr.length-1?arr[p.x-1]:arr[p.y+1];\n int st2=this.x==0?arr[this.y+1]:arr[this.x-1];\n int end2=this.y==arr.length-1?arr[this.x-1]:arr[this.y+1];\n int a=st1%2==end1%2?1:0;\n int b=st2%2==end2%2?1:0;\n if(a>b)\n return 1;\n if(a{\n int x;\n int y;\n char c;\n public Triple(int x, int y, char c){\n this.x=x;\n this.y=y;\n this.c=c;\n }\n public int compareTo(Triple t){\n return this.y-t.y;\n }\n public String toString(){\n if(this.x==1)\n return \"INSERT \"+(this.y+1)+\" \"+this.c;\n else if(this.x==0)\n return \"REPLACE \"+(this.y+1)+\" \"+this.c;\n else\n return \"DELETE \"+(this.y+1);\n }\n }\n static class decimal{\n int x;\n int dec;\n public decimal(String s){\n x=Integer.parseInt(s.substring(0, s.length()-3));\n dec=Integer.parseInt(s.substring(s.length()-2));\n }\n public decimal(int x, int dec){\n this.x=x;\n this.dec=dec;\n }\n public decimal plus(decimal a){\n return new decimal(this.x+a.x+(this.dec+a.dec)/100, (this.dec+a.dec)%100);\n }\n public decimal minus(decimal a){\n return new decimal(this.x-a.x-(this.dec>=a.dec?0:1), (this.dec+100-a.dec)%100);\n }\n public decimal min(decimal a){\n if(a.x>this.x)\n return this;\n if(this.x>a.x)\n return a;\n if(a.dec>this.dec)\n return this;\n return a;\n }\n public String toString(){\n return this.x+\".\"+this.dec;\n }\n public decimal clone(){\n return new decimal(this.x, this.dec);\n }\n public boolean equal(decimal a){\n return a.x==this.x && a.dec==this.dec;\n }\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given strings s and t.\nFind one longest string that is a subsequence of both s and t.\n\nNotes\n\nA subsequence of a string x is the string obtained by removing zero or more characters from x and concatenating the remaining characters without changing the order.\n\nConstraints\n\ns and t are strings consisting of lowercase English letters.\n\n1 \\leq |s|, |t| \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nPrint one longest string that is a subsequence of both s and t.\nIf there are multiple such strings, any of them will be accepted.\n\nSample Input 1\n\naxyb\nabyxb\n\nSample Output 1\n\naxb\n\nThe answer is axb or ayb; either will be accepted.\n\nSample Input 2\n\naa\nxayaz\n\nSample Output 2\n\naa\n\nSample Input 3\n\na\nz\n\nSample Output 3\n\nThe answer is (an empty string).\n\nSample Input 4\n\nabracadabra\navadakedavra\n\nSample Output 4\n\naaadara", "sample_input": "axyb\nabyxb\n"}, "reference_outputs": ["axb\n"], "source_document_id": "p03165", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given strings s and t.\nFind one longest string that is a subsequence of both s and t.\n\nNotes\n\nA subsequence of a string x is the string obtained by removing zero or more characters from x and concatenating the remaining characters without changing the order.\n\nConstraints\n\ns and t are strings consisting of lowercase English letters.\n\n1 \\leq |s|, |t| \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nPrint one longest string that is a subsequence of both s and t.\nIf there are multiple such strings, any of them will be accepted.\n\nSample Input 1\n\naxyb\nabyxb\n\nSample Output 1\n\naxb\n\nThe answer is axb or ayb; either will be accepted.\n\nSample Input 2\n\naa\nxayaz\n\nSample Output 2\n\naa\n\nSample Input 3\n\na\nz\n\nSample Output 3\n\nThe answer is (an empty string).\n\nSample Input 4\n\nabracadabra\navadakedavra\n\nSample Output 4\n\naaadara", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 7775, "cpu_time_ms": 360, "memory_kb": 77996}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s777470618", "group_id": "codeNet:p03165", "input_text": "import java.util.*; \nimport java.io.*;\n\npublic class Main {\t\n\tstatic int dp[][] = new int[3005][3006]; \n\tstatic String ans = \"\";\n\tpublic static int lcs(char p[] , char s[] , int n , int m) {\n\t\tif(n == 0 || m == 0) \n\t\t\treturn 0; \n\t\t\n\t\tif(dp[n][m] != -1) return dp[n][m];\n\t\t\n\t\telse if(p[n-1] == s[m-1]) {\n\t\t\treturn dp[n][m] = 1 + lcs(p , s , n-1 , m-1);\n\t\t}\n\t\t\t \n\t\tint temp1 = lcs(p , s , n-1 , m);\n\t\tint temp2 = lcs(p , s , n , m-1); \n\t\treturn dp[n][m] = Math.max(temp1, temp2); \n\t}\n\tpublic static void pr(char p[] , char s[] ,int n , int m) {\n\t\tif(n<=0 || m <= 0)\n\t\t\treturn;\n\t\tif(p[n-1] == s[m-1]) {\n\t\t\tans = p[n-1] + ans; \n\t\t\tpr(p,s,n-1,m-1); \n\t\t}\n\t\telse if(dp[n-1][m] > dp[n][m-1])\n\t\t\tpr(p,s,n-1,m); \n\t\telse\n\t\t\tpr(p,s,n,m-1); \n\t}\n\tpublic static void solve(InputReader in) {\n\t\tchar p[] = in.readString().toCharArray(); \n\t\tchar s[] = in.readString().toCharArray(); \n\t\tint n = p.length , m = s.length; \n\t\tfor(int i = 0; i<3005; i++) {\n\t\t\tfor(int j = 0; j<3006; j++) {\n\t\t\t\tdp[i][j] = -1; \n\t\t\t}\n\t\t}\n\t\tlcs(p,s,n,m); \n\t\tpr(p,s,n,m);\n\t\tSystem.out.println(ans); \n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\tInputReader in = new InputReader(System.in); \n\t\tint t = 1; \n\t\twhile(t-- > 0) {\n\t\t\tsolve(in); \n\t\t}\n\t}\n}\n\nclass InputReader{\n\tprivate InputStream stream;\n\tprivate byte[] buf = new byte[1024];\n\tprivate int curChar;\n\tprivate int numChars;\n\tprivate SpaceCharFilter filter;\n\n\t public InputReader(InputStream stream) {\n\t\tthis.stream = stream;\n\t}\n\n public int read() {\n\t\tif (numChars == -1)\n\t\t\tthrow new InputMismatchException();\n\t\tif (curChar >= numChars) {\n\t\t\tcurChar = 0;\n\t\t\ttry {\n\t\t\t\tnumChars = stream.read(buf);\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new InputMismatchException();\n\t\t\t}\n\t\t\tif (numChars <= 0)\n\t\t\t\treturn -1;\n\t\t}\n\t\treturn buf[curChar++];\n\t}\n\n public int readInt() {\n\t\tint c = read();\n\t\twhile (isSpaceChar(c))\n\t\t\tc = read();\n\t\tint sgn = 1;\n\t\tif (c == '-') {\n\t\t\tsgn = -1;\n\t\t\tc = read();\n\t\t}\n\t\tint res = 0;\n\t\tdo {\n\t\t\tif (c < '0' || c > '9')\n\t\t\t\tthrow new InputMismatchException();\n\t\t\tres *= 10;\n\t\t\tres += c - '0';\n\t\t\tc = read();\n\t\t} while (!isSpaceChar(c));\n\t\treturn res * sgn;\n\t}\n\n public String readString() {\n\t\tint c = read();\n\t\twhile (isSpaceChar(c))\n\t\t\tc = read();\n\t\tStringBuilder res = new StringBuilder();\n\t\tdo {\n\t\t\tres.appendCodePoint(c);\n\t\t\tc = read();\n\t\t} while (!isSpaceChar(c));\n\t\treturn res.toString();\n\t}\n\n public long readLong() {\n\t\tint c = read();\n\t\twhile (isSpaceChar(c)) {\n\t\t\tc = read();\n\t\t}\n\t\tint sgn = 1;\n\t\tif (c == '-') {\n\t\t\tsgn = -1;\n\t\t\tc = read();\n\t\t}\n\t\tlong res = 0;\n\t\tdo {\n\t\t\tif (c < '0' || c > '9') {\n\t\t\t\tthrow new InputMismatchException();\n\t\t\t}\n\t\t\tres *= 10;\n\t\t\tres += c - '0';\n\t\t\tc = read();\n\t\t} while (!isSpaceChar(c));\n\t\treturn res * sgn;\n\t}\n\t\n public boolean isSpaceChar(int c) {\n\t\tif (filter != null)\n\t\t\treturn filter.isSpaceChar(c);\n\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t}\n \n public String next() {\n\t\treturn readString();\n\t}\n \n public interface SpaceCharFilter {\n\t\tpublic boolean isSpaceChar(int ch);\n\t}\n}\n", "language": "Java", "metadata": {"date": 1595788812, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p03165.html", "problem_id": "p03165", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03165/input.txt", "sample_output_relpath": "derived/input_output/data/p03165/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03165/Java/s777470618.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s777470618", "user_id": "u686751625"}, "prompt_components": {"gold_output": "axb\n", "input_to_evaluate": "import java.util.*; \nimport java.io.*;\n\npublic class Main {\t\n\tstatic int dp[][] = new int[3005][3006]; \n\tstatic String ans = \"\";\n\tpublic static int lcs(char p[] , char s[] , int n , int m) {\n\t\tif(n == 0 || m == 0) \n\t\t\treturn 0; \n\t\t\n\t\tif(dp[n][m] != -1) return dp[n][m];\n\t\t\n\t\telse if(p[n-1] == s[m-1]) {\n\t\t\treturn dp[n][m] = 1 + lcs(p , s , n-1 , m-1);\n\t\t}\n\t\t\t \n\t\tint temp1 = lcs(p , s , n-1 , m);\n\t\tint temp2 = lcs(p , s , n , m-1); \n\t\treturn dp[n][m] = Math.max(temp1, temp2); \n\t}\n\tpublic static void pr(char p[] , char s[] ,int n , int m) {\n\t\tif(n<=0 || m <= 0)\n\t\t\treturn;\n\t\tif(p[n-1] == s[m-1]) {\n\t\t\tans = p[n-1] + ans; \n\t\t\tpr(p,s,n-1,m-1); \n\t\t}\n\t\telse if(dp[n-1][m] > dp[n][m-1])\n\t\t\tpr(p,s,n-1,m); \n\t\telse\n\t\t\tpr(p,s,n,m-1); \n\t}\n\tpublic static void solve(InputReader in) {\n\t\tchar p[] = in.readString().toCharArray(); \n\t\tchar s[] = in.readString().toCharArray(); \n\t\tint n = p.length , m = s.length; \n\t\tfor(int i = 0; i<3005; i++) {\n\t\t\tfor(int j = 0; j<3006; j++) {\n\t\t\t\tdp[i][j] = -1; \n\t\t\t}\n\t\t}\n\t\tlcs(p,s,n,m); \n\t\tpr(p,s,n,m);\n\t\tSystem.out.println(ans); \n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\tInputReader in = new InputReader(System.in); \n\t\tint t = 1; \n\t\twhile(t-- > 0) {\n\t\t\tsolve(in); \n\t\t}\n\t}\n}\n\nclass InputReader{\n\tprivate InputStream stream;\n\tprivate byte[] buf = new byte[1024];\n\tprivate int curChar;\n\tprivate int numChars;\n\tprivate SpaceCharFilter filter;\n\n\t public InputReader(InputStream stream) {\n\t\tthis.stream = stream;\n\t}\n\n public int read() {\n\t\tif (numChars == -1)\n\t\t\tthrow new InputMismatchException();\n\t\tif (curChar >= numChars) {\n\t\t\tcurChar = 0;\n\t\t\ttry {\n\t\t\t\tnumChars = stream.read(buf);\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new InputMismatchException();\n\t\t\t}\n\t\t\tif (numChars <= 0)\n\t\t\t\treturn -1;\n\t\t}\n\t\treturn buf[curChar++];\n\t}\n\n public int readInt() {\n\t\tint c = read();\n\t\twhile (isSpaceChar(c))\n\t\t\tc = read();\n\t\tint sgn = 1;\n\t\tif (c == '-') {\n\t\t\tsgn = -1;\n\t\t\tc = read();\n\t\t}\n\t\tint res = 0;\n\t\tdo {\n\t\t\tif (c < '0' || c > '9')\n\t\t\t\tthrow new InputMismatchException();\n\t\t\tres *= 10;\n\t\t\tres += c - '0';\n\t\t\tc = read();\n\t\t} while (!isSpaceChar(c));\n\t\treturn res * sgn;\n\t}\n\n public String readString() {\n\t\tint c = read();\n\t\twhile (isSpaceChar(c))\n\t\t\tc = read();\n\t\tStringBuilder res = new StringBuilder();\n\t\tdo {\n\t\t\tres.appendCodePoint(c);\n\t\t\tc = read();\n\t\t} while (!isSpaceChar(c));\n\t\treturn res.toString();\n\t}\n\n public long readLong() {\n\t\tint c = read();\n\t\twhile (isSpaceChar(c)) {\n\t\t\tc = read();\n\t\t}\n\t\tint sgn = 1;\n\t\tif (c == '-') {\n\t\t\tsgn = -1;\n\t\t\tc = read();\n\t\t}\n\t\tlong res = 0;\n\t\tdo {\n\t\t\tif (c < '0' || c > '9') {\n\t\t\t\tthrow new InputMismatchException();\n\t\t\t}\n\t\t\tres *= 10;\n\t\t\tres += c - '0';\n\t\t\tc = read();\n\t\t} while (!isSpaceChar(c));\n\t\treturn res * sgn;\n\t}\n\t\n public boolean isSpaceChar(int c) {\n\t\tif (filter != null)\n\t\t\treturn filter.isSpaceChar(c);\n\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t}\n \n public String next() {\n\t\treturn readString();\n\t}\n \n public interface SpaceCharFilter {\n\t\tpublic boolean isSpaceChar(int ch);\n\t}\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given strings s and t.\nFind one longest string that is a subsequence of both s and t.\n\nNotes\n\nA subsequence of a string x is the string obtained by removing zero or more characters from x and concatenating the remaining characters without changing the order.\n\nConstraints\n\ns and t are strings consisting of lowercase English letters.\n\n1 \\leq |s|, |t| \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nPrint one longest string that is a subsequence of both s and t.\nIf there are multiple such strings, any of them will be accepted.\n\nSample Input 1\n\naxyb\nabyxb\n\nSample Output 1\n\naxb\n\nThe answer is axb or ayb; either will be accepted.\n\nSample Input 2\n\naa\nxayaz\n\nSample Output 2\n\naa\n\nSample Input 3\n\na\nz\n\nSample Output 3\n\nThe answer is (an empty string).\n\nSample Input 4\n\nabracadabra\navadakedavra\n\nSample Output 4\n\naaadara", "sample_input": "axyb\nabyxb\n"}, "reference_outputs": ["axb\n"], "source_document_id": "p03165", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given strings s and t.\nFind one longest string that is a subsequence of both s and t.\n\nNotes\n\nA subsequence of a string x is the string obtained by removing zero or more characters from x and concatenating the remaining characters without changing the order.\n\nConstraints\n\ns and t are strings consisting of lowercase English letters.\n\n1 \\leq |s|, |t| \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nPrint one longest string that is a subsequence of both s and t.\nIf there are multiple such strings, any of them will be accepted.\n\nSample Input 1\n\naxyb\nabyxb\n\nSample Output 1\n\naxb\n\nThe answer is axb or ayb; either will be accepted.\n\nSample Input 2\n\naa\nxayaz\n\nSample Output 2\n\naa\n\nSample Input 3\n\na\nz\n\nSample Output 3\n\nThe answer is (an empty string).\n\nSample Input 4\n\nabracadabra\navadakedavra\n\nSample Output 4\n\naaadara", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3019, "cpu_time_ms": 322, "memory_kb": 87680}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s414662124", "group_id": "codeNet:p03165", "input_text": "import java.util.*;\n\nclass Main {\n\n String s;\n String t;\n\n private void run() {\n\n Scanner sc = new Scanner(System.in);\n s = sc.next();\n t = sc.next();\n\n int S = s.length();\n int T = t.length();\n\n int[][] dp = new int[S+1][T+1];\n StringBuilder sb = new StringBuilder();\n\n for (int i = 0; i <= S; i++) {\n for (int j = 0; j <= T; j++) {\n if (i == 0 || j == 0) dp[i][j] = 0;\n else if (s.charAt(i-1) == t.charAt(j-1)) {\n sb.append(s.charAt(i-1));\n dp[i][j] = dp[i-1][j-1] + 1;\n } else if (dp[i-1][j] > dp[i][j-1]) {\n dp[i][j] = dp[i-1][j];\n } else {\n dp[i][j] = dp[i][j-1];\n }\n }\n }\n\n System.out.println(sb.substring(sb.length()/2));\n }\n\n\n public static void main(String[] args) {\n Main solver = new Main();\n solver.run();\n }\n}\n", "language": "Java", "metadata": {"date": 1587668906, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03165.html", "problem_id": "p03165", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03165/input.txt", "sample_output_relpath": "derived/input_output/data/p03165/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03165/Java/s414662124.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s414662124", "user_id": "u079288996"}, "prompt_components": {"gold_output": "axb\n", "input_to_evaluate": "import java.util.*;\n\nclass Main {\n\n String s;\n String t;\n\n private void run() {\n\n Scanner sc = new Scanner(System.in);\n s = sc.next();\n t = sc.next();\n\n int S = s.length();\n int T = t.length();\n\n int[][] dp = new int[S+1][T+1];\n StringBuilder sb = new StringBuilder();\n\n for (int i = 0; i <= S; i++) {\n for (int j = 0; j <= T; j++) {\n if (i == 0 || j == 0) dp[i][j] = 0;\n else if (s.charAt(i-1) == t.charAt(j-1)) {\n sb.append(s.charAt(i-1));\n dp[i][j] = dp[i-1][j-1] + 1;\n } else if (dp[i-1][j] > dp[i][j-1]) {\n dp[i][j] = dp[i-1][j];\n } else {\n dp[i][j] = dp[i][j-1];\n }\n }\n }\n\n System.out.println(sb.substring(sb.length()/2));\n }\n\n\n public static void main(String[] args) {\n Main solver = new Main();\n solver.run();\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given strings s and t.\nFind one longest string that is a subsequence of both s and t.\n\nNotes\n\nA subsequence of a string x is the string obtained by removing zero or more characters from x and concatenating the remaining characters without changing the order.\n\nConstraints\n\ns and t are strings consisting of lowercase English letters.\n\n1 \\leq |s|, |t| \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nPrint one longest string that is a subsequence of both s and t.\nIf there are multiple such strings, any of them will be accepted.\n\nSample Input 1\n\naxyb\nabyxb\n\nSample Output 1\n\naxb\n\nThe answer is axb or ayb; either will be accepted.\n\nSample Input 2\n\naa\nxayaz\n\nSample Output 2\n\naa\n\nSample Input 3\n\na\nz\n\nSample Output 3\n\nThe answer is (an empty string).\n\nSample Input 4\n\nabracadabra\navadakedavra\n\nSample Output 4\n\naaadara", "sample_input": "axyb\nabyxb\n"}, "reference_outputs": ["axb\n"], "source_document_id": "p03165", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given strings s and t.\nFind one longest string that is a subsequence of both s and t.\n\nNotes\n\nA subsequence of a string x is the string obtained by removing zero or more characters from x and concatenating the remaining characters without changing the order.\n\nConstraints\n\ns and t are strings consisting of lowercase English letters.\n\n1 \\leq |s|, |t| \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nPrint one longest string that is a subsequence of both s and t.\nIf there are multiple such strings, any of them will be accepted.\n\nSample Input 1\n\naxyb\nabyxb\n\nSample Output 1\n\naxb\n\nThe answer is axb or ayb; either will be accepted.\n\nSample Input 2\n\naa\nxayaz\n\nSample Output 2\n\naa\n\nSample Input 3\n\na\nz\n\nSample Output 3\n\nThe answer is (an empty string).\n\nSample Input 4\n\nabracadabra\navadakedavra\n\nSample Output 4\n\naaadara", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 998, "cpu_time_ms": 340, "memory_kb": 113972}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s478807212", "group_id": "codeNet:p03165", "input_text": "import java.util.*;\nimport java.io.*;\nimport java.lang.*;\n\n class Main{\n \n static BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n static StringBuilder sb = new StringBuilder(\"\");\n static StringTokenizer stk = new StringTokenizer(\"\");\n\n public static void main(String args[]){\n try{\n String s = bf.readLine();\n String t = bf.readLine();\n solver(s,t);\n }catch(Exception e){\n e.printStackTrace();\n }\n }\n\n public static void solver(String s, String t){\n int[][] dp = new int[s.length()][t.length()];\n\n for(int i=0;i= 0 && j-1 >= 0) ? dp[i-1][j-1] : 0);\n }else{\n dp[i][j] = Math.max((i-1 >= 0 ? dp[i-1][j] : 0),(j-1 >= 0 ? dp[i][j-1] : 0));\n }\n \n }\n }\n int slen = s.length()-1;\n int tlen = t.length()-1;\n\n StringBuilder sb = new StringBuilder(\"\");\n \n while(slen >= 0 && tlen >= 0){\n\n if((slen >= 0 && tlen >= 0) && s.charAt(slen) == t.charAt(tlen)){\n sb.append(s.charAt(slen));\n slen--;\n tlen--;\n }else{\n if(slen-1 >= 0 && tlen-1 >= 0){\n if(dp[slen-1][tlen] > dp[slen][tlen-1] ){\n slen--;\n }else{\n tlen--;\n }\n }else if(slen-1 >= 0 && tlen-1 < 0){\n slen --;\n }else if(slen-1 < 0 && tlen-1 >= 0){\n tlen --;\n }\n }\n }\n\n // printDpTable(dp);\n // System.out.println(dp[s.length()-1][t.length()-1]);\n System.out.println(sb.reverse().toString());\n }\n\n public static void printDpTable(int[][] dp){\n for(int i=0;i= 0 && j-1 >= 0) ? dp[i-1][j-1] : 0);\n }else{\n dp[i][j] = Math.max((i-1 >= 0 ? dp[i-1][j] : 0),(j-1 >= 0 ? dp[i][j-1] : 0));\n }\n \n }\n }\n int slen = s.length()-1;\n int tlen = t.length()-1;\n\n StringBuilder sb = new StringBuilder(\"\");\n \n while(slen >= 0 && tlen >= 0){\n\n if((slen >= 0 && tlen >= 0) && s.charAt(slen) == t.charAt(tlen)){\n sb.append(s.charAt(slen));\n slen--;\n tlen--;\n }else{\n if(slen-1 >= 0 && tlen-1 >= 0){\n if(dp[slen-1][tlen] > dp[slen][tlen-1] ){\n slen--;\n }else{\n tlen--;\n }\n }else if(slen-1 >= 0 && tlen-1 < 0){\n slen --;\n }else if(slen-1 < 0 && tlen-1 >= 0){\n tlen --;\n }\n }\n }\n\n // printDpTable(dp);\n // System.out.println(dp[s.length()-1][t.length()-1]);\n System.out.println(sb.reverse().toString());\n }\n\n public static void printDpTable(int[][] dp){\n for(int i=0;i0)\n\t\t\t\t\tdp[i][j] = Math.max(dp[i][j], dp[i-1][j]);\n\t\t\t\t\tif(j>0)\n\t\t\t\t\tdp[i][j] = Math.max(dp[i][j], dp[i][j-1]);\n\t\t\t\t}\n\t\t\t}\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tint i = n-1;\n\t\t\tint j = m-1;\n\t\t\tfor(;i>=0&&j>=0;){\n\t\t\t\tif(str.charAt(i)==str2.charAt(j)){\n\t\t\t\t\tsb.append(str.charAt(i));\n\t\t\t\t\ti--;j--;\n\t\t\t\t}\n\t\t\t\telse if(j==0||i>0&&dp[i-1][j]>dp[i][j-1]){\n\t\t\t\t\ti--;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tj--;\n\t\t\t\t}\n\t\t\t}\n\t\t\tsb=sb.reverse();\n\t\t\tpw.println(sb);\n\t\t\t\n\t\t}\n\t}\n\tlong binpow(long a, long b, long m) {\n\t\ta %= m;\n\t\tlong res = 1;\n\t\twhile (b > 0) {\n\t\t\tif ((b & 1) == 1)\n\t\t\t\tres = res * a % m;\n\t\t\ta = a * a % m;\n\t\t\tb >>= 1;\n\t\t}\n\t\treturn res;\n\t}\n\tstatic class tup implements Comparable{\n\t\tint a, b;\n\t\ttup(int a,int b){\n\t\t\tthis.a=a;\n\t\t\tthis.b=b;\n\t\t}\n\t\t@Override\n\t\tpublic int compareTo(tup o){\n\t\t\treturn Integer.compare(o.b,b);\n\t\t}\n\t}\n\tstatic void shuffle(int[] a) {\n\t\tRandom get = new Random();\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\tint r = get.nextInt(a.length);\n\t\t\tint temp = a[i];\n\t\t\ta[i] = a[r];\n\t\t\ta[r] = temp;\n\t\t}\n\t}\n\n\tstatic void shuffle(long[] a) {\n\t\tRandom get = new Random();\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\tint r = get.nextInt(a.length);\n\t\t\tlong temp = a[i];\n\t\t\ta[i] = a[r];\n\t\t\ta[r] = temp;\n\t\t}\n\t}\n\n\tstatic class FastReader {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\n\t\tpublic FastReader() {\n\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\t}\n\n\t\tpublic FastReader(String s) throws FileNotFoundException {\n\t\t\tbr = new BufferedReader(new FileReader(new File(s)));\n\t\t}\n\n\t\tString next() {\n\t\t\twhile (st == null || !st.hasMoreElements()) {\n\t\t\t\ttry {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tint nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tlong nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tdouble nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tString nextLine() {\n\t\t\tString str = \"\";\n\t\t\ttry {\n\t\t\t\tstr = br.readLine();\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\treturn str;\n\t\t}\n\t}\n\n}", "language": "Java", "metadata": {"date": 1586404619, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03165.html", "problem_id": "p03165", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03165/input.txt", "sample_output_relpath": "derived/input_output/data/p03165/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03165/Java/s108240639.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s108240639", "user_id": "u882458885"}, "prompt_components": {"gold_output": "axb\n", "input_to_evaluate": "\n// Problem : F - LCS\n// Contest : Educational DP Contest\n// URL : https://atcoder.jp/contests/dp/tasks/dp_f\n// Memory Limit : 1024 MB\n// Time Limit : 2000 ms\n// Powered by CP Editor (https://github.com/cpeditor/cpeditor)\n\nimport java.io.*;\nimport java.util.*;\n\npublic class Main{\n\t\n\tpublic static void main(String[] args) throws Exception {\n\t\tFastReader scan = new FastReader();\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\t//PrintWriter out = new PrintWriter(\"file.out\");\n\t\tTask solver = new Task();\n\t\t//int t = scan.nextInt();\n\t\tint t = 1;\n\t\tfor(int i = 1; i <= t; i++) solver.solve(i, scan, out);\n\t\tout.close();\n\t}\n\n\tstatic class Task {\n\t\tstatic final int inf = Integer.MAX_VALUE;\n\t\tpublic void solve(int testNumber, FastReader sc, PrintWriter pw) {\n\t\t\tString str = sc.nextLine();\n\t\t\tString str2 = sc.nextLine();\n\t\t\tint n = str.length();\n\t\t\tint m = str2.length();\n\t\t\tint[][] dp = new int[str.length()][str2.length()]; //dp[i][j]= longest subsequence of substr(i) and substr(j)\n\t\t\tfor(int i=0;i0)\n\t\t\t\t\tdp[i][j] = Math.max(dp[i][j], dp[i-1][j]);\n\t\t\t\t\tif(j>0)\n\t\t\t\t\tdp[i][j] = Math.max(dp[i][j], dp[i][j-1]);\n\t\t\t\t}\n\t\t\t}\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tint i = n-1;\n\t\t\tint j = m-1;\n\t\t\tfor(;i>=0&&j>=0;){\n\t\t\t\tif(str.charAt(i)==str2.charAt(j)){\n\t\t\t\t\tsb.append(str.charAt(i));\n\t\t\t\t\ti--;j--;\n\t\t\t\t}\n\t\t\t\telse if(j==0||i>0&&dp[i-1][j]>dp[i][j-1]){\n\t\t\t\t\ti--;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tj--;\n\t\t\t\t}\n\t\t\t}\n\t\t\tsb=sb.reverse();\n\t\t\tpw.println(sb);\n\t\t\t\n\t\t}\n\t}\n\tlong binpow(long a, long b, long m) {\n\t\ta %= m;\n\t\tlong res = 1;\n\t\twhile (b > 0) {\n\t\t\tif ((b & 1) == 1)\n\t\t\t\tres = res * a % m;\n\t\t\ta = a * a % m;\n\t\t\tb >>= 1;\n\t\t}\n\t\treturn res;\n\t}\n\tstatic class tup implements Comparable{\n\t\tint a, b;\n\t\ttup(int a,int b){\n\t\t\tthis.a=a;\n\t\t\tthis.b=b;\n\t\t}\n\t\t@Override\n\t\tpublic int compareTo(tup o){\n\t\t\treturn Integer.compare(o.b,b);\n\t\t}\n\t}\n\tstatic void shuffle(int[] a) {\n\t\tRandom get = new Random();\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\tint r = get.nextInt(a.length);\n\t\t\tint temp = a[i];\n\t\t\ta[i] = a[r];\n\t\t\ta[r] = temp;\n\t\t}\n\t}\n\n\tstatic void shuffle(long[] a) {\n\t\tRandom get = new Random();\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\tint r = get.nextInt(a.length);\n\t\t\tlong temp = a[i];\n\t\t\ta[i] = a[r];\n\t\t\ta[r] = temp;\n\t\t}\n\t}\n\n\tstatic class FastReader {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\n\t\tpublic FastReader() {\n\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\t}\n\n\t\tpublic FastReader(String s) throws FileNotFoundException {\n\t\t\tbr = new BufferedReader(new FileReader(new File(s)));\n\t\t}\n\n\t\tString next() {\n\t\t\twhile (st == null || !st.hasMoreElements()) {\n\t\t\t\ttry {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tint nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tlong nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tdouble nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tString nextLine() {\n\t\t\tString str = \"\";\n\t\t\ttry {\n\t\t\t\tstr = br.readLine();\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\treturn str;\n\t\t}\n\t}\n\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given strings s and t.\nFind one longest string that is a subsequence of both s and t.\n\nNotes\n\nA subsequence of a string x is the string obtained by removing zero or more characters from x and concatenating the remaining characters without changing the order.\n\nConstraints\n\ns and t are strings consisting of lowercase English letters.\n\n1 \\leq |s|, |t| \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nPrint one longest string that is a subsequence of both s and t.\nIf there are multiple such strings, any of them will be accepted.\n\nSample Input 1\n\naxyb\nabyxb\n\nSample Output 1\n\naxb\n\nThe answer is axb or ayb; either will be accepted.\n\nSample Input 2\n\naa\nxayaz\n\nSample Output 2\n\naa\n\nSample Input 3\n\na\nz\n\nSample Output 3\n\nThe answer is (an empty string).\n\nSample Input 4\n\nabracadabra\navadakedavra\n\nSample Output 4\n\naaadara", "sample_input": "axyb\nabyxb\n"}, "reference_outputs": ["axb\n"], "source_document_id": "p03165", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given strings s and t.\nFind one longest string that is a subsequence of both s and t.\n\nNotes\n\nA subsequence of a string x is the string obtained by removing zero or more characters from x and concatenating the remaining characters without changing the order.\n\nConstraints\n\ns and t are strings consisting of lowercase English letters.\n\n1 \\leq |s|, |t| \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nPrint one longest string that is a subsequence of both s and t.\nIf there are multiple such strings, any of them will be accepted.\n\nSample Input 1\n\naxyb\nabyxb\n\nSample Output 1\n\naxb\n\nThe answer is axb or ayb; either will be accepted.\n\nSample Input 2\n\naa\nxayaz\n\nSample Output 2\n\naa\n\nSample Input 3\n\na\nz\n\nSample Output 3\n\nThe answer is (an empty string).\n\nSample Input 4\n\nabracadabra\navadakedavra\n\nSample Output 4\n\naaadara", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3259, "cpu_time_ms": 224, "memory_kb": 84692}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s295937744", "group_id": "codeNet:p03165", "input_text": "import java.util.*;\npublic class Main {\n public static void main(String [] args) {\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n String t = sc.next();\n int DP[][] = new int[s.length()+1][t.length()+1];\n int L [][] = new int[s.length()+1][t.length()+1];\n for(int i=0;i comp = new Comparator() {\n public int compare(int[] a, int[] b) {\n for (int i=0; i b[i]) return 1;\n }\n return 0;\n }\n };\n static final long LARGE_LONG = 1000000000000000000L;\n static final int LARGE_INT = 1000000007;\n static final int[] dx = new int[] {1, -1, 0, 0};\n static final int[] dy = new int[] {0, 0, 1, -1};\n static int m;\n static int n;\n static char[] s;\n static char[] t;\n static int[][][] lcs;\n //lcs[i][j][0] = length of lcs occuring in s before i and in t before j. [1] is pointer for reconstructing\n\n public static void main(String[] argst) throws IOException {\n FastReader in = new FastReader();\n // FastReader in = new FastReader(probName + \".in\");\n // Scanner in = new Scanner(System.in);\n\n // PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(probName + \".out\")));\n PrintWriter out = new PrintWriter(System.out);\n s = in.next().toCharArray();\n t = in.next().toCharArray();\n m = s.length;\n n = t.length;\n lcs = new int[m+1][n+1][2];\n int mx = -1;\n for (int i = 1; i <= m; i++) {\n for (int j = 1; j <= n; j++) {\n int pla = -1;\n if (s[i-1] == t[j-1]) {\n pla = lcs[i-1][j-1][0] + 1;\n lcs[i][j][0] = pla;\n lcs[i][j][1] = 1;\n\n }\n else {\n int plal = lcs[i-1][j][0];\n int plar = lcs[i][j-1][0];\n if (plal > plar) {\n pla = plal;\n lcs[i][j][0] = plal;\n lcs[i][j][1] = 2;\n }\n else {\n pla = plar;\n lcs[i][j][0] = plar;\n lcs[i][j][1] = 3;\n }\n }\n if (pla > mx) {\n mx = pla;\n }\n }\n }\n int si = 0;\n int sj = 0;\n dumb:\n for (int i = 1; i <= m; i++) {\n for (int j = 1; j <= n; j++) {\n if (lcs[i][j][0] == mx) {\n si = i;\n sj = j;\n break dumb;\n }\n }\n }\n //System.out.println(Arrays.deepToString(lcs));\n ArrayList ll = new ArrayList();\n int count = 0;\n while (count < mx) {\n if (lcs[si][sj][1] == 1) {\n ll.add(s[si-1]);\n si--;\n sj--;\n count ++;\n }\n else if (lcs[si][sj][1] == 2) {\n si--;\n }\n else if (lcs[si][sj][1] == 3) {\n sj--;\n }\n }\n int plan = ll.size()-1;\n for (int i = plan; i >= 0; i--) {\n out.print(ll.get(i));\n }\n out.println();\n out.close();\n }\n\n /* FastReader code from https://www.geeksforgeeks.org/fast-io-in-java-in-competitive-programming/\n nextLine modified, and added next(), and hasNext()\n */\n static class FastReader {\n final private int BUFFER_SIZE = 1 << 16;\n final private int MAX_LINE_SIZE = 1 << 20;\n private DataInputStream din;\n private byte[] buffer, lineBuf;\n private int bufferPointer, bytesRead;\n\n public FastReader() {\n din = new DataInputStream(System.in);\n buffer = new byte[BUFFER_SIZE];\n bufferPointer = bytesRead = 0;\n }\n public FastReader(String file_name) throws IOException {\n din = new DataInputStream(new FileInputStream(file_name));\n buffer = new byte[BUFFER_SIZE];\n bufferPointer = bytesRead = 0;\n }\n public boolean hasNext() throws IOException {\n byte c;\n while ((c = read()) != -1) {\n if (c > ' ') {\n bufferPointer--;\n return true;\n }\n }\n return false;\n }\n public String nextLine() throws IOException {\n if (lineBuf == null)\tlineBuf = new byte[MAX_LINE_SIZE];\n int ctr = 0;\n byte c;\n while ((c = read()) != -1) {\n if (c == '\\r') continue;\n if (c == '\\n') break;\n lineBuf[ctr++] = c;\n }\n return new String(lineBuf, 0, ctr);\n }\n public String next() throws IOException {\n if (lineBuf == null)\tlineBuf = new byte[MAX_LINE_SIZE];\n int ctr = 0;\n byte c = read();\n while (c <= ' ') \tc = read();\n while (c > ' ') {\n lineBuf[ctr++] = c;\n c = read();\n }\n return new String(lineBuf, 0, ctr);\n }\n public int nextInt() throws IOException {\n int ret = 0;\n byte c = read();\n while (c <= ' ') c = read();\n boolean neg = (c == '-');\n if (neg) c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n\n if (neg) return -ret;\n return ret;\n }\n public long nextLong() throws IOException {\n long ret = 0;\n byte c = read();\n while (c <= ' ') c = read();\n boolean neg = (c == '-');\n if (neg) c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (neg) return -ret;\n return ret;\n }\n public double nextDouble() throws IOException {\n double ret = 0, div = 1;\n byte c = read();\n while (c <= ' ')\n c = read();\n boolean neg = (c == '-');\n if (neg) \tc = read();\n do {\n ret = ret * 10 + c - '0';\n }\n while ((c = read()) >= '0' && c <= '9');\n if (c == '.') {\n while ((c = read()) >= '0' && c <= '9') {\n ret += (c - '0') / (div *= 10);\n }\n }\n if (neg) return -ret;\n return ret;\n }\n private void fillBuffer() throws IOException {\n bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);\n if (bytesRead == -1)\n buffer[0] = -1;\n }\n private byte read() throws IOException {\n if (bufferPointer == bytesRead) fillBuffer();\n return buffer[bufferPointer++];\n }\n public void close() throws IOException {\n if (din == null) \t return;\n din.close();\n }\n }\n}\n\n", "language": "Java", "metadata": {"date": 1585210469, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03165.html", "problem_id": "p03165", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03165/input.txt", "sample_output_relpath": "derived/input_output/data/p03165/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03165/Java/s416769864.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s416769864", "user_id": "u405242666"}, "prompt_components": {"gold_output": "axb\n", "input_to_evaluate": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n //static String probName = \"template\";\n static Comparator comp = new Comparator() {\n public int compare(int[] a, int[] b) {\n for (int i=0; i b[i]) return 1;\n }\n return 0;\n }\n };\n static final long LARGE_LONG = 1000000000000000000L;\n static final int LARGE_INT = 1000000007;\n static final int[] dx = new int[] {1, -1, 0, 0};\n static final int[] dy = new int[] {0, 0, 1, -1};\n static int m;\n static int n;\n static char[] s;\n static char[] t;\n static int[][][] lcs;\n //lcs[i][j][0] = length of lcs occuring in s before i and in t before j. [1] is pointer for reconstructing\n\n public static void main(String[] argst) throws IOException {\n FastReader in = new FastReader();\n // FastReader in = new FastReader(probName + \".in\");\n // Scanner in = new Scanner(System.in);\n\n // PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(probName + \".out\")));\n PrintWriter out = new PrintWriter(System.out);\n s = in.next().toCharArray();\n t = in.next().toCharArray();\n m = s.length;\n n = t.length;\n lcs = new int[m+1][n+1][2];\n int mx = -1;\n for (int i = 1; i <= m; i++) {\n for (int j = 1; j <= n; j++) {\n int pla = -1;\n if (s[i-1] == t[j-1]) {\n pla = lcs[i-1][j-1][0] + 1;\n lcs[i][j][0] = pla;\n lcs[i][j][1] = 1;\n\n }\n else {\n int plal = lcs[i-1][j][0];\n int plar = lcs[i][j-1][0];\n if (plal > plar) {\n pla = plal;\n lcs[i][j][0] = plal;\n lcs[i][j][1] = 2;\n }\n else {\n pla = plar;\n lcs[i][j][0] = plar;\n lcs[i][j][1] = 3;\n }\n }\n if (pla > mx) {\n mx = pla;\n }\n }\n }\n int si = 0;\n int sj = 0;\n dumb:\n for (int i = 1; i <= m; i++) {\n for (int j = 1; j <= n; j++) {\n if (lcs[i][j][0] == mx) {\n si = i;\n sj = j;\n break dumb;\n }\n }\n }\n //System.out.println(Arrays.deepToString(lcs));\n ArrayList ll = new ArrayList();\n int count = 0;\n while (count < mx) {\n if (lcs[si][sj][1] == 1) {\n ll.add(s[si-1]);\n si--;\n sj--;\n count ++;\n }\n else if (lcs[si][sj][1] == 2) {\n si--;\n }\n else if (lcs[si][sj][1] == 3) {\n sj--;\n }\n }\n int plan = ll.size()-1;\n for (int i = plan; i >= 0; i--) {\n out.print(ll.get(i));\n }\n out.println();\n out.close();\n }\n\n /* FastReader code from https://www.geeksforgeeks.org/fast-io-in-java-in-competitive-programming/\n nextLine modified, and added next(), and hasNext()\n */\n static class FastReader {\n final private int BUFFER_SIZE = 1 << 16;\n final private int MAX_LINE_SIZE = 1 << 20;\n private DataInputStream din;\n private byte[] buffer, lineBuf;\n private int bufferPointer, bytesRead;\n\n public FastReader() {\n din = new DataInputStream(System.in);\n buffer = new byte[BUFFER_SIZE];\n bufferPointer = bytesRead = 0;\n }\n public FastReader(String file_name) throws IOException {\n din = new DataInputStream(new FileInputStream(file_name));\n buffer = new byte[BUFFER_SIZE];\n bufferPointer = bytesRead = 0;\n }\n public boolean hasNext() throws IOException {\n byte c;\n while ((c = read()) != -1) {\n if (c > ' ') {\n bufferPointer--;\n return true;\n }\n }\n return false;\n }\n public String nextLine() throws IOException {\n if (lineBuf == null)\tlineBuf = new byte[MAX_LINE_SIZE];\n int ctr = 0;\n byte c;\n while ((c = read()) != -1) {\n if (c == '\\r') continue;\n if (c == '\\n') break;\n lineBuf[ctr++] = c;\n }\n return new String(lineBuf, 0, ctr);\n }\n public String next() throws IOException {\n if (lineBuf == null)\tlineBuf = new byte[MAX_LINE_SIZE];\n int ctr = 0;\n byte c = read();\n while (c <= ' ') \tc = read();\n while (c > ' ') {\n lineBuf[ctr++] = c;\n c = read();\n }\n return new String(lineBuf, 0, ctr);\n }\n public int nextInt() throws IOException {\n int ret = 0;\n byte c = read();\n while (c <= ' ') c = read();\n boolean neg = (c == '-');\n if (neg) c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n\n if (neg) return -ret;\n return ret;\n }\n public long nextLong() throws IOException {\n long ret = 0;\n byte c = read();\n while (c <= ' ') c = read();\n boolean neg = (c == '-');\n if (neg) c = read();\n do {\n ret = ret * 10 + c - '0';\n } while ((c = read()) >= '0' && c <= '9');\n if (neg) return -ret;\n return ret;\n }\n public double nextDouble() throws IOException {\n double ret = 0, div = 1;\n byte c = read();\n while (c <= ' ')\n c = read();\n boolean neg = (c == '-');\n if (neg) \tc = read();\n do {\n ret = ret * 10 + c - '0';\n }\n while ((c = read()) >= '0' && c <= '9');\n if (c == '.') {\n while ((c = read()) >= '0' && c <= '9') {\n ret += (c - '0') / (div *= 10);\n }\n }\n if (neg) return -ret;\n return ret;\n }\n private void fillBuffer() throws IOException {\n bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);\n if (bytesRead == -1)\n buffer[0] = -1;\n }\n private byte read() throws IOException {\n if (bufferPointer == bytesRead) fillBuffer();\n return buffer[bufferPointer++];\n }\n public void close() throws IOException {\n if (din == null) \t return;\n din.close();\n }\n }\n}\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given strings s and t.\nFind one longest string that is a subsequence of both s and t.\n\nNotes\n\nA subsequence of a string x is the string obtained by removing zero or more characters from x and concatenating the remaining characters without changing the order.\n\nConstraints\n\ns and t are strings consisting of lowercase English letters.\n\n1 \\leq |s|, |t| \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nPrint one longest string that is a subsequence of both s and t.\nIf there are multiple such strings, any of them will be accepted.\n\nSample Input 1\n\naxyb\nabyxb\n\nSample Output 1\n\naxb\n\nThe answer is axb or ayb; either will be accepted.\n\nSample Input 2\n\naa\nxayaz\n\nSample Output 2\n\naa\n\nSample Input 3\n\na\nz\n\nSample Output 3\n\nThe answer is (an empty string).\n\nSample Input 4\n\nabracadabra\navadakedavra\n\nSample Output 4\n\naaadara", "sample_input": "axyb\nabyxb\n"}, "reference_outputs": ["axb\n"], "source_document_id": "p03165", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given strings s and t.\nFind one longest string that is a subsequence of both s and t.\n\nNotes\n\nA subsequence of a string x is the string obtained by removing zero or more characters from x and concatenating the remaining characters without changing the order.\n\nConstraints\n\ns and t are strings consisting of lowercase English letters.\n\n1 \\leq |s|, |t| \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nPrint one longest string that is a subsequence of both s and t.\nIf there are multiple such strings, any of them will be accepted.\n\nSample Input 1\n\naxyb\nabyxb\n\nSample Output 1\n\naxb\n\nThe answer is axb or ayb; either will be accepted.\n\nSample Input 2\n\naa\nxayaz\n\nSample Output 2\n\naa\n\nSample Input 3\n\na\nz\n\nSample Output 3\n\nThe answer is (an empty string).\n\nSample Input 4\n\nabracadabra\navadakedavra\n\nSample Output 4\n\naaadara", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 7117, "cpu_time_ms": 2022, "memory_kb": 354644}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s500150661", "group_id": "codeNet:p03165", "input_text": "/*\nIf you want to aim high, aim high\nDon't let that studying and grades consume you\nJust live life young\n******************************\nIf I'm the sun, you're the moon\nBecause when I go up, you go down\n*******************************\nI'm working for the day I will surpass you\nhttps://www.a2oj.com/Ladder16.html\n*/\nimport java.util.*;\nimport java.io.*;\nimport java.math.*;\n\n public class Main\n {\n public static void main(String omkar[]) throws Exception\n {\n BufferedReader infile = new BufferedReader(new InputStreamReader(System.in)); \n String s = infile.readLine();\n String t = infile.readLine();/*\n int N = s.length();\n int M = s.length();\n Node[][] dp = new Node[N+1][M+1];\n for(int i=0; i <= N; i++)\n for(int j=0; j <= M; j++)\n dp[i][j] = new Node(-1, -1, 0);\n for(int i=1; i <= N; i++)\n for(int j=1; j <= M; j++)\n {\n if(s.charAt(i-1) == t.charAt(j-1))\n {\n int len = dp[i-1][j-1].length+1;\n if(len > dp[i][j].length)\n dp[i][j] = new Node(i-1, j-1, len);\n }\n else\n {\n int len = dp[i][j-1].length;\n if(len > dp[i][j].length)\n dp[i][j] = new Node(i, j-1, len);\n len = dp[i-1][j].length;\n if(len > dp[i][j].length)\n dp[i][j] = new Node(i-1, j, len);\n }\n }*/\n System.out.println(solve(s,t));\n }\n public static String solve(String s, String t)\n {\n \t\tif(s.length() == 0 || t.length() == 0) \n return \"\";\n \t\tint m = s.length();\n \t\tint n = t.length();\n \t\tint[][] dp = new int[m+1][n+1];\n \t\tfor (int i = 1; i <= m; i++) \n \t\t\tfor (int j = 1; j <= n; j++) \n {\n \t\t\t\tif(s.charAt(i-1) == t.charAt(j-1)) \n dp[i][j] = dp[i-1][j-1] + 1;\n \t\t\t\telse \n dp[i][j] = Math.max(dp[i-1][j], dp[i][j-1]);\n \t\t\t}\n \t\tint i = m, j = n;\n \t\tStringBuilder sb = new StringBuilder();\n \t\twhile(i >= 1 && j >= 1)\n {\n \t\t\tif(dp[i][j] == dp[i][j-1]) \n j--;\n \t\t\telse if(dp[i][j] == dp[i-1][j]) \n i--;\n \t\t\telse \n {\n \t\t\t\tsb.append(s.charAt(i-1));\n \t\t\t\ti--;\n \t\t\t\tj--;\n \t\t\t}\n \t\t}\n \t\treturn sb.reverse().toString();\n \t}\n }\n class Node\n {\n public int length;\n public int x;\n public int y;\n \n public Node(int a, int b, int c)\n {\n x = a;\n y = b;\n length = c;\n }\n }", "language": "Java", "metadata": {"date": 1584742400, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03165.html", "problem_id": "p03165", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03165/input.txt", "sample_output_relpath": "derived/input_output/data/p03165/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03165/Java/s500150661.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s500150661", "user_id": "u598283679"}, "prompt_components": {"gold_output": "axb\n", "input_to_evaluate": "/*\nIf you want to aim high, aim high\nDon't let that studying and grades consume you\nJust live life young\n******************************\nIf I'm the sun, you're the moon\nBecause when I go up, you go down\n*******************************\nI'm working for the day I will surpass you\nhttps://www.a2oj.com/Ladder16.html\n*/\nimport java.util.*;\nimport java.io.*;\nimport java.math.*;\n\n public class Main\n {\n public static void main(String omkar[]) throws Exception\n {\n BufferedReader infile = new BufferedReader(new InputStreamReader(System.in)); \n String s = infile.readLine();\n String t = infile.readLine();/*\n int N = s.length();\n int M = s.length();\n Node[][] dp = new Node[N+1][M+1];\n for(int i=0; i <= N; i++)\n for(int j=0; j <= M; j++)\n dp[i][j] = new Node(-1, -1, 0);\n for(int i=1; i <= N; i++)\n for(int j=1; j <= M; j++)\n {\n if(s.charAt(i-1) == t.charAt(j-1))\n {\n int len = dp[i-1][j-1].length+1;\n if(len > dp[i][j].length)\n dp[i][j] = new Node(i-1, j-1, len);\n }\n else\n {\n int len = dp[i][j-1].length;\n if(len > dp[i][j].length)\n dp[i][j] = new Node(i, j-1, len);\n len = dp[i-1][j].length;\n if(len > dp[i][j].length)\n dp[i][j] = new Node(i-1, j, len);\n }\n }*/\n System.out.println(solve(s,t));\n }\n public static String solve(String s, String t)\n {\n \t\tif(s.length() == 0 || t.length() == 0) \n return \"\";\n \t\tint m = s.length();\n \t\tint n = t.length();\n \t\tint[][] dp = new int[m+1][n+1];\n \t\tfor (int i = 1; i <= m; i++) \n \t\t\tfor (int j = 1; j <= n; j++) \n {\n \t\t\t\tif(s.charAt(i-1) == t.charAt(j-1)) \n dp[i][j] = dp[i-1][j-1] + 1;\n \t\t\t\telse \n dp[i][j] = Math.max(dp[i-1][j], dp[i][j-1]);\n \t\t\t}\n \t\tint i = m, j = n;\n \t\tStringBuilder sb = new StringBuilder();\n \t\twhile(i >= 1 && j >= 1)\n {\n \t\t\tif(dp[i][j] == dp[i][j-1]) \n j--;\n \t\t\telse if(dp[i][j] == dp[i-1][j]) \n i--;\n \t\t\telse \n {\n \t\t\t\tsb.append(s.charAt(i-1));\n \t\t\t\ti--;\n \t\t\t\tj--;\n \t\t\t}\n \t\t}\n \t\treturn sb.reverse().toString();\n \t}\n }\n class Node\n {\n public int length;\n public int x;\n public int y;\n \n public Node(int a, int b, int c)\n {\n x = a;\n y = b;\n length = c;\n }\n }", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given strings s and t.\nFind one longest string that is a subsequence of both s and t.\n\nNotes\n\nA subsequence of a string x is the string obtained by removing zero or more characters from x and concatenating the remaining characters without changing the order.\n\nConstraints\n\ns and t are strings consisting of lowercase English letters.\n\n1 \\leq |s|, |t| \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nPrint one longest string that is a subsequence of both s and t.\nIf there are multiple such strings, any of them will be accepted.\n\nSample Input 1\n\naxyb\nabyxb\n\nSample Output 1\n\naxb\n\nThe answer is axb or ayb; either will be accepted.\n\nSample Input 2\n\naa\nxayaz\n\nSample Output 2\n\naa\n\nSample Input 3\n\na\nz\n\nSample Output 3\n\nThe answer is (an empty string).\n\nSample Input 4\n\nabracadabra\navadakedavra\n\nSample Output 4\n\naaadara", "sample_input": "axyb\nabyxb\n"}, "reference_outputs": ["axb\n"], "source_document_id": "p03165", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given strings s and t.\nFind one longest string that is a subsequence of both s and t.\n\nNotes\n\nA subsequence of a string x is the string obtained by removing zero or more characters from x and concatenating the remaining characters without changing the order.\n\nConstraints\n\ns and t are strings consisting of lowercase English letters.\n\n1 \\leq |s|, |t| \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nPrint one longest string that is a subsequence of both s and t.\nIf there are multiple such strings, any of them will be accepted.\n\nSample Input 1\n\naxyb\nabyxb\n\nSample Output 1\n\naxb\n\nThe answer is axb or ayb; either will be accepted.\n\nSample Input 2\n\naa\nxayaz\n\nSample Output 2\n\naa\n\nSample Input 3\n\na\nz\n\nSample Output 3\n\nThe answer is (an empty string).\n\nSample Input 4\n\nabracadabra\navadakedavra\n\nSample Output 4\n\naaadara", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2636, "cpu_time_ms": 186, "memory_kb": 82260}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s021561126", "group_id": "codeNet:p03165", "input_text": "\nimport javax.swing.*;\nimport java.io.*;\nimport java.util.*;\n\npublic class Main {\n\n static class Point {\n int i;\n int j;\n\n public Point(int i, int j) {\n this.i = i;\n this.j = j;\n }\n }\n\n public static void main(String[] args) throws IOException {\n BufferedReader rd = new BufferedReader(new InputStreamReader(System.in));\n String first = rd.readLine();\n String second = rd.readLine();\n int[][] arr = new int[first.length()][second.length()];\n Point[][] arr2 = new Point[first.length()][second.length()];\n if (first.charAt(0) == second.charAt(0)) {\n arr[0][0] = 1;\n } else {\n arr[0][0] = 0;\n }\n arr2[0][0] = new Point(0,0);\n for(int i = 0; i < arr.length; i++) {\n for (int j = 0; j < arr[0].length; j++) {\n int prev = 0;\n if(i > 0) {\n prev = arr[i - 1][j];\n }\n int prev2 = 0;\n if(j > 0) {\n prev2 = arr[i][j- 1];\n }\n int curValue = 0;\n if (first.charAt(i) == second.charAt(j)) {\n if (i > 0 && j > 0) {\n arr[i][j] = arr[i - 1][j - 1] + 1;\n arr2[i][j] = new Point(i-1,j - 1);\n } else {\n arr[i][j] = 1;\n if (i == 0) {\n arr2[i][j] = new Point(0, j -1);\n } else {\n arr2[i][j] = new Point(i - 1, 0);\n }\n }\n } else {\n arr[i][j] = Integer.max(prev, prev2);\n if (arr[i][j] == prev) {\n arr2[i][j] = new Point(i-1,j);\n } else if (arr[i][j] == prev2) {\n arr2[i][j] = new Point(i,j - 1);\n }\n }\n }\n }\n\n StringBuilder s = new StringBuilder();\n int lastI = arr.length - 1;\n int lastJ = arr[0].length - 1;\n while (true) {\n if (first.charAt(lastI) == second.charAt(lastJ)) {\n s.append(first.charAt(lastI));\n }\n Point p = arr2[lastI][lastJ];\n if (p.i == -1 || p.j == -1) {\n break;\n }\n lastI = p.i;\n lastJ = p.j;\n if (lastI == 0 && lastJ == 0) {\n if (first.charAt(lastI) == second.charAt(lastJ)) {\n s.append(first.charAt(lastI));\n }\n break;\n }\n }\n BufferedWriter wr = new BufferedWriter(new OutputStreamWriter(System.out));\n wr.append(s.reverse());\n wr.flush();\n }\n\n}", "language": "Java", "metadata": {"date": 1583395485, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03165.html", "problem_id": "p03165", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03165/input.txt", "sample_output_relpath": "derived/input_output/data/p03165/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03165/Java/s021561126.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s021561126", "user_id": "u792014726"}, "prompt_components": {"gold_output": "axb\n", "input_to_evaluate": "\nimport javax.swing.*;\nimport java.io.*;\nimport java.util.*;\n\npublic class Main {\n\n static class Point {\n int i;\n int j;\n\n public Point(int i, int j) {\n this.i = i;\n this.j = j;\n }\n }\n\n public static void main(String[] args) throws IOException {\n BufferedReader rd = new BufferedReader(new InputStreamReader(System.in));\n String first = rd.readLine();\n String second = rd.readLine();\n int[][] arr = new int[first.length()][second.length()];\n Point[][] arr2 = new Point[first.length()][second.length()];\n if (first.charAt(0) == second.charAt(0)) {\n arr[0][0] = 1;\n } else {\n arr[0][0] = 0;\n }\n arr2[0][0] = new Point(0,0);\n for(int i = 0; i < arr.length; i++) {\n for (int j = 0; j < arr[0].length; j++) {\n int prev = 0;\n if(i > 0) {\n prev = arr[i - 1][j];\n }\n int prev2 = 0;\n if(j > 0) {\n prev2 = arr[i][j- 1];\n }\n int curValue = 0;\n if (first.charAt(i) == second.charAt(j)) {\n if (i > 0 && j > 0) {\n arr[i][j] = arr[i - 1][j - 1] + 1;\n arr2[i][j] = new Point(i-1,j - 1);\n } else {\n arr[i][j] = 1;\n if (i == 0) {\n arr2[i][j] = new Point(0, j -1);\n } else {\n arr2[i][j] = new Point(i - 1, 0);\n }\n }\n } else {\n arr[i][j] = Integer.max(prev, prev2);\n if (arr[i][j] == prev) {\n arr2[i][j] = new Point(i-1,j);\n } else if (arr[i][j] == prev2) {\n arr2[i][j] = new Point(i,j - 1);\n }\n }\n }\n }\n\n StringBuilder s = new StringBuilder();\n int lastI = arr.length - 1;\n int lastJ = arr[0].length - 1;\n while (true) {\n if (first.charAt(lastI) == second.charAt(lastJ)) {\n s.append(first.charAt(lastI));\n }\n Point p = arr2[lastI][lastJ];\n if (p.i == -1 || p.j == -1) {\n break;\n }\n lastI = p.i;\n lastJ = p.j;\n if (lastI == 0 && lastJ == 0) {\n if (first.charAt(lastI) == second.charAt(lastJ)) {\n s.append(first.charAt(lastI));\n }\n break;\n }\n }\n BufferedWriter wr = new BufferedWriter(new OutputStreamWriter(System.out));\n wr.append(s.reverse());\n wr.flush();\n }\n\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given strings s and t.\nFind one longest string that is a subsequence of both s and t.\n\nNotes\n\nA subsequence of a string x is the string obtained by removing zero or more characters from x and concatenating the remaining characters without changing the order.\n\nConstraints\n\ns and t are strings consisting of lowercase English letters.\n\n1 \\leq |s|, |t| \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nPrint one longest string that is a subsequence of both s and t.\nIf there are multiple such strings, any of them will be accepted.\n\nSample Input 1\n\naxyb\nabyxb\n\nSample Output 1\n\naxb\n\nThe answer is axb or ayb; either will be accepted.\n\nSample Input 2\n\naa\nxayaz\n\nSample Output 2\n\naa\n\nSample Input 3\n\na\nz\n\nSample Output 3\n\nThe answer is (an empty string).\n\nSample Input 4\n\nabracadabra\navadakedavra\n\nSample Output 4\n\naaadara", "sample_input": "axyb\nabyxb\n"}, "reference_outputs": ["axb\n"], "source_document_id": "p03165", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given strings s and t.\nFind one longest string that is a subsequence of both s and t.\n\nNotes\n\nA subsequence of a string x is the string obtained by removing zero or more characters from x and concatenating the remaining characters without changing the order.\n\nConstraints\n\ns and t are strings consisting of lowercase English letters.\n\n1 \\leq |s|, |t| \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nPrint one longest string that is a subsequence of both s and t.\nIf there are multiple such strings, any of them will be accepted.\n\nSample Input 1\n\naxyb\nabyxb\n\nSample Output 1\n\naxb\n\nThe answer is axb or ayb; either will be accepted.\n\nSample Input 2\n\naa\nxayaz\n\nSample Output 2\n\naa\n\nSample Input 3\n\na\nz\n\nSample Output 3\n\nThe answer is (an empty string).\n\nSample Input 4\n\nabracadabra\navadakedavra\n\nSample Output 4\n\naaadara", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2826, "cpu_time_ms": 2110, "memory_kb": 457240}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s759830895", "group_id": "codeNet:p03165", "input_text": "import java.util.ArrayDeque;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.BitSet;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Iterator;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Map.Entry;\nimport java.util.NoSuchElementException;\nimport java.util.Objects;\nimport java.util.PriorityQueue;\nimport java.util.Random;\nimport java.util.Scanner;\nimport java.util.TreeMap;\nimport java.util.TreeSet;\nimport java.util.function.BiFunction;\nimport java.util.function.IntBinaryOperator;\nimport java.util.function.LongBinaryOperator;\nimport java.util.stream.*;\n// import static java.util.Arrays.compare;\nimport static java.util.Arrays.fill;\nimport static java.util.Arrays.sort;\nimport static java.util.Collections.sort;\nimport static java.util.Comparator.reverseOrder;\n// import static java.util.List.of;\nimport static java.util.Objects.isNull;\nimport static java.util.Objects.nonNull;\n\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\n\nimport java.math.BigInteger;\nimport static java.math.BigInteger.ZERO;\nimport static java.math.BigInteger.ONE;\n// import static java.math.BigInteger.TWO;\nimport static java.math.BigInteger.TEN;\n\nimport static java.lang.Math.PI;\nimport static java.lang.Math.E;\nimport static java.lang.Math.min;\nimport static java.lang.Math.max;\nimport static java.lang.Math.abs;\nimport static java.lang.Math.sin;\nimport static java.lang.Math.cos;\nimport static java.lang.Math.tan;\nimport static java.lang.Math.asin;\nimport static java.lang.Math.acos;\nimport static java.lang.Math.atan;\nimport static java.lang.Math.atan2;\nimport static java.lang.Math.hypot;\nimport static java.lang.Math.sqrt;\nimport static java.lang.Math.log;\nimport static java.lang.Math.exp;\nimport static java.lang.String.format;\nimport static java.lang.System.exit;\nimport static java.lang.System.currentTimeMillis;\n\npublic class Main {\n public static long MOD = 1_000_000_007;\n\n public static void main(String[] args) {\n FastScanner fsc=new FastScanner();\n char[] s=('+'+fsc.next()).toCharArray();\n char[] t=('*'+fsc.next()).toCharArray();\n int n=s.length;\n int m=t.length;\n fsc.close();\n int[][] dp=new int[n][m];\n int[][][] pre=new int[n][m][2];\n for(int i=1;idp[i-1][j]){\n dp[i][j]=dp[i][j-1];\n int k=dp[pre[i][j-1][0]][pre[i][j-1][1]];\n if(dp[i][j-1]==k){\n pre[i][j]=pre[i][j-1];\n } else{\n int[] p={i, j-1};\n pre[i][j]=p;\n }\n } else{\n dp[i][j]=dp[i-1][j];\n int k=dp[pre[i-1][j][0]][pre[i-1][j][1]];\n if(dp[i-1][j]==k){\n pre[i][j]=pre[i-1][j];\n } else{\n int[] p={i-1, j};\n pre[i][j]=p;\n }\n }\n }\n }\n }\n int l=dp[n-1][m-1];\n char[] ans=new char[l];\n int indx=l-1;\n int i=n-1, j=m-1;\n while(i>0 && j>0){\n int[] p=pre[i][j];\n if(s[i]==t[j]){\n ans[indx--]=s[i];\n }\n i=p[0];\n j=p[1];\n }\n StringBuilder sb=new StringBuilder();\n for(char c:ans){\n sb.append(c);\n }\n System.out.println(sb);\n }\n\n static class IntUtil {\n public static int min(int a, int... b) {\n int ret = a;\n for (int c : b) {\n ret = Math.min(ret, c);\n }\n return ret;\n }\n\n public static int max(int a, int... b) {\n int ret = a;\n for (int c : b) {\n ret = Math.max(ret, c);\n }\n return ret;\n }\n\n /**\n * Caluculate the ceil of a/b. Returns the smallest integer greater than or\n * equal to a/b while 'a/b' rounds fractional parts to ZERO.\n * \n * @param a\n * @param b\n * @return the smallest integer greater than or equal to a/b\n */\n public static int ceilDiv(int a, int b) {\n if ((a > 0 && b > 0) || (a < 0 && b < 0)) {\n if (b > 0) {\n return (a + b - 1) / b;\n } else {\n return (a + b + 1) / b;\n }\n } else {\n return a / b;\n }\n }\n\n /**\n * Caluculate the floor of a/b. Returns the largest integer less than or equal\n * to a/b while 'a/b' rounds fractional parts to ZERO.\n * \n * @param a\n * @param b\n * @return the largest integer less than or equal to a/b\n */\n public static int floorDiv(int a, int b) {\n if ((a > 0 && b > 0) || (a < 0 && b < 0)) {\n return a / b;\n } else {\n if (b > 0) {\n return (a - b + 1) / b;\n } else {\n return (a - b - 1) / b;\n }\n }\n }\n\n public static int fold(IntBinaryOperator func, int a, int... b) {\n int ret = a;\n for (int c : b) {\n ret = func.applyAsInt(ret, c);\n }\n return ret;\n }\n }\n\n static class LongUtil {\n public static long min(long a, long... b) {\n long ret = a;\n for (long c : b) {\n ret = Math.min(ret, c);\n }\n return ret;\n }\n\n public static long max(long a, long... b) {\n long ret = a;\n for (long c : b) {\n ret = Math.max(ret, c);\n }\n return ret;\n }\n\n /**\n * Caluculate the ceil of a/b. Returns the smallest integer greater than or\n * equal to a/b while 'a/b' rounds fractional parts to ZERO.\n * \n * @param a\n * @param b\n * @return the smallest integer greater than or equal to a/b\n */\n public static long ceilDiv(long a, long b) {\n if ((a > 0 && b > 0) || (a < 0 && b < 0)) {\n if (b > 0) {\n return (a + b - 1) / b;\n } else {\n return (a + b + 1) / b;\n }\n } else {\n return a / b;\n }\n }\n\n /**\n * Caluculate the floor of a/b. Returns the largest integer less than or equal\n * to a/b while 'a/b' rounds fractional parts to ZERO.\n * \n * @param a\n * @param b\n * @return the largest integer less than or equal to a/b\n */\n public static long floorDiv(long a, long b) {\n if ((a > 0 && b > 0) || (a < 0 && b < 0)) {\n return a / b;\n } else {\n if (b > 0) {\n return (a - b + 1) / b;\n } else {\n return (a - b - 1) / b;\n }\n }\n }\n\n public static long fold(LongBinaryOperator func, long a, long... b) {\n long ret = a;\n for (long c : b) {\n ret = func.applyAsLong(ret, c);\n }\n return ret;\n }\n }\n\n static class MathUtil{\n /**\n * Enumarate primes less than n.\n * \n * @param n\n * @return {@code ArrayList} that holds primes.\n */\n public static ArrayList eratosthenes(int n) {\n int[] div = eratosthenesDivisors(n);\n ArrayList result = new ArrayList<>();\n for (int i = 2; i <= n; i++) {\n if (div[i] == i) {\n result.add(i);\n }\n }\n return result;\n }\n /**\n * execute eratosthenes's prime-enumerate algorithm. a[i] holds the greatest\n * divisor of i. if a[i]=i, i is a prime number. This arrary enables you to\n * prime-factorize in O(log n) time. ( primeFactorization(long n) {\n HashMap primes = new HashMap();\n for (long p = 2; p * p <= n; p++) {\n int q = 0;\n while (n % p == 0) {\n n /= p;\n q++;\n }\n if (q > 0) {\n primes.put(p, q);\n }\n }\n if (n > 1) {\n primes.put(n, 1);\n }\n return primes;\n }\n\n private static HashMap lcm(HashMap amap, HashMap bmap) {\n if (amap.size() < bmap.size()) {\n return lcm(bmap, amap);\n }\n HashMap lcm = amap;\n for (Map.Entry e : bmap.entrySet()) {\n long prime = e.getKey();\n if (lcm.containsKey(prime)) {\n lcm.put(prime, Math.max(lcm.get(prime), e.getValue()));\n } else {\n lcm.put(prime, e.getValue());\n }\n }\n return lcm;\n }\n\n private static HashMap lcm(HashMap amap, long b) {\n HashMap bmap = primeFactorization(b);\n return lcm(amap, bmap);\n }\n\n public static HashMap lcm(long a, long... b) {\n HashMap amap = primeFactorization(a);\n for (long c : b) {\n amap = lcm(amap, c);\n }\n return amap;\n }\n public static long unsafeLCM(long a, long b) {\n return a * b / gcd(a, b);\n }\n\n /**\n * Caluculate the GCD of (a, b)/\n * \n * @param a first value\n * @param b second value\n * @return GCD(a, b)\n */\n public static long gcd(long a, long b) {\n if (a < b) {\n return gcd(b, a);\n }\n long r = a % b;\n while (r != 0) {\n a = b;\n b = r;\n r = a % b;\n }\n return b;\n }\n\n /**\n * Return one of the solutions to {@code ax+by=gcd(a, b)}.\n * \n * @return {@code x}, {@code y}, {@code gcd(a, b)}.\n * @param a a of ax+by=gcd(a, b).\n * @param b b of ax+by=gcd(a, b). class ReferenceLong is a reference type of long.\n */\n public static long[] extGCD(long a, long b) {\n ReferenceLong x = new ReferenceLong();\n ReferenceLong y = new ReferenceLong();\n long[] ret = new long[3];\n ret[2] = extGCD(a, b, x, y);\n ret[0] = x.v;\n ret[1] = y.v;\n return ret;\n }\n\n private static long extGCD(long a, long b, ReferenceLong x, ReferenceLong y) {\n if (b == 0) {\n x.v = 1;\n y.v = 0;\n return a;\n }\n long d = extGCD(b, a % b, y, x);\n y.v -= a / b * x.v;\n return d;\n }\n\n private static class ReferenceLong {\n long v = 0;\n }\n }\n\n \n\n static class IntArrayUtil{\n public static void reverse(int[] a, int begin, int end){\n for(int i=begin;i=1;i--){\n if(ret[i]>ret[i-1]){\n int fail=n, pass=i;\n while(fail-pass>1){\n int mid=pass+(fail-pass)/2;\n if(ret[mid]>ret[i-1]) pass=mid;\n else fail=mid;\n }\n swap(ret, pass, i-1);\n reverse(ret, i, n);\n return ret;\n }\n }\n return null;\n }\n public static int[] predPermutation(int[] a){\n int[] ret=a.clone();\n int n=ret.length;\n for(int i=n-1;i>=1;i--){\n if(ret[i]1){\n int mid=pass+(fail-pass)/2;\n if(ret[mid]=b.length){\n return -1;\n } else if(a[i]>b[i]){\n return 1;\n } else if(a[i]=1;i--){\n if(ret[i]>ret[i-1]){\n int fail=n, pass=i;\n while(fail-pass>1){\n int mid=pass+(fail-pass)/2;\n if(ret[mid]>ret[i-1]) pass=mid;\n else fail=mid;\n }\n swap(ret, pass, i-1);\n reverse(ret, i, n);\n return ret;\n }\n }\n return null;\n }\n public static long[] predPermutation(long[] a){\n long[] ret=a.clone();\n int n=ret.length;\n for(int i=n-1;i>=1;i--){\n if(ret[i]1){\n int mid=pass+(fail-pass)/2;\n if(ret[mid]=b.length){\n return -1;\n } else if(a[i]>b[i]){\n return 1;\n } else if(a[i]= safeMAX || ret <= -safeMAX) {\n ret %= MOD;\n }\n ret += c;\n }\n return ret;\n }\n\n public static long modMul(long a, long... b) {\n long ret = a;\n for (long c : b) {\n ret *= c;\n ret %= MOD;\n }\n return ret;\n }\n\n public static long modDiv(long a, long... b) {\n long ret = a;\n for (long c : b) {\n ret *= modinv(c);\n ret %= MOD;\n }\n return ret;\n }\n\n public static long modSub(long a, long... b) {\n long ret = a;\n for (long c : b) {\n ret -= c;\n if (ret >= safeMAX || ret <= -safeMAX) {\n ret %= MOD;\n }\n }\n ret %= MOD;\n if (ret < 0) {\n ret += MOD;\n }\n return ret;\n }\n\n /**\n * Caluculate the value b s.t. a*b mod MOD = 1.\n * \n * @param a\n * @return inverse of a\n */\n public static long modinv(long a) {\n long b = MOD;\n long u = 1, v = 0;\n while (b >= 1) {\n long t = a / b;\n a -= t * b;\n long tmp1 = a;\n a = b;\n b = tmp1;\n u -= t * v;\n long tmp2 = u;\n u = v;\n v = tmp2;\n }\n u %= MOD;\n return u >= 0 ? u : u + MOD;\n }\n\n /**\n * Caluculate the combination nCr.\n * \n * @param n left\n * @param r right\n * @return nCr\n */\n public static long comb(long n, long r) {\n if (n < r) {\n return 0;\n }\n r = Math.min(r, n - r);\n long res = 1;\n for (long d = 1; d <= r; d++) {\n res *= n;\n res %= MOD;\n n--;\n res *= modinv(d);\n res %= MOD;\n }\n return res;\n }\n }\n\n static class FastScanner {\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte())\n return buffer[ptr++];\n else\n return -1;\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr]))\n ptr++;\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext())\n throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext())\n throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)\n throw new NumberFormatException();\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public void close(){\n try{\n in.close();\n } catch(Exception e){\n e.printStackTrace();\n }\n }\n }\n}", "language": "Java", "metadata": {"date": 1580864871, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03165.html", "problem_id": "p03165", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03165/input.txt", "sample_output_relpath": "derived/input_output/data/p03165/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03165/Java/s759830895.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s759830895", "user_id": "u541055501"}, "prompt_components": {"gold_output": "axb\n", "input_to_evaluate": "import java.util.ArrayDeque;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.BitSet;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Iterator;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Map.Entry;\nimport java.util.NoSuchElementException;\nimport java.util.Objects;\nimport java.util.PriorityQueue;\nimport java.util.Random;\nimport java.util.Scanner;\nimport java.util.TreeMap;\nimport java.util.TreeSet;\nimport java.util.function.BiFunction;\nimport java.util.function.IntBinaryOperator;\nimport java.util.function.LongBinaryOperator;\nimport java.util.stream.*;\n// import static java.util.Arrays.compare;\nimport static java.util.Arrays.fill;\nimport static java.util.Arrays.sort;\nimport static java.util.Collections.sort;\nimport static java.util.Comparator.reverseOrder;\n// import static java.util.List.of;\nimport static java.util.Objects.isNull;\nimport static java.util.Objects.nonNull;\n\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\n\nimport java.math.BigInteger;\nimport static java.math.BigInteger.ZERO;\nimport static java.math.BigInteger.ONE;\n// import static java.math.BigInteger.TWO;\nimport static java.math.BigInteger.TEN;\n\nimport static java.lang.Math.PI;\nimport static java.lang.Math.E;\nimport static java.lang.Math.min;\nimport static java.lang.Math.max;\nimport static java.lang.Math.abs;\nimport static java.lang.Math.sin;\nimport static java.lang.Math.cos;\nimport static java.lang.Math.tan;\nimport static java.lang.Math.asin;\nimport static java.lang.Math.acos;\nimport static java.lang.Math.atan;\nimport static java.lang.Math.atan2;\nimport static java.lang.Math.hypot;\nimport static java.lang.Math.sqrt;\nimport static java.lang.Math.log;\nimport static java.lang.Math.exp;\nimport static java.lang.String.format;\nimport static java.lang.System.exit;\nimport static java.lang.System.currentTimeMillis;\n\npublic class Main {\n public static long MOD = 1_000_000_007;\n\n public static void main(String[] args) {\n FastScanner fsc=new FastScanner();\n char[] s=('+'+fsc.next()).toCharArray();\n char[] t=('*'+fsc.next()).toCharArray();\n int n=s.length;\n int m=t.length;\n fsc.close();\n int[][] dp=new int[n][m];\n int[][][] pre=new int[n][m][2];\n for(int i=1;idp[i-1][j]){\n dp[i][j]=dp[i][j-1];\n int k=dp[pre[i][j-1][0]][pre[i][j-1][1]];\n if(dp[i][j-1]==k){\n pre[i][j]=pre[i][j-1];\n } else{\n int[] p={i, j-1};\n pre[i][j]=p;\n }\n } else{\n dp[i][j]=dp[i-1][j];\n int k=dp[pre[i-1][j][0]][pre[i-1][j][1]];\n if(dp[i-1][j]==k){\n pre[i][j]=pre[i-1][j];\n } else{\n int[] p={i-1, j};\n pre[i][j]=p;\n }\n }\n }\n }\n }\n int l=dp[n-1][m-1];\n char[] ans=new char[l];\n int indx=l-1;\n int i=n-1, j=m-1;\n while(i>0 && j>0){\n int[] p=pre[i][j];\n if(s[i]==t[j]){\n ans[indx--]=s[i];\n }\n i=p[0];\n j=p[1];\n }\n StringBuilder sb=new StringBuilder();\n for(char c:ans){\n sb.append(c);\n }\n System.out.println(sb);\n }\n\n static class IntUtil {\n public static int min(int a, int... b) {\n int ret = a;\n for (int c : b) {\n ret = Math.min(ret, c);\n }\n return ret;\n }\n\n public static int max(int a, int... b) {\n int ret = a;\n for (int c : b) {\n ret = Math.max(ret, c);\n }\n return ret;\n }\n\n /**\n * Caluculate the ceil of a/b. Returns the smallest integer greater than or\n * equal to a/b while 'a/b' rounds fractional parts to ZERO.\n * \n * @param a\n * @param b\n * @return the smallest integer greater than or equal to a/b\n */\n public static int ceilDiv(int a, int b) {\n if ((a > 0 && b > 0) || (a < 0 && b < 0)) {\n if (b > 0) {\n return (a + b - 1) / b;\n } else {\n return (a + b + 1) / b;\n }\n } else {\n return a / b;\n }\n }\n\n /**\n * Caluculate the floor of a/b. Returns the largest integer less than or equal\n * to a/b while 'a/b' rounds fractional parts to ZERO.\n * \n * @param a\n * @param b\n * @return the largest integer less than or equal to a/b\n */\n public static int floorDiv(int a, int b) {\n if ((a > 0 && b > 0) || (a < 0 && b < 0)) {\n return a / b;\n } else {\n if (b > 0) {\n return (a - b + 1) / b;\n } else {\n return (a - b - 1) / b;\n }\n }\n }\n\n public static int fold(IntBinaryOperator func, int a, int... b) {\n int ret = a;\n for (int c : b) {\n ret = func.applyAsInt(ret, c);\n }\n return ret;\n }\n }\n\n static class LongUtil {\n public static long min(long a, long... b) {\n long ret = a;\n for (long c : b) {\n ret = Math.min(ret, c);\n }\n return ret;\n }\n\n public static long max(long a, long... b) {\n long ret = a;\n for (long c : b) {\n ret = Math.max(ret, c);\n }\n return ret;\n }\n\n /**\n * Caluculate the ceil of a/b. Returns the smallest integer greater than or\n * equal to a/b while 'a/b' rounds fractional parts to ZERO.\n * \n * @param a\n * @param b\n * @return the smallest integer greater than or equal to a/b\n */\n public static long ceilDiv(long a, long b) {\n if ((a > 0 && b > 0) || (a < 0 && b < 0)) {\n if (b > 0) {\n return (a + b - 1) / b;\n } else {\n return (a + b + 1) / b;\n }\n } else {\n return a / b;\n }\n }\n\n /**\n * Caluculate the floor of a/b. Returns the largest integer less than or equal\n * to a/b while 'a/b' rounds fractional parts to ZERO.\n * \n * @param a\n * @param b\n * @return the largest integer less than or equal to a/b\n */\n public static long floorDiv(long a, long b) {\n if ((a > 0 && b > 0) || (a < 0 && b < 0)) {\n return a / b;\n } else {\n if (b > 0) {\n return (a - b + 1) / b;\n } else {\n return (a - b - 1) / b;\n }\n }\n }\n\n public static long fold(LongBinaryOperator func, long a, long... b) {\n long ret = a;\n for (long c : b) {\n ret = func.applyAsLong(ret, c);\n }\n return ret;\n }\n }\n\n static class MathUtil{\n /**\n * Enumarate primes less than n.\n * \n * @param n\n * @return {@code ArrayList} that holds primes.\n */\n public static ArrayList eratosthenes(int n) {\n int[] div = eratosthenesDivisors(n);\n ArrayList result = new ArrayList<>();\n for (int i = 2; i <= n; i++) {\n if (div[i] == i) {\n result.add(i);\n }\n }\n return result;\n }\n /**\n * execute eratosthenes's prime-enumerate algorithm. a[i] holds the greatest\n * divisor of i. if a[i]=i, i is a prime number. This arrary enables you to\n * prime-factorize in O(log n) time. ( primeFactorization(long n) {\n HashMap primes = new HashMap();\n for (long p = 2; p * p <= n; p++) {\n int q = 0;\n while (n % p == 0) {\n n /= p;\n q++;\n }\n if (q > 0) {\n primes.put(p, q);\n }\n }\n if (n > 1) {\n primes.put(n, 1);\n }\n return primes;\n }\n\n private static HashMap lcm(HashMap amap, HashMap bmap) {\n if (amap.size() < bmap.size()) {\n return lcm(bmap, amap);\n }\n HashMap lcm = amap;\n for (Map.Entry e : bmap.entrySet()) {\n long prime = e.getKey();\n if (lcm.containsKey(prime)) {\n lcm.put(prime, Math.max(lcm.get(prime), e.getValue()));\n } else {\n lcm.put(prime, e.getValue());\n }\n }\n return lcm;\n }\n\n private static HashMap lcm(HashMap amap, long b) {\n HashMap bmap = primeFactorization(b);\n return lcm(amap, bmap);\n }\n\n public static HashMap lcm(long a, long... b) {\n HashMap amap = primeFactorization(a);\n for (long c : b) {\n amap = lcm(amap, c);\n }\n return amap;\n }\n public static long unsafeLCM(long a, long b) {\n return a * b / gcd(a, b);\n }\n\n /**\n * Caluculate the GCD of (a, b)/\n * \n * @param a first value\n * @param b second value\n * @return GCD(a, b)\n */\n public static long gcd(long a, long b) {\n if (a < b) {\n return gcd(b, a);\n }\n long r = a % b;\n while (r != 0) {\n a = b;\n b = r;\n r = a % b;\n }\n return b;\n }\n\n /**\n * Return one of the solutions to {@code ax+by=gcd(a, b)}.\n * \n * @return {@code x}, {@code y}, {@code gcd(a, b)}.\n * @param a a of ax+by=gcd(a, b).\n * @param b b of ax+by=gcd(a, b). class ReferenceLong is a reference type of long.\n */\n public static long[] extGCD(long a, long b) {\n ReferenceLong x = new ReferenceLong();\n ReferenceLong y = new ReferenceLong();\n long[] ret = new long[3];\n ret[2] = extGCD(a, b, x, y);\n ret[0] = x.v;\n ret[1] = y.v;\n return ret;\n }\n\n private static long extGCD(long a, long b, ReferenceLong x, ReferenceLong y) {\n if (b == 0) {\n x.v = 1;\n y.v = 0;\n return a;\n }\n long d = extGCD(b, a % b, y, x);\n y.v -= a / b * x.v;\n return d;\n }\n\n private static class ReferenceLong {\n long v = 0;\n }\n }\n\n \n\n static class IntArrayUtil{\n public static void reverse(int[] a, int begin, int end){\n for(int i=begin;i=1;i--){\n if(ret[i]>ret[i-1]){\n int fail=n, pass=i;\n while(fail-pass>1){\n int mid=pass+(fail-pass)/2;\n if(ret[mid]>ret[i-1]) pass=mid;\n else fail=mid;\n }\n swap(ret, pass, i-1);\n reverse(ret, i, n);\n return ret;\n }\n }\n return null;\n }\n public static int[] predPermutation(int[] a){\n int[] ret=a.clone();\n int n=ret.length;\n for(int i=n-1;i>=1;i--){\n if(ret[i]1){\n int mid=pass+(fail-pass)/2;\n if(ret[mid]=b.length){\n return -1;\n } else if(a[i]>b[i]){\n return 1;\n } else if(a[i]=1;i--){\n if(ret[i]>ret[i-1]){\n int fail=n, pass=i;\n while(fail-pass>1){\n int mid=pass+(fail-pass)/2;\n if(ret[mid]>ret[i-1]) pass=mid;\n else fail=mid;\n }\n swap(ret, pass, i-1);\n reverse(ret, i, n);\n return ret;\n }\n }\n return null;\n }\n public static long[] predPermutation(long[] a){\n long[] ret=a.clone();\n int n=ret.length;\n for(int i=n-1;i>=1;i--){\n if(ret[i]1){\n int mid=pass+(fail-pass)/2;\n if(ret[mid]=b.length){\n return -1;\n } else if(a[i]>b[i]){\n return 1;\n } else if(a[i]= safeMAX || ret <= -safeMAX) {\n ret %= MOD;\n }\n ret += c;\n }\n return ret;\n }\n\n public static long modMul(long a, long... b) {\n long ret = a;\n for (long c : b) {\n ret *= c;\n ret %= MOD;\n }\n return ret;\n }\n\n public static long modDiv(long a, long... b) {\n long ret = a;\n for (long c : b) {\n ret *= modinv(c);\n ret %= MOD;\n }\n return ret;\n }\n\n public static long modSub(long a, long... b) {\n long ret = a;\n for (long c : b) {\n ret -= c;\n if (ret >= safeMAX || ret <= -safeMAX) {\n ret %= MOD;\n }\n }\n ret %= MOD;\n if (ret < 0) {\n ret += MOD;\n }\n return ret;\n }\n\n /**\n * Caluculate the value b s.t. a*b mod MOD = 1.\n * \n * @param a\n * @return inverse of a\n */\n public static long modinv(long a) {\n long b = MOD;\n long u = 1, v = 0;\n while (b >= 1) {\n long t = a / b;\n a -= t * b;\n long tmp1 = a;\n a = b;\n b = tmp1;\n u -= t * v;\n long tmp2 = u;\n u = v;\n v = tmp2;\n }\n u %= MOD;\n return u >= 0 ? u : u + MOD;\n }\n\n /**\n * Caluculate the combination nCr.\n * \n * @param n left\n * @param r right\n * @return nCr\n */\n public static long comb(long n, long r) {\n if (n < r) {\n return 0;\n }\n r = Math.min(r, n - r);\n long res = 1;\n for (long d = 1; d <= r; d++) {\n res *= n;\n res %= MOD;\n n--;\n res *= modinv(d);\n res %= MOD;\n }\n return res;\n }\n }\n\n static class FastScanner {\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte())\n return buffer[ptr++];\n else\n return -1;\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr]))\n ptr++;\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext())\n throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext())\n throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)\n throw new NumberFormatException();\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public void close(){\n try{\n in.close();\n } catch(Exception e){\n e.printStackTrace();\n }\n }\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given strings s and t.\nFind one longest string that is a subsequence of both s and t.\n\nNotes\n\nA subsequence of a string x is the string obtained by removing zero or more characters from x and concatenating the remaining characters without changing the order.\n\nConstraints\n\ns and t are strings consisting of lowercase English letters.\n\n1 \\leq |s|, |t| \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nPrint one longest string that is a subsequence of both s and t.\nIf there are multiple such strings, any of them will be accepted.\n\nSample Input 1\n\naxyb\nabyxb\n\nSample Output 1\n\naxb\n\nThe answer is axb or ayb; either will be accepted.\n\nSample Input 2\n\naa\nxayaz\n\nSample Output 2\n\naa\n\nSample Input 3\n\na\nz\n\nSample Output 3\n\nThe answer is (an empty string).\n\nSample Input 4\n\nabracadabra\navadakedavra\n\nSample Output 4\n\naaadara", "sample_input": "axyb\nabyxb\n"}, "reference_outputs": ["axb\n"], "source_document_id": "p03165", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given strings s and t.\nFind one longest string that is a subsequence of both s and t.\n\nNotes\n\nA subsequence of a string x is the string obtained by removing zero or more characters from x and concatenating the remaining characters without changing the order.\n\nConstraints\n\ns and t are strings consisting of lowercase English letters.\n\n1 \\leq |s|, |t| \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nPrint one longest string that is a subsequence of both s and t.\nIf there are multiple such strings, any of them will be accepted.\n\nSample Input 1\n\naxyb\nabyxb\n\nSample Output 1\n\naxb\n\nThe answer is axb or ayb; either will be accepted.\n\nSample Input 2\n\naa\nxayaz\n\nSample Output 2\n\naa\n\nSample Input 3\n\na\nz\n\nSample Output 3\n\nThe answer is (an empty string).\n\nSample Input 4\n\nabracadabra\navadakedavra\n\nSample Output 4\n\naaadara", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 23069, "cpu_time_ms": 2110, "memory_kb": 539800}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s494467861", "group_id": "codeNet:p03165", "input_text": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayDeque;\n\npublic class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\t\t\n\t\tchar s[] = br.readLine().toCharArray();\n\t\tchar t[] = br.readLine().toCharArray();\n\t\tbr.close();\n\n\t\tint row = t.length;\n\t\tint col = s.length;\n\t\tint tb[][] = new int[row + 1][col + 1];\n\n\t\tfor ( int r = 0; r < row; r++ ) {\n\t\t\tfor ( int c = 0; c < col; c++ ) {\n\t\t\t\tif ( t[r] == s[c] ) {\n\t\t\t\t\ttb[r + 1][c + 1] = tb[r][c] + 1;\n\t\t\t\t} else {\n\t\t\t\t\ttb[r + 1][c + 1] = Math.max(tb[r + 1][c], tb[r][c + 1]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tint r = row;\n\t\tint c = col;\n\t\tArrayDeque stack = new ArrayDeque();\n\t\tstack.add(' ');\n\t\twhile ( tb[r][c] != 0 ) {\n\n\t\t\t// 左上に行けるとき\n\t\t\tif ( tb[r - 1][c - 1] == tb[r][c] ) {\n\t\t\t\tr -= 1;\n\t\t\t\tc -= 1;\n\t\t\t} else\n\t\t\t// 上にだけ行けるとき\n\t\t\tif ( tb[r - 1][c] == tb[r][c] ) {\n\t\t\t\tr -= 1;\n\t\t\t} else\n\t\t\t// 左にだけ行けるとき\n\t\t\tif ( tb[r][c - 1] == tb[r][c] ) {\n\t\t\t\tc -= 1;\n\t\t\t} else\n\t\t\t// 行き止まり\n\t\t\t{\n\t\t\t\tstack.add((Character) s[c - 1]);\n\t\t\t\tr -= 1;\n\t\t\t\tc -= 1;\n\t\t\t}\n\t\t}\n\n\t\tStringBuilder sb = new StringBuilder();\n\t\twhile ( stack.size() > 0 ) {\n\t\t\tsb.append(stack.pollLast());\n\t\t}\n\t\tSystem.out.println(sb);\n\t}\n}\n", "language": "Java", "metadata": {"date": 1568903107, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03165.html", "problem_id": "p03165", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03165/input.txt", "sample_output_relpath": "derived/input_output/data/p03165/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03165/Java/s494467861.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s494467861", "user_id": "u605722824"}, "prompt_components": {"gold_output": "axb\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayDeque;\n\npublic class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\t\t\n\t\tchar s[] = br.readLine().toCharArray();\n\t\tchar t[] = br.readLine().toCharArray();\n\t\tbr.close();\n\n\t\tint row = t.length;\n\t\tint col = s.length;\n\t\tint tb[][] = new int[row + 1][col + 1];\n\n\t\tfor ( int r = 0; r < row; r++ ) {\n\t\t\tfor ( int c = 0; c < col; c++ ) {\n\t\t\t\tif ( t[r] == s[c] ) {\n\t\t\t\t\ttb[r + 1][c + 1] = tb[r][c] + 1;\n\t\t\t\t} else {\n\t\t\t\t\ttb[r + 1][c + 1] = Math.max(tb[r + 1][c], tb[r][c + 1]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tint r = row;\n\t\tint c = col;\n\t\tArrayDeque stack = new ArrayDeque();\n\t\tstack.add(' ');\n\t\twhile ( tb[r][c] != 0 ) {\n\n\t\t\t// 左上に行けるとき\n\t\t\tif ( tb[r - 1][c - 1] == tb[r][c] ) {\n\t\t\t\tr -= 1;\n\t\t\t\tc -= 1;\n\t\t\t} else\n\t\t\t// 上にだけ行けるとき\n\t\t\tif ( tb[r - 1][c] == tb[r][c] ) {\n\t\t\t\tr -= 1;\n\t\t\t} else\n\t\t\t// 左にだけ行けるとき\n\t\t\tif ( tb[r][c - 1] == tb[r][c] ) {\n\t\t\t\tc -= 1;\n\t\t\t} else\n\t\t\t// 行き止まり\n\t\t\t{\n\t\t\t\tstack.add((Character) s[c - 1]);\n\t\t\t\tr -= 1;\n\t\t\t\tc -= 1;\n\t\t\t}\n\t\t}\n\n\t\tStringBuilder sb = new StringBuilder();\n\t\twhile ( stack.size() > 0 ) {\n\t\t\tsb.append(stack.pollLast());\n\t\t}\n\t\tSystem.out.println(sb);\n\t}\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given strings s and t.\nFind one longest string that is a subsequence of both s and t.\n\nNotes\n\nA subsequence of a string x is the string obtained by removing zero or more characters from x and concatenating the remaining characters without changing the order.\n\nConstraints\n\ns and t are strings consisting of lowercase English letters.\n\n1 \\leq |s|, |t| \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nPrint one longest string that is a subsequence of both s and t.\nIf there are multiple such strings, any of them will be accepted.\n\nSample Input 1\n\naxyb\nabyxb\n\nSample Output 1\n\naxb\n\nThe answer is axb or ayb; either will be accepted.\n\nSample Input 2\n\naa\nxayaz\n\nSample Output 2\n\naa\n\nSample Input 3\n\na\nz\n\nSample Output 3\n\nThe answer is (an empty string).\n\nSample Input 4\n\nabracadabra\navadakedavra\n\nSample Output 4\n\naaadara", "sample_input": "axyb\nabyxb\n"}, "reference_outputs": ["axb\n"], "source_document_id": "p03165", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given strings s and t.\nFind one longest string that is a subsequence of both s and t.\n\nNotes\n\nA subsequence of a string x is the string obtained by removing zero or more characters from x and concatenating the remaining characters without changing the order.\n\nConstraints\n\ns and t are strings consisting of lowercase English letters.\n\n1 \\leq |s|, |t| \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nPrint one longest string that is a subsequence of both s and t.\nIf there are multiple such strings, any of them will be accepted.\n\nSample Input 1\n\naxyb\nabyxb\n\nSample Output 1\n\naxb\n\nThe answer is axb or ayb; either will be accepted.\n\nSample Input 2\n\naa\nxayaz\n\nSample Output 2\n\naa\n\nSample Input 3\n\na\nz\n\nSample Output 3\n\nThe answer is (an empty string).\n\nSample Input 4\n\nabracadabra\navadakedavra\n\nSample Output 4\n\naaadara", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1365, "cpu_time_ms": 175, "memory_kb": 82388}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s113875455", "group_id": "codeNet:p03165", "input_text": "import java.util.ArrayDeque;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tstatic char\ts[];\n\tstatic char\tt[];\n\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\ts = in.next().toCharArray();\n\t\tt = in.next().toCharArray();\n\t\tin.close();\n\n\t\tint row = t.length;\n\t\tint col = s.length;\n\t\tint tb[][] = new int[row + 1][col + 1];\n\t\t//int lcs = 0;\n\n\t\tfor ( int r = 0; r < row; r++ ) {\n\t\t\tfor ( int c = 0; c < col; c++ ) {\n\t\t\t\tif ( t[r] == s[c] ) {\n\t\t\t\t\ttb[r + 1][c + 1] = tb[r][c] + 1;\n\t\t\t\t\t// lcs = Math.max(lcs, tb[r + 1][c + 1]);\n\t\t\t\t} else {\n\t\t\t\t\ttb[r + 1][c + 1] = Math.max(tb[r + 1][c], tb[r][c + 1]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n//\t\tfor ( int[] is : tb ) {\n//\t\t\tfor ( int i : is ) {\n//\t\t\t\tSystem.out.print(i + \" \");\n//\t\t\t}\n//\t\t\tSystem.out.println();\n//\t\t}\n\n\t\tint r = row;\n\t\tint c = col;\n\t\tArrayDeque stack = new ArrayDeque();\n\t\twhile ( r > 0 && c > 0 ) {\n\n\t\t\t// 左上に行けるとき\n\t\t\tif ( tb[r][c] == tb[r - 1][c - 1] ) {\n\t\t\t\tr -= 1;\n\t\t\t\tc -= 1;\n\t\t\t} else\n\t\t\t// 上にだけ行けるとき\n\t\t\tif ( tb[r][c] != tb[r][c - 1] && tb[r][c] == tb[r - 1][c] ) {\n\t\t\t\tr -= 1;\n\t\t\t} else\n\t\t\t// 左にだけ行けるとき\n\t\t\tif ( tb[r][c] == tb[r][c - 1] && tb[r][c] != tb[r - 1][c] ) {\n\t\t\t\tc -= 1;\n\t\t\t} else\n\t\t\t// 行き止まり\n\t\t\t{\n\t\t\t\tstack.add((Character) s[c-1]);\n\t\t\t\tr -= 1;\n\t\t\t\tc -= 1;\n\t\t\t}\n\t\t}\n\t\tif(stack.size() == 0) {\n\t\t\tSystem.out.print(' ');\n\t\t\treturn;\n\t\t}\n\n\t\twhile ( stack.size() > 0 ) {\n\t\t\tSystem.out.print(stack.pollLast());\n\t\t}\n//\t\tSystem.out.println();\n//\t\tSystem.out.println(tb[row][col]);\n\t}\n}", "language": "Java", "metadata": {"date": 1568898989, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03165.html", "problem_id": "p03165", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03165/input.txt", "sample_output_relpath": "derived/input_output/data/p03165/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03165/Java/s113875455.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s113875455", "user_id": "u605722824"}, "prompt_components": {"gold_output": "axb\n", "input_to_evaluate": "import java.util.ArrayDeque;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tstatic char\ts[];\n\tstatic char\tt[];\n\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\ts = in.next().toCharArray();\n\t\tt = in.next().toCharArray();\n\t\tin.close();\n\n\t\tint row = t.length;\n\t\tint col = s.length;\n\t\tint tb[][] = new int[row + 1][col + 1];\n\t\t//int lcs = 0;\n\n\t\tfor ( int r = 0; r < row; r++ ) {\n\t\t\tfor ( int c = 0; c < col; c++ ) {\n\t\t\t\tif ( t[r] == s[c] ) {\n\t\t\t\t\ttb[r + 1][c + 1] = tb[r][c] + 1;\n\t\t\t\t\t// lcs = Math.max(lcs, tb[r + 1][c + 1]);\n\t\t\t\t} else {\n\t\t\t\t\ttb[r + 1][c + 1] = Math.max(tb[r + 1][c], tb[r][c + 1]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n//\t\tfor ( int[] is : tb ) {\n//\t\t\tfor ( int i : is ) {\n//\t\t\t\tSystem.out.print(i + \" \");\n//\t\t\t}\n//\t\t\tSystem.out.println();\n//\t\t}\n\n\t\tint r = row;\n\t\tint c = col;\n\t\tArrayDeque stack = new ArrayDeque();\n\t\twhile ( r > 0 && c > 0 ) {\n\n\t\t\t// 左上に行けるとき\n\t\t\tif ( tb[r][c] == tb[r - 1][c - 1] ) {\n\t\t\t\tr -= 1;\n\t\t\t\tc -= 1;\n\t\t\t} else\n\t\t\t// 上にだけ行けるとき\n\t\t\tif ( tb[r][c] != tb[r][c - 1] && tb[r][c] == tb[r - 1][c] ) {\n\t\t\t\tr -= 1;\n\t\t\t} else\n\t\t\t// 左にだけ行けるとき\n\t\t\tif ( tb[r][c] == tb[r][c - 1] && tb[r][c] != tb[r - 1][c] ) {\n\t\t\t\tc -= 1;\n\t\t\t} else\n\t\t\t// 行き止まり\n\t\t\t{\n\t\t\t\tstack.add((Character) s[c-1]);\n\t\t\t\tr -= 1;\n\t\t\t\tc -= 1;\n\t\t\t}\n\t\t}\n\t\tif(stack.size() == 0) {\n\t\t\tSystem.out.print(' ');\n\t\t\treturn;\n\t\t}\n\n\t\twhile ( stack.size() > 0 ) {\n\t\t\tSystem.out.print(stack.pollLast());\n\t\t}\n//\t\tSystem.out.println();\n//\t\tSystem.out.println(tb[row][col]);\n\t}\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given strings s and t.\nFind one longest string that is a subsequence of both s and t.\n\nNotes\n\nA subsequence of a string x is the string obtained by removing zero or more characters from x and concatenating the remaining characters without changing the order.\n\nConstraints\n\ns and t are strings consisting of lowercase English letters.\n\n1 \\leq |s|, |t| \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nPrint one longest string that is a subsequence of both s and t.\nIf there are multiple such strings, any of them will be accepted.\n\nSample Input 1\n\naxyb\nabyxb\n\nSample Output 1\n\naxb\n\nThe answer is axb or ayb; either will be accepted.\n\nSample Input 2\n\naa\nxayaz\n\nSample Output 2\n\naa\n\nSample Input 3\n\na\nz\n\nSample Output 3\n\nThe answer is (an empty string).\n\nSample Input 4\n\nabracadabra\navadakedavra\n\nSample Output 4\n\naaadara", "sample_input": "axyb\nabyxb\n"}, "reference_outputs": ["axb\n"], "source_document_id": "p03165", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given strings s and t.\nFind one longest string that is a subsequence of both s and t.\n\nNotes\n\nA subsequence of a string x is the string obtained by removing zero or more characters from x and concatenating the remaining characters without changing the order.\n\nConstraints\n\ns and t are strings consisting of lowercase English letters.\n\n1 \\leq |s|, |t| \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nPrint one longest string that is a subsequence of both s and t.\nIf there are multiple such strings, any of them will be accepted.\n\nSample Input 1\n\naxyb\nabyxb\n\nSample Output 1\n\naxb\n\nThe answer is axb or ayb; either will be accepted.\n\nSample Input 2\n\naa\nxayaz\n\nSample Output 2\n\naa\n\nSample Input 3\n\na\nz\n\nSample Output 3\n\nThe answer is (an empty string).\n\nSample Input 4\n\nabracadabra\navadakedavra\n\nSample Output 4\n\naaadara", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1542, "cpu_time_ms": 231, "memory_kb": 80972}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s057523865", "group_id": "codeNet:p03165", "input_text": "import java.util.*;\nimport java.io.*;\n\n/*\n * F - LCS\n */\npublic class Main\n{\nstatic char[] s;\nstatic char[] t;\nstatic StringBuilder[][] cache2;\nstatic String answer;\nstatic final StringBuilder nullBuilder = new StringBuilder();\n\npublic static void main( String[] args ) throws Exception\n{\n\tlong now = System.currentTimeMillis();\n\tfinal BufferedReader reader = new BufferedReader( new InputStreamReader( getInputStream() ) );// System.in ) );\n\ts = reader.readLine().toCharArray();\n\tt = reader.readLine().toCharArray();\n\tcache2 = new StringBuilder[ s.length ][ t.length ];\n\n\tanswer = search( 0, 0 ).toString();\n\n\tp( answer );\n\tif( System.getProperty( \"test\" ) != null )\n\t{\n\t\tp( answer.length() );\n\t\tp( System.currentTimeMillis() - now );\n\t}\n}\n\npublic static InputStream getInputStream() throws IOException\n{\n\t//p( System.getProperties() );\n\tif( System.getProperty( \"test\" ) != null )\n\t{\n\t\treturn new FileInputStream( \"1\" );\n\t}\n\telse\n\t{\n\t\treturn System.in;\n\t}\n}\n\npublic static StringBuilder search( int I, int J )\n{\n\tif( I == s.length || J == t.length )\n\t{\n\t\t//p( \"return null\" );\n\t\treturn nullBuilder;\n\t}\n\t\n\t{\n\t\tfinal StringBuilder cached = cache2[ I ][ J ];\n\t\tif( cached != null )\n\t\t{\n\t\t\t//p( \"return cached:\" + I + \" \" + J + \" \" + cached );\n\t\t\treturn cached;\n\t\t}\t\t\n\t}\n\n\tStringBuilder result = null;\n\n\tif( s[ I ] == t[ J ] )\n\t{\n\t\tStringBuilder searchResult = search( I + 1, J + 1 );\n\t\tStringBuilder tmpResult = new StringBuilder( searchResult.length() + 100 );\n\t\ttmpResult.append( s[ I ] );\n\t\ttmpResult.append( searchResult );\n\t\tresult = tmpResult;\n\t}\n\telse\n\t{\n\t\t//捨てる場合の結果を取得\n\t\tfinal StringBuilder resultOnDrop = search( I + 1, J );\n\n\t\t//捨てない場合の結果を取得\n\t\t//tの最初のs[ I ]と同じ文字の位置を探す\n\t\tint index = -1;\n\t\tfor( int j = J + 1; j < t.length; ++j )\n\t\t{\n\t\t\tif( t[ j ] == s[ I ] )\n\t\t\t{\n\t\t\t\tindex = j;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif( index != -1 )\n\t\t{\n\t\t\t//見つかった\n\t\t\tStringBuilder searchResult = search( I + 1, index + 1 );\n\t\t\tint lengthOnUse = searchResult.length() + 1;\n\n\t\t\tif( resultOnDrop.length() > lengthOnUse )\n\t\t\t{\n\t\t\t\tresult = resultOnDrop;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tfinal StringBuilder resultOnUse = new StringBuilder( searchResult.length() + 100 );\n\t\t\t\tresultOnUse.append( s[ I ] );\n\t\t\t\tresultOnUse.append( searchResult );\n\t\t\t\tresult = resultOnUse;\n\n\t\t\t\t//キャッシュ\n\t\t\t\tfor( int j = J; j < index + 1; ++j )\n\t\t\t\t{\n\t\t\t\t\tcache2[ I ][ j ] = result;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tresult = resultOnDrop;\n\t\t}\n\t\t\n\t\tint cached = 0;\n\t\tif( result == resultOnDrop )\n\t\t{\n\t\t\tfor( int i = I + 1; i < s.length; ++i )\n\t\t\t{\n\t\t\t\tif( s[ I ] == s[ i ] )\n\t\t\t\t{\n\t\t\t\t\tcache2[ i ][ J ] = result;\n\t\t\t\t\t++cached;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tfor( int j = J + 1; j < t.length; ++j )\n\t\t\t{\n\t\t\t\tif( t[ J ] == t[ j ] )\n\t\t\t\t{\n\t\t\t\t\tcache2[ I ][ j ] = result;\n\t\t\t\t\t++cached;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t//p( cached );\n\t}\n\n\t//キャッシュ\n\tcache2[ I ][ J ] = result;\n\n\treturn result;\n}\n\npublic static void p( Object o )\n{\n\tSystem.out.println( o );\n}\n\n}\n", "language": "Java", "metadata": {"date": 1567171074, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03165.html", "problem_id": "p03165", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03165/input.txt", "sample_output_relpath": "derived/input_output/data/p03165/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03165/Java/s057523865.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s057523865", "user_id": "u208228736"}, "prompt_components": {"gold_output": "axb\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\n\n/*\n * F - LCS\n */\npublic class Main\n{\nstatic char[] s;\nstatic char[] t;\nstatic StringBuilder[][] cache2;\nstatic String answer;\nstatic final StringBuilder nullBuilder = new StringBuilder();\n\npublic static void main( String[] args ) throws Exception\n{\n\tlong now = System.currentTimeMillis();\n\tfinal BufferedReader reader = new BufferedReader( new InputStreamReader( getInputStream() ) );// System.in ) );\n\ts = reader.readLine().toCharArray();\n\tt = reader.readLine().toCharArray();\n\tcache2 = new StringBuilder[ s.length ][ t.length ];\n\n\tanswer = search( 0, 0 ).toString();\n\n\tp( answer );\n\tif( System.getProperty( \"test\" ) != null )\n\t{\n\t\tp( answer.length() );\n\t\tp( System.currentTimeMillis() - now );\n\t}\n}\n\npublic static InputStream getInputStream() throws IOException\n{\n\t//p( System.getProperties() );\n\tif( System.getProperty( \"test\" ) != null )\n\t{\n\t\treturn new FileInputStream( \"1\" );\n\t}\n\telse\n\t{\n\t\treturn System.in;\n\t}\n}\n\npublic static StringBuilder search( int I, int J )\n{\n\tif( I == s.length || J == t.length )\n\t{\n\t\t//p( \"return null\" );\n\t\treturn nullBuilder;\n\t}\n\t\n\t{\n\t\tfinal StringBuilder cached = cache2[ I ][ J ];\n\t\tif( cached != null )\n\t\t{\n\t\t\t//p( \"return cached:\" + I + \" \" + J + \" \" + cached );\n\t\t\treturn cached;\n\t\t}\t\t\n\t}\n\n\tStringBuilder result = null;\n\n\tif( s[ I ] == t[ J ] )\n\t{\n\t\tStringBuilder searchResult = search( I + 1, J + 1 );\n\t\tStringBuilder tmpResult = new StringBuilder( searchResult.length() + 100 );\n\t\ttmpResult.append( s[ I ] );\n\t\ttmpResult.append( searchResult );\n\t\tresult = tmpResult;\n\t}\n\telse\n\t{\n\t\t//捨てる場合の結果を取得\n\t\tfinal StringBuilder resultOnDrop = search( I + 1, J );\n\n\t\t//捨てない場合の結果を取得\n\t\t//tの最初のs[ I ]と同じ文字の位置を探す\n\t\tint index = -1;\n\t\tfor( int j = J + 1; j < t.length; ++j )\n\t\t{\n\t\t\tif( t[ j ] == s[ I ] )\n\t\t\t{\n\t\t\t\tindex = j;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif( index != -1 )\n\t\t{\n\t\t\t//見つかった\n\t\t\tStringBuilder searchResult = search( I + 1, index + 1 );\n\t\t\tint lengthOnUse = searchResult.length() + 1;\n\n\t\t\tif( resultOnDrop.length() > lengthOnUse )\n\t\t\t{\n\t\t\t\tresult = resultOnDrop;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tfinal StringBuilder resultOnUse = new StringBuilder( searchResult.length() + 100 );\n\t\t\t\tresultOnUse.append( s[ I ] );\n\t\t\t\tresultOnUse.append( searchResult );\n\t\t\t\tresult = resultOnUse;\n\n\t\t\t\t//キャッシュ\n\t\t\t\tfor( int j = J; j < index + 1; ++j )\n\t\t\t\t{\n\t\t\t\t\tcache2[ I ][ j ] = result;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tresult = resultOnDrop;\n\t\t}\n\t\t\n\t\tint cached = 0;\n\t\tif( result == resultOnDrop )\n\t\t{\n\t\t\tfor( int i = I + 1; i < s.length; ++i )\n\t\t\t{\n\t\t\t\tif( s[ I ] == s[ i ] )\n\t\t\t\t{\n\t\t\t\t\tcache2[ i ][ J ] = result;\n\t\t\t\t\t++cached;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tfor( int j = J + 1; j < t.length; ++j )\n\t\t\t{\n\t\t\t\tif( t[ J ] == t[ j ] )\n\t\t\t\t{\n\t\t\t\t\tcache2[ I ][ j ] = result;\n\t\t\t\t\t++cached;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t//p( cached );\n\t}\n\n\t//キャッシュ\n\tcache2[ I ][ J ] = result;\n\n\treturn result;\n}\n\npublic static void p( Object o )\n{\n\tSystem.out.println( o );\n}\n\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given strings s and t.\nFind one longest string that is a subsequence of both s and t.\n\nNotes\n\nA subsequence of a string x is the string obtained by removing zero or more characters from x and concatenating the remaining characters without changing the order.\n\nConstraints\n\ns and t are strings consisting of lowercase English letters.\n\n1 \\leq |s|, |t| \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nPrint one longest string that is a subsequence of both s and t.\nIf there are multiple such strings, any of them will be accepted.\n\nSample Input 1\n\naxyb\nabyxb\n\nSample Output 1\n\naxb\n\nThe answer is axb or ayb; either will be accepted.\n\nSample Input 2\n\naa\nxayaz\n\nSample Output 2\n\naa\n\nSample Input 3\n\na\nz\n\nSample Output 3\n\nThe answer is (an empty string).\n\nSample Input 4\n\nabracadabra\navadakedavra\n\nSample Output 4\n\naaadara", "sample_input": "axyb\nabyxb\n"}, "reference_outputs": ["axb\n"], "source_document_id": "p03165", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given strings s and t.\nFind one longest string that is a subsequence of both s and t.\n\nNotes\n\nA subsequence of a string x is the string obtained by removing zero or more characters from x and concatenating the remaining characters without changing the order.\n\nConstraints\n\ns and t are strings consisting of lowercase English letters.\n\n1 \\leq |s|, |t| \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nPrint one longest string that is a subsequence of both s and t.\nIf there are multiple such strings, any of them will be accepted.\n\nSample Input 1\n\naxyb\nabyxb\n\nSample Output 1\n\naxb\n\nThe answer is axb or ayb; either will be accepted.\n\nSample Input 2\n\naa\nxayaz\n\nSample Output 2\n\naa\n\nSample Input 3\n\na\nz\n\nSample Output 3\n\nThe answer is (an empty string).\n\nSample Input 4\n\nabracadabra\navadakedavra\n\nSample Output 4\n\naaadara", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3009, "cpu_time_ms": 2115, "memory_kb": 1024612}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s631024683", "group_id": "codeNet:p03165", "input_text": "import java.util.*;\nimport java.io.*;\n\n/*\n * F - LCS\n */\npublic class Main\n{\nstatic char[] s;\nstatic char[] t;\nstatic StringBuilder[][] cache2;\nstatic String answer;\nstatic final StringBuilder nullBuilder = new StringBuilder();\n\npublic static void main( String[] args ) throws Exception\n{\n\tlong now = System.currentTimeMillis();\n\tfinal BufferedReader reader = new BufferedReader( new InputStreamReader( getInputStream() ) );// System.in ) );\n\ts = reader.readLine().toCharArray();\n\tt = reader.readLine().toCharArray();\n\tcache2 = new StringBuilder[ s.length ][ t.length ];\n\n\tanswer = search( 0, 0 ).toString();\n\n\tp( answer );\n\tif( System.getProperty( \"test\" ) != null )\n\t{\n\t\tp( answer.length() );\n\t\tp( System.currentTimeMillis() - now );\n\t}\n}\n\npublic static InputStream getInputStream() throws IOException\n{\n\t//p( System.getProperties() );\n\tif( System.getProperty( \"test\" ) != null )\n\t{\n\t\treturn new FileInputStream( \"1\" );\n\t}\n\telse\n\t{\n\t\treturn System.in;\n\t}\n}\n\npublic static StringBuilder search( int I, int J )\n{\n\tif( I == s.length || J == t.length )\n\t{\n\t\t//p( \"return null\" );\n\t\treturn nullBuilder;\n\t}\n\tfinal StringBuilder cached = cache2[ I ][ J ];\n\tif( cached != null )\n\t{\n\t\t//p( \"return cached:\" + I + \" \" + J + \" \" + cached );\n\t\treturn cached;\n\t}\n\n\tStringBuilder result = null;\n\n\tif( s[ I ] == t[ J ] )\n\t{\n\t\tStringBuilder tmpResult = new StringBuilder();\n\t\ttmpResult.append( s[ I ] );\n\t\ttmpResult.append( search( I + 1, J + 1 ) );\n\t\tresult = tmpResult;\n\t}\n\telse\n\t{\n\t\t//捨てる場合の結果を取得\n\t\tfinal StringBuilder resultOnDrop = search( I + 1, J );\n\n\t\t//捨てない場合の結果を取得\n\t\t//tの最初のs[ I ]と同じ文字の位置を探す\n\t\tint index = -1;\n\t\tfor( int j = J; j < t.length; ++j )\n\t\t{\n\t\t\tif( t[ j ] == s[ I ] )\n\t\t\t{\n\t\t\t\tindex = j;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif( index != -1 )\n\t\t{\n\t\t\t//見つかった\n\t\t\tStringBuilder searchResult = search( I + 1, index + 1 );\n\t\t\tint lengthOnUse = searchResult.length() + 1;\n\n\t\t\tif( resultOnDrop.length() > lengthOnUse )\n\t\t\t{\n\t\t\t\tresult = resultOnDrop;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tfinal StringBuilder resultOnUse = new StringBuilder();\n\t\t\t\tresultOnUse.append( s[ I ] );\n\t\t\t\tresultOnUse.append( search( I + 1, index + 1 ) );\n\t\t\t\tresult = resultOnUse;\n\n\t\t\t\t//キャッシュ\n\t\t\t\tfor( int j = J; j < index + 1; ++j )\n\t\t\t\t{\n\t\t\t\t\tcache2[ I ][ j ] = result;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\telse\n\t\t{\n\t\t\tresult = resultOnDrop;\n\t\t}\n\t}\n\n\t//キャッシュ\n\tcache2[ I ][ J ] = result;\n\n\treturn result;\n}\n\npublic static void p( Object o )\n{\n\tSystem.out.println( o );\n}\n\n}\n", "language": "Java", "metadata": {"date": 1567169443, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03165.html", "problem_id": "p03165", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03165/input.txt", "sample_output_relpath": "derived/input_output/data/p03165/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03165/Java/s631024683.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s631024683", "user_id": "u208228736"}, "prompt_components": {"gold_output": "axb\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\n\n/*\n * F - LCS\n */\npublic class Main\n{\nstatic char[] s;\nstatic char[] t;\nstatic StringBuilder[][] cache2;\nstatic String answer;\nstatic final StringBuilder nullBuilder = new StringBuilder();\n\npublic static void main( String[] args ) throws Exception\n{\n\tlong now = System.currentTimeMillis();\n\tfinal BufferedReader reader = new BufferedReader( new InputStreamReader( getInputStream() ) );// System.in ) );\n\ts = reader.readLine().toCharArray();\n\tt = reader.readLine().toCharArray();\n\tcache2 = new StringBuilder[ s.length ][ t.length ];\n\n\tanswer = search( 0, 0 ).toString();\n\n\tp( answer );\n\tif( System.getProperty( \"test\" ) != null )\n\t{\n\t\tp( answer.length() );\n\t\tp( System.currentTimeMillis() - now );\n\t}\n}\n\npublic static InputStream getInputStream() throws IOException\n{\n\t//p( System.getProperties() );\n\tif( System.getProperty( \"test\" ) != null )\n\t{\n\t\treturn new FileInputStream( \"1\" );\n\t}\n\telse\n\t{\n\t\treturn System.in;\n\t}\n}\n\npublic static StringBuilder search( int I, int J )\n{\n\tif( I == s.length || J == t.length )\n\t{\n\t\t//p( \"return null\" );\n\t\treturn nullBuilder;\n\t}\n\tfinal StringBuilder cached = cache2[ I ][ J ];\n\tif( cached != null )\n\t{\n\t\t//p( \"return cached:\" + I + \" \" + J + \" \" + cached );\n\t\treturn cached;\n\t}\n\n\tStringBuilder result = null;\n\n\tif( s[ I ] == t[ J ] )\n\t{\n\t\tStringBuilder tmpResult = new StringBuilder();\n\t\ttmpResult.append( s[ I ] );\n\t\ttmpResult.append( search( I + 1, J + 1 ) );\n\t\tresult = tmpResult;\n\t}\n\telse\n\t{\n\t\t//捨てる場合の結果を取得\n\t\tfinal StringBuilder resultOnDrop = search( I + 1, J );\n\n\t\t//捨てない場合の結果を取得\n\t\t//tの最初のs[ I ]と同じ文字の位置を探す\n\t\tint index = -1;\n\t\tfor( int j = J; j < t.length; ++j )\n\t\t{\n\t\t\tif( t[ j ] == s[ I ] )\n\t\t\t{\n\t\t\t\tindex = j;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif( index != -1 )\n\t\t{\n\t\t\t//見つかった\n\t\t\tStringBuilder searchResult = search( I + 1, index + 1 );\n\t\t\tint lengthOnUse = searchResult.length() + 1;\n\n\t\t\tif( resultOnDrop.length() > lengthOnUse )\n\t\t\t{\n\t\t\t\tresult = resultOnDrop;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tfinal StringBuilder resultOnUse = new StringBuilder();\n\t\t\t\tresultOnUse.append( s[ I ] );\n\t\t\t\tresultOnUse.append( search( I + 1, index + 1 ) );\n\t\t\t\tresult = resultOnUse;\n\n\t\t\t\t//キャッシュ\n\t\t\t\tfor( int j = J; j < index + 1; ++j )\n\t\t\t\t{\n\t\t\t\t\tcache2[ I ][ j ] = result;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\telse\n\t\t{\n\t\t\tresult = resultOnDrop;\n\t\t}\n\t}\n\n\t//キャッシュ\n\tcache2[ I ][ J ] = result;\n\n\treturn result;\n}\n\npublic static void p( Object o )\n{\n\tSystem.out.println( o );\n}\n\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given strings s and t.\nFind one longest string that is a subsequence of both s and t.\n\nNotes\n\nA subsequence of a string x is the string obtained by removing zero or more characters from x and concatenating the remaining characters without changing the order.\n\nConstraints\n\ns and t are strings consisting of lowercase English letters.\n\n1 \\leq |s|, |t| \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nPrint one longest string that is a subsequence of both s and t.\nIf there are multiple such strings, any of them will be accepted.\n\nSample Input 1\n\naxyb\nabyxb\n\nSample Output 1\n\naxb\n\nThe answer is axb or ayb; either will be accepted.\n\nSample Input 2\n\naa\nxayaz\n\nSample Output 2\n\naa\n\nSample Input 3\n\na\nz\n\nSample Output 3\n\nThe answer is (an empty string).\n\nSample Input 4\n\nabracadabra\navadakedavra\n\nSample Output 4\n\naaadara", "sample_input": "axyb\nabyxb\n"}, "reference_outputs": ["axb\n"], "source_document_id": "p03165", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given strings s and t.\nFind one longest string that is a subsequence of both s and t.\n\nNotes\n\nA subsequence of a string x is the string obtained by removing zero or more characters from x and concatenating the remaining characters without changing the order.\n\nConstraints\n\ns and t are strings consisting of lowercase English letters.\n\n1 \\leq |s|, |t| \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nPrint one longest string that is a subsequence of both s and t.\nIf there are multiple such strings, any of them will be accepted.\n\nSample Input 1\n\naxyb\nabyxb\n\nSample Output 1\n\naxb\n\nThe answer is axb or ayb; either will be accepted.\n\nSample Input 2\n\naa\nxayaz\n\nSample Output 2\n\naa\n\nSample Input 3\n\na\nz\n\nSample Output 3\n\nThe answer is (an empty string).\n\nSample Input 4\n\nabracadabra\navadakedavra\n\nSample Output 4\n\naaadara", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2509, "cpu_time_ms": 2114, "memory_kb": 1034132}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s373690933", "group_id": "codeNet:p03165", "input_text": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\npublic class Main {\n private static final BufferedReader READER = new BufferedReader(new InputStreamReader(System.in));\n\n private static int getInt() {\n return Integer.parseInt(line());\n }\n\n private static int[] getIntArr(int n) {\n int[] ans = new int[n];\n\n StringTokenizer stringTokenizer = new StringTokenizer(line(), \" \");\n for (int i = 0; i < n && stringTokenizer.hasMoreTokens(); i++) {\n ans[i] = Integer.parseInt(stringTokenizer.nextToken());\n }\n\n return ans;\n }\n\n private static String line() {\n try {\n return READER.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n\n private static String solve() {\n return solveInternal(line(), line());\n }\n\n private static String solveInternal(String s, String t) {\n if (s.equals(t)) {\n return s;\n }\n if (s.isEmpty() || t.isEmpty()) {\n return \"\";\n }\n\n int[][] dp = new int[s.length()][t.length()];\n\n char firstS = s.charAt(0);\n char firstT = t.charAt(0);\n\n dp[0][0] = firstS == firstT ? 1 : 0;\n\n for (int i = 1; i < s.length(); i++) {\n dp[i][0] = s.charAt(i) == firstT ? 1 : dp[i - 1][0];\n }\n for (int i = 1; i < t.length(); i++) {\n dp[0][i] = t.charAt(i) == firstS ? 1 : dp[0][i - 1];\n }\n\n for (int i = 1; i < s.length(); i++) {\n for (int j = 1; j < t.length(); j++) {\n if (s.charAt(i) == t.charAt(j)) {\n dp[i][j] = dp[i - 1][j - 1] + 1;\n } else {\n dp[i][j] = max(dp[i - 1][j - 1], dp[i - 1][j], dp[i][j - 1]);\n }\n }\n }\n\n char[] ans = new char[dp[s.length() - 1][t.length() - 1]];\n\n int i = s.length() - 1;\n int j = t.length() - 1;\n int k = ans.length;\n while (k > 0) {\n\n if (i > 0 && j > 0 && dp[i - 1][j - 1] == k) {\n i--;\n j--;\n } else if (i > 0 && dp[i - 1][j] == k) {\n i--;\n } else if (j > 0 && dp[i][j - 1] == k) {\n j--;\n } else {\n if (s.charAt(i) != t.charAt(j)) {\n throw new IllegalStateException();\n }\n k--;\n ans[k] = s.charAt(i);\n }\n }\n return new String(ans);\n }\n\n private static int max(int x, int y, int z) {\n return Math.max(Math.max(x, y), z);\n }\n\n public static void main(String... args) {\n System.out.println(solve());\n// String s = \"aaaaaaaggggaaaaaaaaui\";\n// String t = \"baaaaahhhhhaaaaaaaaazpok\";\n// System.out.println(\n// solveInternal(s, t)\n// );\n }\n}\n", "language": "Java", "metadata": {"date": 1564792070, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03165.html", "problem_id": "p03165", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03165/input.txt", "sample_output_relpath": "derived/input_output/data/p03165/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03165/Java/s373690933.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s373690933", "user_id": "u201043154"}, "prompt_components": {"gold_output": "axb\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\npublic class Main {\n private static final BufferedReader READER = new BufferedReader(new InputStreamReader(System.in));\n\n private static int getInt() {\n return Integer.parseInt(line());\n }\n\n private static int[] getIntArr(int n) {\n int[] ans = new int[n];\n\n StringTokenizer stringTokenizer = new StringTokenizer(line(), \" \");\n for (int i = 0; i < n && stringTokenizer.hasMoreTokens(); i++) {\n ans[i] = Integer.parseInt(stringTokenizer.nextToken());\n }\n\n return ans;\n }\n\n private static String line() {\n try {\n return READER.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n\n private static String solve() {\n return solveInternal(line(), line());\n }\n\n private static String solveInternal(String s, String t) {\n if (s.equals(t)) {\n return s;\n }\n if (s.isEmpty() || t.isEmpty()) {\n return \"\";\n }\n\n int[][] dp = new int[s.length()][t.length()];\n\n char firstS = s.charAt(0);\n char firstT = t.charAt(0);\n\n dp[0][0] = firstS == firstT ? 1 : 0;\n\n for (int i = 1; i < s.length(); i++) {\n dp[i][0] = s.charAt(i) == firstT ? 1 : dp[i - 1][0];\n }\n for (int i = 1; i < t.length(); i++) {\n dp[0][i] = t.charAt(i) == firstS ? 1 : dp[0][i - 1];\n }\n\n for (int i = 1; i < s.length(); i++) {\n for (int j = 1; j < t.length(); j++) {\n if (s.charAt(i) == t.charAt(j)) {\n dp[i][j] = dp[i - 1][j - 1] + 1;\n } else {\n dp[i][j] = max(dp[i - 1][j - 1], dp[i - 1][j], dp[i][j - 1]);\n }\n }\n }\n\n char[] ans = new char[dp[s.length() - 1][t.length() - 1]];\n\n int i = s.length() - 1;\n int j = t.length() - 1;\n int k = ans.length;\n while (k > 0) {\n\n if (i > 0 && j > 0 && dp[i - 1][j - 1] == k) {\n i--;\n j--;\n } else if (i > 0 && dp[i - 1][j] == k) {\n i--;\n } else if (j > 0 && dp[i][j - 1] == k) {\n j--;\n } else {\n if (s.charAt(i) != t.charAt(j)) {\n throw new IllegalStateException();\n }\n k--;\n ans[k] = s.charAt(i);\n }\n }\n return new String(ans);\n }\n\n private static int max(int x, int y, int z) {\n return Math.max(Math.max(x, y), z);\n }\n\n public static void main(String... args) {\n System.out.println(solve());\n// String s = \"aaaaaaaggggaaaaaaaaui\";\n// String t = \"baaaaahhhhhaaaaaaaaazpok\";\n// System.out.println(\n// solveInternal(s, t)\n// );\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given strings s and t.\nFind one longest string that is a subsequence of both s and t.\n\nNotes\n\nA subsequence of a string x is the string obtained by removing zero or more characters from x and concatenating the remaining characters without changing the order.\n\nConstraints\n\ns and t are strings consisting of lowercase English letters.\n\n1 \\leq |s|, |t| \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nPrint one longest string that is a subsequence of both s and t.\nIf there are multiple such strings, any of them will be accepted.\n\nSample Input 1\n\naxyb\nabyxb\n\nSample Output 1\n\naxb\n\nThe answer is axb or ayb; either will be accepted.\n\nSample Input 2\n\naa\nxayaz\n\nSample Output 2\n\naa\n\nSample Input 3\n\na\nz\n\nSample Output 3\n\nThe answer is (an empty string).\n\nSample Input 4\n\nabracadabra\navadakedavra\n\nSample Output 4\n\naaadara", "sample_input": "axyb\nabyxb\n"}, "reference_outputs": ["axb\n"], "source_document_id": "p03165", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given strings s and t.\nFind one longest string that is a subsequence of both s and t.\n\nNotes\n\nA subsequence of a string x is the string obtained by removing zero or more characters from x and concatenating the remaining characters without changing the order.\n\nConstraints\n\ns and t are strings consisting of lowercase English letters.\n\n1 \\leq |s|, |t| \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nPrint one longest string that is a subsequence of both s and t.\nIf there are multiple such strings, any of them will be accepted.\n\nSample Input 1\n\naxyb\nabyxb\n\nSample Output 1\n\naxb\n\nThe answer is axb or ayb; either will be accepted.\n\nSample Input 2\n\naa\nxayaz\n\nSample Output 2\n\naa\n\nSample Input 3\n\na\nz\n\nSample Output 3\n\nThe answer is (an empty string).\n\nSample Input 4\n\nabracadabra\navadakedavra\n\nSample Output 4\n\naaadara", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2969, "cpu_time_ms": 201, "memory_kb": 81548}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s106690394", "group_id": "codeNet:p03165", "input_text": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\npublic class Main {\n public static long solve[][] = new long[3002][3002];\n public static char direction[][] = new char[3002][3002];\n public static void main(String args[])throws IOException\n {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n String s=br.readLine();\n String t=br.readLine();\n int SL=s.length();\n int TL=t.length();\n solve[0][0]=0;\n for(int i=0;isolve[i][j-1])\n {\n solve[i][j]=solve[i-1][j];\n direction[i][j]='u';\n }\n else\n {\n solve[i][j]=solve[i][j-1];\n direction[i][j]='l';\n }\n }\n }\n }\n //System.out.println(solve[SL][TL]);\n int i=SL,j=TL;\n StringBuilder sb = new StringBuilder(\"\");\n while(i!=0&&j!=0)\n {\n if(direction[i][j]=='d')\n {\n sb.append(s.charAt(i-1));\n i--;\n j--;\n }\n else if(direction[i][j]=='u')\n i--;\n else\n j--;\n }\n System.out.println(sb.reverse().toString());\n /*for(int i=1;i<=SL;i++)\n {\n for(int j=1;j<=TL;j++)\n System.out.print(direction[i][j]+\" \");\n System.out.println();\n }*/\n }\n}", "language": "Java", "metadata": {"date": 1549158271, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03165.html", "problem_id": "p03165", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03165/input.txt", "sample_output_relpath": "derived/input_output/data/p03165/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03165/Java/s106690394.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s106690394", "user_id": "u185736584"}, "prompt_components": {"gold_output": "axb\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\npublic class Main {\n public static long solve[][] = new long[3002][3002];\n public static char direction[][] = new char[3002][3002];\n public static void main(String args[])throws IOException\n {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n String s=br.readLine();\n String t=br.readLine();\n int SL=s.length();\n int TL=t.length();\n solve[0][0]=0;\n for(int i=0;isolve[i][j-1])\n {\n solve[i][j]=solve[i-1][j];\n direction[i][j]='u';\n }\n else\n {\n solve[i][j]=solve[i][j-1];\n direction[i][j]='l';\n }\n }\n }\n }\n //System.out.println(solve[SL][TL]);\n int i=SL,j=TL;\n StringBuilder sb = new StringBuilder(\"\");\n while(i!=0&&j!=0)\n {\n if(direction[i][j]=='d')\n {\n sb.append(s.charAt(i-1));\n i--;\n j--;\n }\n else if(direction[i][j]=='u')\n i--;\n else\n j--;\n }\n System.out.println(sb.reverse().toString());\n /*for(int i=1;i<=SL;i++)\n {\n for(int j=1;j<=TL;j++)\n System.out.print(direction[i][j]+\" \");\n System.out.println();\n }*/\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given strings s and t.\nFind one longest string that is a subsequence of both s and t.\n\nNotes\n\nA subsequence of a string x is the string obtained by removing zero or more characters from x and concatenating the remaining characters without changing the order.\n\nConstraints\n\ns and t are strings consisting of lowercase English letters.\n\n1 \\leq |s|, |t| \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nPrint one longest string that is a subsequence of both s and t.\nIf there are multiple such strings, any of them will be accepted.\n\nSample Input 1\n\naxyb\nabyxb\n\nSample Output 1\n\naxb\n\nThe answer is axb or ayb; either will be accepted.\n\nSample Input 2\n\naa\nxayaz\n\nSample Output 2\n\naa\n\nSample Input 3\n\na\nz\n\nSample Output 3\n\nThe answer is (an empty string).\n\nSample Input 4\n\nabracadabra\navadakedavra\n\nSample Output 4\n\naaadara", "sample_input": "axyb\nabyxb\n"}, "reference_outputs": ["axb\n"], "source_document_id": "p03165", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given strings s and t.\nFind one longest string that is a subsequence of both s and t.\n\nNotes\n\nA subsequence of a string x is the string obtained by removing zero or more characters from x and concatenating the remaining characters without changing the order.\n\nConstraints\n\ns and t are strings consisting of lowercase English letters.\n\n1 \\leq |s|, |t| \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nPrint one longest string that is a subsequence of both s and t.\nIf there are multiple such strings, any of them will be accepted.\n\nSample Input 1\n\naxyb\nabyxb\n\nSample Output 1\n\naxb\n\nThe answer is axb or ayb; either will be accepted.\n\nSample Input 2\n\naa\nxayaz\n\nSample Output 2\n\naa\n\nSample Input 3\n\na\nz\n\nSample Output 3\n\nThe answer is (an empty string).\n\nSample Input 4\n\nabracadabra\navadakedavra\n\nSample Output 4\n\naaadara", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2053, "cpu_time_ms": 246, "memory_kb": 130888}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s003002554", "group_id": "codeNet:p03165", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n String t = sc.next();\n String[][] dp = new String[s.length() + 1][t.length() + 1];\n for (int i = 0 ; i < s.length() + 1 ; i++) {\n for (int j = 0; j < t.length() + 1; j++) {\n dp[i][j] = \"\";\n }\n }\n for (int i = 0 ; i < s.length(); i++) {\n for (int j = 0 ; j < t.length(); j++) {\n if (s.substring(i, i + 1).equals(t.substring(j, j+1))) {\n dp[i +1][j + 1] = dp[i][j] + s.substring(i, i + 1);\n } else {\n if (dp[i][j + 1].length() > dp[i + 1][j].length()) {\n dp[i +1][j + 1] = dp[i][j + 1];\n } else {\n dp[i +1][j + 1] = dp[i + 1][j];\n }\n }\n }\n }\n System.out.println(dp[s.length()][t.length()]);\n }\n\n}\n", "language": "Java", "metadata": {"date": 1546808284, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03165.html", "problem_id": "p03165", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03165/input.txt", "sample_output_relpath": "derived/input_output/data/p03165/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03165/Java/s003002554.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s003002554", "user_id": "u845442981"}, "prompt_components": {"gold_output": "axb\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n String t = sc.next();\n String[][] dp = new String[s.length() + 1][t.length() + 1];\n for (int i = 0 ; i < s.length() + 1 ; i++) {\n for (int j = 0; j < t.length() + 1; j++) {\n dp[i][j] = \"\";\n }\n }\n for (int i = 0 ; i < s.length(); i++) {\n for (int j = 0 ; j < t.length(); j++) {\n if (s.substring(i, i + 1).equals(t.substring(j, j+1))) {\n dp[i +1][j + 1] = dp[i][j] + s.substring(i, i + 1);\n } else {\n if (dp[i][j + 1].length() > dp[i + 1][j].length()) {\n dp[i +1][j + 1] = dp[i][j + 1];\n } else {\n dp[i +1][j + 1] = dp[i + 1][j];\n }\n }\n }\n }\n System.out.println(dp[s.length()][t.length()]);\n }\n\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given strings s and t.\nFind one longest string that is a subsequence of both s and t.\n\nNotes\n\nA subsequence of a string x is the string obtained by removing zero or more characters from x and concatenating the remaining characters without changing the order.\n\nConstraints\n\ns and t are strings consisting of lowercase English letters.\n\n1 \\leq |s|, |t| \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nPrint one longest string that is a subsequence of both s and t.\nIf there are multiple such strings, any of them will be accepted.\n\nSample Input 1\n\naxyb\nabyxb\n\nSample Output 1\n\naxb\n\nThe answer is axb or ayb; either will be accepted.\n\nSample Input 2\n\naa\nxayaz\n\nSample Output 2\n\naa\n\nSample Input 3\n\na\nz\n\nSample Output 3\n\nThe answer is (an empty string).\n\nSample Input 4\n\nabracadabra\navadakedavra\n\nSample Output 4\n\naaadara", "sample_input": "axyb\nabyxb\n"}, "reference_outputs": ["axb\n"], "source_document_id": "p03165", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given strings s and t.\nFind one longest string that is a subsequence of both s and t.\n\nNotes\n\nA subsequence of a string x is the string obtained by removing zero or more characters from x and concatenating the remaining characters without changing the order.\n\nConstraints\n\ns and t are strings consisting of lowercase English letters.\n\n1 \\leq |s|, |t| \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nPrint one longest string that is a subsequence of both s and t.\nIf there are multiple such strings, any of them will be accepted.\n\nSample Input 1\n\naxyb\nabyxb\n\nSample Output 1\n\naxb\n\nThe answer is axb or ayb; either will be accepted.\n\nSample Input 2\n\naa\nxayaz\n\nSample Output 2\n\naa\n\nSample Input 3\n\na\nz\n\nSample Output 3\n\nThe answer is (an empty string).\n\nSample Input 4\n\nabracadabra\navadakedavra\n\nSample Output 4\n\naaadara", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1042, "cpu_time_ms": 2121, "memory_kb": 772676}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s052563323", "group_id": "codeNet:p03206", "input_text": "\nimport java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n try (Scanner sc = new Scanner(System.in)) {\n int input = sc.nextInt();\n\n if (input == 25) {\n System.out.println(\"Christmas\");\n } else if (input == 24) {\n System.out.println(\"Christmas Eve\");\n } else if (input == 23) {\n System.out.println(\"Christmas Eve Eve\");\n } else if (input == 22) {\n System.out.println(\"Christmas Eve Eve Eve\");\n }\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1577633767, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03206.html", "problem_id": "p03206", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03206/input.txt", "sample_output_relpath": "derived/input_output/data/p03206/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03206/Java/s052563323.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s052563323", "user_id": "u897013300"}, "prompt_components": {"gold_output": "Christmas\n", "input_to_evaluate": "\nimport java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n try (Scanner sc = new Scanner(System.in)) {\n int input = sc.nextInt();\n\n if (input == 25) {\n System.out.println(\"Christmas\");\n } else if (input == 24) {\n System.out.println(\"Christmas Eve\");\n } else if (input == 23) {\n System.out.println(\"Christmas Eve Eve\");\n } else if (input == 22) {\n System.out.println(\"Christmas Eve Eve Eve\");\n }\n }\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIn some other world, today is December D-th.\n\nWrite a program that prints Christmas if D = 25, Christmas Eve if D = 24, Christmas Eve Eve if D = 23 and Christmas Eve Eve Eve if D = 22.\n\nConstraints\n\n22 \\leq D \\leq 25\n\nD is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD\n\nOutput\n\nPrint the specified string (case-sensitive).\n\nSample Input 1\n\n25\n\nSample Output 1\n\nChristmas\n\nSample Input 2\n\n22\n\nSample Output 2\n\nChristmas Eve Eve Eve\n\nBe sure to print spaces between the words.", "sample_input": "25\n"}, "reference_outputs": ["Christmas\n"], "source_document_id": "p03206", "source_text": "Score : 100 points\n\nProblem Statement\n\nIn some other world, today is December D-th.\n\nWrite a program that prints Christmas if D = 25, Christmas Eve if D = 24, Christmas Eve Eve if D = 23 and Christmas Eve Eve Eve if D = 22.\n\nConstraints\n\n22 \\leq D \\leq 25\n\nD is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD\n\nOutput\n\nPrint the specified string (case-sensitive).\n\nSample Input 1\n\n25\n\nSample Output 1\n\nChristmas\n\nSample Input 2\n\n22\n\nSample Output 2\n\nChristmas Eve Eve Eve\n\nBe sure to print spaces between the words.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 95, "memory_kb": 21588}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s062964170", "group_id": "codeNet:p03206", "input_text": "import java.util.Scanner;\n/**方針\n//層の数が、Stringの桁数を溢れるかいなかの判断が必要。\n//レベルN+1のバーガーには、レベルNのバーガーが2つ含まれるので、\n//ざっくりレベルNのバーガーは、2^Nの文字数になる。(レベル0のバーガーが1文字なので)\n//N<50なので、文字数の最大は2^50≒10^15。\n//Stringは大体1億文字(10^8程度)までしか使えないので、単純にバーガーを文字で作ることはできない。\n//\n//そこで、バーガーの対称性や、再帰性に注目して、以下の作業を繰り返す。\n//(ア)XがレベルNバーガーの中心層より、下のとき、\n//レベルNバーガーのX番目だが、これはレベルN-1バーガーのX-1番目である。\n//(イ)XがレベルNバーガーの中心層より、上のとき、\n//レベルNバーガーのX番目は、レベルN-1バーガーの\"X-(レベルN-1バーガーの層数)\"層目である。\n//ただし、このときはレベルN-1バーガーに含まれるパテ数+1枚のパテを食べていることに注意(足していく)。\n//この作業を繰り返していき、「1層目までを食べる。」となったときに終了し、それまでに食べたパテ数が答え。\n//ただし繰り返しの中で、もしも途中でXがレベルNバーガーの中心層になったら、簡単に計算できるので求めて、終わり。\n*/\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint N = sc.nextInt();\n\t\tlong X = sc.nextLong();\n\t\tlong ans = 0;\n\t\tsc.close();\n\t\t\n\t\t//レベルNバーガーの中心の層の数が格納された配列。\n\t\tlong mid[] = new long[N+1];\n\t\tmid[0]=1;\n\t\tfor(int i=1;i<=N;i++) {\n\t\t\tmid[i]=(mid[i-1]*2-1)+2;\n\t\t}\n\t\t\n\t\tint levelcount=N;//バーガーのレベル数(ループの度に小さくなる。)\n\t\twhile (X>1) {\n\t\t\t//Xがバーガーの中心に当たる場合\n\t\t\t//1つ低いレベルのバーガーのパテ数+1枚食べて終わり\n\t\t\tif(X==mid[levelcount]) {\n\t\t\t\tans += getPuttyNum(levelcount-1)+1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t//Xがバーガーの中心より上にある場合\n\t\t\telse if(X>mid[levelcount]) {\n\t\t\t\t//Xがバーガーの一番上だった場合は、そのバーガーを食べきって終了\n\t\t\t\tif(X==mid[levelcount]*2-1) {\n\t\t\t\t\tans += getPuttyNum(levelcount);\n\t\t\t\t\tbreak;\n\t\t\t\t}else {\n\t\t\t\tans += getPuttyNum(levelcount-1)+1;\n\t\t\t\tX -= mid[levelcount];\n\t\t\t\t}\n\t\t\t}\n\t\t\t//Xがバーガーの中心より下にある場合\n\t\t\telse{\n\t\t\t\tX --;\n\t\t\t}\n\t\t\tlevelcount--;\n\t\t}\t\t\n\t\tSystem.out.println(ans);\n\t}\n\t\n\t//入力したレベルのバーガーのパテ数を教えてくれる。\n\t//繰り返し呼び出されるので、これは毎回計算するのではなく、記録すべき。\n\t//配列に入れればいいが、一旦このまま実行してみて、配列にする場合と比較してみる。\n\tstatic long getPuttyNum(int level) {\n\t\tlong putty_num=0;\n\t\tfor(int i=0;i<=level;i++) {\n\t\t\tif(i==0) {\n\t\t\t\tputty_num=1;\n\t\t\t}else {\n\t\t\t\tputty_num = 2*putty_num+1;\n\t\t\t}\n\t\t}\n\t\treturn putty_num;\n\t}\n}\n", "language": "Java", "metadata": {"date": 1571518911, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03206.html", "problem_id": "p03206", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03206/input.txt", "sample_output_relpath": "derived/input_output/data/p03206/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03206/Java/s062964170.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s062964170", "user_id": "u881359256"}, "prompt_components": {"gold_output": "Christmas\n", "input_to_evaluate": "import java.util.Scanner;\n/**方針\n//層の数が、Stringの桁数を溢れるかいなかの判断が必要。\n//レベルN+1のバーガーには、レベルNのバーガーが2つ含まれるので、\n//ざっくりレベルNのバーガーは、2^Nの文字数になる。(レベル0のバーガーが1文字なので)\n//N<50なので、文字数の最大は2^50≒10^15。\n//Stringは大体1億文字(10^8程度)までしか使えないので、単純にバーガーを文字で作ることはできない。\n//\n//そこで、バーガーの対称性や、再帰性に注目して、以下の作業を繰り返す。\n//(ア)XがレベルNバーガーの中心層より、下のとき、\n//レベルNバーガーのX番目だが、これはレベルN-1バーガーのX-1番目である。\n//(イ)XがレベルNバーガーの中心層より、上のとき、\n//レベルNバーガーのX番目は、レベルN-1バーガーの\"X-(レベルN-1バーガーの層数)\"層目である。\n//ただし、このときはレベルN-1バーガーに含まれるパテ数+1枚のパテを食べていることに注意(足していく)。\n//この作業を繰り返していき、「1層目までを食べる。」となったときに終了し、それまでに食べたパテ数が答え。\n//ただし繰り返しの中で、もしも途中でXがレベルNバーガーの中心層になったら、簡単に計算できるので求めて、終わり。\n*/\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint N = sc.nextInt();\n\t\tlong X = sc.nextLong();\n\t\tlong ans = 0;\n\t\tsc.close();\n\t\t\n\t\t//レベルNバーガーの中心の層の数が格納された配列。\n\t\tlong mid[] = new long[N+1];\n\t\tmid[0]=1;\n\t\tfor(int i=1;i<=N;i++) {\n\t\t\tmid[i]=(mid[i-1]*2-1)+2;\n\t\t}\n\t\t\n\t\tint levelcount=N;//バーガーのレベル数(ループの度に小さくなる。)\n\t\twhile (X>1) {\n\t\t\t//Xがバーガーの中心に当たる場合\n\t\t\t//1つ低いレベルのバーガーのパテ数+1枚食べて終わり\n\t\t\tif(X==mid[levelcount]) {\n\t\t\t\tans += getPuttyNum(levelcount-1)+1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t//Xがバーガーの中心より上にある場合\n\t\t\telse if(X>mid[levelcount]) {\n\t\t\t\t//Xがバーガーの一番上だった場合は、そのバーガーを食べきって終了\n\t\t\t\tif(X==mid[levelcount]*2-1) {\n\t\t\t\t\tans += getPuttyNum(levelcount);\n\t\t\t\t\tbreak;\n\t\t\t\t}else {\n\t\t\t\tans += getPuttyNum(levelcount-1)+1;\n\t\t\t\tX -= mid[levelcount];\n\t\t\t\t}\n\t\t\t}\n\t\t\t//Xがバーガーの中心より下にある場合\n\t\t\telse{\n\t\t\t\tX --;\n\t\t\t}\n\t\t\tlevelcount--;\n\t\t}\t\t\n\t\tSystem.out.println(ans);\n\t}\n\t\n\t//入力したレベルのバーガーのパテ数を教えてくれる。\n\t//繰り返し呼び出されるので、これは毎回計算するのではなく、記録すべき。\n\t//配列に入れればいいが、一旦このまま実行してみて、配列にする場合と比較してみる。\n\tstatic long getPuttyNum(int level) {\n\t\tlong putty_num=0;\n\t\tfor(int i=0;i<=level;i++) {\n\t\t\tif(i==0) {\n\t\t\t\tputty_num=1;\n\t\t\t}else {\n\t\t\t\tputty_num = 2*putty_num+1;\n\t\t\t}\n\t\t}\n\t\treturn putty_num;\n\t}\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIn some other world, today is December D-th.\n\nWrite a program that prints Christmas if D = 25, Christmas Eve if D = 24, Christmas Eve Eve if D = 23 and Christmas Eve Eve Eve if D = 22.\n\nConstraints\n\n22 \\leq D \\leq 25\n\nD is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD\n\nOutput\n\nPrint the specified string (case-sensitive).\n\nSample Input 1\n\n25\n\nSample Output 1\n\nChristmas\n\nSample Input 2\n\n22\n\nSample Output 2\n\nChristmas Eve Eve Eve\n\nBe sure to print spaces between the words.", "sample_input": "25\n"}, "reference_outputs": ["Christmas\n"], "source_document_id": "p03206", "source_text": "Score : 100 points\n\nProblem Statement\n\nIn some other world, today is December D-th.\n\nWrite a program that prints Christmas if D = 25, Christmas Eve if D = 24, Christmas Eve Eve if D = 23 and Christmas Eve Eve Eve if D = 22.\n\nConstraints\n\n22 \\leq D \\leq 25\n\nD is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD\n\nOutput\n\nPrint the specified string (case-sensitive).\n\nSample Input 1\n\n25\n\nSample Output 1\n\nChristmas\n\nSample Input 2\n\n22\n\nSample Output 2\n\nChristmas Eve Eve Eve\n\nBe sure to print spaces between the words.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3153, "cpu_time_ms": 95, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s758579657", "group_id": "codeNet:p03206", "input_text": "import java.util.Scanner;\npublic class Main{\n public static void main(String[] args){\n Scanner s = new Scanner(System.in);\n int a = s.nextInt();\n\n if(a == 25){\n System.out.println(\"Christmas\");\n }else if(a == 24){\n System.out.println(\"Christmas Eve\");\n }else if(a == 23){\n System.out.println(\"Christmas Eve Eve\");\n }else if(a == 22){\n System.out.println(\"Christmas Eve Eve Eve\");\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1561836813, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03206.html", "problem_id": "p03206", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03206/input.txt", "sample_output_relpath": "derived/input_output/data/p03206/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03206/Java/s758579657.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s758579657", "user_id": "u357903962"}, "prompt_components": {"gold_output": "Christmas\n", "input_to_evaluate": "import java.util.Scanner;\npublic class Main{\n public static void main(String[] args){\n Scanner s = new Scanner(System.in);\n int a = s.nextInt();\n\n if(a == 25){\n System.out.println(\"Christmas\");\n }else if(a == 24){\n System.out.println(\"Christmas Eve\");\n }else if(a == 23){\n System.out.println(\"Christmas Eve Eve\");\n }else if(a == 22){\n System.out.println(\"Christmas Eve Eve Eve\");\n }\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIn some other world, today is December D-th.\n\nWrite a program that prints Christmas if D = 25, Christmas Eve if D = 24, Christmas Eve Eve if D = 23 and Christmas Eve Eve Eve if D = 22.\n\nConstraints\n\n22 \\leq D \\leq 25\n\nD is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD\n\nOutput\n\nPrint the specified string (case-sensitive).\n\nSample Input 1\n\n25\n\nSample Output 1\n\nChristmas\n\nSample Input 2\n\n22\n\nSample Output 2\n\nChristmas Eve Eve Eve\n\nBe sure to print spaces between the words.", "sample_input": "25\n"}, "reference_outputs": ["Christmas\n"], "source_document_id": "p03206", "source_text": "Score : 100 points\n\nProblem Statement\n\nIn some other world, today is December D-th.\n\nWrite a program that prints Christmas if D = 25, Christmas Eve if D = 24, Christmas Eve Eve if D = 23 and Christmas Eve Eve Eve if D = 22.\n\nConstraints\n\n22 \\leq D \\leq 25\n\nD is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD\n\nOutput\n\nPrint the specified string (case-sensitive).\n\nSample Input 1\n\n25\n\nSample Output 1\n\nChristmas\n\nSample Input 2\n\n22\n\nSample Output 2\n\nChristmas Eve Eve Eve\n\nBe sure to print spaces between the words.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 431, "cpu_time_ms": 93, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s299956823", "group_id": "codeNet:p03206", "input_text": "import java.util.*;\n\npublic class Main{\n\tpublic static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n if(x == 25){\n System.out.println(\"Christmas\");\n }else if(x==24){\n System.out.println(\"Christmas Eve\");\n }else if(x==23){\n System.out.println(\"Christmas Eve Eve\");\n }else{\n System.out.println(\"Christmas Eve Eve Eve\");\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1556852605, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03206.html", "problem_id": "p03206", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03206/input.txt", "sample_output_relpath": "derived/input_output/data/p03206/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03206/Java/s299956823.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s299956823", "user_id": "u024824950"}, "prompt_components": {"gold_output": "Christmas\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main{\n\tpublic static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int x = sc.nextInt();\n if(x == 25){\n System.out.println(\"Christmas\");\n }else if(x==24){\n System.out.println(\"Christmas Eve\");\n }else if(x==23){\n System.out.println(\"Christmas Eve Eve\");\n }else{\n System.out.println(\"Christmas Eve Eve Eve\");\n }\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIn some other world, today is December D-th.\n\nWrite a program that prints Christmas if D = 25, Christmas Eve if D = 24, Christmas Eve Eve if D = 23 and Christmas Eve Eve Eve if D = 22.\n\nConstraints\n\n22 \\leq D \\leq 25\n\nD is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD\n\nOutput\n\nPrint the specified string (case-sensitive).\n\nSample Input 1\n\n25\n\nSample Output 1\n\nChristmas\n\nSample Input 2\n\n22\n\nSample Output 2\n\nChristmas Eve Eve Eve\n\nBe sure to print spaces between the words.", "sample_input": "25\n"}, "reference_outputs": ["Christmas\n"], "source_document_id": "p03206", "source_text": "Score : 100 points\n\nProblem Statement\n\nIn some other world, today is December D-th.\n\nWrite a program that prints Christmas if D = 25, Christmas Eve if D = 24, Christmas Eve Eve if D = 23 and Christmas Eve Eve Eve if D = 22.\n\nConstraints\n\n22 \\leq D \\leq 25\n\nD is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD\n\nOutput\n\nPrint the specified string (case-sensitive).\n\nSample Input 1\n\n25\n\nSample Output 1\n\nChristmas\n\nSample Input 2\n\n22\n\nSample Output 2\n\nChristmas Eve Eve Eve\n\nBe sure to print spaces between the words.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 95, "memory_kb": 21716}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s775444402", "group_id": "codeNet:p03206", "input_text": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint k = sc.nextInt();\n\t\tint[] nums = new int[n];\n\t\tfor(int i=0; i= d && i>=22; i--) {\n result += \" Eve\";\n }\n System.out.println(result);\n }\n}", "language": "Java", "metadata": {"date": 1544386063, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03206.html", "problem_id": "p03206", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03206/input.txt", "sample_output_relpath": "derived/input_output/data/p03206/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03206/Java/s011405547.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s011405547", "user_id": "u445722681"}, "prompt_components": {"gold_output": "Christmas\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n // System.out.println(\"input a number: \");\n int d = sc.nextInt();\n\n String result = \"Christmas\";\n for (int i = 24; i >= d && i>=22; i--) {\n result += \" Eve\";\n }\n System.out.println(result);\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIn some other world, today is December D-th.\n\nWrite a program that prints Christmas if D = 25, Christmas Eve if D = 24, Christmas Eve Eve if D = 23 and Christmas Eve Eve Eve if D = 22.\n\nConstraints\n\n22 \\leq D \\leq 25\n\nD is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD\n\nOutput\n\nPrint the specified string (case-sensitive).\n\nSample Input 1\n\n25\n\nSample Output 1\n\nChristmas\n\nSample Input 2\n\n22\n\nSample Output 2\n\nChristmas Eve Eve Eve\n\nBe sure to print spaces between the words.", "sample_input": "25\n"}, "reference_outputs": ["Christmas\n"], "source_document_id": "p03206", "source_text": "Score : 100 points\n\nProblem Statement\n\nIn some other world, today is December D-th.\n\nWrite a program that prints Christmas if D = 25, Christmas Eve if D = 24, Christmas Eve Eve if D = 23 and Christmas Eve Eve Eve if D = 22.\n\nConstraints\n\n22 \\leq D \\leq 25\n\nD is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD\n\nOutput\n\nPrint the specified string (case-sensitive).\n\nSample Input 1\n\n25\n\nSample Output 1\n\nChristmas\n\nSample Input 2\n\n22\n\nSample Output 2\n\nChristmas Eve Eve Eve\n\nBe sure to print spaces between the words.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 388, "cpu_time_ms": 110, "memory_kb": 22612}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s196913727", "group_id": "codeNet:p03206", "input_text": "import java.util.*;\npublic class Main {\n\n\n public static void main(String[] args) {\n\n Scanner scan = new Scanner(System.in);\n\n int D = Integer .parseInt(scan.next());\n\n if(D == 25) System.out.println(\"Christmas\");\n if(D == 24) System.out.println(\"Christmas Eve\");\n if(D == 23) System.out.println(\"Christmas Eve Eve\");\n if(D == 22) System.out.println(\"Christmas Eve Eve Eve\");\n }\n}", "language": "Java", "metadata": {"date": 1544351124, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03206.html", "problem_id": "p03206", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03206/input.txt", "sample_output_relpath": "derived/input_output/data/p03206/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03206/Java/s196913727.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s196913727", "user_id": "u446997166"}, "prompt_components": {"gold_output": "Christmas\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n\n\n public static void main(String[] args) {\n\n Scanner scan = new Scanner(System.in);\n\n int D = Integer .parseInt(scan.next());\n\n if(D == 25) System.out.println(\"Christmas\");\n if(D == 24) System.out.println(\"Christmas Eve\");\n if(D == 23) System.out.println(\"Christmas Eve Eve\");\n if(D == 22) System.out.println(\"Christmas Eve Eve Eve\");\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIn some other world, today is December D-th.\n\nWrite a program that prints Christmas if D = 25, Christmas Eve if D = 24, Christmas Eve Eve if D = 23 and Christmas Eve Eve Eve if D = 22.\n\nConstraints\n\n22 \\leq D \\leq 25\n\nD is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD\n\nOutput\n\nPrint the specified string (case-sensitive).\n\nSample Input 1\n\n25\n\nSample Output 1\n\nChristmas\n\nSample Input 2\n\n22\n\nSample Output 2\n\nChristmas Eve Eve Eve\n\nBe sure to print spaces between the words.", "sample_input": "25\n"}, "reference_outputs": ["Christmas\n"], "source_document_id": "p03206", "source_text": "Score : 100 points\n\nProblem Statement\n\nIn some other world, today is December D-th.\n\nWrite a program that prints Christmas if D = 25, Christmas Eve if D = 24, Christmas Eve Eve if D = 23 and Christmas Eve Eve Eve if D = 22.\n\nConstraints\n\n22 \\leq D \\leq 25\n\nD is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD\n\nOutput\n\nPrint the specified string (case-sensitive).\n\nSample Input 1\n\n25\n\nSample Output 1\n\nChristmas\n\nSample Input 2\n\n22\n\nSample Output 2\n\nChristmas Eve Eve Eve\n\nBe sure to print spaces between the words.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 428, "cpu_time_ms": 95, "memory_kb": 21716}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s103048338", "group_id": "codeNet:p03206", "input_text": "\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.AbstractMap;\nimport java.util.NoSuchElementException;\n/** ABC115-A */\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner();\n\t\tint N = sc.nextInt();\n\n\n\t\t//************************************/\n\t\t// ここから出力処理\n\t\t//************************************/\n\t\tPrintWriter out = new PrintWriter(System.out);\n\n\n\t\tif(N == 25){\n\t\t\tout.println(\"Christmas\");\n\n\t\t}else if(N == 24) {\n\t\t\tout.println(\"Christmas Eve\");\n\n\t\t}else if(N == 23) {\n\t\t\tout.println(\"Christmas Eve Eve\");\n\n\t\t}else if(N == 22) {\n\t\t\tout.println(\"hristmas Eve Eve Eve\");\n\n\t\t}\n\n\t\t// 最後に必ずFlush\n\t\tout.flush();\n\t}\n}\n\n\n\n///** テンプレート */\n//public class Main {\n//\tpublic static void main(String[] args) {\n//\t\tFastScanner sc = new FastScanner();\n//\t\tint N = sc.nextInt();\n//\t\tint M = sc.nextInt();\n//\n//\t\tint[] ary = new int[N];\n//\t\tfor(int i = 0; i < N; i++) {\n//\t\t\tary[i] = sc.nextInt();\n//\t\t}\n//\n//\t\t//************************************/\n//\t\t// ここから出力処理\n//\t\t//************************************/\n//\t\tPrintWriter out = new PrintWriter(System.out);\n//\n//\n//\t\tout.println(\"hoge\");\n//\n//\t\t// 最後に必ずFlush\n//\t\tout.flush();\n//\t}\n//}\n\n/** スキャン用 */\nclass FastScanner {\n\tprivate final InputStream in = System.in;\n\tprivate final byte[] buffer = new byte[1024];\n\tprivate int ptr = 0;\n\tprivate int buflen = 0;\n\n\t/** クラス内部用だよ */\n\tprivate boolean hasNextByte() {\n\t\tif (ptr < buflen) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\tptr = 0;\n\t\t\ttry {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\t/** クラス内部用だよ */\n\tprivate int readByte() {\n\t\tif (hasNextByte()) {\n\t\t\treturn buffer[ptr++];\n\t\t} else {\n\t\t\treturn -1;\n\t\t}\n\t}\n\n\t/**\n\t * クラス内部用だよ\n\t * ASCII の文字の内、表示用の文字を返す関数\n\t *\n\t * @return 改行とか制御文字じゃない、表示用文字ならtrue\n\t * */\n\tprivate static boolean isPrintableChar(int c) {\n\t\treturn 33 <= c && c <= 126;\n\t}\n\n\t/**\n\t * @return 改行文字とか空白以外を除いた、次の文字があればtrue\n\t * */\n\tpublic boolean hasNext() {\n\t\twhile (hasNextByte() && !isPrintableChar(buffer[ptr])) {\n\t\t\tptr++;\n\t\t}\n\t\treturn hasNextByte();\n\t}\n\n\t/**\n\t *\n\t * @return 次の文字列\n\t */\n\tpublic String next() {\n\t\tif (!hasNext()) {\n\t\t\tthrow new NoSuchElementException();\n\t\t}\n\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint b = readByte();\n\t\twhile (isPrintableChar(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\n\t/**\n\t *\n\t * @return 次のLong\n\t */\n\tpublic long nextLong() {\n\t\tif (!hasNext())\n\t\t\tthrow new NoSuchElementException();\n\t\tlong n = 0;\n\t\tboolean minus = false;\n\t\tint b = readByte();\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\tif (b < '0' || '9' < b) {\n\t\t\tthrow new NumberFormatException();\n\t\t}\n\t\twhile (true) {\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n\t/**\n\t *\n\t * @return 次のInt\n\t */\n\tpublic int nextInt() {\n\t\tlong nl = nextLong();\n\t\tif (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)\n\t\t\tthrow new NumberFormatException();\n\t\treturn (int) nl;\n\t}\n\n\t/**\n\t *\n\t * @return 次のDouble\n\t */\n\tpublic double nextDouble() {\n\t\treturn Double.parseDouble(next());\n\t}\n}\n\nclass Pair extends AbstractMap.SimpleEntry {\n\t/** serialVersionUID. */\n\tprivate static final long serialVersionUID = 6411527075103472113L;\n\n\tpublic Pair(final K key, final V value) {\n\t\tsuper(key, value);\n\t}\n}\n", "language": "Java", "metadata": {"date": 1544321646, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03206.html", "problem_id": "p03206", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03206/input.txt", "sample_output_relpath": "derived/input_output/data/p03206/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03206/Java/s103048338.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s103048338", "user_id": "u635596076"}, "prompt_components": {"gold_output": "Christmas\n", "input_to_evaluate": "\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.AbstractMap;\nimport java.util.NoSuchElementException;\n/** ABC115-A */\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner();\n\t\tint N = sc.nextInt();\n\n\n\t\t//************************************/\n\t\t// ここから出力処理\n\t\t//************************************/\n\t\tPrintWriter out = new PrintWriter(System.out);\n\n\n\t\tif(N == 25){\n\t\t\tout.println(\"Christmas\");\n\n\t\t}else if(N == 24) {\n\t\t\tout.println(\"Christmas Eve\");\n\n\t\t}else if(N == 23) {\n\t\t\tout.println(\"Christmas Eve Eve\");\n\n\t\t}else if(N == 22) {\n\t\t\tout.println(\"hristmas Eve Eve Eve\");\n\n\t\t}\n\n\t\t// 最後に必ずFlush\n\t\tout.flush();\n\t}\n}\n\n\n\n///** テンプレート */\n//public class Main {\n//\tpublic static void main(String[] args) {\n//\t\tFastScanner sc = new FastScanner();\n//\t\tint N = sc.nextInt();\n//\t\tint M = sc.nextInt();\n//\n//\t\tint[] ary = new int[N];\n//\t\tfor(int i = 0; i < N; i++) {\n//\t\t\tary[i] = sc.nextInt();\n//\t\t}\n//\n//\t\t//************************************/\n//\t\t// ここから出力処理\n//\t\t//************************************/\n//\t\tPrintWriter out = new PrintWriter(System.out);\n//\n//\n//\t\tout.println(\"hoge\");\n//\n//\t\t// 最後に必ずFlush\n//\t\tout.flush();\n//\t}\n//}\n\n/** スキャン用 */\nclass FastScanner {\n\tprivate final InputStream in = System.in;\n\tprivate final byte[] buffer = new byte[1024];\n\tprivate int ptr = 0;\n\tprivate int buflen = 0;\n\n\t/** クラス内部用だよ */\n\tprivate boolean hasNextByte() {\n\t\tif (ptr < buflen) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\tptr = 0;\n\t\t\ttry {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\t/** クラス内部用だよ */\n\tprivate int readByte() {\n\t\tif (hasNextByte()) {\n\t\t\treturn buffer[ptr++];\n\t\t} else {\n\t\t\treturn -1;\n\t\t}\n\t}\n\n\t/**\n\t * クラス内部用だよ\n\t * ASCII の文字の内、表示用の文字を返す関数\n\t *\n\t * @return 改行とか制御文字じゃない、表示用文字ならtrue\n\t * */\n\tprivate static boolean isPrintableChar(int c) {\n\t\treturn 33 <= c && c <= 126;\n\t}\n\n\t/**\n\t * @return 改行文字とか空白以外を除いた、次の文字があればtrue\n\t * */\n\tpublic boolean hasNext() {\n\t\twhile (hasNextByte() && !isPrintableChar(buffer[ptr])) {\n\t\t\tptr++;\n\t\t}\n\t\treturn hasNextByte();\n\t}\n\n\t/**\n\t *\n\t * @return 次の文字列\n\t */\n\tpublic String next() {\n\t\tif (!hasNext()) {\n\t\t\tthrow new NoSuchElementException();\n\t\t}\n\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint b = readByte();\n\t\twhile (isPrintableChar(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\n\t/**\n\t *\n\t * @return 次のLong\n\t */\n\tpublic long nextLong() {\n\t\tif (!hasNext())\n\t\t\tthrow new NoSuchElementException();\n\t\tlong n = 0;\n\t\tboolean minus = false;\n\t\tint b = readByte();\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\tif (b < '0' || '9' < b) {\n\t\t\tthrow new NumberFormatException();\n\t\t}\n\t\twhile (true) {\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\n\t/**\n\t *\n\t * @return 次のInt\n\t */\n\tpublic int nextInt() {\n\t\tlong nl = nextLong();\n\t\tif (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)\n\t\t\tthrow new NumberFormatException();\n\t\treturn (int) nl;\n\t}\n\n\t/**\n\t *\n\t * @return 次のDouble\n\t */\n\tpublic double nextDouble() {\n\t\treturn Double.parseDouble(next());\n\t}\n}\n\nclass Pair extends AbstractMap.SimpleEntry {\n\t/** serialVersionUID. */\n\tprivate static final long serialVersionUID = 6411527075103472113L;\n\n\tpublic Pair(final K key, final V value) {\n\t\tsuper(key, value);\n\t}\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIn some other world, today is December D-th.\n\nWrite a program that prints Christmas if D = 25, Christmas Eve if D = 24, Christmas Eve Eve if D = 23 and Christmas Eve Eve Eve if D = 22.\n\nConstraints\n\n22 \\leq D \\leq 25\n\nD is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD\n\nOutput\n\nPrint the specified string (case-sensitive).\n\nSample Input 1\n\n25\n\nSample Output 1\n\nChristmas\n\nSample Input 2\n\n22\n\nSample Output 2\n\nChristmas Eve Eve Eve\n\nBe sure to print spaces between the words.", "sample_input": "25\n"}, "reference_outputs": ["Christmas\n"], "source_document_id": "p03206", "source_text": "Score : 100 points\n\nProblem Statement\n\nIn some other world, today is December D-th.\n\nWrite a program that prints Christmas if D = 25, Christmas Eve if D = 24, Christmas Eve Eve if D = 23 and Christmas Eve Eve Eve if D = 22.\n\nConstraints\n\n22 \\leq D \\leq 25\n\nD is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD\n\nOutput\n\nPrint the specified string (case-sensitive).\n\nSample Input 1\n\n25\n\nSample Output 1\n\nChristmas\n\nSample Input 2\n\n22\n\nSample Output 2\n\nChristmas Eve Eve Eve\n\nBe sure to print spaces between the words.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3779, "cpu_time_ms": 71, "memory_kb": 21076}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s089325401", "group_id": "codeNet:p03240", "input_text": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n static MyReader in = new MyReader();\n\n public static void main(String[] args) {\n int N = in.i();\n int[] x = new int[N * 3];\n for (int i = 0; i < x.length; ) {\n x[i++] = in.i();\n x[i++] = in.i();\n x[i++] = in.i();\n }\n\n int x0 = 0;\n int y0 = 0;\n int h0 = 0;\n for (int i = 0; i < x.length; ) {\n x0 = x[i++];\n y0 = x[i++];\n h0 = x[i++];\n if (0 < h0) {\n break;\n }\n }\n\n for (int Cx = 0; Cx <= 100; Cx++) {\n loop: for (int Cy = 0; Cy <= 100; Cy++) {\n int H = h0 + Math.abs(Cx - x0) + Math.abs(Cy - y0);\n for (int i = 0; i < x.length; ) {\n int h = Math.max(H - Math.abs(Cx - x[i++]) - Math.abs(Cy - x[i++]), 0);\n if (h != x[i++]) {\n continue loop;\n }\n }\n System.out.printf(\"%d %d %d\\n\", Cx, Cy, H);\n return;\n }\n }\n }\n}\n\nclass MyReader extends BufferedReader {\n char[] cbuf = new char[1024];\n int head = 0;\n int tail = 0;\n\n MyReader() {\n super(new InputStreamReader(System.in));\n }\n\n char next() {\n if (head == tail) {\n try {\n tail = super.read(cbuf, 0, cbuf.length);\n } catch (IOException e) {\n e.printStackTrace();\n }\n head = 0;\n }\n return cbuf[head++];\n }\n\n int i() {\n int k = next() - '0';\n boolean minus = k == -3;\n int n = minus ? 0 : k;\n while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k;\n return minus ? -n : n;\n }\n\n int[] ii(final int N) {\n int[] a = new int[N];\n for (int j = 0; j < a.length; j++) a[j] = i();\n return a;\n }\n\n long l() {\n int k = next() - '0';\n boolean minus = k == -3;\n long n = minus ? 0 : k;\n while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k;\n return minus ? -n : n;\n }\n\n char[] s(final int N) {\n char[] s = new char[N];\n for (int i = 0; i < N; i++) {\n s[i] = next();\n }\n next();\n return s;\n }\n\n public int read(char[] cbuf) {\n int i;\n char c;\n for (i = 0; (c = next()) != ' ' && c != '\\n'; i++) cbuf[i] = c;\n return i;\n }\n\n public String readLine() {\n try {\n return super.readLine();\n } catch (IOException e) {\n return null;\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1600759043, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p03240.html", "problem_id": "p03240", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03240/input.txt", "sample_output_relpath": "derived/input_output/data/p03240/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03240/Java/s089325401.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s089325401", "user_id": "u752907799"}, "prompt_components": {"gold_output": "2 2 6\n", "input_to_evaluate": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n static MyReader in = new MyReader();\n\n public static void main(String[] args) {\n int N = in.i();\n int[] x = new int[N * 3];\n for (int i = 0; i < x.length; ) {\n x[i++] = in.i();\n x[i++] = in.i();\n x[i++] = in.i();\n }\n\n int x0 = 0;\n int y0 = 0;\n int h0 = 0;\n for (int i = 0; i < x.length; ) {\n x0 = x[i++];\n y0 = x[i++];\n h0 = x[i++];\n if (0 < h0) {\n break;\n }\n }\n\n for (int Cx = 0; Cx <= 100; Cx++) {\n loop: for (int Cy = 0; Cy <= 100; Cy++) {\n int H = h0 + Math.abs(Cx - x0) + Math.abs(Cy - y0);\n for (int i = 0; i < x.length; ) {\n int h = Math.max(H - Math.abs(Cx - x[i++]) - Math.abs(Cy - x[i++]), 0);\n if (h != x[i++]) {\n continue loop;\n }\n }\n System.out.printf(\"%d %d %d\\n\", Cx, Cy, H);\n return;\n }\n }\n }\n}\n\nclass MyReader extends BufferedReader {\n char[] cbuf = new char[1024];\n int head = 0;\n int tail = 0;\n\n MyReader() {\n super(new InputStreamReader(System.in));\n }\n\n char next() {\n if (head == tail) {\n try {\n tail = super.read(cbuf, 0, cbuf.length);\n } catch (IOException e) {\n e.printStackTrace();\n }\n head = 0;\n }\n return cbuf[head++];\n }\n\n int i() {\n int k = next() - '0';\n boolean minus = k == -3;\n int n = minus ? 0 : k;\n while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k;\n return minus ? -n : n;\n }\n\n int[] ii(final int N) {\n int[] a = new int[N];\n for (int j = 0; j < a.length; j++) a[j] = i();\n return a;\n }\n\n long l() {\n int k = next() - '0';\n boolean minus = k == -3;\n long n = minus ? 0 : k;\n while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k;\n return minus ? -n : n;\n }\n\n char[] s(final int N) {\n char[] s = new char[N];\n for (int i = 0; i < N; i++) {\n s[i] = next();\n }\n next();\n return s;\n }\n\n public int read(char[] cbuf) {\n int i;\n char c;\n for (i = 0; (c = next()) != ' ' && c != '\\n'; i++) cbuf[i] = c;\n return i;\n }\n\n public String readLine() {\n try {\n return super.readLine();\n } catch (IOException e) {\n return null;\n }\n }\n}\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "sample_input": "4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n"}, "reference_outputs": ["2 2 6\n"], "source_document_id": "p03240", "source_text": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2662, "cpu_time_ms": 97, "memory_kb": 34320}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s868119497", "group_id": "codeNet:p03240", "input_text": "//package Atcoder;\n\nimport java.util.*;\nimport java.io.BufferedReader; \nimport java.io.IOException; \nimport java.io.InputStreamReader; \nimport java.util.Scanner; \nimport java.util.StringTokenizer;\n\n\npublic class Main {\n\t\n\tstatic class IO \n { \n BufferedReader br; \n StringTokenizer st; \n \n public IO() \n { \n br = new BufferedReader(new\n InputStreamReader(System.in)); \n } \n \n String next() \n { \n while (st == null || !st.hasMoreElements()) \n { \n try\n { \n st = new StringTokenizer(br.readLine()); \n } \n catch (IOException e) \n { \n e.printStackTrace(); \n } \n } \n return st.nextToken(); \n } \n \n int nextInt() \n { \n return Integer.parseInt(next()); \n } \n \n long nextLong() \n { \n return Long.parseLong(next()); \n } \n \n double nextDouble() \n { \n return Double.parseDouble(next()); \n } \n \n String nextLine() \n { \n String str = \"\"; \n try\n { \n str = br.readLine(); \n } \n catch (IOException e) \n { \n e.printStackTrace(); \n } \n return str; \n } \n }\n\t\n\tpublic static void main(String[] args) {\n\t\tIO fs = new IO();\n\t\tint n = fs.nextInt();\n\t\tint [] x = new int[n];\n\t\tint [] y = new int[n];\n\t\tint [] h = new int[n];\n\t\tfor(int i = 0; i st = new HashSet();\n\t\tfor(ansx = 0; ansx<=100; ansx++) {\n\t\t\tfor(ansy = 0; ansy<=100; ansy++) {\n\t\t\t\tst.clear();\n\t\t\t\tboolean canbe = true;\n\t\t\t\tint ph = 0;\n\t\t\t\tfor(int i = 0; i Math.abs(ansx-x[i])+Math.abs(ansy-y[i])) {\n\t\t\t\t\t\t\t\tstillpos = false;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(stillpos) {\n\t\t\t\t\t\tresx = ansx;resy = ansy;resh = ph;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(resx!=-1 || resy!=-1 || resh!=-1)break;\n\t\t}\n\t\tSystem.out.println(resx+\" \"+resy+\" \"+resh);\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1593734700, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03240.html", "problem_id": "p03240", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03240/input.txt", "sample_output_relpath": "derived/input_output/data/p03240/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03240/Java/s868119497.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s868119497", "user_id": "u133356919"}, "prompt_components": {"gold_output": "2 2 6\n", "input_to_evaluate": "//package Atcoder;\n\nimport java.util.*;\nimport java.io.BufferedReader; \nimport java.io.IOException; \nimport java.io.InputStreamReader; \nimport java.util.Scanner; \nimport java.util.StringTokenizer;\n\n\npublic class Main {\n\t\n\tstatic class IO \n { \n BufferedReader br; \n StringTokenizer st; \n \n public IO() \n { \n br = new BufferedReader(new\n InputStreamReader(System.in)); \n } \n \n String next() \n { \n while (st == null || !st.hasMoreElements()) \n { \n try\n { \n st = new StringTokenizer(br.readLine()); \n } \n catch (IOException e) \n { \n e.printStackTrace(); \n } \n } \n return st.nextToken(); \n } \n \n int nextInt() \n { \n return Integer.parseInt(next()); \n } \n \n long nextLong() \n { \n return Long.parseLong(next()); \n } \n \n double nextDouble() \n { \n return Double.parseDouble(next()); \n } \n \n String nextLine() \n { \n String str = \"\"; \n try\n { \n str = br.readLine(); \n } \n catch (IOException e) \n { \n e.printStackTrace(); \n } \n return str; \n } \n }\n\t\n\tpublic static void main(String[] args) {\n\t\tIO fs = new IO();\n\t\tint n = fs.nextInt();\n\t\tint [] x = new int[n];\n\t\tint [] y = new int[n];\n\t\tint [] h = new int[n];\n\t\tfor(int i = 0; i st = new HashSet();\n\t\tfor(ansx = 0; ansx<=100; ansx++) {\n\t\t\tfor(ansy = 0; ansy<=100; ansy++) {\n\t\t\t\tst.clear();\n\t\t\t\tboolean canbe = true;\n\t\t\t\tint ph = 0;\n\t\t\t\tfor(int i = 0; i Math.abs(ansx-x[i])+Math.abs(ansy-y[i])) {\n\t\t\t\t\t\t\t\tstillpos = false;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(stillpos) {\n\t\t\t\t\t\tresx = ansx;resy = ansy;resh = ph;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(resx!=-1 || resy!=-1 || resh!=-1)break;\n\t\t}\n\t\tSystem.out.println(resx+\" \"+resy+\" \"+resh);\n\t}\n\n}\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "sample_input": "4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n"}, "reference_outputs": ["2 2 6\n"], "source_document_id": "p03240", "source_text": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2627, "cpu_time_ms": 104, "memory_kb": 27528}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s089959277", "group_id": "codeNet:p03240", "input_text": "import java.util.*;\nimport java.io.*;\n \npublic class Main {\n public static void main(String[] args) throws Exception {\n FastScanner sc = new FastScanner(System.in);\n int n = sc.nextInt();\n ArrayList li = new ArrayList();\n for(int i = 0; i < n; i++){\n li.add(new Point(sc.nextInt(),sc.nextInt(),sc.nextInt()));\n }\n Collections.sort(li);\n for(int i = 0; i <= 100; i++){\n for(int j = 0; j <= 100; j++){\n boolean flg = true;\n Point c = li.get(0);\n int chk = Math.abs(c.x-i)+Math.abs(c.y-j)+c.h;\n for(int k = 1; k < n; k++){\n Point p = li.get(k);\n if(!(p.h == 0 && chk <= Math.abs(p.x-i)+Math.abs(p.y-j)) && chk != Math.abs(p.x-i)+Math.abs(p.y-j)+p.h){\n flg = false;\n break;\n }\n }\n if(flg){\n System.out.println(i+\" \"+j+\" \"+chk);\n return;\n }\n }\n }\n }\n}\n\nclass Point implements Comparable{\n int x,y,h;\n public Point(int x, int y, int h){\n this.x = x;\n this.y = y;\n this.h = h;\n }\n public int compareTo(Point p){\n if(this.h > p.h){\n return -1;\n }else if(this.h < p.h){\n return 1;\n }else{\n return 0;\n }\n }\n}\n\nclass FastScanner {\n private BufferedReader reader = null;\n private StringTokenizer tokenizer = null;\n public FastScanner(InputStream in) {\n reader = new BufferedReader(new InputStreamReader(in));\n tokenizer = null;\n }\n\n public String next() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public String nextLine() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n return reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken(\"\\n\");\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public int[] nextIntArray(int n) {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n return a;\n }\n\n public long[] nextLongArray(int n) {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = nextLong();\n return a;\n } \n}\n", "language": "Java", "metadata": {"date": 1590446234, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03240.html", "problem_id": "p03240", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03240/input.txt", "sample_output_relpath": "derived/input_output/data/p03240/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03240/Java/s089959277.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s089959277", "user_id": "u578775554"}, "prompt_components": {"gold_output": "2 2 6\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\n \npublic class Main {\n public static void main(String[] args) throws Exception {\n FastScanner sc = new FastScanner(System.in);\n int n = sc.nextInt();\n ArrayList li = new ArrayList();\n for(int i = 0; i < n; i++){\n li.add(new Point(sc.nextInt(),sc.nextInt(),sc.nextInt()));\n }\n Collections.sort(li);\n for(int i = 0; i <= 100; i++){\n for(int j = 0; j <= 100; j++){\n boolean flg = true;\n Point c = li.get(0);\n int chk = Math.abs(c.x-i)+Math.abs(c.y-j)+c.h;\n for(int k = 1; k < n; k++){\n Point p = li.get(k);\n if(!(p.h == 0 && chk <= Math.abs(p.x-i)+Math.abs(p.y-j)) && chk != Math.abs(p.x-i)+Math.abs(p.y-j)+p.h){\n flg = false;\n break;\n }\n }\n if(flg){\n System.out.println(i+\" \"+j+\" \"+chk);\n return;\n }\n }\n }\n }\n}\n\nclass Point implements Comparable{\n int x,y,h;\n public Point(int x, int y, int h){\n this.x = x;\n this.y = y;\n this.h = h;\n }\n public int compareTo(Point p){\n if(this.h > p.h){\n return -1;\n }else if(this.h < p.h){\n return 1;\n }else{\n return 0;\n }\n }\n}\n\nclass FastScanner {\n private BufferedReader reader = null;\n private StringTokenizer tokenizer = null;\n public FastScanner(InputStream in) {\n reader = new BufferedReader(new InputStreamReader(in));\n tokenizer = null;\n }\n\n public String next() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public String nextLine() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n return reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken(\"\\n\");\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public int[] nextIntArray(int n) {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n return a;\n }\n\n public long[] nextLongArray(int n) {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = nextLong();\n return a;\n } \n}\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "sample_input": "4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n"}, "reference_outputs": ["2 2 6\n"], "source_document_id": "p03240", "source_text": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2908, "cpu_time_ms": 86, "memory_kb": 22868}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s461252524", "group_id": "codeNet:p03240", "input_text": "// 20/02/03 17:00\n\nimport java.io.*;\nimport java.util.*;\n\nclass Main{\n final static long MOD = 1000000007;\n FastScanner sc = new FastScanner();\n\n public static void main(String[] args) {\n new Main().solve();\n }\n\n void solve(){\n\n int n = sc.nextInt();\n int[] x = new int[n];\n int[] y = new int[n];\n int[] h = new int[n];\n int f = 0;\n\n for(int i = 0; i < n; i++){\n x[i] = sc.nextInt();\n y[i] = sc.nextInt();\n h[i] = sc.nextInt();\n if(h[i] > 0 && f == 0) f = i;\n }\n\n for(int i = 0; i <= 100; i++){\n for(int j = 0; j <= 100; j++){\n boolean flag = true;\n for(int k = 1; k < n; k++){\n int max = Math.max(h[k], h[k - 1]);\n int min = Math.min(h[k], h[k - 1]);\n int maxX;\n int maxY;\n int minX;\n int minY;\n if(h[k] == max){\n maxX = x[k];\n maxY = y[k];\n minX = x[k - 1];\n minY = y[k - 1];\n }else{\n maxX = x[k - 1];\n maxY = y[k - 1];\n minX = x[k];\n minY = y[k];\n }\n if((h[k] != 0 && h[k - 1] != 0) && Math.abs(Math.abs(i - x[k]) + Math.abs(j - y[k]) - Math.abs(Math.abs(i - x[k - 1]) + Math.abs(j - y[k - 1]))) != Math.abs(h[k] - h[k - 1]) || Math.abs(i - maxX) + Math.abs(j - maxY) > Math.abs(i - minX) + Math.abs(j - minY)){ //2点からの距離を満たすか, 高い方から遠くないか\n flag = false;\n break;\n }\n }\n if(flag){\n int cx = i;\n int cy = j;\n int hc = h[f] + Math.abs(cx - x[f]) + Math.abs(cy - y[f]);\n for(int k = 0; k < n; k++){\n if(Math.abs(cx - x[k]) + Math.abs(cy - y[k]) != Math.abs(hc - h[k])){\n flag = false;\n }\n }\n if(flag){\n System.out.println(cx + \" \" + cy + \" \" + hc);\n }\n }\n }\n }\n\n }\n\n long mod_pow(long a, long r){ // return a^r (mod MOD)\n long sum = 1;\n while(r > 0){\n if((r & 1) == 1){\n sum *= a;\n sum %= MOD;\n }\n a *= a;\n a %= MOD;\n r >>= 1;\n }\n return sum;\n }\n\n long mod_inv(long a){ // return aの逆元 (mod MOD)\n return mod_pow(a, MOD - 2);\n }\n\n long fact(long n){ // return n!\n if(n == 0){\n return 1;\n }\n return n * fact(n - 1);\n }\n\n long mod_fact(long n){ // retur n! (mod MOD)\n if(n == 0){\n return 1;\n }\n return n * mod_fact(n - 1) % MOD;\n }\n\n long gcd(long a, long b){ // return aとbの最大公約数\n if(b == 0){\n return a;\n }\n return gcd(b, a % b);\n }\n\n boolean is_prime(long a){ // aの素数判定\n if(a <= 1) return false;\n for(int i = 2; i * i <= a; i++){\n if(a % i == 0) return false;\n }\n return true;\n }\n\n String nextPermutation(String s){ // return sの次の順列\n ArrayList list = new ArrayList<>();\n for(int i = 0; i < s.length(); i++) list.add(s.charAt(i));\n\n int pivotPos = -1;\n char pivot = 0;\n for(int i = list.size() - 2; i >= 0; i--){\n if(list.get(i) < list.get(i+1)){\n \t\t\tpivotPos = i;\n \t\t\tpivot = list.get(i);\n \t\t\tbreak;\n \t\t}\n \t}\n\n if(pivotPos == -1 && pivot == 0) return null;\n\n int L = pivotPos + 1;\n int R = list.size() - 1;\n \tint minPos = -1;\n \tchar min = Character.MAX_VALUE;\n \tfor(int i = R; i >= L; i--){\n \t\tif(pivot < list.get(i)){\n \t\t\tif(list.get(i) < min){\n \t\t\t\tmin = list.get(i);\n \t\t\t\tminPos = i;\n \t\t\t}\n \t\t}\n \t}\n\n \tCollections.swap(list, pivotPos, minPos);\n \tCollections.sort(list.subList(L, R + 1));\n\n \tStringBuilder sb = new StringBuilder();\n \tfor(int i=0; i Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }\n public double nextDouble(){\n return Double.parseDouble(next());\n }\n}\n\n\n\nclass Pair implements Comparable{\n long a, b;\n public Pair(long i, long j){\n a = i;\n b = j;\n }\n\n @Override\n public int compareTo(Pair p){\n if(this.b < p.b) return -1;\n else if(this.b > p.b) return 1;\n else return 0;\n }\n}\n", "language": "Java", "metadata": {"date": 1580775922, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03240.html", "problem_id": "p03240", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03240/input.txt", "sample_output_relpath": "derived/input_output/data/p03240/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03240/Java/s461252524.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s461252524", "user_id": "u521293705"}, "prompt_components": {"gold_output": "2 2 6\n", "input_to_evaluate": "// 20/02/03 17:00\n\nimport java.io.*;\nimport java.util.*;\n\nclass Main{\n final static long MOD = 1000000007;\n FastScanner sc = new FastScanner();\n\n public static void main(String[] args) {\n new Main().solve();\n }\n\n void solve(){\n\n int n = sc.nextInt();\n int[] x = new int[n];\n int[] y = new int[n];\n int[] h = new int[n];\n int f = 0;\n\n for(int i = 0; i < n; i++){\n x[i] = sc.nextInt();\n y[i] = sc.nextInt();\n h[i] = sc.nextInt();\n if(h[i] > 0 && f == 0) f = i;\n }\n\n for(int i = 0; i <= 100; i++){\n for(int j = 0; j <= 100; j++){\n boolean flag = true;\n for(int k = 1; k < n; k++){\n int max = Math.max(h[k], h[k - 1]);\n int min = Math.min(h[k], h[k - 1]);\n int maxX;\n int maxY;\n int minX;\n int minY;\n if(h[k] == max){\n maxX = x[k];\n maxY = y[k];\n minX = x[k - 1];\n minY = y[k - 1];\n }else{\n maxX = x[k - 1];\n maxY = y[k - 1];\n minX = x[k];\n minY = y[k];\n }\n if((h[k] != 0 && h[k - 1] != 0) && Math.abs(Math.abs(i - x[k]) + Math.abs(j - y[k]) - Math.abs(Math.abs(i - x[k - 1]) + Math.abs(j - y[k - 1]))) != Math.abs(h[k] - h[k - 1]) || Math.abs(i - maxX) + Math.abs(j - maxY) > Math.abs(i - minX) + Math.abs(j - minY)){ //2点からの距離を満たすか, 高い方から遠くないか\n flag = false;\n break;\n }\n }\n if(flag){\n int cx = i;\n int cy = j;\n int hc = h[f] + Math.abs(cx - x[f]) + Math.abs(cy - y[f]);\n for(int k = 0; k < n; k++){\n if(Math.abs(cx - x[k]) + Math.abs(cy - y[k]) != Math.abs(hc - h[k])){\n flag = false;\n }\n }\n if(flag){\n System.out.println(cx + \" \" + cy + \" \" + hc);\n }\n }\n }\n }\n\n }\n\n long mod_pow(long a, long r){ // return a^r (mod MOD)\n long sum = 1;\n while(r > 0){\n if((r & 1) == 1){\n sum *= a;\n sum %= MOD;\n }\n a *= a;\n a %= MOD;\n r >>= 1;\n }\n return sum;\n }\n\n long mod_inv(long a){ // return aの逆元 (mod MOD)\n return mod_pow(a, MOD - 2);\n }\n\n long fact(long n){ // return n!\n if(n == 0){\n return 1;\n }\n return n * fact(n - 1);\n }\n\n long mod_fact(long n){ // retur n! (mod MOD)\n if(n == 0){\n return 1;\n }\n return n * mod_fact(n - 1) % MOD;\n }\n\n long gcd(long a, long b){ // return aとbの最大公約数\n if(b == 0){\n return a;\n }\n return gcd(b, a % b);\n }\n\n boolean is_prime(long a){ // aの素数判定\n if(a <= 1) return false;\n for(int i = 2; i * i <= a; i++){\n if(a % i == 0) return false;\n }\n return true;\n }\n\n String nextPermutation(String s){ // return sの次の順列\n ArrayList list = new ArrayList<>();\n for(int i = 0; i < s.length(); i++) list.add(s.charAt(i));\n\n int pivotPos = -1;\n char pivot = 0;\n for(int i = list.size() - 2; i >= 0; i--){\n if(list.get(i) < list.get(i+1)){\n \t\t\tpivotPos = i;\n \t\t\tpivot = list.get(i);\n \t\t\tbreak;\n \t\t}\n \t}\n\n if(pivotPos == -1 && pivot == 0) return null;\n\n int L = pivotPos + 1;\n int R = list.size() - 1;\n \tint minPos = -1;\n \tchar min = Character.MAX_VALUE;\n \tfor(int i = R; i >= L; i--){\n \t\tif(pivot < list.get(i)){\n \t\t\tif(list.get(i) < min){\n \t\t\t\tmin = list.get(i);\n \t\t\t\tminPos = i;\n \t\t\t}\n \t\t}\n \t}\n\n \tCollections.swap(list, pivotPos, minPos);\n \tCollections.sort(list.subList(L, R + 1));\n\n \tStringBuilder sb = new StringBuilder();\n \tfor(int i=0; i Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }\n public double nextDouble(){\n return Double.parseDouble(next());\n }\n}\n\n\n\nclass Pair implements Comparable{\n long a, b;\n public Pair(long i, long j){\n a = i;\n b = j;\n }\n\n @Override\n public int compareTo(Pair p){\n if(this.b < p.b) return -1;\n else if(this.b > p.b) return 1;\n else return 0;\n }\n}\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "sample_input": "4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n"}, "reference_outputs": ["2 2 6\n"], "source_document_id": "p03240", "source_text": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 6845, "cpu_time_ms": 103, "memory_kb": 24660}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s919421214", "group_id": "codeNet:p03240", "input_text": "import java.util.Scanner;\npublic class Main {\n public static void main(String args[]) {\n Scanner scan = new Scanner(System.in);\n int N = scan.nextInt();//入力される数\n int[] inx = new int[N];\n int[] iny = new int[N];\n int[] inh = new int[N];\n int H = 0;\n int Cx = 0;\n int Cy = 0;\n int w;\n int temp = 0;\n int flag;\n\n for(int i = 0;i 0 ? x - Cx:Cx - x;\n int u = y - Cy > 0 ? y - Cy:Cy - y;\n int H = h + t + u;\n if(h >= 0){\n return H;\n }else{\n return 0;\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1579129603, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03240.html", "problem_id": "p03240", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03240/input.txt", "sample_output_relpath": "derived/input_output/data/p03240/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03240/Java/s919421214.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s919421214", "user_id": "u308736928"}, "prompt_components": {"gold_output": "2 2 6\n", "input_to_evaluate": "import java.util.Scanner;\npublic class Main {\n public static void main(String args[]) {\n Scanner scan = new Scanner(System.in);\n int N = scan.nextInt();//入力される数\n int[] inx = new int[N];\n int[] iny = new int[N];\n int[] inh = new int[N];\n int H = 0;\n int Cx = 0;\n int Cy = 0;\n int w;\n int temp = 0;\n int flag;\n\n for(int i = 0;i 0 ? x - Cx:Cx - x;\n int u = y - Cy > 0 ? y - Cy:Cy - y;\n int H = h + t + u;\n if(h >= 0){\n return H;\n }else{\n return 0;\n }\n }\n}\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "sample_input": "4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n"}, "reference_outputs": ["2 2 6\n"], "source_document_id": "p03240", "source_text": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1557, "cpu_time_ms": 119, "memory_kb": 22996}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s631825081", "group_id": "codeNet:p03240", "input_text": "import java.util.ArrayList;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = in.nextInt();\n\t\tint hi = 0;\n\t\tArrayList xlist = new ArrayList();\n\t\tArrayList ylist = new ArrayList();\n\t\tArrayList hlist = new ArrayList();\n\t\tfor ( int i = 0; i < n; i++ ) {\n\t\t\txlist.add(in.nextInt());\n\t\t\tylist.add(in.nextInt());\n\t\t\thlist.add(in.nextInt());\n\n\t\t\tif ( hlist.get(i) != 0 ) hi = i;\n\t\t}\n\t\tin.close();\n\n\t\tfor ( int cy = 0; cy <= 100; cy++ ) {\n\t\t\tfor ( int cx = 0; cx <= 100; cx++ ) {\n\t\t\t\tboolean match = true;\n\t\t\t\tint Height = hlist.get(hi) + Math.abs(xlist.get(hi) - cx) + Math.abs(ylist.get(hi) - cy);\n\t\t\t\t\n\t\t\t\tfor ( int i = 0; i < hlist.size(); i++ ) {\t\t\t\t\t\n\t\t\t\t\tif(hlist.get(i) != 0) {\n\t\t\t\t\t\tint tempH = hlist.get(i) + Math.abs(xlist.get(i) - cx) + Math.abs(ylist.get(i) - cy);\n\t\t\t\t\t\tif ( Height != tempH ) {\n\t\t\t\t\t\t\tmatch = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tHeight = tempH;\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif(hlist.get(i) == 0 && Height > Math.abs(xlist.get(i) - cx) + Math.abs(ylist.get(i) - cy)) {\n\t\t\t\t\t\tmatch = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ( match ) {\n\t\t\t\t\tSystem.out.println(cx + \" \" + cy + \" \" + Height);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n", "language": "Java", "metadata": {"date": 1569794287, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03240.html", "problem_id": "p03240", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03240/input.txt", "sample_output_relpath": "derived/input_output/data/p03240/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03240/Java/s631825081.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s631825081", "user_id": "u605722824"}, "prompt_components": {"gold_output": "2 2 6\n", "input_to_evaluate": "import java.util.ArrayList;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = in.nextInt();\n\t\tint hi = 0;\n\t\tArrayList xlist = new ArrayList();\n\t\tArrayList ylist = new ArrayList();\n\t\tArrayList hlist = new ArrayList();\n\t\tfor ( int i = 0; i < n; i++ ) {\n\t\t\txlist.add(in.nextInt());\n\t\t\tylist.add(in.nextInt());\n\t\t\thlist.add(in.nextInt());\n\n\t\t\tif ( hlist.get(i) != 0 ) hi = i;\n\t\t}\n\t\tin.close();\n\n\t\tfor ( int cy = 0; cy <= 100; cy++ ) {\n\t\t\tfor ( int cx = 0; cx <= 100; cx++ ) {\n\t\t\t\tboolean match = true;\n\t\t\t\tint Height = hlist.get(hi) + Math.abs(xlist.get(hi) - cx) + Math.abs(ylist.get(hi) - cy);\n\t\t\t\t\n\t\t\t\tfor ( int i = 0; i < hlist.size(); i++ ) {\t\t\t\t\t\n\t\t\t\t\tif(hlist.get(i) != 0) {\n\t\t\t\t\t\tint tempH = hlist.get(i) + Math.abs(xlist.get(i) - cx) + Math.abs(ylist.get(i) - cy);\n\t\t\t\t\t\tif ( Height != tempH ) {\n\t\t\t\t\t\t\tmatch = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tHeight = tempH;\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif(hlist.get(i) == 0 && Height > Math.abs(xlist.get(i) - cx) + Math.abs(ylist.get(i) - cy)) {\n\t\t\t\t\t\tmatch = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ( match ) {\n\t\t\t\t\tSystem.out.println(cx + \" \" + cy + \" \" + Height);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "sample_input": "4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n"}, "reference_outputs": ["2 2 6\n"], "source_document_id": "p03240", "source_text": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1305, "cpu_time_ms": 122, "memory_kb": 21972}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s212203453", "group_id": "codeNet:p03240", "input_text": "import java.util.Scanner;\n\npublic class Main {\n static final Scanner sc = new Scanner(System.in);\n static final int MOD = (int) 1E9 + 7;\n \n public static void main(String[] args) {\n int N = nint();\n Point[] a = new Point[N];\n for (int i = 0; i < N; i++) {\n a[i] = new Point(nint(), nint(), nint());\n }\n \n for (int x = 0; x <= 100; x++) {\n loop: for (int y = 0; y < 100; y++) {\n Point maybeC = new Point(x, y);\n maybeC.h = calc_H(maybeC, a[0]);\n \n for (int i = 0; i < a.length; i++) {\n if (calc_h(maybeC, a[i]) != a[i].h) {\n continue loop;\n }\n }\n \n System.out.println(maybeC.forAns());\n return;\n }\n }\n }\n \n static int calc_H(Point maybeC, Point defined) {\n int absX = Math.abs(maybeC.x - defined.x);\n int absY = Math.abs(maybeC.y - defined.y);\n return defined.h + absX + absY;\n }\n \n static int calc_h(Point c, Point toCalc) {\n return Math.max(c.h - Math.abs(c.x - toCalc.x) - Math.abs(c.y - toCalc.y), 0);\n }\n \n static class Point {\n int x;\n int y;\n int h;\n public Point(int x, int y, int h) {\n super();\n this.x = x;\n this.y = y;\n this.h = h;\n }\n \n public Point(int x, int y) {\n this(x, y, -1);\n }\n \n @Override\n public String toString() {\n return String.format(\"Point[x:%d, y:%d, h:%d]\", x, y, h);\n }\n \n public String forAns() {\n return x + \" \" + y + \" \" + h;\n }\n }\n\n private static long nlong() {\n return sc.nextLong();\n }\n\n private static int nint() {\n return sc.nextInt();\n }\n\n private static String nstr() {\n return sc.next();\n }\n\n private static char[] nsToChars() {\n return sc.next().toCharArray();\n }\n\n private static long[] nlongs(int n) {\n return nlongs(n, 0, 0);\n }\n\n private static int[] nints(int n) {\n return nints(n, 0, 0);\n }\n\n private static int[] nints(int n, int padL, int padR) {\n int[] a = new int[padL + n + padR];\n for (int i = 0; i < n; i++)\n a[padL + i] = nint();\n return a;\n }\n\n private static long[] nlongs(int n, int padL, int padR) {\n long[] a = new long[padL + n + padR];\n for (int i = 0; i < n; i++)\n a[padL + i] = nlong();\n return a;\n }\n\n private static String[] nstrs(int n) {\n String[] a = new String[n];\n for (int i = 0; i < n; i++)\n a[i] = nstr();\n return a;\n }\n\n private static char[][] nsToChars2D(int h, int w) {\n return nsToChars2D(h, w, 0);\n }\n\n private static char[][] nsToChars2D(int h, int w, int pad) {\n char[][] a2 = new char[h + pad * 2][w + pad * 2];\n for (int i = 0; i < h; i++)\n System.arraycopy(nsToChars(), 0, a2[pad + i], pad, w);\n return a2;\n }\n}\n", "language": "Java", "metadata": {"date": 1567374291, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03240.html", "problem_id": "p03240", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03240/input.txt", "sample_output_relpath": "derived/input_output/data/p03240/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03240/Java/s212203453.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s212203453", "user_id": "u228127260"}, "prompt_components": {"gold_output": "2 2 6\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n static final Scanner sc = new Scanner(System.in);\n static final int MOD = (int) 1E9 + 7;\n \n public static void main(String[] args) {\n int N = nint();\n Point[] a = new Point[N];\n for (int i = 0; i < N; i++) {\n a[i] = new Point(nint(), nint(), nint());\n }\n \n for (int x = 0; x <= 100; x++) {\n loop: for (int y = 0; y < 100; y++) {\n Point maybeC = new Point(x, y);\n maybeC.h = calc_H(maybeC, a[0]);\n \n for (int i = 0; i < a.length; i++) {\n if (calc_h(maybeC, a[i]) != a[i].h) {\n continue loop;\n }\n }\n \n System.out.println(maybeC.forAns());\n return;\n }\n }\n }\n \n static int calc_H(Point maybeC, Point defined) {\n int absX = Math.abs(maybeC.x - defined.x);\n int absY = Math.abs(maybeC.y - defined.y);\n return defined.h + absX + absY;\n }\n \n static int calc_h(Point c, Point toCalc) {\n return Math.max(c.h - Math.abs(c.x - toCalc.x) - Math.abs(c.y - toCalc.y), 0);\n }\n \n static class Point {\n int x;\n int y;\n int h;\n public Point(int x, int y, int h) {\n super();\n this.x = x;\n this.y = y;\n this.h = h;\n }\n \n public Point(int x, int y) {\n this(x, y, -1);\n }\n \n @Override\n public String toString() {\n return String.format(\"Point[x:%d, y:%d, h:%d]\", x, y, h);\n }\n \n public String forAns() {\n return x + \" \" + y + \" \" + h;\n }\n }\n\n private static long nlong() {\n return sc.nextLong();\n }\n\n private static int nint() {\n return sc.nextInt();\n }\n\n private static String nstr() {\n return sc.next();\n }\n\n private static char[] nsToChars() {\n return sc.next().toCharArray();\n }\n\n private static long[] nlongs(int n) {\n return nlongs(n, 0, 0);\n }\n\n private static int[] nints(int n) {\n return nints(n, 0, 0);\n }\n\n private static int[] nints(int n, int padL, int padR) {\n int[] a = new int[padL + n + padR];\n for (int i = 0; i < n; i++)\n a[padL + i] = nint();\n return a;\n }\n\n private static long[] nlongs(int n, int padL, int padR) {\n long[] a = new long[padL + n + padR];\n for (int i = 0; i < n; i++)\n a[padL + i] = nlong();\n return a;\n }\n\n private static String[] nstrs(int n) {\n String[] a = new String[n];\n for (int i = 0; i < n; i++)\n a[i] = nstr();\n return a;\n }\n\n private static char[][] nsToChars2D(int h, int w) {\n return nsToChars2D(h, w, 0);\n }\n\n private static char[][] nsToChars2D(int h, int w, int pad) {\n char[][] a2 = new char[h + pad * 2][w + pad * 2];\n for (int i = 0; i < h; i++)\n System.arraycopy(nsToChars(), 0, a2[pad + i], pad, w);\n return a2;\n }\n}\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "sample_input": "4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n"}, "reference_outputs": ["2 2 6\n"], "source_document_id": "p03240", "source_text": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3157, "cpu_time_ms": 112, "memory_kb": 21972}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s063970759", "group_id": "codeNet:p03240", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint n = sc.nextInt();\n\t\tint[] x = new int[n];\n\t\tint[] y = new int[n];\n\t\tint[] h = new int[n];\n\t\tint px = 0;\n\t\tint py = 0;\n\t\tint ph = 0;\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tx[i] = sc.nextInt();\n\t\t\ty[i] = sc.nextInt();\n\t\t\th[i] = sc.nextInt();\n\t\t\tif (h[i] > 0 && ph == 0) {\n\t\t\t\tpx = x[i];\n\t\t\t\tpy = y[i];\n\t\t\t\tph = h[i];\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i <= 100; i++) {\n\t\t\tloop: for (int j = 0; j <= 100; j++) {\n\t\t\t\tint cx = i;\n\t\t\t\tint cy = j;\n\t\t\t\tint ch = ph + Math.abs(cx - px) + Math.abs(cy - py);\n\n//\t\t\t\tSystem.out.println(cx + \", \" + cy + \", \" + ch);\n\n\t\t\t\tfor (int k = 0; k < n; k++) {\n//\t\t\t\t\tSystem.out.print(\"ch=\" + ch + \", k=\" + k + \", \");\n//\t\t\t\t\tSystem.out.println(h[k] + Math.abs(cx - x[k]) + Math.abs(cy - y[k]));\n\t\t\t\t\tif (ch != h[k] + Math.abs(cx - x[k]) + Math.abs(cy - y[k])) {\n\t\t\t\t\t\tcontinue loop;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tSystem.out.println(cx + \" \" + cy + \" \" + ch);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}\n\n\t\tsc.close();\n\t}\n\n}", "language": "Java", "metadata": {"date": 1563078598, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03240.html", "problem_id": "p03240", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03240/input.txt", "sample_output_relpath": "derived/input_output/data/p03240/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03240/Java/s063970759.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s063970759", "user_id": "u117657834"}, "prompt_components": {"gold_output": "2 2 6\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint n = sc.nextInt();\n\t\tint[] x = new int[n];\n\t\tint[] y = new int[n];\n\t\tint[] h = new int[n];\n\t\tint px = 0;\n\t\tint py = 0;\n\t\tint ph = 0;\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tx[i] = sc.nextInt();\n\t\t\ty[i] = sc.nextInt();\n\t\t\th[i] = sc.nextInt();\n\t\t\tif (h[i] > 0 && ph == 0) {\n\t\t\t\tpx = x[i];\n\t\t\t\tpy = y[i];\n\t\t\t\tph = h[i];\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i <= 100; i++) {\n\t\t\tloop: for (int j = 0; j <= 100; j++) {\n\t\t\t\tint cx = i;\n\t\t\t\tint cy = j;\n\t\t\t\tint ch = ph + Math.abs(cx - px) + Math.abs(cy - py);\n\n//\t\t\t\tSystem.out.println(cx + \", \" + cy + \", \" + ch);\n\n\t\t\t\tfor (int k = 0; k < n; k++) {\n//\t\t\t\t\tSystem.out.print(\"ch=\" + ch + \", k=\" + k + \", \");\n//\t\t\t\t\tSystem.out.println(h[k] + Math.abs(cx - x[k]) + Math.abs(cy - y[k]));\n\t\t\t\t\tif (ch != h[k] + Math.abs(cx - x[k]) + Math.abs(cy - y[k])) {\n\t\t\t\t\t\tcontinue loop;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tSystem.out.println(cx + \" \" + cy + \" \" + ch);\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}\n\n\t\tsc.close();\n\t}\n\n}", "problem_context": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "sample_input": "4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n"}, "reference_outputs": ["2 2 6\n"], "source_document_id": "p03240", "source_text": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 115, "memory_kb": 22228}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s607044378", "group_id": "codeNet:p03240", "input_text": "import java.util.Scanner;\n\npublic class Main{\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n\n try{\n //入力\n int N = scan.nextInt();\n int[] x = new int[N];\n int[] y = new int[N];\n int[] h = new int[N];\n for(int i = 0; i < N; i++){\n x[i] = scan.nextInt();\n y[i] = scan.nextInt();\n h[i] = scan.nextInt();\n }\n\n int X = 0;\n int Y = 0;\n int H = 0;\n loop: for(int cx = 0; cx <= 100; cx++){\n for(int cy = 0; cy <= 100; cy++){\n for(int i = 0; i < N; i++){\n if(h[i] != 0){\n H = h[i] + Math.abs(cx-x[i]) + Math.abs(cy-y[i]);\n break;\n }\n }\n H = getHeight(H, cx, cy, N, h, x, y);\n if(H != -1){\n X = cx;\n Y = cy;\n break loop;\n }\n }\n }\n\n System.out.println(X+\" \"+Y+\" \"+H);\n\n }finally{\n scan.close();\n }\n }\n\n static int getHeight(int H, int cx, int cy, int N, int[] h, int[] x, int[] y){\n for(int i = 0; i < N; i++){\n if(h[i] != Math.max(H-Math.abs(cx-x[i])-Math.abs(cy-y[i]), 0)){\n H = -1;\n }\n }\n return H;\n }\n}\n", "language": "Java", "metadata": {"date": 1551130644, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03240.html", "problem_id": "p03240", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03240/input.txt", "sample_output_relpath": "derived/input_output/data/p03240/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03240/Java/s607044378.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s607044378", "user_id": "u769839099"}, "prompt_components": {"gold_output": "2 2 6\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main{\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n\n try{\n //入力\n int N = scan.nextInt();\n int[] x = new int[N];\n int[] y = new int[N];\n int[] h = new int[N];\n for(int i = 0; i < N; i++){\n x[i] = scan.nextInt();\n y[i] = scan.nextInt();\n h[i] = scan.nextInt();\n }\n\n int X = 0;\n int Y = 0;\n int H = 0;\n loop: for(int cx = 0; cx <= 100; cx++){\n for(int cy = 0; cy <= 100; cy++){\n for(int i = 0; i < N; i++){\n if(h[i] != 0){\n H = h[i] + Math.abs(cx-x[i]) + Math.abs(cy-y[i]);\n break;\n }\n }\n H = getHeight(H, cx, cy, N, h, x, y);\n if(H != -1){\n X = cx;\n Y = cy;\n break loop;\n }\n }\n }\n\n System.out.println(X+\" \"+Y+\" \"+H);\n\n }finally{\n scan.close();\n }\n }\n\n static int getHeight(int H, int cx, int cy, int N, int[] h, int[] x, int[] y){\n for(int i = 0; i < N; i++){\n if(h[i] != Math.max(H-Math.abs(cx-x[i])-Math.abs(cy-y[i]), 0)){\n H = -1;\n }\n }\n return H;\n }\n}\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "sample_input": "4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n"}, "reference_outputs": ["2 2 6\n"], "source_document_id": "p03240", "source_text": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1525, "cpu_time_ms": 149, "memory_kb": 22100}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s721562170", "group_id": "codeNet:p03240", "input_text": "import java.util.Scanner;\n\nclass Main{\n\tstatic final long MOD = 1000000007;\n\n\tstatic int H, W, K;\n\tstatic long[][] dp = new long[110][10];\n\tstatic int ans = 0;\n\tstatic long n = 0;\n\n\n\n\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\t\t\t//文字の入力\n\t\tint n = sc.nextInt();\n\t\tint[] x = new int[n];\n\t\tint[]y = new int[n];\n\t\tint[] h = new int[n];\n\t\tfor(int i = 0;i < n;i++){\n\t\t\tx[i] =sc.nextInt();\n\t\t\ty[i] = sc.nextInt();\n\t\t\th[i] = sc.nextInt();\n\t\t}\n\t\tfor(int cx = 0;cx <= 100;cx++){\n\t\t\tfor(int cy = 0;cy <= 100;cy++){\n\t\t\t\tlong H = 0;\n\t\t\t\tfor(int i = 0;i < n;i++){\n\t\t\t\t\tif(h[i] != 0){\n\t\t\t\t\t\tH= (long)( h[i] +(long) Math.abs(x[i]-cx) + Math.abs(y[i]-cy));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\n\t\t\t\tboolean flag = true;\n\t\t\t\tfor(int i = 0;i < n;i++){\n\t\t\t\t\tif(h[i] != 0){\n\t\t\t\t\t\tif(h[i] != H - (long)Math.abs(x[i]-cx) - Math.abs(y[i]-cy)){\n\t\t\t\t\t\t\tflag = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tif(H - Math.abs(x[i]-cx) - Math.abs(y[i]-cy)!= 0){\n\t\t\t\t\t\t\t\tflag = false;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(flag){\n\t\t\t\t\tSystem.out.println(cx + \" \" + cy + \" \" + H);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n\n\n\n\n\nclass Pair implements Comparable{\n\tint from;\t\t//p\n\tint end;\t\t//y\n\tint num;\n\tint bango;\n\t@Override\n\tpublic int compareTo(Object other) {\n\t\tPair otherpair = (Pair)other;\n\n\t\treturn end - otherpair.end;\n\t}\n}\n\n", "language": "Java", "metadata": {"date": 1546565053, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03240.html", "problem_id": "p03240", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03240/input.txt", "sample_output_relpath": "derived/input_output/data/p03240/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03240/Java/s721562170.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s721562170", "user_id": "u632953742"}, "prompt_components": {"gold_output": "2 2 6\n", "input_to_evaluate": "import java.util.Scanner;\n\nclass Main{\n\tstatic final long MOD = 1000000007;\n\n\tstatic int H, W, K;\n\tstatic long[][] dp = new long[110][10];\n\tstatic int ans = 0;\n\tstatic long n = 0;\n\n\n\n\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\t\t\t//文字の入力\n\t\tint n = sc.nextInt();\n\t\tint[] x = new int[n];\n\t\tint[]y = new int[n];\n\t\tint[] h = new int[n];\n\t\tfor(int i = 0;i < n;i++){\n\t\t\tx[i] =sc.nextInt();\n\t\t\ty[i] = sc.nextInt();\n\t\t\th[i] = sc.nextInt();\n\t\t}\n\t\tfor(int cx = 0;cx <= 100;cx++){\n\t\t\tfor(int cy = 0;cy <= 100;cy++){\n\t\t\t\tlong H = 0;\n\t\t\t\tfor(int i = 0;i < n;i++){\n\t\t\t\t\tif(h[i] != 0){\n\t\t\t\t\t\tH= (long)( h[i] +(long) Math.abs(x[i]-cx) + Math.abs(y[i]-cy));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\n\t\t\t\tboolean flag = true;\n\t\t\t\tfor(int i = 0;i < n;i++){\n\t\t\t\t\tif(h[i] != 0){\n\t\t\t\t\t\tif(h[i] != H - (long)Math.abs(x[i]-cx) - Math.abs(y[i]-cy)){\n\t\t\t\t\t\t\tflag = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tif(H - Math.abs(x[i]-cx) - Math.abs(y[i]-cy)!= 0){\n\t\t\t\t\t\t\t\tflag = false;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(flag){\n\t\t\t\t\tSystem.out.println(cx + \" \" + cy + \" \" + H);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n\n\n\n\n\nclass Pair implements Comparable{\n\tint from;\t\t//p\n\tint end;\t\t//y\n\tint num;\n\tint bango;\n\t@Override\n\tpublic int compareTo(Object other) {\n\t\tPair otherpair = (Pair)other;\n\n\t\treturn end - otherpair.end;\n\t}\n}\n\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "sample_input": "4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n"}, "reference_outputs": ["2 2 6\n"], "source_document_id": "p03240", "source_text": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1349, "cpu_time_ms": 126, "memory_kb": 24916}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s235649668", "group_id": "codeNet:p03240", "input_text": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n try (Scanner sc = new Scanner(System.in);) {\n new Main().solve(sc);\n }\n }\n\n void solve(Scanner sc) {\n int n = sc.nextInt();\n Point[] ps = new Point[n];\n\n for (int i = 0; i < n; i++) {\n int x = sc.nextInt();\n int y = sc.nextInt();\n int h = sc.nextInt();\n if (h == 100) {\n System.out.printf(\"%d %d %d%n\", x, y, h);\n return;\n }\n ps[i] = new Point(x, y, h);\n }\n\n Arrays.sort(ps, (x, y) -> y.h - x.h);\n\n for (int x = 0; x <= 100; x++) {\n for (int y = 0; y <= 100; y++) {\n if (n >= 3) {\n int h1 = ps[0].h + Math.abs(ps[0].x - x) + Math.abs(ps[0].y - y);\n int h2 = ps[1].h + Math.abs(ps[1].x - x) + Math.abs(ps[1].y - y);\n\n if (h1 == h2) {\n System.out.printf(\"%d %d %d%n\", x, y, h1);\n return;\n }\n }\n }\n }\n }\n}\n\nclass Point {\n int x;\n int y;\n int h;\n\n Point(int x, int y, int h) {\n this.x = x;\n this.y = y;\n this.h = h;\n }\n}", "language": "Java", "metadata": {"date": 1546318476, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03240.html", "problem_id": "p03240", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03240/input.txt", "sample_output_relpath": "derived/input_output/data/p03240/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03240/Java/s235649668.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s235649668", "user_id": "u784448849"}, "prompt_components": {"gold_output": "2 2 6\n", "input_to_evaluate": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n try (Scanner sc = new Scanner(System.in);) {\n new Main().solve(sc);\n }\n }\n\n void solve(Scanner sc) {\n int n = sc.nextInt();\n Point[] ps = new Point[n];\n\n for (int i = 0; i < n; i++) {\n int x = sc.nextInt();\n int y = sc.nextInt();\n int h = sc.nextInt();\n if (h == 100) {\n System.out.printf(\"%d %d %d%n\", x, y, h);\n return;\n }\n ps[i] = new Point(x, y, h);\n }\n\n Arrays.sort(ps, (x, y) -> y.h - x.h);\n\n for (int x = 0; x <= 100; x++) {\n for (int y = 0; y <= 100; y++) {\n if (n >= 3) {\n int h1 = ps[0].h + Math.abs(ps[0].x - x) + Math.abs(ps[0].y - y);\n int h2 = ps[1].h + Math.abs(ps[1].x - x) + Math.abs(ps[1].y - y);\n\n if (h1 == h2) {\n System.out.printf(\"%d %d %d%n\", x, y, h1);\n return;\n }\n }\n }\n }\n }\n}\n\nclass Point {\n int x;\n int y;\n int h;\n\n Point(int x, int y, int h) {\n this.x = x;\n this.y = y;\n this.h = h;\n }\n}", "problem_context": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "sample_input": "4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n"}, "reference_outputs": ["2 2 6\n"], "source_document_id": "p03240", "source_text": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1323, "cpu_time_ms": 202, "memory_kb": 29012}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s644874596", "group_id": "codeNet:p03240", "input_text": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tPoint[] arr = new Point[n];\n\t\tint zero = 0;\n\t\tfor(int i=0;i(){\n\n\t\t\t\t@Override\n\t\t\t\tpublic int compare(Point arg0, Point arg1) {\n\t\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\t\treturn -Integer.compare(arg0.h, arg1.h);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t});\n\t\t\t\n \t\tint h = 0;\n \t\tboolean val=true;\n \t\tL1:for(int x=0;x<=100;x++){\n \t\t\tfor(int y=0;y<=100;y++){\n \t\t\t\tval=true;\n \t\t\t\tfor(int i=0;i=1){\n \t\t\t\t\tSystem.out.println(x+\" \"+y+\" \"+h);\n \t\t\t\t\tbreak L1;\n \t\t\t\t}\n \t\t\t}\n \t\t} \n\t\t//}\n\t}\n}\nclass Point{\n\tint x, y, h;\n\tPoint(int x, int y, int h){\n\t\tthis.x=x;\n\t\tthis.y=y;\n\t\tthis.h=h;\n\t}\n}\n/*\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\n5\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n10 20 0\n\n2\n47 23 0\n10 20 0\n*/", "language": "Java", "metadata": {"date": 1539632768, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03240.html", "problem_id": "p03240", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03240/input.txt", "sample_output_relpath": "derived/input_output/data/p03240/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03240/Java/s644874596.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s644874596", "user_id": "u353919145"}, "prompt_components": {"gold_output": "2 2 6\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tPoint[] arr = new Point[n];\n\t\tint zero = 0;\n\t\tfor(int i=0;i(){\n\n\t\t\t\t@Override\n\t\t\t\tpublic int compare(Point arg0, Point arg1) {\n\t\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\t\treturn -Integer.compare(arg0.h, arg1.h);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t});\n\t\t\t\n \t\tint h = 0;\n \t\tboolean val=true;\n \t\tL1:for(int x=0;x<=100;x++){\n \t\t\tfor(int y=0;y<=100;y++){\n \t\t\t\tval=true;\n \t\t\t\tfor(int i=0;i=1){\n \t\t\t\t\tSystem.out.println(x+\" \"+y+\" \"+h);\n \t\t\t\t\tbreak L1;\n \t\t\t\t}\n \t\t\t}\n \t\t} \n\t\t//}\n\t}\n}\nclass Point{\n\tint x, y, h;\n\tPoint(int x, int y, int h){\n\t\tthis.x=x;\n\t\tthis.y=y;\n\t\tthis.h=h;\n\t}\n}\n/*\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\n5\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n10 20 0\n\n2\n47 23 0\n10 20 0\n*/", "problem_context": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "sample_input": "4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n"}, "reference_outputs": ["2 2 6\n"], "source_document_id": "p03240", "source_text": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1349, "cpu_time_ms": 120, "memory_kb": 23124}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s651446930", "group_id": "codeNet:p03240", "input_text": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n int[] xA = new int[n];\n int[] yA = new int[n];\n int[] hA = new int[n];\n\n for (int i = 0; i < n; i++) {\n xA[i] = sc.nextInt();\n yA[i] = sc.nextInt();\n hA[i] = sc.nextInt();\n }\n\n for (int x = 0; x <= 100; x++) {\n for (int y = 0; y <= 100; y++) {\n int i = 0;\n int h = hA[i] + Math.abs(xA[i] - x) + Math.abs(yA[i] - y);\n do {\n i++;\n if (i >= n) {\n if (h < 0)\n h = 0;\n System.out.println(x + \" \" + y + \" \" + h);\n System.exit(0);\n }\n } while (h == hA[i] + Math.abs(xA[i] - x) + Math.abs(yA[i] - y));\n }\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1539060339, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03240.html", "problem_id": "p03240", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03240/input.txt", "sample_output_relpath": "derived/input_output/data/p03240/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03240/Java/s651446930.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s651446930", "user_id": "u387806792"}, "prompt_components": {"gold_output": "2 2 6\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n int[] xA = new int[n];\n int[] yA = new int[n];\n int[] hA = new int[n];\n\n for (int i = 0; i < n; i++) {\n xA[i] = sc.nextInt();\n yA[i] = sc.nextInt();\n hA[i] = sc.nextInt();\n }\n\n for (int x = 0; x <= 100; x++) {\n for (int y = 0; y <= 100; y++) {\n int i = 0;\n int h = hA[i] + Math.abs(xA[i] - x) + Math.abs(yA[i] - y);\n do {\n i++;\n if (i >= n) {\n if (h < 0)\n h = 0;\n System.out.println(x + \" \" + y + \" \" + h);\n System.exit(0);\n }\n } while (h == hA[i] + Math.abs(xA[i] - x) + Math.abs(yA[i] - y));\n }\n }\n }\n}\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "sample_input": "4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n"}, "reference_outputs": ["2 2 6\n"], "source_document_id": "p03240", "source_text": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 117, "memory_kb": 23892}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s172440657", "group_id": "codeNet:p03240", "input_text": "import java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Scanner;\nimport java.util.Set;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint N = scan.nextInt();\n\t\tint[]x = new int[N];\n\t\tint[]y = new int[N];\n\t\tint[]h = new int[N];\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tx[i] = scan.nextInt();\n\t\t\ty[i] = scan.nextInt();\n\t\t\th[i] = scan.nextInt();\n\t\t}\n\t\tscan.close();\n\n\t\tArrayList>> mlist = new ArrayList>>();\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tMap> map = new HashMap>();\n\t\t\tfor(int cx = 0; cx <= 100; cx++) {\n\t\t\t\tfor(int cy = 0; cy <= 100; cy++) {\n\t\t\t\t\tint H = h[i] + Math.abs(x[i] - cx) + Math.abs(y[i]- cy);\n\t\t\t\t\tif(H == 0) continue;\n\t\t\t\t\tif(map.containsKey(H)) {\n\t\t\t\t\t\tArrayList list = map.get(H);\n\t\t\t\t\t\tint[]t = {cx, cy};\n\t\t\t\t\t\tlist.add(t);\n\t\t\t\t\t\tmap.put(H, list);\n\t\t\t\t\t}else {\n\t\t\t\t\t\tint[]t = {cx, cy};\n\t\t\t\t\t\tArrayList list = new ArrayList();\n\t\t\t\t\t\tlist.add(t);\n\t\t\t\t\t\tmap.put(H, list);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tmlist.add(map);\n\t\t}\n\t\tSet set = new HashSet();\n\t\tfor(int k : mlist.get(0).keySet()){\n\t\t\tboolean flag = true;\n\t\t\tfor(int i = 1; i < N; i++) {\n\t\t\t\tMap> map = mlist.get(i);\n\t\t\t\tif(!map.containsKey(k)) {\n\t\t\t\t\tflag = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(flag) {\n\t\t\t\tif(k >= 1 && k <= 100) {\n\t\t\t\t\tset.add(k);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tint cnt = 0;\n\t\tint a[] = new int[3];\n\t\tList list = new ArrayList();\n\t\tfor(int i : set) {\n\t\t\tMap> map = mlist.get(0);\n\t\t\tfor(int j = 0; j < map.get(i).size(); j++) {\n\t\t\t\tint[]p = map.get(i).get(j);\n\t\t\t\tint cx = p[0];\n\t\t\t\tint cy = p[1];\n\t\t\t\t//System.out.println(cx + \" \" + cy);\n\t\t\t\tboolean flag1 = true;\n\t\t\t\tfor(int k = 0; k < N; k++) {\n\t\t\t\t\tint t = Math.max(0, i - Math.abs(x[k] - cx) - Math.abs(y[k] - cy));\n\t\t\t\t\tif(t != h[k]) {\n\t\t\t\t\t\tflag1 = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(flag1) {\n\t\t\t\t\tboolean flag0 = true;\n\t\t\t\t\tfor(int k = 1; k < N; k++) {\n\t\t\t\t\t\tMap> mapK = mlist.get(k);\n\t\t\t\t\t\tList listK = mapK.get(i);\n\t\t\t\t\t\tboolean flag = false;\n\t\t\t\t\t\tfor(int l = 0; l < listK.size(); l++){\n\t\t\t\t\t\t\tint[]pK = listK.get(l);\n\t\t\t\t\t\t\tif(cx == pK[0] || cy == pK[1]) {\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(flag) {\n\t\t\t\t\t\t\tflag0 = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(flag0) {\n\t\t\t\t\t\tSystem.out.println(cx + \" \" + cy + \" \" + i);\n\t\t\t\t\t\tSystem.exit(0);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "language": "Java", "metadata": {"date": 1539040359, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03240.html", "problem_id": "p03240", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03240/input.txt", "sample_output_relpath": "derived/input_output/data/p03240/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03240/Java/s172440657.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s172440657", "user_id": "u634209474"}, "prompt_components": {"gold_output": "2 2 6\n", "input_to_evaluate": "import java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Scanner;\nimport java.util.Set;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint N = scan.nextInt();\n\t\tint[]x = new int[N];\n\t\tint[]y = new int[N];\n\t\tint[]h = new int[N];\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tx[i] = scan.nextInt();\n\t\t\ty[i] = scan.nextInt();\n\t\t\th[i] = scan.nextInt();\n\t\t}\n\t\tscan.close();\n\n\t\tArrayList>> mlist = new ArrayList>>();\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tMap> map = new HashMap>();\n\t\t\tfor(int cx = 0; cx <= 100; cx++) {\n\t\t\t\tfor(int cy = 0; cy <= 100; cy++) {\n\t\t\t\t\tint H = h[i] + Math.abs(x[i] - cx) + Math.abs(y[i]- cy);\n\t\t\t\t\tif(H == 0) continue;\n\t\t\t\t\tif(map.containsKey(H)) {\n\t\t\t\t\t\tArrayList list = map.get(H);\n\t\t\t\t\t\tint[]t = {cx, cy};\n\t\t\t\t\t\tlist.add(t);\n\t\t\t\t\t\tmap.put(H, list);\n\t\t\t\t\t}else {\n\t\t\t\t\t\tint[]t = {cx, cy};\n\t\t\t\t\t\tArrayList list = new ArrayList();\n\t\t\t\t\t\tlist.add(t);\n\t\t\t\t\t\tmap.put(H, list);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tmlist.add(map);\n\t\t}\n\t\tSet set = new HashSet();\n\t\tfor(int k : mlist.get(0).keySet()){\n\t\t\tboolean flag = true;\n\t\t\tfor(int i = 1; i < N; i++) {\n\t\t\t\tMap> map = mlist.get(i);\n\t\t\t\tif(!map.containsKey(k)) {\n\t\t\t\t\tflag = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(flag) {\n\t\t\t\tif(k >= 1 && k <= 100) {\n\t\t\t\t\tset.add(k);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tint cnt = 0;\n\t\tint a[] = new int[3];\n\t\tList list = new ArrayList();\n\t\tfor(int i : set) {\n\t\t\tMap> map = mlist.get(0);\n\t\t\tfor(int j = 0; j < map.get(i).size(); j++) {\n\t\t\t\tint[]p = map.get(i).get(j);\n\t\t\t\tint cx = p[0];\n\t\t\t\tint cy = p[1];\n\t\t\t\t//System.out.println(cx + \" \" + cy);\n\t\t\t\tboolean flag1 = true;\n\t\t\t\tfor(int k = 0; k < N; k++) {\n\t\t\t\t\tint t = Math.max(0, i - Math.abs(x[k] - cx) - Math.abs(y[k] - cy));\n\t\t\t\t\tif(t != h[k]) {\n\t\t\t\t\t\tflag1 = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(flag1) {\n\t\t\t\t\tboolean flag0 = true;\n\t\t\t\t\tfor(int k = 1; k < N; k++) {\n\t\t\t\t\t\tMap> mapK = mlist.get(k);\n\t\t\t\t\t\tList listK = mapK.get(i);\n\t\t\t\t\t\tboolean flag = false;\n\t\t\t\t\t\tfor(int l = 0; l < listK.size(); l++){\n\t\t\t\t\t\t\tint[]pK = listK.get(l);\n\t\t\t\t\t\t\tif(cx == pK[0] || cy == pK[1]) {\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(flag) {\n\t\t\t\t\t\t\tflag0 = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(flag0) {\n\t\t\t\t\t\tSystem.out.println(cx + \" \" + cy + \" \" + i);\n\t\t\t\t\t\tSystem.exit(0);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "problem_context": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "sample_input": "4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n"}, "reference_outputs": ["2 2 6\n"], "source_document_id": "p03240", "source_text": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2590, "cpu_time_ms": 549, "memory_kb": 95416}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s289142551", "group_id": "codeNet:p03240", "input_text": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.NoSuchElementException;\n\npublic class Main {\n\tstatic FastScanner sc;\n\tstatic PrintWriter out;\n\tpublic static void main(String[] args){\n\t\tsc = new FastScanner();\n\t\tout = new PrintWriter(System.out);\n\t\t//out.println(solve());\n\t\tsolve();\n\t\tout.flush();\n\t}\n\n\tstatic void solve(){\n\t\tint N = sc.nextInt();\n\t\tint[] xList = new int[N];\n\t\tint[] yList = new int[N];\n\t\tint[] hList = new int[N];\n\t\tfor(int i=0;i 0){\n\t\t\t\t\tout.println(x + \" \" + y + \" \" + H);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n}\n\nclass FastScanner {\n\tprivate final InputStream in = System.in;\n\tprivate final byte[] buffer = new byte[1024];\n\tprivate int ptr = 0;\n\tprivate int buflen = 0;\n\tprivate boolean hasNextByte() {\n\t\tif (ptr < buflen) {\n\t\t\treturn true;\n\t\t}else{\n\t\t\tptr = 0;\n\t\t\ttry {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\tprivate int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}\n\tprivate static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}\n\tpublic boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}\n\tpublic String next() {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint b = readByte();\n\t\twhile(isPrintableChar(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\tpublic long nextLong() {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tlong n = 0;\n\t\tboolean minus = false;\n\t\tint b = readByte();\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\tif (b < '0' || '9' < b) {\n\t\t\tthrow new NumberFormatException();\n\t\t}\n\t\twhile(true){\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t}else if(b == -1 || !isPrintableChar(b)){\n\t\t\t\treturn minus ? -n : n;\n\t\t\t}else{\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\tpublic int nextInt() {\n\t\tlong nl = nextLong();\n\t\tif (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n\t\treturn (int) nl;\n\t}\n\tpublic double nextDouble() { return Double.parseDouble(next());}\n}", "language": "Java", "metadata": {"date": 1538965597, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03240.html", "problem_id": "p03240", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03240/input.txt", "sample_output_relpath": "derived/input_output/data/p03240/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03240/Java/s289142551.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s289142551", "user_id": "u687766076"}, "prompt_components": {"gold_output": "2 2 6\n", "input_to_evaluate": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.NoSuchElementException;\n\npublic class Main {\n\tstatic FastScanner sc;\n\tstatic PrintWriter out;\n\tpublic static void main(String[] args){\n\t\tsc = new FastScanner();\n\t\tout = new PrintWriter(System.out);\n\t\t//out.println(solve());\n\t\tsolve();\n\t\tout.flush();\n\t}\n\n\tstatic void solve(){\n\t\tint N = sc.nextInt();\n\t\tint[] xList = new int[N];\n\t\tint[] yList = new int[N];\n\t\tint[] hList = new int[N];\n\t\tfor(int i=0;i 0){\n\t\t\t\t\tout.println(x + \" \" + y + \" \" + H);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n}\n\nclass FastScanner {\n\tprivate final InputStream in = System.in;\n\tprivate final byte[] buffer = new byte[1024];\n\tprivate int ptr = 0;\n\tprivate int buflen = 0;\n\tprivate boolean hasNextByte() {\n\t\tif (ptr < buflen) {\n\t\t\treturn true;\n\t\t}else{\n\t\t\tptr = 0;\n\t\t\ttry {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\tprivate int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}\n\tprivate static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}\n\tpublic boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}\n\tpublic String next() {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint b = readByte();\n\t\twhile(isPrintableChar(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\tpublic long nextLong() {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tlong n = 0;\n\t\tboolean minus = false;\n\t\tint b = readByte();\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\tif (b < '0' || '9' < b) {\n\t\t\tthrow new NumberFormatException();\n\t\t}\n\t\twhile(true){\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t}else if(b == -1 || !isPrintableChar(b)){\n\t\t\t\treturn minus ? -n : n;\n\t\t\t}else{\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\tpublic int nextInt() {\n\t\tlong nl = nextLong();\n\t\tif (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n\t\treturn (int) nl;\n\t}\n\tpublic double nextDouble() { return Double.parseDouble(next());}\n}", "problem_context": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "sample_input": "4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n"}, "reference_outputs": ["2 2 6\n"], "source_document_id": "p03240", "source_text": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2674, "cpu_time_ms": 73, "memory_kb": 22740}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s723718468", "group_id": "codeNet:p03240", "input_text": "import java.util.Scanner;\n\nclass Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] x = new int[n];\n\t\tint[] y = new int[n];\n\t\tint[] h = new int[n];\n\t\tint xtemp = 0;\n\t\tint ytemp = 0;\n\t\tint htemp = 0;\n\t\tint hmax = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tx[i] = sc.nextInt();\n\t\t\ty[i] = sc.nextInt();\n\t\t\th[i] = sc.nextInt();\n\t\t\tif (h[i] > 1) {\n\t\t\t\txtemp = x[i];\n\t\t\t\tytemp = y[i];\n\t\t\t\thtemp = h[i];\n\t\t\t}\n\t\t}\n\t\tfor (int i = 0; i <= 100; i++) {\n\t\t\tfor (int j = 0; j <= 100; j++) {\n\t\t\t\thmax = htemp + Math.abs(xtemp - i) + Math.abs(ytemp - j);\n\t\t\t\tfor (int k = 0; k < n; k++) {\n\t\t\t\t\tif (hmax - Math.abs(x[k] - i) - Math.abs(y[k] - j) == h[k]) {\n\t\t\t\t\t\tif (k == n - 1) {\n\t\t\t\t\t\t\tSystem.out.println(i + \" \" + j + \" \" + hmax);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n", "language": "Java", "metadata": {"date": 1538896929, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03240.html", "problem_id": "p03240", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03240/input.txt", "sample_output_relpath": "derived/input_output/data/p03240/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03240/Java/s723718468.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s723718468", "user_id": "u930578449"}, "prompt_components": {"gold_output": "2 2 6\n", "input_to_evaluate": "import java.util.Scanner;\n\nclass Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] x = new int[n];\n\t\tint[] y = new int[n];\n\t\tint[] h = new int[n];\n\t\tint xtemp = 0;\n\t\tint ytemp = 0;\n\t\tint htemp = 0;\n\t\tint hmax = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tx[i] = sc.nextInt();\n\t\t\ty[i] = sc.nextInt();\n\t\t\th[i] = sc.nextInt();\n\t\t\tif (h[i] > 1) {\n\t\t\t\txtemp = x[i];\n\t\t\t\tytemp = y[i];\n\t\t\t\thtemp = h[i];\n\t\t\t}\n\t\t}\n\t\tfor (int i = 0; i <= 100; i++) {\n\t\t\tfor (int j = 0; j <= 100; j++) {\n\t\t\t\thmax = htemp + Math.abs(xtemp - i) + Math.abs(ytemp - j);\n\t\t\t\tfor (int k = 0; k < n; k++) {\n\t\t\t\t\tif (hmax - Math.abs(x[k] - i) - Math.abs(y[k] - j) == h[k]) {\n\t\t\t\t\t\tif (k == n - 1) {\n\t\t\t\t\t\t\tSystem.out.println(i + \" \" + j + \" \" + hmax);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "sample_input": "4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n"}, "reference_outputs": ["2 2 6\n"], "source_document_id": "p03240", "source_text": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 118, "memory_kb": 22996}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s278653965", "group_id": "codeNet:p03240", "input_text": "import static java.lang.Math.*;\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.InputMismatchException;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tInputReader in = new InputReader(inputStream);\n\t\tPrintWriter out = new PrintWriter(outputStream);\n\t\tTaskX solver = new TaskX();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n\n\tstatic int INF = 1 << 30;\n\tstatic long LINF = 1L << 55;\n\tstatic int MOD = 1000000007;\n\tstatic int[] mh4 = { 0, -1, 1, 0 };\n\tstatic int[] mw4 = { -1, 0, 0, 1 };\n\tstatic int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };\n\tstatic int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };\n\n\tstatic class TaskX {\n\n\t\tint n;\n\t\tint[] xi, yi, hi;\n\t\tpublic void solve(int testNumber, InputReader in, PrintWriter out) {\n\n\t\t\tn = in.nextInt();\n\t\t\txi = new int[n];\n\t\t\tyi = new int[n];\n\t\t\thi = new int[n];\n\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\txi[i] = in.nextInt();\n\t\t\t\tyi[i] = in.nextInt();\n\t\t\t\thi[i] = in.nextInt();\n\t\t\t}\n\n\t\t\tfor (int cx = 0; cx <= 100; cx++) {\n\t\t\t\tfor (int cy = 0; cy <= 100; cy++) {\n\t\t\t\t\tint h = -1;\n\t\t\t\t\tboolean ok = true;\n\t\t\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\t\t\tint tmp = hi[i] + abs(xi[i] - cx) + abs(yi[i] - cy);\n\t\t\t\t\t\tif (hi[i] > 0) {\n\t\t\t\t\t\t\tif (h == -1) {\n\t\t\t\t\t\t\t\th = hi[i] + tmp;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tif (h != tmp) {\n\t\t\t\t\t\t\t\t\tok = false;\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!ok) continue;\n\n\t\t\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\t\t\tif (hi[i] == 0) {\n\t\t\t\t\t\t\tint dist = abs(xi[i] - cx) + abs(yi[i] - cy);\n\t\t\t\t\t\t\tif (h > dist) {\n\t\t\t\t\t\t\t\tok = false;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (ok) {\n\t\t\t\t\t\tout.printf(\"%d %d %d\\n\", cx, cy, h);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t}\n\n\tstatic class InputReader {\n\t\tBufferedReader in;\n\t\tStringTokenizer tok;\n\n\t\tpublic String nextString() {\n\t\t\twhile (!tok.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\ttok = new StringTokenizer(in.readLine(), \" \");\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn tok.nextToken();\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\treturn Integer.parseInt(nextString());\n\t\t}\n\n\t\tpublic long nextLong() {\n\t\t\treturn Long.parseLong(nextString());\n\t\t}\n\n\t\tpublic double nextDouble() {\n\t\t\treturn Double.parseDouble(nextString());\n\t\t}\n\n\t\tpublic int[] nextIntArray(int n) {\n\t\t\tint[] res = new int[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tres[i] = nextInt();\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic int[] nextIntArrayDec(int n) {\n\t\t\tint[] res = new int[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tres[i] = nextInt() - 1;\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic int[] nextIntArray1Index(int n) {\n\t\t\tint[] res = new int[n + 1];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tres[i + 1] = nextInt();\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic long[] nextLongArray(int n) {\n\t\t\tlong[] res = new long[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tres[i] = nextLong();\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic long[] nextLongArrayDec(int n) {\n\t\t\tlong[] res = new long[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tres[i] = nextLong() - 1;\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic long[] nextLongArray1Index(int n) {\n\t\t\tlong[] res = new long[n + 1];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tres[i + 1] = nextLong();\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic double[] nextDoubleArray(int n) {\n\t\t\tdouble[] res = new double[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tres[i] = nextDouble();\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic InputReader(InputStream inputStream) {\n\t\t\tin = new BufferedReader(new InputStreamReader(inputStream));\n\t\t\ttok = new StringTokenizer(\"\");\n\t\t}\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1538885174, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03240.html", "problem_id": "p03240", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03240/input.txt", "sample_output_relpath": "derived/input_output/data/p03240/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03240/Java/s278653965.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s278653965", "user_id": "u266665184"}, "prompt_components": {"gold_output": "2 2 6\n", "input_to_evaluate": "import static java.lang.Math.*;\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.InputMismatchException;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tInputReader in = new InputReader(inputStream);\n\t\tPrintWriter out = new PrintWriter(outputStream);\n\t\tTaskX solver = new TaskX();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n\n\tstatic int INF = 1 << 30;\n\tstatic long LINF = 1L << 55;\n\tstatic int MOD = 1000000007;\n\tstatic int[] mh4 = { 0, -1, 1, 0 };\n\tstatic int[] mw4 = { -1, 0, 0, 1 };\n\tstatic int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };\n\tstatic int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };\n\n\tstatic class TaskX {\n\n\t\tint n;\n\t\tint[] xi, yi, hi;\n\t\tpublic void solve(int testNumber, InputReader in, PrintWriter out) {\n\n\t\t\tn = in.nextInt();\n\t\t\txi = new int[n];\n\t\t\tyi = new int[n];\n\t\t\thi = new int[n];\n\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\txi[i] = in.nextInt();\n\t\t\t\tyi[i] = in.nextInt();\n\t\t\t\thi[i] = in.nextInt();\n\t\t\t}\n\n\t\t\tfor (int cx = 0; cx <= 100; cx++) {\n\t\t\t\tfor (int cy = 0; cy <= 100; cy++) {\n\t\t\t\t\tint h = -1;\n\t\t\t\t\tboolean ok = true;\n\t\t\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\t\t\tint tmp = hi[i] + abs(xi[i] - cx) + abs(yi[i] - cy);\n\t\t\t\t\t\tif (hi[i] > 0) {\n\t\t\t\t\t\t\tif (h == -1) {\n\t\t\t\t\t\t\t\th = hi[i] + tmp;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tif (h != tmp) {\n\t\t\t\t\t\t\t\t\tok = false;\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!ok) continue;\n\n\t\t\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\t\t\tif (hi[i] == 0) {\n\t\t\t\t\t\t\tint dist = abs(xi[i] - cx) + abs(yi[i] - cy);\n\t\t\t\t\t\t\tif (h > dist) {\n\t\t\t\t\t\t\t\tok = false;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (ok) {\n\t\t\t\t\t\tout.printf(\"%d %d %d\\n\", cx, cy, h);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t}\n\n\tstatic class InputReader {\n\t\tBufferedReader in;\n\t\tStringTokenizer tok;\n\n\t\tpublic String nextString() {\n\t\t\twhile (!tok.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\ttok = new StringTokenizer(in.readLine(), \" \");\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn tok.nextToken();\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\treturn Integer.parseInt(nextString());\n\t\t}\n\n\t\tpublic long nextLong() {\n\t\t\treturn Long.parseLong(nextString());\n\t\t}\n\n\t\tpublic double nextDouble() {\n\t\t\treturn Double.parseDouble(nextString());\n\t\t}\n\n\t\tpublic int[] nextIntArray(int n) {\n\t\t\tint[] res = new int[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tres[i] = nextInt();\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic int[] nextIntArrayDec(int n) {\n\t\t\tint[] res = new int[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tres[i] = nextInt() - 1;\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic int[] nextIntArray1Index(int n) {\n\t\t\tint[] res = new int[n + 1];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tres[i + 1] = nextInt();\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic long[] nextLongArray(int n) {\n\t\t\tlong[] res = new long[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tres[i] = nextLong();\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic long[] nextLongArrayDec(int n) {\n\t\t\tlong[] res = new long[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tres[i] = nextLong() - 1;\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic long[] nextLongArray1Index(int n) {\n\t\t\tlong[] res = new long[n + 1];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tres[i + 1] = nextLong();\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic double[] nextDoubleArray(int n) {\n\t\t\tdouble[] res = new double[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tres[i] = nextDouble();\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic InputReader(InputStream inputStream) {\n\t\t\tin = new BufferedReader(new InputStreamReader(inputStream));\n\t\t\ttok = new StringTokenizer(\"\");\n\t\t}\n\t}\n\n}\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "sample_input": "4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n"}, "reference_outputs": ["2 2 6\n"], "source_document_id": "p03240", "source_text": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3717, "cpu_time_ms": 89, "memory_kb": 23380}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s210130669", "group_id": "codeNet:p03240", "input_text": "package atCoder.contest.D;\n\nimport java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n\n int[] a_x = new int[n];\n int[] a_y = new int[n];\n int[] a_h = new int[n];\n\n int[][] map = new int [101][101];\n\n int temp = 0;\n boolean flag = false;\n\n for(int i = 0;i < n;i++){\n a_x[i] = sc.nextInt();\n a_y[i] = sc.nextInt();\n a_h[i] = sc.nextInt();\n }\n\n boolean k_flag = true;\n\n for(int i = 0;i < n;i++){\n map[a_x[i]][a_y[i]] = a_h[i];\n }\n\n for(int i = 0;i <= 100;i ++){\n for(int j = 0;j <= 100;j ++){\n flag = true;\n for(int k = 0;k < n;k ++){\n if(a_h[k]!=0) {\n if (k_flag) {\n temp = Math.abs(a_x[k] - i) + Math.abs(a_y[k] - j) + a_h[k];\n k_flag = false;\n }\n\n// System.out.println(i + \" \" + j + \" \" + temp);\n\n if (temp != Math.abs(a_x[k] - i) + Math.abs(a_y[k] - j) + a_h[k]) {\n flag = false;\n break;\n }\n }\n }\n\n if(flag){\n System.out.println(i + \" \" + j + \" \" + temp);\n }\n }\n }\n\n }\n}\n", "language": "Java", "metadata": {"date": 1538879523, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03240.html", "problem_id": "p03240", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03240/input.txt", "sample_output_relpath": "derived/input_output/data/p03240/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03240/Java/s210130669.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s210130669", "user_id": "u245879900"}, "prompt_components": {"gold_output": "2 2 6\n", "input_to_evaluate": "package atCoder.contest.D;\n\nimport java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n\n int[] a_x = new int[n];\n int[] a_y = new int[n];\n int[] a_h = new int[n];\n\n int[][] map = new int [101][101];\n\n int temp = 0;\n boolean flag = false;\n\n for(int i = 0;i < n;i++){\n a_x[i] = sc.nextInt();\n a_y[i] = sc.nextInt();\n a_h[i] = sc.nextInt();\n }\n\n boolean k_flag = true;\n\n for(int i = 0;i < n;i++){\n map[a_x[i]][a_y[i]] = a_h[i];\n }\n\n for(int i = 0;i <= 100;i ++){\n for(int j = 0;j <= 100;j ++){\n flag = true;\n for(int k = 0;k < n;k ++){\n if(a_h[k]!=0) {\n if (k_flag) {\n temp = Math.abs(a_x[k] - i) + Math.abs(a_y[k] - j) + a_h[k];\n k_flag = false;\n }\n\n// System.out.println(i + \" \" + j + \" \" + temp);\n\n if (temp != Math.abs(a_x[k] - i) + Math.abs(a_y[k] - j) + a_h[k]) {\n flag = false;\n break;\n }\n }\n }\n\n if(flag){\n System.out.println(i + \" \" + j + \" \" + temp);\n }\n }\n }\n\n }\n}\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "sample_input": "4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n"}, "reference_outputs": ["2 2 6\n"], "source_document_id": "p03240", "source_text": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1504, "cpu_time_ms": 106, "memory_kb": 23764}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s929878269", "group_id": "codeNet:p03240", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\tint jou[][]=new int[n][3];\n\n\t\tfor(int i=0;ijou[i][2] + zettaichi(jou[i][0]-x) + zettaichi(jou[i][1]-y)) {\n\t\t\t\t\tha=false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif(ha)\n\t\t\tSystem.out.print(x + \" \" + y + \" \" + height);\n\n\t}\n\n\n\n\tpublic static int zettaichi(int x) {\n\t\tif(x>=0)\n\t\t\treturn x;\n\t\telse\n\t\t\treturn -x;\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1538876799, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03240.html", "problem_id": "p03240", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03240/input.txt", "sample_output_relpath": "derived/input_output/data/p03240/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03240/Java/s929878269.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s929878269", "user_id": "u264729421"}, "prompt_components": {"gold_output": "2 2 6\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\tint jou[][]=new int[n][3];\n\n\t\tfor(int i=0;ijou[i][2] + zettaichi(jou[i][0]-x) + zettaichi(jou[i][1]-y)) {\n\t\t\t\t\tha=false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif(ha)\n\t\t\tSystem.out.print(x + \" \" + y + \" \" + height);\n\n\t}\n\n\n\n\tpublic static int zettaichi(int x) {\n\t\tif(x>=0)\n\t\t\treturn x;\n\t\telse\n\t\t\treturn -x;\n\t}\n\n}\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "sample_input": "4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n"}, "reference_outputs": ["2 2 6\n"], "source_document_id": "p03240", "source_text": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 149, "memory_kb": 23892}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s735469144", "group_id": "codeNet:p03240", "input_text": "import java.io.*;\nimport java.util.*;\nimport java.math.*;\n// import java.awt.Point;\n \npublic class Main {\n InputStream is;\n PrintWriter out;\n String INPUT = \"\";\n \n // static int mod = 1_000_000_007;\n long inf = Long.MAX_VALUE;\n\n void solve(){ \n int n = ni();\n int[][] res = new int[n][3];\n for(int i = 0; i < n; i++){\n res[i][0] = ni();\n res[i][1] = ni();\n res[i][2] = ni();\n }\n for(int i = 0; i <= 100; i++){\n for(int j= 0; j <= 100; j++){\n int h = -1;\n long upper = inf;\n boolean flag = true;\n for(int k = 0; k < n; k++){\n if(res[k][2]==0){\n upper = Math.min((int)Math.abs(res[k][0]-i) + (int)Math.abs(res[k][1]-j), upper);\n continue;\n }\n int h1 = res[k][2] + (int)Math.abs(res[k][0]-i) + (int)Math.abs(res[k][1]-j);\n if(h==-1){\n h = h1;\n continue;\n }\n if(h!=h1 || h1>upper){\n flag = false;\n break;\n }\n h = h1;\n }\n if(h<1) continue;\n if(flag){\n out.println(i+\" \"+j+\" \"+h);\n return;\n }\n }\n }\n }\n\n void run() throws Exception\n {\n is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());\n out = new PrintWriter(System.out);\n long s = System.currentTimeMillis();\n solve();\n out.flush();\n if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+\"ms\");\n }\n \n public static void main(String[] args) throws Exception { new Main().run(); }\n \n private byte[] inbuf = new byte[1024];\n private int lenbuf = 0, ptrbuf = 0;\n \n private int readByte()\n {\n if(lenbuf == -1)throw new InputMismatchException();\n if(ptrbuf >= lenbuf){\n ptrbuf = 0;\n try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }\n if(lenbuf <= 0)return -1;\n }\n return inbuf[ptrbuf++];\n }\n \n private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }\n private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }\n \n private double nd() { return Double.parseDouble(ns()); }\n private char nc() { return (char)skip(); }\n \n private String ns()\n {\n int b = skip();\n StringBuilder sb = new StringBuilder();\n while(!(isSpaceChar(b) && b != ' ')){\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n \n private char[] ns(int n)\n {\n char[] buf = new char[n];\n int b = skip(), p = 0;\n while(p < n && !(isSpaceChar(b))){\n buf[p++] = (char)b;\n b = readByte();\n }\n return n == p ? buf : Arrays.copyOf(buf, p);\n }\n \n private char[][] nm(int n, int m)\n {\n char[][] map = new char[n][];\n for(int i = 0;i < n;i++)map[i] = ns(m);\n return map;\n }\n \n private int[] na(int n)\n {\n int[] a = new int[n];\n for(int i = 0;i < n;i++)a[i] = ni();\n return a;\n }\n \n private int ni()\n {\n int num = 0, b;\n boolean minus = false;\n while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));\n if(b == '-'){\n minus = true;\n b = readByte();\n }\n \n while(true){\n if(b >= '0' && b <= '9'){\n num = num * 10 + (b - '0');\n }else{\n return minus ? -num : num;\n }\n b = readByte();\n }\n }\n \n private long nl()\n {\n long num = 0;\n int b;\n boolean minus = false;\n while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));\n if(b == '-'){\n minus = true;\n b = readByte();\n }\n \n while(true){\n if(b >= '0' && b <= '9'){\n num = num * 10 + (b - '0');\n }else{\n return minus ? -num : num;\n }\n b = readByte();\n }\n }\n \n private static void tr(Object... o) { System.out.println(Arrays.deepToString(o)); }\n \n}\n", "language": "Java", "metadata": {"date": 1538875079, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03240.html", "problem_id": "p03240", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03240/input.txt", "sample_output_relpath": "derived/input_output/data/p03240/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03240/Java/s735469144.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s735469144", "user_id": "u675503966"}, "prompt_components": {"gold_output": "2 2 6\n", "input_to_evaluate": "import java.io.*;\nimport java.util.*;\nimport java.math.*;\n// import java.awt.Point;\n \npublic class Main {\n InputStream is;\n PrintWriter out;\n String INPUT = \"\";\n \n // static int mod = 1_000_000_007;\n long inf = Long.MAX_VALUE;\n\n void solve(){ \n int n = ni();\n int[][] res = new int[n][3];\n for(int i = 0; i < n; i++){\n res[i][0] = ni();\n res[i][1] = ni();\n res[i][2] = ni();\n }\n for(int i = 0; i <= 100; i++){\n for(int j= 0; j <= 100; j++){\n int h = -1;\n long upper = inf;\n boolean flag = true;\n for(int k = 0; k < n; k++){\n if(res[k][2]==0){\n upper = Math.min((int)Math.abs(res[k][0]-i) + (int)Math.abs(res[k][1]-j), upper);\n continue;\n }\n int h1 = res[k][2] + (int)Math.abs(res[k][0]-i) + (int)Math.abs(res[k][1]-j);\n if(h==-1){\n h = h1;\n continue;\n }\n if(h!=h1 || h1>upper){\n flag = false;\n break;\n }\n h = h1;\n }\n if(h<1) continue;\n if(flag){\n out.println(i+\" \"+j+\" \"+h);\n return;\n }\n }\n }\n }\n\n void run() throws Exception\n {\n is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());\n out = new PrintWriter(System.out);\n long s = System.currentTimeMillis();\n solve();\n out.flush();\n if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+\"ms\");\n }\n \n public static void main(String[] args) throws Exception { new Main().run(); }\n \n private byte[] inbuf = new byte[1024];\n private int lenbuf = 0, ptrbuf = 0;\n \n private int readByte()\n {\n if(lenbuf == -1)throw new InputMismatchException();\n if(ptrbuf >= lenbuf){\n ptrbuf = 0;\n try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }\n if(lenbuf <= 0)return -1;\n }\n return inbuf[ptrbuf++];\n }\n \n private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }\n private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }\n \n private double nd() { return Double.parseDouble(ns()); }\n private char nc() { return (char)skip(); }\n \n private String ns()\n {\n int b = skip();\n StringBuilder sb = new StringBuilder();\n while(!(isSpaceChar(b) && b != ' ')){\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n \n private char[] ns(int n)\n {\n char[] buf = new char[n];\n int b = skip(), p = 0;\n while(p < n && !(isSpaceChar(b))){\n buf[p++] = (char)b;\n b = readByte();\n }\n return n == p ? buf : Arrays.copyOf(buf, p);\n }\n \n private char[][] nm(int n, int m)\n {\n char[][] map = new char[n][];\n for(int i = 0;i < n;i++)map[i] = ns(m);\n return map;\n }\n \n private int[] na(int n)\n {\n int[] a = new int[n];\n for(int i = 0;i < n;i++)a[i] = ni();\n return a;\n }\n \n private int ni()\n {\n int num = 0, b;\n boolean minus = false;\n while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));\n if(b == '-'){\n minus = true;\n b = readByte();\n }\n \n while(true){\n if(b >= '0' && b <= '9'){\n num = num * 10 + (b - '0');\n }else{\n return minus ? -num : num;\n }\n b = readByte();\n }\n }\n \n private long nl()\n {\n long num = 0;\n int b;\n boolean minus = false;\n while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));\n if(b == '-'){\n minus = true;\n b = readByte();\n }\n \n while(true){\n if(b >= '0' && b <= '9'){\n num = num * 10 + (b - '0');\n }else{\n return minus ? -num : num;\n }\n b = readByte();\n }\n }\n \n private static void tr(Object... o) { System.out.println(Arrays.deepToString(o)); }\n \n}\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "sample_input": "4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n"}, "reference_outputs": ["2 2 6\n"], "source_document_id": "p03240", "source_text": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 4511, "cpu_time_ms": 128, "memory_kb": 22996}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s125716154", "group_id": "codeNet:p03240", "input_text": "import java.io.*;\nimport java.util.*;\nimport java.math.*;\n// import java.awt.Point;\n \npublic class Main {\n InputStream is;\n PrintWriter out;\n String INPUT = \"\";\n \n // static int mod = 1_000_000_007;\n long inf = Long.MAX_VALUE;\n\n void solve(){ \n int n = ni();\n int[][] res = new int[n][3];\n for(int i = 0; i < n; i++){\n res[i][0] = ni();\n res[i][1] = ni();\n res[i][2] = ni();\n }\n for(int i = 0; i <= 100; i++){\n for(int j= 0; j <= 100; j++){\n int h = -1;\n int upper = 1000000000;\n boolean flag = true;\n for(int k = 0; k < n; k++){\n if(res[k][2]==0){\n upper = Math.min((int)Math.abs(res[k][0]-i) + (int)Math.abs(res[k][1]-j), upper);\n continue;\n }\n int h1 = res[k][2] + (int)Math.abs(res[k][0]-i) + (int)Math.abs(res[k][1]-j);\n if(h==-1){\n h = h1;\n continue;\n }\n if(h!=h1 || h1>upper){\n flag = false;\n break;\n }\n h = h1;\n }\n if(h<1) continue;\n if(flag){\n out.println(i+\" \"+j+\" \"+h);\n return;\n }\n }\n }\n }\n\n void run() throws Exception\n {\n is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());\n out = new PrintWriter(System.out);\n long s = System.currentTimeMillis();\n solve();\n out.flush();\n if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+\"ms\");\n }\n \n public static void main(String[] args) throws Exception { new Main().run(); }\n \n private byte[] inbuf = new byte[1024];\n private int lenbuf = 0, ptrbuf = 0;\n \n private int readByte()\n {\n if(lenbuf == -1)throw new InputMismatchException();\n if(ptrbuf >= lenbuf){\n ptrbuf = 0;\n try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }\n if(lenbuf <= 0)return -1;\n }\n return inbuf[ptrbuf++];\n }\n \n private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }\n private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }\n \n private double nd() { return Double.parseDouble(ns()); }\n private char nc() { return (char)skip(); }\n \n private String ns()\n {\n int b = skip();\n StringBuilder sb = new StringBuilder();\n while(!(isSpaceChar(b) && b != ' ')){\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n \n private char[] ns(int n)\n {\n char[] buf = new char[n];\n int b = skip(), p = 0;\n while(p < n && !(isSpaceChar(b))){\n buf[p++] = (char)b;\n b = readByte();\n }\n return n == p ? buf : Arrays.copyOf(buf, p);\n }\n \n private char[][] nm(int n, int m)\n {\n char[][] map = new char[n][];\n for(int i = 0;i < n;i++)map[i] = ns(m);\n return map;\n }\n \n private int[] na(int n)\n {\n int[] a = new int[n];\n for(int i = 0;i < n;i++)a[i] = ni();\n return a;\n }\n \n private int ni()\n {\n int num = 0, b;\n boolean minus = false;\n while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));\n if(b == '-'){\n minus = true;\n b = readByte();\n }\n \n while(true){\n if(b >= '0' && b <= '9'){\n num = num * 10 + (b - '0');\n }else{\n return minus ? -num : num;\n }\n b = readByte();\n }\n }\n \n private long nl()\n {\n long num = 0;\n int b;\n boolean minus = false;\n while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));\n if(b == '-'){\n minus = true;\n b = readByte();\n }\n \n while(true){\n if(b >= '0' && b <= '9'){\n num = num * 10 + (b - '0');\n }else{\n return minus ? -num : num;\n }\n b = readByte();\n }\n }\n \n private static void tr(Object... o) { System.out.println(Arrays.deepToString(o)); }\n \n}\n", "language": "Java", "metadata": {"date": 1538874966, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03240.html", "problem_id": "p03240", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03240/input.txt", "sample_output_relpath": "derived/input_output/data/p03240/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03240/Java/s125716154.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s125716154", "user_id": "u675503966"}, "prompt_components": {"gold_output": "2 2 6\n", "input_to_evaluate": "import java.io.*;\nimport java.util.*;\nimport java.math.*;\n// import java.awt.Point;\n \npublic class Main {\n InputStream is;\n PrintWriter out;\n String INPUT = \"\";\n \n // static int mod = 1_000_000_007;\n long inf = Long.MAX_VALUE;\n\n void solve(){ \n int n = ni();\n int[][] res = new int[n][3];\n for(int i = 0; i < n; i++){\n res[i][0] = ni();\n res[i][1] = ni();\n res[i][2] = ni();\n }\n for(int i = 0; i <= 100; i++){\n for(int j= 0; j <= 100; j++){\n int h = -1;\n int upper = 1000000000;\n boolean flag = true;\n for(int k = 0; k < n; k++){\n if(res[k][2]==0){\n upper = Math.min((int)Math.abs(res[k][0]-i) + (int)Math.abs(res[k][1]-j), upper);\n continue;\n }\n int h1 = res[k][2] + (int)Math.abs(res[k][0]-i) + (int)Math.abs(res[k][1]-j);\n if(h==-1){\n h = h1;\n continue;\n }\n if(h!=h1 || h1>upper){\n flag = false;\n break;\n }\n h = h1;\n }\n if(h<1) continue;\n if(flag){\n out.println(i+\" \"+j+\" \"+h);\n return;\n }\n }\n }\n }\n\n void run() throws Exception\n {\n is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());\n out = new PrintWriter(System.out);\n long s = System.currentTimeMillis();\n solve();\n out.flush();\n if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+\"ms\");\n }\n \n public static void main(String[] args) throws Exception { new Main().run(); }\n \n private byte[] inbuf = new byte[1024];\n private int lenbuf = 0, ptrbuf = 0;\n \n private int readByte()\n {\n if(lenbuf == -1)throw new InputMismatchException();\n if(ptrbuf >= lenbuf){\n ptrbuf = 0;\n try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }\n if(lenbuf <= 0)return -1;\n }\n return inbuf[ptrbuf++];\n }\n \n private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }\n private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }\n \n private double nd() { return Double.parseDouble(ns()); }\n private char nc() { return (char)skip(); }\n \n private String ns()\n {\n int b = skip();\n StringBuilder sb = new StringBuilder();\n while(!(isSpaceChar(b) && b != ' ')){\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n \n private char[] ns(int n)\n {\n char[] buf = new char[n];\n int b = skip(), p = 0;\n while(p < n && !(isSpaceChar(b))){\n buf[p++] = (char)b;\n b = readByte();\n }\n return n == p ? buf : Arrays.copyOf(buf, p);\n }\n \n private char[][] nm(int n, int m)\n {\n char[][] map = new char[n][];\n for(int i = 0;i < n;i++)map[i] = ns(m);\n return map;\n }\n \n private int[] na(int n)\n {\n int[] a = new int[n];\n for(int i = 0;i < n;i++)a[i] = ni();\n return a;\n }\n \n private int ni()\n {\n int num = 0, b;\n boolean minus = false;\n while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));\n if(b == '-'){\n minus = true;\n b = readByte();\n }\n \n while(true){\n if(b >= '0' && b <= '9'){\n num = num * 10 + (b - '0');\n }else{\n return minus ? -num : num;\n }\n b = readByte();\n }\n }\n \n private long nl()\n {\n long num = 0;\n int b;\n boolean minus = false;\n while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));\n if(b == '-'){\n minus = true;\n b = readByte();\n }\n \n while(true){\n if(b >= '0' && b <= '9'){\n num = num * 10 + (b - '0');\n }else{\n return minus ? -num : num;\n }\n b = readByte();\n }\n }\n \n private static void tr(Object... o) { System.out.println(Arrays.deepToString(o)); }\n \n}\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "sample_input": "4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n"}, "reference_outputs": ["2 2 6\n"], "source_document_id": "p03240", "source_text": "Score: 300 points\n\nProblem Statement\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0).\n\nAoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:\n\nC_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1.\n\nAdditionally, he obtained N pieces of information. The i-th of them is: \"the altitude of point (x_i, y_i) is h_i.\"\n\nThis was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\nx_i and y_i are integers between 0 and 100 (inclusive).\n\nh_i is an integer between 0 and 10^9 (inclusive).\n\nThe N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.\n\nThe center coordinates and the height of the pyramid can be uniquely identified.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1 h_1\nx_2 y_2 h_2\nx_3 y_3 h_3\n:\nx_N y_N h_N\n\nOutput\n\nPrint values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.\n\nSample Input 1\n\n4\n2 3 5\n2 1 5\n1 2 5\n3 2 5\n\nSample Output 1\n\n2 2 6\n\nIn this case, the center coordinates and the height can be identified as (2, 2) and 6.\n\nSample Input 2\n\n2\n0 0 100\n1 1 98\n\nSample Output 2\n\n0 0 100\n\nIn this case, the center coordinates and the height can be identified as (0, 0) and 100.\n\nNote that C_X and C_Y are known to be integers between 0 and 100.\n\nSample Input 3\n\n3\n99 1 191\n100 1 192\n99 0 192\n\nSample Output 3\n\n100 0 193\n\nIn this case, the center coordinates and the height can be identified as (100, 0) and 193.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 4517, "cpu_time_ms": 88, "memory_kb": 21204}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s400941210", "group_id": "codeNet:p03250", "input_text": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String args[]) {\n\n // 入力\n Scanner sc = new Scanner(System.in);\n int a = Integer.parseInt(sc.next());\n int b = Integer.parseInt(sc.next());\n int c = Integer.parseInt(sc.next());\n\n // 主処理\n int[] abc = new int[] { a, b, c };\n Arrays.sort(abc);\n\n int result = abc[0] + abc[1] + (abc[2] * 10);\n\n // 出力\n System.out.println(result);\n sc.close();\n }\n}", "language": "Java", "metadata": {"date": 1583285348, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03250.html", "problem_id": "p03250", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03250/input.txt", "sample_output_relpath": "derived/input_output/data/p03250/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03250/Java/s400941210.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s400941210", "user_id": "u194225526"}, "prompt_components": {"gold_output": "53\n", "input_to_evaluate": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String args[]) {\n\n // 入力\n Scanner sc = new Scanner(System.in);\n int a = Integer.parseInt(sc.next());\n int b = Integer.parseInt(sc.next());\n int c = Integer.parseInt(sc.next());\n\n // 主処理\n int[] abc = new int[] { a, b, c };\n Arrays.sort(abc);\n\n int result = abc[0] + abc[1] + (abc[2] * 10);\n\n // 出力\n System.out.println(result);\n sc.close();\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou have decided to give an allowance to your child depending on the outcome of the game that he will play now.\n\nThe game is played as follows:\n\nThere are three \"integer panels\", each with a digit between 1 and 9 (inclusive) printed on it, and one \"operator panel\" with a + printed on it.\n\nThe player should construct a formula of the form X + Y, by arranging the four panels from left to right. (The operator panel should not be placed at either end of the formula.)\n\nThen, the amount of the allowance will be equal to the resulting value of the formula.\n\nGiven the values A, B and C printed on the integer panels used in the game, find the maximum possible amount of the allowance.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B, C \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the maximum possible amount of the allowance.\n\nSample Input 1\n\n1 5 2\n\nSample Output 1\n\n53\n\nThe amount of the allowance will be 53 when the panels are arranged as 52+1, and this is the maximum possible amount.\n\nSample Input 2\n\n9 9 9\n\nSample Output 2\n\n108\n\nSample Input 3\n\n6 6 7\n\nSample Output 3\n\n82", "sample_input": "1 5 2\n"}, "reference_outputs": ["53\n"], "source_document_id": "p03250", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou have decided to give an allowance to your child depending on the outcome of the game that he will play now.\n\nThe game is played as follows:\n\nThere are three \"integer panels\", each with a digit between 1 and 9 (inclusive) printed on it, and one \"operator panel\" with a + printed on it.\n\nThe player should construct a formula of the form X + Y, by arranging the four panels from left to right. (The operator panel should not be placed at either end of the formula.)\n\nThen, the amount of the allowance will be equal to the resulting value of the formula.\n\nGiven the values A, B and C printed on the integer panels used in the game, find the maximum possible amount of the allowance.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B, C \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the maximum possible amount of the allowance.\n\nSample Input 1\n\n1 5 2\n\nSample Output 1\n\n53\n\nThe amount of the allowance will be 53 when the panels are arranged as 52+1, and this is the maximum possible amount.\n\nSample Input 2\n\n9 9 9\n\nSample Output 2\n\n108\n\nSample Input 3\n\n6 6 7\n\nSample Output 3\n\n82", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 108, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s335822036", "group_id": "codeNet:p03250", "input_text": "\nimport java.util.*;\n\npublic class Main {\n\n public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n int[] a = new int[3];\n for (int i = 0; i < 3; i++)\n a[i] = sc.nextInt();\n Arrays.sort(a);\n System.out.println(a[2] * 10 + a[1] + a[0]);\n }\n\n}\n", "language": "Java", "metadata": {"date": 1549388776, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03250.html", "problem_id": "p03250", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03250/input.txt", "sample_output_relpath": "derived/input_output/data/p03250/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03250/Java/s335822036.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s335822036", "user_id": "u272319314"}, "prompt_components": {"gold_output": "53\n", "input_to_evaluate": "\nimport java.util.*;\n\npublic class Main {\n\n public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n int[] a = new int[3];\n for (int i = 0; i < 3; i++)\n a[i] = sc.nextInt();\n Arrays.sort(a);\n System.out.println(a[2] * 10 + a[1] + a[0]);\n }\n\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou have decided to give an allowance to your child depending on the outcome of the game that he will play now.\n\nThe game is played as follows:\n\nThere are three \"integer panels\", each with a digit between 1 and 9 (inclusive) printed on it, and one \"operator panel\" with a + printed on it.\n\nThe player should construct a formula of the form X + Y, by arranging the four panels from left to right. (The operator panel should not be placed at either end of the formula.)\n\nThen, the amount of the allowance will be equal to the resulting value of the formula.\n\nGiven the values A, B and C printed on the integer panels used in the game, find the maximum possible amount of the allowance.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B, C \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the maximum possible amount of the allowance.\n\nSample Input 1\n\n1 5 2\n\nSample Output 1\n\n53\n\nThe amount of the allowance will be 53 when the panels are arranged as 52+1, and this is the maximum possible amount.\n\nSample Input 2\n\n9 9 9\n\nSample Output 2\n\n108\n\nSample Input 3\n\n6 6 7\n\nSample Output 3\n\n82", "sample_input": "1 5 2\n"}, "reference_outputs": ["53\n"], "source_document_id": "p03250", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou have decided to give an allowance to your child depending on the outcome of the game that he will play now.\n\nThe game is played as follows:\n\nThere are three \"integer panels\", each with a digit between 1 and 9 (inclusive) printed on it, and one \"operator panel\" with a + printed on it.\n\nThe player should construct a formula of the form X + Y, by arranging the four panels from left to right. (The operator panel should not be placed at either end of the formula.)\n\nThen, the amount of the allowance will be equal to the resulting value of the formula.\n\nGiven the values A, B and C printed on the integer panels used in the game, find the maximum possible amount of the allowance.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B, C \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the maximum possible amount of the allowance.\n\nSample Input 1\n\n1 5 2\n\nSample Output 1\n\n53\n\nThe amount of the allowance will be 53 when the panels are arranged as 52+1, and this is the maximum possible amount.\n\nSample Input 2\n\n9 9 9\n\nSample Output 2\n\n108\n\nSample Input 3\n\n6 6 7\n\nSample Output 3\n\n82", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 318, "cpu_time_ms": 97, "memory_kb": 21588}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s351070186", "group_id": "codeNet:p03250", "input_text": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int[] arr = {sc.nextInt(), sc.nextInt(), sc.nextInt()};\n Arrays.sort(arr);\n System.out.println(arr[0]*10+arr[1]+arr[2]);\n }\n}", "language": "Java", "metadata": {"date": 1548801066, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03250.html", "problem_id": "p03250", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03250/input.txt", "sample_output_relpath": "derived/input_output/data/p03250/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03250/Java/s351070186.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s351070186", "user_id": "u719622470"}, "prompt_components": {"gold_output": "53\n", "input_to_evaluate": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int[] arr = {sc.nextInt(), sc.nextInt(), sc.nextInt()};\n Arrays.sort(arr);\n System.out.println(arr[0]*10+arr[1]+arr[2]);\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou have decided to give an allowance to your child depending on the outcome of the game that he will play now.\n\nThe game is played as follows:\n\nThere are three \"integer panels\", each with a digit between 1 and 9 (inclusive) printed on it, and one \"operator panel\" with a + printed on it.\n\nThe player should construct a formula of the form X + Y, by arranging the four panels from left to right. (The operator panel should not be placed at either end of the formula.)\n\nThen, the amount of the allowance will be equal to the resulting value of the formula.\n\nGiven the values A, B and C printed on the integer panels used in the game, find the maximum possible amount of the allowance.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B, C \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the maximum possible amount of the allowance.\n\nSample Input 1\n\n1 5 2\n\nSample Output 1\n\n53\n\nThe amount of the allowance will be 53 when the panels are arranged as 52+1, and this is the maximum possible amount.\n\nSample Input 2\n\n9 9 9\n\nSample Output 2\n\n108\n\nSample Input 3\n\n6 6 7\n\nSample Output 3\n\n82", "sample_input": "1 5 2\n"}, "reference_outputs": ["53\n"], "source_document_id": "p03250", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou have decided to give an allowance to your child depending on the outcome of the game that he will play now.\n\nThe game is played as follows:\n\nThere are three \"integer panels\", each with a digit between 1 and 9 (inclusive) printed on it, and one \"operator panel\" with a + printed on it.\n\nThe player should construct a formula of the form X + Y, by arranging the four panels from left to right. (The operator panel should not be placed at either end of the formula.)\n\nThen, the amount of the allowance will be equal to the resulting value of the formula.\n\nGiven the values A, B and C printed on the integer panels used in the game, find the maximum possible amount of the allowance.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B, C \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the maximum possible amount of the allowance.\n\nSample Input 1\n\n1 5 2\n\nSample Output 1\n\n53\n\nThe amount of the allowance will be 53 when the panels are arranged as 52+1, and this is the maximum possible amount.\n\nSample Input 2\n\n9 9 9\n\nSample Output 2\n\n108\n\nSample Input 3\n\n6 6 7\n\nSample Output 3\n\n82", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 98, "memory_kb": 21716}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s308798417", "group_id": "codeNet:p03250", "input_text": "import java.io.*;\nimport java.util.*;\n\npublic class Main implements Runnable { //Runnableを実装する\n public static void main(String[] args) {\n new Thread(null, new Main(), \"\", 64 * 1024 * 1024).start(); //16MBスタックを確保して実行\n }\n\n public void run() {\n //ここに処理を書く\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n int b = sc.nextInt();\n int c = sc.nextInt();\n int[]s = {a,b,c};\n Arrays.sort(s);\n System.out.println(s[2]*10+s[1]+s[0]);\n }\n}\n", "language": "Java", "metadata": {"date": 1538186799, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03250.html", "problem_id": "p03250", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03250/input.txt", "sample_output_relpath": "derived/input_output/data/p03250/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03250/Java/s308798417.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s308798417", "user_id": "u986437843"}, "prompt_components": {"gold_output": "53\n", "input_to_evaluate": "import java.io.*;\nimport java.util.*;\n\npublic class Main implements Runnable { //Runnableを実装する\n public static void main(String[] args) {\n new Thread(null, new Main(), \"\", 64 * 1024 * 1024).start(); //16MBスタックを確保して実行\n }\n\n public void run() {\n //ここに処理を書く\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n int b = sc.nextInt();\n int c = sc.nextInt();\n int[]s = {a,b,c};\n Arrays.sort(s);\n System.out.println(s[2]*10+s[1]+s[0]);\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou have decided to give an allowance to your child depending on the outcome of the game that he will play now.\n\nThe game is played as follows:\n\nThere are three \"integer panels\", each with a digit between 1 and 9 (inclusive) printed on it, and one \"operator panel\" with a + printed on it.\n\nThe player should construct a formula of the form X + Y, by arranging the four panels from left to right. (The operator panel should not be placed at either end of the formula.)\n\nThen, the amount of the allowance will be equal to the resulting value of the formula.\n\nGiven the values A, B and C printed on the integer panels used in the game, find the maximum possible amount of the allowance.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B, C \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the maximum possible amount of the allowance.\n\nSample Input 1\n\n1 5 2\n\nSample Output 1\n\n53\n\nThe amount of the allowance will be 53 when the panels are arranged as 52+1, and this is the maximum possible amount.\n\nSample Input 2\n\n9 9 9\n\nSample Output 2\n\n108\n\nSample Input 3\n\n6 6 7\n\nSample Output 3\n\n82", "sample_input": "1 5 2\n"}, "reference_outputs": ["53\n"], "source_document_id": "p03250", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou have decided to give an allowance to your child depending on the outcome of the game that he will play now.\n\nThe game is played as follows:\n\nThere are three \"integer panels\", each with a digit between 1 and 9 (inclusive) printed on it, and one \"operator panel\" with a + printed on it.\n\nThe player should construct a formula of the form X + Y, by arranging the four panels from left to right. (The operator panel should not be placed at either end of the formula.)\n\nThen, the amount of the allowance will be equal to the resulting value of the formula.\n\nGiven the values A, B and C printed on the integer panels used in the game, find the maximum possible amount of the allowance.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B, C \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the maximum possible amount of the allowance.\n\nSample Input 1\n\n1 5 2\n\nSample Output 1\n\n53\n\nThe amount of the allowance will be 53 when the panels are arranged as 52+1, and this is the maximum possible amount.\n\nSample Input 2\n\n9 9 9\n\nSample Output 2\n\n108\n\nSample Input 3\n\n6 6 7\n\nSample Output 3\n\n82", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 94, "memory_kb": 25940}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s596687597", "group_id": "codeNet:p03250", "input_text": "import java.util.Scanner;\nimport java.util.Arrays;\n\nclass Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int num[] = new int[3];\n for (int i = 0; i < 3; ++i) num[i] = sc.nextInt();\n sc.close();\n Arrays.sort(num);\n System.out.print(num[0] + num[1] + num[2] * 10);\n }\n}", "language": "Java", "metadata": {"date": 1538014042, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03250.html", "problem_id": "p03250", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03250/input.txt", "sample_output_relpath": "derived/input_output/data/p03250/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03250/Java/s596687597.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s596687597", "user_id": "u102795616"}, "prompt_components": {"gold_output": "53\n", "input_to_evaluate": "import java.util.Scanner;\nimport java.util.Arrays;\n\nclass Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int num[] = new int[3];\n for (int i = 0; i < 3; ++i) num[i] = sc.nextInt();\n sc.close();\n Arrays.sort(num);\n System.out.print(num[0] + num[1] + num[2] * 10);\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou have decided to give an allowance to your child depending on the outcome of the game that he will play now.\n\nThe game is played as follows:\n\nThere are three \"integer panels\", each with a digit between 1 and 9 (inclusive) printed on it, and one \"operator panel\" with a + printed on it.\n\nThe player should construct a formula of the form X + Y, by arranging the four panels from left to right. (The operator panel should not be placed at either end of the formula.)\n\nThen, the amount of the allowance will be equal to the resulting value of the formula.\n\nGiven the values A, B and C printed on the integer panels used in the game, find the maximum possible amount of the allowance.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B, C \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the maximum possible amount of the allowance.\n\nSample Input 1\n\n1 5 2\n\nSample Output 1\n\n53\n\nThe amount of the allowance will be 53 when the panels are arranged as 52+1, and this is the maximum possible amount.\n\nSample Input 2\n\n9 9 9\n\nSample Output 2\n\n108\n\nSample Input 3\n\n6 6 7\n\nSample Output 3\n\n82", "sample_input": "1 5 2\n"}, "reference_outputs": ["53\n"], "source_document_id": "p03250", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou have decided to give an allowance to your child depending on the outcome of the game that he will play now.\n\nThe game is played as follows:\n\nThere are three \"integer panels\", each with a digit between 1 and 9 (inclusive) printed on it, and one \"operator panel\" with a + printed on it.\n\nThe player should construct a formula of the form X + Y, by arranging the four panels from left to right. (The operator panel should not be placed at either end of the formula.)\n\nThen, the amount of the allowance will be equal to the resulting value of the formula.\n\nGiven the values A, B and C printed on the integer panels used in the game, find the maximum possible amount of the allowance.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B, C \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the maximum possible amount of the allowance.\n\nSample Input 1\n\n1 5 2\n\nSample Output 1\n\n53\n\nThe amount of the allowance will be 53 when the panels are arranged as 52+1, and this is the maximum possible amount.\n\nSample Input 2\n\n9 9 9\n\nSample Output 2\n\n108\n\nSample Input 3\n\n6 6 7\n\nSample Output 3\n\n82", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 356, "cpu_time_ms": 94, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s263535993", "group_id": "codeNet:p03250", "input_text": "import java.util.*;\npublic class Main{\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tScanner sc = new Scanner(System.in);\n\t\tint[] data = new int[3];\n\t\tfor(int i=0; i<3; i++) {\n\t\t\tdata[i]=sc.nextInt();\n\t\t}\n\t\tint max=data[0];\n\t\tfor(int i=0; i<3; i++) {\n\t\t\tif(data[i]>max) {\n\t\t\t\tmax=data[i];\n\t\t\t}\n\t\t}\n\t\tint ans = (max*10)+data[0]+data[1]+data[2]-max;\n\t\tSystem.out.println(ans);\n\t}\n}", "language": "Java", "metadata": {"date": 1537751283, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03250.html", "problem_id": "p03250", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03250/input.txt", "sample_output_relpath": "derived/input_output/data/p03250/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03250/Java/s263535993.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s263535993", "user_id": "u656481579"}, "prompt_components": {"gold_output": "53\n", "input_to_evaluate": "import java.util.*;\npublic class Main{\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tScanner sc = new Scanner(System.in);\n\t\tint[] data = new int[3];\n\t\tfor(int i=0; i<3; i++) {\n\t\t\tdata[i]=sc.nextInt();\n\t\t}\n\t\tint max=data[0];\n\t\tfor(int i=0; i<3; i++) {\n\t\t\tif(data[i]>max) {\n\t\t\t\tmax=data[i];\n\t\t\t}\n\t\t}\n\t\tint ans = (max*10)+data[0]+data[1]+data[2]-max;\n\t\tSystem.out.println(ans);\n\t}\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou have decided to give an allowance to your child depending on the outcome of the game that he will play now.\n\nThe game is played as follows:\n\nThere are three \"integer panels\", each with a digit between 1 and 9 (inclusive) printed on it, and one \"operator panel\" with a + printed on it.\n\nThe player should construct a formula of the form X + Y, by arranging the four panels from left to right. (The operator panel should not be placed at either end of the formula.)\n\nThen, the amount of the allowance will be equal to the resulting value of the formula.\n\nGiven the values A, B and C printed on the integer panels used in the game, find the maximum possible amount of the allowance.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B, C \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the maximum possible amount of the allowance.\n\nSample Input 1\n\n1 5 2\n\nSample Output 1\n\n53\n\nThe amount of the allowance will be 53 when the panels are arranged as 52+1, and this is the maximum possible amount.\n\nSample Input 2\n\n9 9 9\n\nSample Output 2\n\n108\n\nSample Input 3\n\n6 6 7\n\nSample Output 3\n\n82", "sample_input": "1 5 2\n"}, "reference_outputs": ["53\n"], "source_document_id": "p03250", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou have decided to give an allowance to your child depending on the outcome of the game that he will play now.\n\nThe game is played as follows:\n\nThere are three \"integer panels\", each with a digit between 1 and 9 (inclusive) printed on it, and one \"operator panel\" with a + printed on it.\n\nThe player should construct a formula of the form X + Y, by arranging the four panels from left to right. (The operator panel should not be placed at either end of the formula.)\n\nThen, the amount of the allowance will be equal to the resulting value of the formula.\n\nGiven the values A, B and C printed on the integer panels used in the game, find the maximum possible amount of the allowance.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B, C \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the maximum possible amount of the allowance.\n\nSample Input 1\n\n1 5 2\n\nSample Output 1\n\n53\n\nThe amount of the allowance will be 53 when the panels are arranged as 52+1, and this is the maximum possible amount.\n\nSample Input 2\n\n9 9 9\n\nSample Output 2\n\n108\n\nSample Input 3\n\n6 6 7\n\nSample Output 3\n\n82", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 415, "cpu_time_ms": 111, "memory_kb": 21716}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s829248819", "group_id": "codeNet:p03250", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint[] a = new int[3];\n\t\tint max = 0;\n\t\tint sum = 0;\n\t\tfor (int i = 0; i < 3; i++) {\n\t\t\ta[i] = sc.nextInt();\n\t\t\tsum += a[i];\n\t\t\tmax = Math.max(max, a[i]);\n\t\t}\n\t\tint money = sum + max * 9;\n\t\tSystem.out.println(money);\n\t}\n}\n", "language": "Java", "metadata": {"date": 1537751147, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03250.html", "problem_id": "p03250", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03250/input.txt", "sample_output_relpath": "derived/input_output/data/p03250/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03250/Java/s829248819.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s829248819", "user_id": "u752146501"}, "prompt_components": {"gold_output": "53\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint[] a = new int[3];\n\t\tint max = 0;\n\t\tint sum = 0;\n\t\tfor (int i = 0; i < 3; i++) {\n\t\t\ta[i] = sc.nextInt();\n\t\t\tsum += a[i];\n\t\t\tmax = Math.max(max, a[i]);\n\t\t}\n\t\tint money = sum + max * 9;\n\t\tSystem.out.println(money);\n\t}\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou have decided to give an allowance to your child depending on the outcome of the game that he will play now.\n\nThe game is played as follows:\n\nThere are three \"integer panels\", each with a digit between 1 and 9 (inclusive) printed on it, and one \"operator panel\" with a + printed on it.\n\nThe player should construct a formula of the form X + Y, by arranging the four panels from left to right. (The operator panel should not be placed at either end of the formula.)\n\nThen, the amount of the allowance will be equal to the resulting value of the formula.\n\nGiven the values A, B and C printed on the integer panels used in the game, find the maximum possible amount of the allowance.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B, C \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the maximum possible amount of the allowance.\n\nSample Input 1\n\n1 5 2\n\nSample Output 1\n\n53\n\nThe amount of the allowance will be 53 when the panels are arranged as 52+1, and this is the maximum possible amount.\n\nSample Input 2\n\n9 9 9\n\nSample Output 2\n\n108\n\nSample Input 3\n\n6 6 7\n\nSample Output 3\n\n82", "sample_input": "1 5 2\n"}, "reference_outputs": ["53\n"], "source_document_id": "p03250", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou have decided to give an allowance to your child depending on the outcome of the game that he will play now.\n\nThe game is played as follows:\n\nThere are three \"integer panels\", each with a digit between 1 and 9 (inclusive) printed on it, and one \"operator panel\" with a + printed on it.\n\nThe player should construct a formula of the form X + Y, by arranging the four panels from left to right. (The operator panel should not be placed at either end of the formula.)\n\nThen, the amount of the allowance will be equal to the resulting value of the formula.\n\nGiven the values A, B and C printed on the integer panels used in the game, find the maximum possible amount of the allowance.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B, C \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the maximum possible amount of the allowance.\n\nSample Input 1\n\n1 5 2\n\nSample Output 1\n\n53\n\nThe amount of the allowance will be 53 when the panels are arranged as 52+1, and this is the maximum possible amount.\n\nSample Input 2\n\n9 9 9\n\nSample Output 2\n\n108\n\nSample Input 3\n\n6 6 7\n\nSample Output 3\n\n82", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 94, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s686361716", "group_id": "codeNet:p03251", "input_text": "\nimport java.util.*;\n\npublic class Main {\n\n public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int m = sc.nextInt();\n int x = sc.nextInt();\n int y = sc.nextInt();\n int[] xm = new int[n];\n int[] ym = new int[m];\n for (int i = 0; i < n; i++) {\n xm[i] = sc.nextInt();\n }\n for (int i = 0; i < m; i++) {\n ym[i] = sc.nextInt();\n }\n boolean ok = false;\n IN: for (int z = x + 1; z <= y; z++) {\n for (int i = 0; i < n; i++) {\n if (xm[i] >= z)\n continue IN;\n }\n for (int i = 0; i < m; i++) {\n if (ym[i] < z)\n continue IN;\n }\n ok = true;\n }\n\n System.out.println(ok ? \"No War\" : \"War\");\n\n }\n\n}\n", "language": "Java", "metadata": {"date": 1549393303, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03251.html", "problem_id": "p03251", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03251/input.txt", "sample_output_relpath": "derived/input_output/data/p03251/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03251/Java/s686361716.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s686361716", "user_id": "u272319314"}, "prompt_components": {"gold_output": "No War\n", "input_to_evaluate": "\nimport java.util.*;\n\npublic class Main {\n\n public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int m = sc.nextInt();\n int x = sc.nextInt();\n int y = sc.nextInt();\n int[] xm = new int[n];\n int[] ym = new int[m];\n for (int i = 0; i < n; i++) {\n xm[i] = sc.nextInt();\n }\n for (int i = 0; i < m; i++) {\n ym[i] = sc.nextInt();\n }\n boolean ok = false;\n IN: for (int z = x + 1; z <= y; z++) {\n for (int i = 0; i < n; i++) {\n if (xm[i] >= z)\n continue IN;\n }\n for (int i = 0; i < m; i++) {\n if (ym[i] < z)\n continue IN;\n }\n ok = true;\n }\n\n System.out.println(ok ? \"No War\" : \"War\");\n\n }\n\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nOur world is one-dimensional, and ruled by two empires called Empire A and Empire B.\n\nThe capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y.\n\nOne day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes inclined to put the cities at coordinates y_1, y_2, ..., y_M under its control.\n\nIf there exists an integer Z that satisfies all of the following three conditions, they will come to an agreement, but otherwise war will break out.\n\nX < Z \\leq Y\n\nx_1, x_2, ..., x_N < Z\n\ny_1, y_2, ..., y_M \\geq Z\n\nDetermine if war will break out.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 100\n\n-100 \\leq X < Y \\leq 100\n\n-100 \\leq x_i, y_i \\leq 100\n\nx_1, x_2, ..., x_N \\neq X\n\nx_i are all different.\n\ny_1, y_2, ..., y_M \\neq Y\n\ny_i are all different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M X Y\nx_1 x_2 ... x_N\ny_1 y_2 ... y_M\n\nOutput\n\nIf war will break out, print War; otherwise, print No War.\n\nSample Input 1\n\n3 2 10 20\n8 15 13\n16 22\n\nSample Output 1\n\nNo War\n\nThe choice Z = 16 satisfies all of the three conditions as follows, thus they will come to an agreement.\n\nX = 10 < 16 \\leq 20 = Y\n\n8, 15, 13 < 16\n\n16, 22 \\geq 16\n\nSample Input 2\n\n4 2 -48 -1\n-20 -35 -91 -23\n-22 66\n\nSample Output 2\n\nWar\n\nSample Input 3\n\n5 3 6 8\n-10 3 1 5 -100\n100 6 14\n\nSample Output 3\n\nWar", "sample_input": "3 2 10 20\n8 15 13\n16 22\n"}, "reference_outputs": ["No War\n"], "source_document_id": "p03251", "source_text": "Score : 200 points\n\nProblem Statement\n\nOur world is one-dimensional, and ruled by two empires called Empire A and Empire B.\n\nThe capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y.\n\nOne day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes inclined to put the cities at coordinates y_1, y_2, ..., y_M under its control.\n\nIf there exists an integer Z that satisfies all of the following three conditions, they will come to an agreement, but otherwise war will break out.\n\nX < Z \\leq Y\n\nx_1, x_2, ..., x_N < Z\n\ny_1, y_2, ..., y_M \\geq Z\n\nDetermine if war will break out.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 100\n\n-100 \\leq X < Y \\leq 100\n\n-100 \\leq x_i, y_i \\leq 100\n\nx_1, x_2, ..., x_N \\neq X\n\nx_i are all different.\n\ny_1, y_2, ..., y_M \\neq Y\n\ny_i are all different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M X Y\nx_1 x_2 ... x_N\ny_1 y_2 ... y_M\n\nOutput\n\nIf war will break out, print War; otherwise, print No War.\n\nSample Input 1\n\n3 2 10 20\n8 15 13\n16 22\n\nSample Output 1\n\nNo War\n\nThe choice Z = 16 satisfies all of the three conditions as follows, thus they will come to an agreement.\n\nX = 10 < 16 \\leq 20 = Y\n\n8, 15, 13 < 16\n\n16, 22 \\geq 16\n\nSample Input 2\n\n4 2 -48 -1\n-20 -35 -91 -23\n-22 66\n\nSample Output 2\n\nWar\n\nSample Input 3\n\n5 3 6 8\n-10 3 1 5 -100\n100 6 14\n\nSample Output 3\n\nWar", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 890, "cpu_time_ms": 113, "memory_kb": 22612}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s510299570", "group_id": "codeNet:p03251", "input_text": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\t// 整数の標準入力\n\t\tint n = sc.nextInt();\n\t\tint m = sc.nextInt();\n\t\tint x = sc.nextInt();\n\t\tint y = sc.nextInt();\n\t\tint z;\n\t\tInteger nArray[] = new Integer[n];\n\t\tint mArray[] = new int[m];\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tnArray[i] = sc.nextInt();\n\t\t}\n\t\tfor(int j = 0; j < m; j++) {\n\t\t\tmArray[j] = sc.nextInt();\n\t\t}\n\t\tArrays.sort(nArray, Collections.reverseOrder());\n\t\tArrays.sort(mArray);\n\t\tz = mArray[0];\n\t\tif(x < z && z <= y && nArray[0] < z) {\n\t\t\tSystem.out.println(\"No War\");\n\t\t} else {\n\t\t\tSystem.out.println(\"War\");\n\t\t}\n\t\tsc.close();\n\t}\n}\n", "language": "Java", "metadata": {"date": 1544860745, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03251.html", "problem_id": "p03251", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03251/input.txt", "sample_output_relpath": "derived/input_output/data/p03251/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03251/Java/s510299570.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s510299570", "user_id": "u357005212"}, "prompt_components": {"gold_output": "No War\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\t// 整数の標準入力\n\t\tint n = sc.nextInt();\n\t\tint m = sc.nextInt();\n\t\tint x = sc.nextInt();\n\t\tint y = sc.nextInt();\n\t\tint z;\n\t\tInteger nArray[] = new Integer[n];\n\t\tint mArray[] = new int[m];\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tnArray[i] = sc.nextInt();\n\t\t}\n\t\tfor(int j = 0; j < m; j++) {\n\t\t\tmArray[j] = sc.nextInt();\n\t\t}\n\t\tArrays.sort(nArray, Collections.reverseOrder());\n\t\tArrays.sort(mArray);\n\t\tz = mArray[0];\n\t\tif(x < z && z <= y && nArray[0] < z) {\n\t\t\tSystem.out.println(\"No War\");\n\t\t} else {\n\t\t\tSystem.out.println(\"War\");\n\t\t}\n\t\tsc.close();\n\t}\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nOur world is one-dimensional, and ruled by two empires called Empire A and Empire B.\n\nThe capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y.\n\nOne day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes inclined to put the cities at coordinates y_1, y_2, ..., y_M under its control.\n\nIf there exists an integer Z that satisfies all of the following three conditions, they will come to an agreement, but otherwise war will break out.\n\nX < Z \\leq Y\n\nx_1, x_2, ..., x_N < Z\n\ny_1, y_2, ..., y_M \\geq Z\n\nDetermine if war will break out.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 100\n\n-100 \\leq X < Y \\leq 100\n\n-100 \\leq x_i, y_i \\leq 100\n\nx_1, x_2, ..., x_N \\neq X\n\nx_i are all different.\n\ny_1, y_2, ..., y_M \\neq Y\n\ny_i are all different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M X Y\nx_1 x_2 ... x_N\ny_1 y_2 ... y_M\n\nOutput\n\nIf war will break out, print War; otherwise, print No War.\n\nSample Input 1\n\n3 2 10 20\n8 15 13\n16 22\n\nSample Output 1\n\nNo War\n\nThe choice Z = 16 satisfies all of the three conditions as follows, thus they will come to an agreement.\n\nX = 10 < 16 \\leq 20 = Y\n\n8, 15, 13 < 16\n\n16, 22 \\geq 16\n\nSample Input 2\n\n4 2 -48 -1\n-20 -35 -91 -23\n-22 66\n\nSample Output 2\n\nWar\n\nSample Input 3\n\n5 3 6 8\n-10 3 1 5 -100\n100 6 14\n\nSample Output 3\n\nWar", "sample_input": "3 2 10 20\n8 15 13\n16 22\n"}, "reference_outputs": ["No War\n"], "source_document_id": "p03251", "source_text": "Score : 200 points\n\nProblem Statement\n\nOur world is one-dimensional, and ruled by two empires called Empire A and Empire B.\n\nThe capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y.\n\nOne day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes inclined to put the cities at coordinates y_1, y_2, ..., y_M under its control.\n\nIf there exists an integer Z that satisfies all of the following three conditions, they will come to an agreement, but otherwise war will break out.\n\nX < Z \\leq Y\n\nx_1, x_2, ..., x_N < Z\n\ny_1, y_2, ..., y_M \\geq Z\n\nDetermine if war will break out.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 100\n\n-100 \\leq X < Y \\leq 100\n\n-100 \\leq x_i, y_i \\leq 100\n\nx_1, x_2, ..., x_N \\neq X\n\nx_i are all different.\n\ny_1, y_2, ..., y_M \\neq Y\n\ny_i are all different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M X Y\nx_1 x_2 ... x_N\ny_1 y_2 ... y_M\n\nOutput\n\nIf war will break out, print War; otherwise, print No War.\n\nSample Input 1\n\n3 2 10 20\n8 15 13\n16 22\n\nSample Output 1\n\nNo War\n\nThe choice Z = 16 satisfies all of the three conditions as follows, thus they will come to an agreement.\n\nX = 10 < 16 \\leq 20 = Y\n\n8, 15, 13 < 16\n\n16, 22 \\geq 16\n\nSample Input 2\n\n4 2 -48 -1\n-20 -35 -91 -23\n-22 66\n\nSample Output 2\n\nWar\n\nSample Input 3\n\n5 3 6 8\n-10 3 1 5 -100\n100 6 14\n\nSample Output 3\n\nWar", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 117, "memory_kb": 22996}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s350719552", "group_id": "codeNet:p03251", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint N, n, M, m, X, Y;\n\t\tint xmax = -101, ymin = 101;\n\t\tN = scanner.nextInt();\n\t\tM = scanner.nextInt();\n\t\tX = scanner.nextInt();\n\t\tY = scanner.nextInt();\n\n\t\tint x[] = new int[N];\n\t\tint y[] = new int[M];\n\n\t\tfor (n = 1; n <= N; n++) {\n\t\t\tx[n - 1] = scanner.nextInt();\n\t\t\txmax = Math.max(xmax, x[n - 1]);\n\t\t}\n\t\tfor (m = 1; m <= M; m++) {\n\t\t\ty[m - 1] = scanner.nextInt();\n\t\t\tymin = Math.min(ymin, y[m - 1]);\n\t\t}\n\t\t\n\t\tscanner.close();\n\t\t\n\t\tif (xmax <= ymin && X < xmax && ymin <= Y) {\n\t\t\tSystem.out.println(\"No War\");\n\t\t} else {\n\t\t\tSystem.out.println(\"War\");\n\t\t}\n\n\t}\n}", "language": "Java", "metadata": {"date": 1539107158, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03251.html", "problem_id": "p03251", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03251/input.txt", "sample_output_relpath": "derived/input_output/data/p03251/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03251/Java/s350719552.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s350719552", "user_id": "u116830678"}, "prompt_components": {"gold_output": "No War\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint N, n, M, m, X, Y;\n\t\tint xmax = -101, ymin = 101;\n\t\tN = scanner.nextInt();\n\t\tM = scanner.nextInt();\n\t\tX = scanner.nextInt();\n\t\tY = scanner.nextInt();\n\n\t\tint x[] = new int[N];\n\t\tint y[] = new int[M];\n\n\t\tfor (n = 1; n <= N; n++) {\n\t\t\tx[n - 1] = scanner.nextInt();\n\t\t\txmax = Math.max(xmax, x[n - 1]);\n\t\t}\n\t\tfor (m = 1; m <= M; m++) {\n\t\t\ty[m - 1] = scanner.nextInt();\n\t\t\tymin = Math.min(ymin, y[m - 1]);\n\t\t}\n\t\t\n\t\tscanner.close();\n\t\t\n\t\tif (xmax <= ymin && X < xmax && ymin <= Y) {\n\t\t\tSystem.out.println(\"No War\");\n\t\t} else {\n\t\t\tSystem.out.println(\"War\");\n\t\t}\n\n\t}\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nOur world is one-dimensional, and ruled by two empires called Empire A and Empire B.\n\nThe capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y.\n\nOne day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes inclined to put the cities at coordinates y_1, y_2, ..., y_M under its control.\n\nIf there exists an integer Z that satisfies all of the following three conditions, they will come to an agreement, but otherwise war will break out.\n\nX < Z \\leq Y\n\nx_1, x_2, ..., x_N < Z\n\ny_1, y_2, ..., y_M \\geq Z\n\nDetermine if war will break out.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 100\n\n-100 \\leq X < Y \\leq 100\n\n-100 \\leq x_i, y_i \\leq 100\n\nx_1, x_2, ..., x_N \\neq X\n\nx_i are all different.\n\ny_1, y_2, ..., y_M \\neq Y\n\ny_i are all different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M X Y\nx_1 x_2 ... x_N\ny_1 y_2 ... y_M\n\nOutput\n\nIf war will break out, print War; otherwise, print No War.\n\nSample Input 1\n\n3 2 10 20\n8 15 13\n16 22\n\nSample Output 1\n\nNo War\n\nThe choice Z = 16 satisfies all of the three conditions as follows, thus they will come to an agreement.\n\nX = 10 < 16 \\leq 20 = Y\n\n8, 15, 13 < 16\n\n16, 22 \\geq 16\n\nSample Input 2\n\n4 2 -48 -1\n-20 -35 -91 -23\n-22 66\n\nSample Output 2\n\nWar\n\nSample Input 3\n\n5 3 6 8\n-10 3 1 5 -100\n100 6 14\n\nSample Output 3\n\nWar", "sample_input": "3 2 10 20\n8 15 13\n16 22\n"}, "reference_outputs": ["No War\n"], "source_document_id": "p03251", "source_text": "Score : 200 points\n\nProblem Statement\n\nOur world is one-dimensional, and ruled by two empires called Empire A and Empire B.\n\nThe capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y.\n\nOne day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes inclined to put the cities at coordinates y_1, y_2, ..., y_M under its control.\n\nIf there exists an integer Z that satisfies all of the following three conditions, they will come to an agreement, but otherwise war will break out.\n\nX < Z \\leq Y\n\nx_1, x_2, ..., x_N < Z\n\ny_1, y_2, ..., y_M \\geq Z\n\nDetermine if war will break out.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 100\n\n-100 \\leq X < Y \\leq 100\n\n-100 \\leq x_i, y_i \\leq 100\n\nx_1, x_2, ..., x_N \\neq X\n\nx_i are all different.\n\ny_1, y_2, ..., y_M \\neq Y\n\ny_i are all different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M X Y\nx_1 x_2 ... x_N\ny_1 y_2 ... y_M\n\nOutput\n\nIf war will break out, print War; otherwise, print No War.\n\nSample Input 1\n\n3 2 10 20\n8 15 13\n16 22\n\nSample Output 1\n\nNo War\n\nThe choice Z = 16 satisfies all of the three conditions as follows, thus they will come to an agreement.\n\nX = 10 < 16 \\leq 20 = Y\n\n8, 15, 13 < 16\n\n16, 22 \\geq 16\n\nSample Input 2\n\n4 2 -48 -1\n-20 -35 -91 -23\n-22 66\n\nSample Output 2\n\nWar\n\nSample Input 3\n\n5 3 6 8\n-10 3 1 5 -100\n100 6 14\n\nSample Output 3\n\nWar", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 698, "cpu_time_ms": 117, "memory_kb": 23764}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s165659284", "group_id": "codeNet:p03251", "input_text": "import java.util.*;\nimport java.io.*;\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\nimport java.math.MathContext;\n \nclass Main {\n \n public static void main(String[] args) throws IOException {\n \tint n = in.nextInt() + 1;\n \tint m = in.nextInt() + 1;\n \tint[] x = new int[n];\n \tx[0] = in.nextInt();\n \tint[] y = new int[m];\n \ty[0] = in.nextInt();\n \tfor(int i = 1; i < n; i ++)\n \t\tx[i] = in.nextInt();\n \tfor(int i = 1; i < m; i ++)\n \t\ty[i] = in.nextInt();\n \tArrays.sort(x);\n \tArrays.sort(y);\n \tif(y[0] > x[n - 1])\n \t\tsop(\"No War\");\n \telse\n \t\tsop(\"War\");\n }\n \n static class FastReader {\n BufferedReader br;\n StringTokenizer st;\n \n public FastReader() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n \n String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n }\n catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n \n int nextInt() {\n return Integer.parseInt(next());\n }\n \n char nextChar() {\n return in.next().charAt(0);\n }\n \n long nextLong() {\n return Long.parseLong(next());\n }\n \n double nextDouble() {\n return Double.parseDouble(next());\n }\n \n String nextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n }\n catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n }\n \n static FastReader in = new FastReader();\n static OutputStream out = new BufferedOutputStream(System.out);\n \n public static byte[] toByte(Object o) {\n return String.valueOf(o).getBytes();\n }\n \n public static void sop(Object o) {\n System.out.print(o);\n }\n} ", "language": "Java", "metadata": {"date": 1537960194, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03251.html", "problem_id": "p03251", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03251/input.txt", "sample_output_relpath": "derived/input_output/data/p03251/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03251/Java/s165659284.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s165659284", "user_id": "u193004207"}, "prompt_components": {"gold_output": "No War\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\nimport java.math.MathContext;\n \nclass Main {\n \n public static void main(String[] args) throws IOException {\n \tint n = in.nextInt() + 1;\n \tint m = in.nextInt() + 1;\n \tint[] x = new int[n];\n \tx[0] = in.nextInt();\n \tint[] y = new int[m];\n \ty[0] = in.nextInt();\n \tfor(int i = 1; i < n; i ++)\n \t\tx[i] = in.nextInt();\n \tfor(int i = 1; i < m; i ++)\n \t\ty[i] = in.nextInt();\n \tArrays.sort(x);\n \tArrays.sort(y);\n \tif(y[0] > x[n - 1])\n \t\tsop(\"No War\");\n \telse\n \t\tsop(\"War\");\n }\n \n static class FastReader {\n BufferedReader br;\n StringTokenizer st;\n \n public FastReader() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n \n String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n }\n catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n \n int nextInt() {\n return Integer.parseInt(next());\n }\n \n char nextChar() {\n return in.next().charAt(0);\n }\n \n long nextLong() {\n return Long.parseLong(next());\n }\n \n double nextDouble() {\n return Double.parseDouble(next());\n }\n \n String nextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n }\n catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n }\n \n static FastReader in = new FastReader();\n static OutputStream out = new BufferedOutputStream(System.out);\n \n public static byte[] toByte(Object o) {\n return String.valueOf(o).getBytes();\n }\n \n public static void sop(Object o) {\n System.out.print(o);\n }\n} ", "problem_context": "Score : 200 points\n\nProblem Statement\n\nOur world is one-dimensional, and ruled by two empires called Empire A and Empire B.\n\nThe capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y.\n\nOne day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes inclined to put the cities at coordinates y_1, y_2, ..., y_M under its control.\n\nIf there exists an integer Z that satisfies all of the following three conditions, they will come to an agreement, but otherwise war will break out.\n\nX < Z \\leq Y\n\nx_1, x_2, ..., x_N < Z\n\ny_1, y_2, ..., y_M \\geq Z\n\nDetermine if war will break out.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 100\n\n-100 \\leq X < Y \\leq 100\n\n-100 \\leq x_i, y_i \\leq 100\n\nx_1, x_2, ..., x_N \\neq X\n\nx_i are all different.\n\ny_1, y_2, ..., y_M \\neq Y\n\ny_i are all different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M X Y\nx_1 x_2 ... x_N\ny_1 y_2 ... y_M\n\nOutput\n\nIf war will break out, print War; otherwise, print No War.\n\nSample Input 1\n\n3 2 10 20\n8 15 13\n16 22\n\nSample Output 1\n\nNo War\n\nThe choice Z = 16 satisfies all of the three conditions as follows, thus they will come to an agreement.\n\nX = 10 < 16 \\leq 20 = Y\n\n8, 15, 13 < 16\n\n16, 22 \\geq 16\n\nSample Input 2\n\n4 2 -48 -1\n-20 -35 -91 -23\n-22 66\n\nSample Output 2\n\nWar\n\nSample Input 3\n\n5 3 6 8\n-10 3 1 5 -100\n100 6 14\n\nSample Output 3\n\nWar", "sample_input": "3 2 10 20\n8 15 13\n16 22\n"}, "reference_outputs": ["No War\n"], "source_document_id": "p03251", "source_text": "Score : 200 points\n\nProblem Statement\n\nOur world is one-dimensional, and ruled by two empires called Empire A and Empire B.\n\nThe capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y.\n\nOne day, Empire A becomes inclined to put the cities at coordinates x_1, x_2, ..., x_N under its control, and Empire B becomes inclined to put the cities at coordinates y_1, y_2, ..., y_M under its control.\n\nIf there exists an integer Z that satisfies all of the following three conditions, they will come to an agreement, but otherwise war will break out.\n\nX < Z \\leq Y\n\nx_1, x_2, ..., x_N < Z\n\ny_1, y_2, ..., y_M \\geq Z\n\nDetermine if war will break out.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 100\n\n-100 \\leq X < Y \\leq 100\n\n-100 \\leq x_i, y_i \\leq 100\n\nx_1, x_2, ..., x_N \\neq X\n\nx_i are all different.\n\ny_1, y_2, ..., y_M \\neq Y\n\ny_i are all different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M X Y\nx_1 x_2 ... x_N\ny_1 y_2 ... y_M\n\nOutput\n\nIf war will break out, print War; otherwise, print No War.\n\nSample Input 1\n\n3 2 10 20\n8 15 13\n16 22\n\nSample Output 1\n\nNo War\n\nThe choice Z = 16 satisfies all of the three conditions as follows, thus they will come to an agreement.\n\nX = 10 < 16 \\leq 20 = Y\n\n8, 15, 13 < 16\n\n16, 22 \\geq 16\n\nSample Input 2\n\n4 2 -48 -1\n-20 -35 -91 -23\n-22 66\n\nSample Output 2\n\nWar\n\nSample Input 3\n\n5 3 6 8\n-10 3 1 5 -100\n100 6 14\n\nSample Output 3\n\nWar", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2064, "cpu_time_ms": 79, "memory_kb": 24660}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s549953391", "group_id": "codeNet:p03260", "input_text": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int A = sc.nextInt();\n int B = sc.nextInt();\n\n System.out.println(solve(A, B) ? \"Yes\" : \"No\");\n\n sc.close();\n }\n\n static boolean solve(int A, int B) {\n return A * B % 2 != 0;\n }\n}", "language": "Java", "metadata": {"date": 1592891631, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p03260.html", "problem_id": "p03260", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03260/input.txt", "sample_output_relpath": "derived/input_output/data/p03260/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03260/Java/s549953391.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s549953391", "user_id": "u157091785"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int A = sc.nextInt();\n int B = sc.nextInt();\n\n System.out.println(solve(A, B) ? \"Yes\" : \"No\");\n\n sc.close();\n }\n\n static boolean solve(int A, int B) {\n return A * B % 2 != 0;\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given integers A and B, each between 1 and 3 (inclusive).\n\nDetermine if there is an integer C between 1 and 3 (inclusive) such that A \\times B \\times C is an odd number.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nIf there is an integer C between 1 and 3 that satisfies the condition, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 1\n\nSample Output 1\n\nYes\n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an odd number.\n\nSample Input 2\n\n1 2\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n2 2\n\nSample Output 3\n\nNo", "sample_input": "3 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03260", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given integers A and B, each between 1 and 3 (inclusive).\n\nDetermine if there is an integer C between 1 and 3 (inclusive) such that A \\times B \\times C is an odd number.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nIf there is an integer C between 1 and 3 that satisfies the condition, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 1\n\nSample Output 1\n\nYes\n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an odd number.\n\nSample Input 2\n\n1 2\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n2 2\n\nSample Output 3\n\nNo", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 119, "memory_kb": 35628}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s005202358", "group_id": "codeNet:p03260", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc= new Scanner(System.in);\n\t\tint A =sc.nextInt(),B=sc.nextInt();\n\n\t\tSystem.out.println(A*B%2!=0?\"Yes\":\"No\");\n\t}\n}", "language": "Java", "metadata": {"date": 1590298902, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03260.html", "problem_id": "p03260", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03260/input.txt", "sample_output_relpath": "derived/input_output/data/p03260/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03260/Java/s005202358.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s005202358", "user_id": "u029404735"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc= new Scanner(System.in);\n\t\tint A =sc.nextInt(),B=sc.nextInt();\n\n\t\tSystem.out.println(A*B%2!=0?\"Yes\":\"No\");\n\t}\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given integers A and B, each between 1 and 3 (inclusive).\n\nDetermine if there is an integer C between 1 and 3 (inclusive) such that A \\times B \\times C is an odd number.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nIf there is an integer C between 1 and 3 that satisfies the condition, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 1\n\nSample Output 1\n\nYes\n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an odd number.\n\nSample Input 2\n\n1 2\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n2 2\n\nSample Output 3\n\nNo", "sample_input": "3 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03260", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given integers A and B, each between 1 and 3 (inclusive).\n\nDetermine if there is an integer C between 1 and 3 (inclusive) such that A \\times B \\times C is an odd number.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nIf there is an integer C between 1 and 3 that satisfies the condition, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 1\n\nSample Output 1\n\nYes\n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an odd number.\n\nSample Input 2\n\n1 2\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n2 2\n\nSample Output 3\n\nNo", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 93, "memory_kb": 20560}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s946200282", "group_id": "codeNet:p03260", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint A = Integer.parseInt(sc.next());\n\t\tint B = Integer.parseInt(sc.next());\n\t\tsc.close();\n\n\t\tif((A * B) % 2 == 0) {\n\t\t\tSystem.out.println(\"No\");\n\t\t}else {\n\t\t\tSystem.out.println(\"Yes\");\n\t\t}\n\t}\n}", "language": "Java", "metadata": {"date": 1589100000, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03260.html", "problem_id": "p03260", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03260/input.txt", "sample_output_relpath": "derived/input_output/data/p03260/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03260/Java/s946200282.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s946200282", "user_id": "u556125658"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint A = Integer.parseInt(sc.next());\n\t\tint B = Integer.parseInt(sc.next());\n\t\tsc.close();\n\n\t\tif((A * B) % 2 == 0) {\n\t\t\tSystem.out.println(\"No\");\n\t\t}else {\n\t\t\tSystem.out.println(\"Yes\");\n\t\t}\n\t}\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given integers A and B, each between 1 and 3 (inclusive).\n\nDetermine if there is an integer C between 1 and 3 (inclusive) such that A \\times B \\times C is an odd number.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nIf there is an integer C between 1 and 3 that satisfies the condition, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 1\n\nSample Output 1\n\nYes\n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an odd number.\n\nSample Input 2\n\n1 2\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n2 2\n\nSample Output 3\n\nNo", "sample_input": "3 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03260", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given integers A and B, each between 1 and 3 (inclusive).\n\nDetermine if there is an integer C between 1 and 3 (inclusive) such that A \\times B \\times C is an odd number.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nIf there is an integer C between 1 and 3 that satisfies the condition, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 1\n\nSample Output 1\n\nYes\n\nLet C = 3. Then, A \\times B \\times C = 3 \\times 1 \\times 3 = 9, which is an odd number.\n\nSample Input 2\n\n1 2\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n2 2\n\nSample Output 3\n\nNo", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 91, "memory_kb": 21972}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s711531726", "group_id": "codeNet:p03260", "input_text": "import java.util.*;\nimport java.io.*;\n\nclass Main {\n\n\tvoid solve() {\n\n\t\tint a = inint(), b = inint();\n\t\tString ans = \"No\";\n\t\tif (a*b*1%2 == 1) ans = \"Yes\";\n\t\tif (a*b*2%2 == 1) ans = \"Yes\";\n\t\tif (a*b*3%2 == 1) ans = \"Yes\";\n\t\tout.println(ans);\n\t\t\n\t}\n\t\n\tpublic static Scanner in = new Scanner(System.in);\n\tpublic static PrintWriter out = new PrintWriter(System.out);\n\t\n\tpublic static void main(String[] args) {\n\t\tnew Main().solve();\n\t\tout.flush();\n\t}\n\t\n\tpublic int inint() {\n\t\treturn in.nextInt();\n\t}\n\t\n\tpublic String instr() {\n\t\treturn in.next();\n\t}\n\n\tpublic int[] inintar(int num) {\n\t\tint[] a = new int[num];\n\t\tfor (int i=0; i Integer.MAX_VALUE) {\n throw new NumberFormatException();\n }\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n}\n", "language": "Java", "metadata": {"date": 1590859232, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03261.html", "problem_id": "p03261", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03261/input.txt", "sample_output_relpath": "derived/input_output/data/p03261/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03261/Java/s885015948.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s885015948", "user_id": "u871244227"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "\nimport java.text.DecimalFormat;\nimport java.util.stream.LongStream;\nimport java.util.stream.IntStream;\nimport java.io.*;\nimport java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n FastScanner sc = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n\n AtCoder problem = new AtCoder(sc);\n problem.solve(out);\n\n out.flush();\n }\n\n}\n\nclass AtCoder {\n\n final int N;\n String[] ss;\n\n AtCoder(FastScanner sc) {\n N = sc.nextInt();\n ss = new String[N];\n for (int i = 0; i < N; i++) {\n ss[i] = sc.next();\n }\n }\n\n void solve(PrintWriter out) {\n for (int i = 0; i < N - 1; i++) {\n int j = ss[i].length() - 1;\n if (ss[i].charAt(j) != ss[i + 1].charAt(0)) {\n out.println(\"No\");\n return;\n }\n }\n Arrays.sort(ss);\n for (int i = 0; i < N - 1; i++) {\n if (ss[i].equals(ss[i + 1])) {\n out.println(\"No\");\n return;\n }\n }\n out.println(\"Yes\");\n }\n\n}\n\n// https://qiita.com/p_shiki37/items/a0f6aac33bf60f5f65e4\nclass FastScanner {\n\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte()) {\n return buffer[ptr++];\n } else {\n return -1;\n }\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr])) {\n ptr++;\n }\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {\n throw new NumberFormatException();\n }\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi is practicing shiritori alone again today.\n\nShiritori is a game as follows:\n\nIn the first turn, a player announces any one word.\n\nIn the subsequent turns, a player announces a word that satisfies the following conditions:\n\nThat word is not announced before.\n\nThe first character of that word is the same as the last character of the last word announced.\n\nIn this game, he is practicing to announce as many words as possible in ten seconds.\n\nYou are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.\n\nConstraints\n\nN is an integer satisfying 2 \\leq N \\leq 100.\n\nW_i is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nW_1\nW_2\n:\nW_N\n\nOutput\n\nIf every word announced by Takahashi satisfied the conditions, print Yes; otherwise, print No.\n\nSample Input 1\n\n4\nhoge\nenglish\nhoge\nenigma\n\nSample Output 1\n\nNo\n\nAs hoge is announced multiple times, the rules of shiritori was not observed.\n\nSample Input 2\n\n9\nbasic\nc\ncpp\nphp\npython\nnadesico\nocaml\nlua\nassembly\n\nSample Output 2\n\nYes\n\nSample Input 3\n\n8\na\naa\naaa\naaaa\naaaaa\naaaaaa\naaa\naaaaaaa\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3\nabc\narc\nagc\n\nSample Output 4\n\nNo", "sample_input": "4\nhoge\nenglish\nhoge\nenigma\n"}, "reference_outputs": ["No\n"], "source_document_id": "p03261", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi is practicing shiritori alone again today.\n\nShiritori is a game as follows:\n\nIn the first turn, a player announces any one word.\n\nIn the subsequent turns, a player announces a word that satisfies the following conditions:\n\nThat word is not announced before.\n\nThe first character of that word is the same as the last character of the last word announced.\n\nIn this game, he is practicing to announce as many words as possible in ten seconds.\n\nYou are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.\n\nConstraints\n\nN is an integer satisfying 2 \\leq N \\leq 100.\n\nW_i is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nW_1\nW_2\n:\nW_N\n\nOutput\n\nIf every word announced by Takahashi satisfied the conditions, print Yes; otherwise, print No.\n\nSample Input 1\n\n4\nhoge\nenglish\nhoge\nenigma\n\nSample Output 1\n\nNo\n\nAs hoge is announced multiple times, the rules of shiritori was not observed.\n\nSample Input 2\n\n9\nbasic\nc\ncpp\nphp\npython\nnadesico\nocaml\nlua\nassembly\n\nSample Output 2\n\nYes\n\nSample Input 3\n\n8\na\naa\naaa\naaaa\naaaaa\naaaaaa\naaa\naaaaaaa\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3\nabc\narc\nagc\n\nSample Output 4\n\nNo", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3490, "cpu_time_ms": 83, "memory_kb": 21328}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s558241217", "group_id": "codeNet:p03261", "input_text": "import java.util.*;\n \npublic class Main {\n\t\n public static void main(String[] args) {\n \tScanner sc = new Scanner(System.in);\n \tint N = sc.nextInt();\n \tchar save = 0;\n \tString ans = \"Yes\";\n \tSet old = new HashSet<>();\n \tfor (int i = 0; i < N; i++) {\n \t\tString s = sc.next();\n \t\tif (i != 0 && (s.charAt(0) != save || old.contains(s))) {\n \t\t\tans = \"No\";\n \t\t\tbreak;\n \t\t}\n \t\tsave = s.charAt(s.length()-1);\n \t\told.add(s);\n \t}\n \tSystem.out.println(ans);\n }\n}", "language": "Java", "metadata": {"date": 1589693385, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03261.html", "problem_id": "p03261", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03261/input.txt", "sample_output_relpath": "derived/input_output/data/p03261/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03261/Java/s558241217.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s558241217", "user_id": "u866594486"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "import java.util.*;\n \npublic class Main {\n\t\n public static void main(String[] args) {\n \tScanner sc = new Scanner(System.in);\n \tint N = sc.nextInt();\n \tchar save = 0;\n \tString ans = \"Yes\";\n \tSet old = new HashSet<>();\n \tfor (int i = 0; i < N; i++) {\n \t\tString s = sc.next();\n \t\tif (i != 0 && (s.charAt(0) != save || old.contains(s))) {\n \t\t\tans = \"No\";\n \t\t\tbreak;\n \t\t}\n \t\tsave = s.charAt(s.length()-1);\n \t\told.add(s);\n \t}\n \tSystem.out.println(ans);\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi is practicing shiritori alone again today.\n\nShiritori is a game as follows:\n\nIn the first turn, a player announces any one word.\n\nIn the subsequent turns, a player announces a word that satisfies the following conditions:\n\nThat word is not announced before.\n\nThe first character of that word is the same as the last character of the last word announced.\n\nIn this game, he is practicing to announce as many words as possible in ten seconds.\n\nYou are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.\n\nConstraints\n\nN is an integer satisfying 2 \\leq N \\leq 100.\n\nW_i is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nW_1\nW_2\n:\nW_N\n\nOutput\n\nIf every word announced by Takahashi satisfied the conditions, print Yes; otherwise, print No.\n\nSample Input 1\n\n4\nhoge\nenglish\nhoge\nenigma\n\nSample Output 1\n\nNo\n\nAs hoge is announced multiple times, the rules of shiritori was not observed.\n\nSample Input 2\n\n9\nbasic\nc\ncpp\nphp\npython\nnadesico\nocaml\nlua\nassembly\n\nSample Output 2\n\nYes\n\nSample Input 3\n\n8\na\naa\naaa\naaaa\naaaaa\naaaaaa\naaa\naaaaaaa\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3\nabc\narc\nagc\n\nSample Output 4\n\nNo", "sample_input": "4\nhoge\nenglish\nhoge\nenigma\n"}, "reference_outputs": ["No\n"], "source_document_id": "p03261", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi is practicing shiritori alone again today.\n\nShiritori is a game as follows:\n\nIn the first turn, a player announces any one word.\n\nIn the subsequent turns, a player announces a word that satisfies the following conditions:\n\nThat word is not announced before.\n\nThe first character of that word is the same as the last character of the last word announced.\n\nIn this game, he is practicing to announce as many words as possible in ten seconds.\n\nYou are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.\n\nConstraints\n\nN is an integer satisfying 2 \\leq N \\leq 100.\n\nW_i is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nW_1\nW_2\n:\nW_N\n\nOutput\n\nIf every word announced by Takahashi satisfied the conditions, print Yes; otherwise, print No.\n\nSample Input 1\n\n4\nhoge\nenglish\nhoge\nenigma\n\nSample Output 1\n\nNo\n\nAs hoge is announced multiple times, the rules of shiritori was not observed.\n\nSample Input 2\n\n9\nbasic\nc\ncpp\nphp\npython\nnadesico\nocaml\nlua\nassembly\n\nSample Output 2\n\nYes\n\nSample Input 3\n\n8\na\naa\naaa\naaaa\naaaaa\naaaaaa\naaa\naaaaaaa\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3\nabc\narc\nagc\n\nSample Output 4\n\nNo", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 107, "memory_kb": 21716}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s964678437", "group_id": "codeNet:p03261", "input_text": "import java.util.HashSet;\nimport java.util.Scanner;\nimport java.util.Set;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n\n long N = scanner.nextLong(); scanner.nextLine();\n\n Set strs = new HashSet<>();\n\n String first = scanner.nextLine();\n strs.add(first);\n\n char tail = first.charAt(first.length() - 1);\n\n String ans = \"Yes\";\n for(int i = 1; i < N; i++) {\n String str = scanner.nextLine();\n char h = str.charAt(0);\n char t = str.charAt(str.length() - 1);\n\n if(tail != h || strs.contains(str)) {\n ans = \"No\";\n scanner.nextLine();\n scanner.close();\n break;\n }\n tail = t;\n strs.add(str);\n }\n\n System.out.println(ans);\n }\n}\n", "language": "Java", "metadata": {"date": 1578574494, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03261.html", "problem_id": "p03261", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03261/input.txt", "sample_output_relpath": "derived/input_output/data/p03261/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03261/Java/s964678437.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s964678437", "user_id": "u407630908"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "import java.util.HashSet;\nimport java.util.Scanner;\nimport java.util.Set;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n\n long N = scanner.nextLong(); scanner.nextLine();\n\n Set strs = new HashSet<>();\n\n String first = scanner.nextLine();\n strs.add(first);\n\n char tail = first.charAt(first.length() - 1);\n\n String ans = \"Yes\";\n for(int i = 1; i < N; i++) {\n String str = scanner.nextLine();\n char h = str.charAt(0);\n char t = str.charAt(str.length() - 1);\n\n if(tail != h || strs.contains(str)) {\n ans = \"No\";\n scanner.nextLine();\n scanner.close();\n break;\n }\n tail = t;\n strs.add(str);\n }\n\n System.out.println(ans);\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi is practicing shiritori alone again today.\n\nShiritori is a game as follows:\n\nIn the first turn, a player announces any one word.\n\nIn the subsequent turns, a player announces a word that satisfies the following conditions:\n\nThat word is not announced before.\n\nThe first character of that word is the same as the last character of the last word announced.\n\nIn this game, he is practicing to announce as many words as possible in ten seconds.\n\nYou are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.\n\nConstraints\n\nN is an integer satisfying 2 \\leq N \\leq 100.\n\nW_i is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nW_1\nW_2\n:\nW_N\n\nOutput\n\nIf every word announced by Takahashi satisfied the conditions, print Yes; otherwise, print No.\n\nSample Input 1\n\n4\nhoge\nenglish\nhoge\nenigma\n\nSample Output 1\n\nNo\n\nAs hoge is announced multiple times, the rules of shiritori was not observed.\n\nSample Input 2\n\n9\nbasic\nc\ncpp\nphp\npython\nnadesico\nocaml\nlua\nassembly\n\nSample Output 2\n\nYes\n\nSample Input 3\n\n8\na\naa\naaa\naaaa\naaaaa\naaaaaa\naaa\naaaaaaa\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3\nabc\narc\nagc\n\nSample Output 4\n\nNo", "sample_input": "4\nhoge\nenglish\nhoge\nenigma\n"}, "reference_outputs": ["No\n"], "source_document_id": "p03261", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi is practicing shiritori alone again today.\n\nShiritori is a game as follows:\n\nIn the first turn, a player announces any one word.\n\nIn the subsequent turns, a player announces a word that satisfies the following conditions:\n\nThat word is not announced before.\n\nThe first character of that word is the same as the last character of the last word announced.\n\nIn this game, he is practicing to announce as many words as possible in ten seconds.\n\nYou are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.\n\nConstraints\n\nN is an integer satisfying 2 \\leq N \\leq 100.\n\nW_i is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nW_1\nW_2\n:\nW_N\n\nOutput\n\nIf every word announced by Takahashi satisfied the conditions, print Yes; otherwise, print No.\n\nSample Input 1\n\n4\nhoge\nenglish\nhoge\nenigma\n\nSample Output 1\n\nNo\n\nAs hoge is announced multiple times, the rules of shiritori was not observed.\n\nSample Input 2\n\n9\nbasic\nc\ncpp\nphp\npython\nnadesico\nocaml\nlua\nassembly\n\nSample Output 2\n\nYes\n\nSample Input 3\n\n8\na\naa\naaa\naaaa\naaaaa\naaaaaa\naaa\naaaaaaa\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3\nabc\narc\nagc\n\nSample Output 4\n\nNo", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 901, "cpu_time_ms": 107, "memory_kb": 23252}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s989139527", "group_id": "codeNet:p03261", "input_text": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int N = scanner.nextInt();\n HashSet words = new HashSet<>();\n String lastWord = scanner.next();\n words.add(lastWord);\n for (int i = 1; i < N; ++i) {\n String word = scanner.next();\n if (word.charAt(0) != lastWord.charAt(lastWord.length() - 1)) {\n System.out.println(\"No\");\n return;\n }\n if (words.contains(word)) {\n System.out.println(\"No\");\n return;\n }\n lastWord = word;\n words.add(word);\n }\n System.out.println(\"Yes\");\n return;\n }\n}", "language": "Java", "metadata": {"date": 1538787793, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03261.html", "problem_id": "p03261", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03261/input.txt", "sample_output_relpath": "derived/input_output/data/p03261/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03261/Java/s989139527.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s989139527", "user_id": "u870585895"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int N = scanner.nextInt();\n HashSet words = new HashSet<>();\n String lastWord = scanner.next();\n words.add(lastWord);\n for (int i = 1; i < N; ++i) {\n String word = scanner.next();\n if (word.charAt(0) != lastWord.charAt(lastWord.length() - 1)) {\n System.out.println(\"No\");\n return;\n }\n if (words.contains(word)) {\n System.out.println(\"No\");\n return;\n }\n lastWord = word;\n words.add(word);\n }\n System.out.println(\"Yes\");\n return;\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi is practicing shiritori alone again today.\n\nShiritori is a game as follows:\n\nIn the first turn, a player announces any one word.\n\nIn the subsequent turns, a player announces a word that satisfies the following conditions:\n\nThat word is not announced before.\n\nThe first character of that word is the same as the last character of the last word announced.\n\nIn this game, he is practicing to announce as many words as possible in ten seconds.\n\nYou are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.\n\nConstraints\n\nN is an integer satisfying 2 \\leq N \\leq 100.\n\nW_i is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nW_1\nW_2\n:\nW_N\n\nOutput\n\nIf every word announced by Takahashi satisfied the conditions, print Yes; otherwise, print No.\n\nSample Input 1\n\n4\nhoge\nenglish\nhoge\nenigma\n\nSample Output 1\n\nNo\n\nAs hoge is announced multiple times, the rules of shiritori was not observed.\n\nSample Input 2\n\n9\nbasic\nc\ncpp\nphp\npython\nnadesico\nocaml\nlua\nassembly\n\nSample Output 2\n\nYes\n\nSample Input 3\n\n8\na\naa\naaa\naaaa\naaaaa\naaaaaa\naaa\naaaaaaa\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3\nabc\narc\nagc\n\nSample Output 4\n\nNo", "sample_input": "4\nhoge\nenglish\nhoge\nenigma\n"}, "reference_outputs": ["No\n"], "source_document_id": "p03261", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi is practicing shiritori alone again today.\n\nShiritori is a game as follows:\n\nIn the first turn, a player announces any one word.\n\nIn the subsequent turns, a player announces a word that satisfies the following conditions:\n\nThat word is not announced before.\n\nThe first character of that word is the same as the last character of the last word announced.\n\nIn this game, he is practicing to announce as many words as possible in ten seconds.\n\nYou are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.\n\nConstraints\n\nN is an integer satisfying 2 \\leq N \\leq 100.\n\nW_i is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nW_1\nW_2\n:\nW_N\n\nOutput\n\nIf every word announced by Takahashi satisfied the conditions, print Yes; otherwise, print No.\n\nSample Input 1\n\n4\nhoge\nenglish\nhoge\nenigma\n\nSample Output 1\n\nNo\n\nAs hoge is announced multiple times, the rules of shiritori was not observed.\n\nSample Input 2\n\n9\nbasic\nc\ncpp\nphp\npython\nnadesico\nocaml\nlua\nassembly\n\nSample Output 2\n\nYes\n\nSample Input 3\n\n8\na\naa\naaa\naaaa\naaaaa\naaaaaa\naaa\naaaaaaa\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3\nabc\narc\nagc\n\nSample Output 4\n\nNo", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 659, "cpu_time_ms": 101, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s687649671", "group_id": "codeNet:p03261", "input_text": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n\n Scanner scanner = new Scanner(System.in);\n int wordsN = scanner.nextInt();\n String[] shiritoriW = new String[wordsN];\n String ans=\"Yes\";\n shiritoriW[0] = scanner.next();\n checkLoop:\n for(int i=1;i=0;j--){\n if(shiritoriW[i].equals(shiritoriW[j])){\n ans = \"No\";\n break checkLoop;\n }\n }\n }\n }\n System.out.println(ans);\n }\n}\n", "language": "Java", "metadata": {"date": 1536464894, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03261.html", "problem_id": "p03261", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03261/input.txt", "sample_output_relpath": "derived/input_output/data/p03261/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03261/Java/s687649671.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s687649671", "user_id": "u190664328"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n\n Scanner scanner = new Scanner(System.in);\n int wordsN = scanner.nextInt();\n String[] shiritoriW = new String[wordsN];\n String ans=\"Yes\";\n shiritoriW[0] = scanner.next();\n checkLoop:\n for(int i=1;i=0;j--){\n if(shiritoriW[i].equals(shiritoriW[j])){\n ans = \"No\";\n break checkLoop;\n }\n }\n }\n }\n System.out.println(ans);\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi is practicing shiritori alone again today.\n\nShiritori is a game as follows:\n\nIn the first turn, a player announces any one word.\n\nIn the subsequent turns, a player announces a word that satisfies the following conditions:\n\nThat word is not announced before.\n\nThe first character of that word is the same as the last character of the last word announced.\n\nIn this game, he is practicing to announce as many words as possible in ten seconds.\n\nYou are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.\n\nConstraints\n\nN is an integer satisfying 2 \\leq N \\leq 100.\n\nW_i is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nW_1\nW_2\n:\nW_N\n\nOutput\n\nIf every word announced by Takahashi satisfied the conditions, print Yes; otherwise, print No.\n\nSample Input 1\n\n4\nhoge\nenglish\nhoge\nenigma\n\nSample Output 1\n\nNo\n\nAs hoge is announced multiple times, the rules of shiritori was not observed.\n\nSample Input 2\n\n9\nbasic\nc\ncpp\nphp\npython\nnadesico\nocaml\nlua\nassembly\n\nSample Output 2\n\nYes\n\nSample Input 3\n\n8\na\naa\naaa\naaaa\naaaaa\naaaaaa\naaa\naaaaaaa\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3\nabc\narc\nagc\n\nSample Output 4\n\nNo", "sample_input": "4\nhoge\nenglish\nhoge\nenigma\n"}, "reference_outputs": ["No\n"], "source_document_id": "p03261", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi is practicing shiritori alone again today.\n\nShiritori is a game as follows:\n\nIn the first turn, a player announces any one word.\n\nIn the subsequent turns, a player announces a word that satisfies the following conditions:\n\nThat word is not announced before.\n\nThe first character of that word is the same as the last character of the last word announced.\n\nIn this game, he is practicing to announce as many words as possible in ten seconds.\n\nYou are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.\n\nConstraints\n\nN is an integer satisfying 2 \\leq N \\leq 100.\n\nW_i is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nW_1\nW_2\n:\nW_N\n\nOutput\n\nIf every word announced by Takahashi satisfied the conditions, print Yes; otherwise, print No.\n\nSample Input 1\n\n4\nhoge\nenglish\nhoge\nenigma\n\nSample Output 1\n\nNo\n\nAs hoge is announced multiple times, the rules of shiritori was not observed.\n\nSample Input 2\n\n9\nbasic\nc\ncpp\nphp\npython\nnadesico\nocaml\nlua\nassembly\n\nSample Output 2\n\nYes\n\nSample Input 3\n\n8\na\naa\naaa\naaaa\naaaaa\naaaaaa\naaa\naaaaaaa\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3\nabc\narc\nagc\n\nSample Output 4\n\nNo", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 839, "cpu_time_ms": 104, "memory_kb": 22996}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s761128671", "group_id": "codeNet:p03261", "input_text": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\t// 整数の入力\n int N = sc.nextInt();\n int flag = 0;\n\n String[] moji = new String[N];\n for(int i=0; i0){\n //if((moji[i].charAt(0)) != moji[i-1].charAt((moji[i-1].length)-1))flag=1;\n String tmp = moji[i-1]; \n char Ctmp = (tmp.charAt(tmp.length()-1));\n if((moji[i].charAt(0)) != Ctmp)flag=1;\n }\n if(flag == 1)break;\n }\n\n for(int i=0; i1)flag=1;break;\n }\n\n if(flag==0)System.out.println(\"Yes\");\n else System.out.println(\"No\");\n\t}\n}", "language": "Java", "metadata": {"date": 1536459273, "filename_ext": "java", "original_language": "Java7 (OpenJDK 1.7.0)", "problem_description_relpath": "problem_descriptions/p03261.html", "problem_id": "p03261", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03261/input.txt", "sample_output_relpath": "derived/input_output/data/p03261/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03261/Java/s761128671.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s761128671", "user_id": "u484062444"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\t// 整数の入力\n int N = sc.nextInt();\n int flag = 0;\n\n String[] moji = new String[N];\n for(int i=0; i0){\n //if((moji[i].charAt(0)) != moji[i-1].charAt((moji[i-1].length)-1))flag=1;\n String tmp = moji[i-1]; \n char Ctmp = (tmp.charAt(tmp.length()-1));\n if((moji[i].charAt(0)) != Ctmp)flag=1;\n }\n if(flag == 1)break;\n }\n\n for(int i=0; i1)flag=1;break;\n }\n\n if(flag==0)System.out.println(\"Yes\");\n else System.out.println(\"No\");\n\t}\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi is practicing shiritori alone again today.\n\nShiritori is a game as follows:\n\nIn the first turn, a player announces any one word.\n\nIn the subsequent turns, a player announces a word that satisfies the following conditions:\n\nThat word is not announced before.\n\nThe first character of that word is the same as the last character of the last word announced.\n\nIn this game, he is practicing to announce as many words as possible in ten seconds.\n\nYou are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.\n\nConstraints\n\nN is an integer satisfying 2 \\leq N \\leq 100.\n\nW_i is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nW_1\nW_2\n:\nW_N\n\nOutput\n\nIf every word announced by Takahashi satisfied the conditions, print Yes; otherwise, print No.\n\nSample Input 1\n\n4\nhoge\nenglish\nhoge\nenigma\n\nSample Output 1\n\nNo\n\nAs hoge is announced multiple times, the rules of shiritori was not observed.\n\nSample Input 2\n\n9\nbasic\nc\ncpp\nphp\npython\nnadesico\nocaml\nlua\nassembly\n\nSample Output 2\n\nYes\n\nSample Input 3\n\n8\na\naa\naaa\naaaa\naaaaa\naaaaaa\naaa\naaaaaaa\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3\nabc\narc\nagc\n\nSample Output 4\n\nNo", "sample_input": "4\nhoge\nenglish\nhoge\nenigma\n"}, "reference_outputs": ["No\n"], "source_document_id": "p03261", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi is practicing shiritori alone again today.\n\nShiritori is a game as follows:\n\nIn the first turn, a player announces any one word.\n\nIn the subsequent turns, a player announces a word that satisfies the following conditions:\n\nThat word is not announced before.\n\nThe first character of that word is the same as the last character of the last word announced.\n\nIn this game, he is practicing to announce as many words as possible in ten seconds.\n\nYou are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.\n\nConstraints\n\nN is an integer satisfying 2 \\leq N \\leq 100.\n\nW_i is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nW_1\nW_2\n:\nW_N\n\nOutput\n\nIf every word announced by Takahashi satisfied the conditions, print Yes; otherwise, print No.\n\nSample Input 1\n\n4\nhoge\nenglish\nhoge\nenigma\n\nSample Output 1\n\nNo\n\nAs hoge is announced multiple times, the rules of shiritori was not observed.\n\nSample Input 2\n\n9\nbasic\nc\ncpp\nphp\npython\nnadesico\nocaml\nlua\nassembly\n\nSample Output 2\n\nYes\n\nSample Input 3\n\n8\na\naa\naaa\naaaa\naaaaa\naaaaaa\naaa\naaaaaaa\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3\nabc\narc\nagc\n\nSample Output 4\n\nNo", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 891, "cpu_time_ms": 107, "memory_kb": 22740}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s531601033", "group_id": "codeNet:p03261", "input_text": "import java.util.*;\nimport java.lang.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\t// 整数の入力\n\t\tint n = sc.nextInt();\n\n\n\n\t\tMap wMap = new HashMap<>();\n\t\tboolean isRuled = true;\n\t\tString previousLastWord = \"\";\n\t\tfor(int i=0;i0 && !w.substring(0,1).equals(previousLastWord)){\n\n\t\t\t\t\t// System.out.println(\"equals\");\n\t\t\t\t\tisRuled=false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\twMap.put(w,true);\n\n\t\t\t\tpreviousLastWord = w.substring(w.length()-1,w.length());\n\t\t}\n\n\t\tif(isRuled){\n\t\tSystem.out.println(\"Yes\");\n\t\t}else{\n\t\tSystem.out.println(\"No\");\n\t\t}\n\n\t}\n}", "language": "Java", "metadata": {"date": 1536456115, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03261.html", "problem_id": "p03261", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03261/input.txt", "sample_output_relpath": "derived/input_output/data/p03261/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03261/Java/s531601033.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s531601033", "user_id": "u573545768"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "import java.util.*;\nimport java.lang.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\t// 整数の入力\n\t\tint n = sc.nextInt();\n\n\n\n\t\tMap wMap = new HashMap<>();\n\t\tboolean isRuled = true;\n\t\tString previousLastWord = \"\";\n\t\tfor(int i=0;i0 && !w.substring(0,1).equals(previousLastWord)){\n\n\t\t\t\t\t// System.out.println(\"equals\");\n\t\t\t\t\tisRuled=false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\twMap.put(w,true);\n\n\t\t\t\tpreviousLastWord = w.substring(w.length()-1,w.length());\n\t\t}\n\n\t\tif(isRuled){\n\t\tSystem.out.println(\"Yes\");\n\t\t}else{\n\t\tSystem.out.println(\"No\");\n\t\t}\n\n\t}\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi is practicing shiritori alone again today.\n\nShiritori is a game as follows:\n\nIn the first turn, a player announces any one word.\n\nIn the subsequent turns, a player announces a word that satisfies the following conditions:\n\nThat word is not announced before.\n\nThe first character of that word is the same as the last character of the last word announced.\n\nIn this game, he is practicing to announce as many words as possible in ten seconds.\n\nYou are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.\n\nConstraints\n\nN is an integer satisfying 2 \\leq N \\leq 100.\n\nW_i is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nW_1\nW_2\n:\nW_N\n\nOutput\n\nIf every word announced by Takahashi satisfied the conditions, print Yes; otherwise, print No.\n\nSample Input 1\n\n4\nhoge\nenglish\nhoge\nenigma\n\nSample Output 1\n\nNo\n\nAs hoge is announced multiple times, the rules of shiritori was not observed.\n\nSample Input 2\n\n9\nbasic\nc\ncpp\nphp\npython\nnadesico\nocaml\nlua\nassembly\n\nSample Output 2\n\nYes\n\nSample Input 3\n\n8\na\naa\naaa\naaaa\naaaaa\naaaaaa\naaa\naaaaaaa\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3\nabc\narc\nagc\n\nSample Output 4\n\nNo", "sample_input": "4\nhoge\nenglish\nhoge\nenigma\n"}, "reference_outputs": ["No\n"], "source_document_id": "p03261", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi is practicing shiritori alone again today.\n\nShiritori is a game as follows:\n\nIn the first turn, a player announces any one word.\n\nIn the subsequent turns, a player announces a word that satisfies the following conditions:\n\nThat word is not announced before.\n\nThe first character of that word is the same as the last character of the last word announced.\n\nIn this game, he is practicing to announce as many words as possible in ten seconds.\n\nYou are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.\n\nConstraints\n\nN is an integer satisfying 2 \\leq N \\leq 100.\n\nW_i is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nW_1\nW_2\n:\nW_N\n\nOutput\n\nIf every word announced by Takahashi satisfied the conditions, print Yes; otherwise, print No.\n\nSample Input 1\n\n4\nhoge\nenglish\nhoge\nenigma\n\nSample Output 1\n\nNo\n\nAs hoge is announced multiple times, the rules of shiritori was not observed.\n\nSample Input 2\n\n9\nbasic\nc\ncpp\nphp\npython\nnadesico\nocaml\nlua\nassembly\n\nSample Output 2\n\nYes\n\nSample Input 3\n\n8\na\naa\naaa\naaaa\naaaaa\naaaaaa\naaa\naaaaaaa\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3\nabc\narc\nagc\n\nSample Output 4\n\nNo", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 960, "cpu_time_ms": 108, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s195717741", "group_id": "codeNet:p03261", "input_text": "import java.io.BufferedInputStream;\nimport java.util.HashSet;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scan = new Scanner(new BufferedInputStream(System.in));\n int N = scan.nextInt();\n String[] words = new String[N];\n for (int i=0;i visited = new HashSet<>();\n for (int i=0;i 0 && words[i].charAt(0) != words[i-1].charAt(words[i-1].length()-1)) return false;\n }\n return true;\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1536455360, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03261.html", "problem_id": "p03261", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03261/input.txt", "sample_output_relpath": "derived/input_output/data/p03261/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03261/Java/s195717741.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s195717741", "user_id": "u840655147"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "import java.io.BufferedInputStream;\nimport java.util.HashSet;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scan = new Scanner(new BufferedInputStream(System.in));\n int N = scan.nextInt();\n String[] words = new String[N];\n for (int i=0;i visited = new HashSet<>();\n for (int i=0;i 0 && words[i].charAt(0) != words[i-1].charAt(words[i-1].length()-1)) return false;\n }\n return true;\n }\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi is practicing shiritori alone again today.\n\nShiritori is a game as follows:\n\nIn the first turn, a player announces any one word.\n\nIn the subsequent turns, a player announces a word that satisfies the following conditions:\n\nThat word is not announced before.\n\nThe first character of that word is the same as the last character of the last word announced.\n\nIn this game, he is practicing to announce as many words as possible in ten seconds.\n\nYou are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.\n\nConstraints\n\nN is an integer satisfying 2 \\leq N \\leq 100.\n\nW_i is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nW_1\nW_2\n:\nW_N\n\nOutput\n\nIf every word announced by Takahashi satisfied the conditions, print Yes; otherwise, print No.\n\nSample Input 1\n\n4\nhoge\nenglish\nhoge\nenigma\n\nSample Output 1\n\nNo\n\nAs hoge is announced multiple times, the rules of shiritori was not observed.\n\nSample Input 2\n\n9\nbasic\nc\ncpp\nphp\npython\nnadesico\nocaml\nlua\nassembly\n\nSample Output 2\n\nYes\n\nSample Input 3\n\n8\na\naa\naaa\naaaa\naaaaa\naaaaaa\naaa\naaaaaaa\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3\nabc\narc\nagc\n\nSample Output 4\n\nNo", "sample_input": "4\nhoge\nenglish\nhoge\nenigma\n"}, "reference_outputs": ["No\n"], "source_document_id": "p03261", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi is practicing shiritori alone again today.\n\nShiritori is a game as follows:\n\nIn the first turn, a player announces any one word.\n\nIn the subsequent turns, a player announces a word that satisfies the following conditions:\n\nThat word is not announced before.\n\nThe first character of that word is the same as the last character of the last word announced.\n\nIn this game, he is practicing to announce as many words as possible in ten seconds.\n\nYou are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.\n\nConstraints\n\nN is an integer satisfying 2 \\leq N \\leq 100.\n\nW_i is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nW_1\nW_2\n:\nW_N\n\nOutput\n\nIf every word announced by Takahashi satisfied the conditions, print Yes; otherwise, print No.\n\nSample Input 1\n\n4\nhoge\nenglish\nhoge\nenigma\n\nSample Output 1\n\nNo\n\nAs hoge is announced multiple times, the rules of shiritori was not observed.\n\nSample Input 2\n\n9\nbasic\nc\ncpp\nphp\npython\nnadesico\nocaml\nlua\nassembly\n\nSample Output 2\n\nYes\n\nSample Input 3\n\n8\na\naa\naaa\naaaa\naaaaa\naaaaaa\naaa\naaaaaaa\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3\nabc\narc\nagc\n\nSample Output 4\n\nNo", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 840, "cpu_time_ms": 122, "memory_kb": 23764}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s542694687", "group_id": "codeNet:p03262", "input_text": "import java.util.Scanner;\nimport java.util.Arrays;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint offset = Integer.parseInt(scanner.nextLine().split(\" \")[1]);\n\t\tSystem.out.println(\n\t\t\t\tArrays.stream(scanner.nextLine().split(\" \"))\n\t\t\t\t\t.mapToInt(Integer::parseInt)\n\t\t\t\t\t.map(i -> i - offset)\n\t\t\t\t\t.map(Math::abs)\n\t\t\t\t\t.filter(i -> i != 0)\n\t\t\t\t\t.reduce((i1, i2) -> gcd(i1, i2))\n\t\t\t\t\t.getAsInt()\n\t\t\t\t);\n\t}\n\tpublic static int gcd(int i1, int i2) {\n\t\tint bg = i1 > i2 ? i1 : i2;\n\t\tint sm = i1 > i2 ? i2 : i1;\n\t\tint remainder = sm;\n\t\twhile(bg % sm != 0) {\n\t\t\tremainder = bg % sm;\n\t\t\tbg = sm;\n\t\t\tsm = remainder;\n\t\t}\n\t\treturn remainder;\n\t}\n}", "language": "Java", "metadata": {"date": 1575660094, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03262.html", "problem_id": "p03262", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03262/input.txt", "sample_output_relpath": "derived/input_output/data/p03262/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03262/Java/s542694687.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s542694687", "user_id": "u109541560"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.Scanner;\nimport java.util.Arrays;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint offset = Integer.parseInt(scanner.nextLine().split(\" \")[1]);\n\t\tSystem.out.println(\n\t\t\t\tArrays.stream(scanner.nextLine().split(\" \"))\n\t\t\t\t\t.mapToInt(Integer::parseInt)\n\t\t\t\t\t.map(i -> i - offset)\n\t\t\t\t\t.map(Math::abs)\n\t\t\t\t\t.filter(i -> i != 0)\n\t\t\t\t\t.reduce((i1, i2) -> gcd(i1, i2))\n\t\t\t\t\t.getAsInt()\n\t\t\t\t);\n\t}\n\tpublic static int gcd(int i1, int i2) {\n\t\tint bg = i1 > i2 ? i1 : i2;\n\t\tint sm = i1 > i2 ? i2 : i1;\n\t\tint remainder = sm;\n\t\twhile(bg % sm != 0) {\n\t\t\tremainder = bg % sm;\n\t\t\tbg = sm;\n\t\t\tsm = remainder;\n\t\t}\n\t\treturn remainder;\n\t}\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N cities on a number line. The i-th city is located at coordinate x_i.\n\nYour objective is to visit all these cities at least once.\n\nIn order to do so, you will first set a positive integer D.\n\nThen, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like:\n\nMove 1: travel from coordinate y to coordinate y + D.\n\nMove 2: travel from coordinate y to coordinate y - D.\n\nFind the maximum value of D that enables you to visit all the cities.\n\nHere, to visit a city is to travel to the coordinate where that city is located.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq X \\leq 10^9\n\n1 \\leq x_i \\leq 10^9\n\nx_i are all different.\n\nx_1, x_2, ..., x_N \\neq X\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the maximum value of D that enables you to visit all the cities.\n\nSample Input 1\n\n3 3\n1 7 11\n\nSample Output 1\n\n2\n\nSetting D = 2 enables you to visit all the cities as follows, and this is the maximum value of such D.\n\nPerform Move 2 to travel to coordinate 1.\n\nPerform Move 1 to travel to coordinate 3.\n\nPerform Move 1 to travel to coordinate 5.\n\nPerform Move 1 to travel to coordinate 7.\n\nPerform Move 1 to travel to coordinate 9.\n\nPerform Move 1 to travel to coordinate 11.\n\nSample Input 2\n\n3 81\n33 105 57\n\nSample Output 2\n\n24\n\nSample Input 3\n\n1 1\n1000000000\n\nSample Output 3\n\n999999999", "sample_input": "3 3\n1 7 11\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03262", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N cities on a number line. The i-th city is located at coordinate x_i.\n\nYour objective is to visit all these cities at least once.\n\nIn order to do so, you will first set a positive integer D.\n\nThen, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like:\n\nMove 1: travel from coordinate y to coordinate y + D.\n\nMove 2: travel from coordinate y to coordinate y - D.\n\nFind the maximum value of D that enables you to visit all the cities.\n\nHere, to visit a city is to travel to the coordinate where that city is located.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq X \\leq 10^9\n\n1 \\leq x_i \\leq 10^9\n\nx_i are all different.\n\nx_1, x_2, ..., x_N \\neq X\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the maximum value of D that enables you to visit all the cities.\n\nSample Input 1\n\n3 3\n1 7 11\n\nSample Output 1\n\n2\n\nSetting D = 2 enables you to visit all the cities as follows, and this is the maximum value of such D.\n\nPerform Move 2 to travel to coordinate 1.\n\nPerform Move 1 to travel to coordinate 3.\n\nPerform Move 1 to travel to coordinate 5.\n\nPerform Move 1 to travel to coordinate 7.\n\nPerform Move 1 to travel to coordinate 9.\n\nPerform Move 1 to travel to coordinate 11.\n\nSample Input 2\n\n3 81\n33 105 57\n\nSample Output 2\n\n24\n\nSample Input 3\n\n1 1\n1000000000\n\nSample Output 3\n\n999999999", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 395, "memory_kb": 47836}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s466955336", "group_id": "codeNet:p03262", "input_text": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.NoSuchElementException;\n\n\npublic class Main{\n\tstatic FastScanner sc = new FastScanner();\n\tstatic PrintWriter out = new PrintWriter(System.out);\n\t\n\tpublic static void main(String[] args) {\n\t\tint N = sc.nextInt();\n\t\tint X = sc.nextInt();\n\t\t\n\t\tint a [] = sc.nextIntArray(N, false);\n\t\t\n\t\tArrays.sort(a);\n\t\t\n\t\tif (N==1){\n\t\t\tout.println(Math.abs(X-a[0]));\n\t\t}\n\t\t\n\t\telse {\n\t\t\tint min = 2000000001;\n\t\t\tint initial = 2000000001;\n\t\t\tfor (int i=0; i list = getLongList(sc, n);\n list.add(x);\n Collections.sort(list);\n long max = 0;\n long stock = list.get(0);\n for (int i = 1; i < list.size(); i++) {\n if (gcd(list.get(i), stock) > max) {\n max = gcd(list.get(i), stock);\n }\n }\n\n if (max == 0) {\n max = 1;\n }\n out.println(max);\n }\n }\n\n // method\n static int nint(Scanner sc) {\n return Integer.parseInt(sc.next());\n }\n\n static long nlong(Scanner sc) {\n return Long.parseLong(sc.next());\n }\n\n static double ndouble(Scanner sc) {\n return Double.parseDouble(sc.next());\n }\n\n static float nfloat(Scanner sc) {\n return Float.parseFloat(sc.next());\n }\n\n static String nstr(Scanner sc) {\n return sc.next();\n }\n\n static long[] longLine(Scanner sc, int size) {\n long[] lLine = new long[size];\n for (int i = 0; i < size; i++) {\n lLine[i] = nlong(sc);\n }\n return lLine;\n }\n\n static int[] intLine(Scanner sc, int size) {\n int[] iLine = new int[size];\n for (int i = 0; i < size; i++) {\n iLine[i] = nint(sc);\n }\n return iLine;\n }\n\n static String[] strLine(Scanner sc, int size) {\n String[] strLine = new String[size];\n for (int i = 0; i < size; i++) {\n strLine[i] = nstr(sc);\n }\n return strLine;\n }\n\n static long maxFromList(List longList) {\n return longList.stream().max(Comparator.naturalOrder()).get();\n }\n\n static long minFromList(List longList) {\n return longList.stream().min(Comparator.naturalOrder()).get();\n }\n\n static int sumDigits(int n) {\n int sum = 0;\n while (n != 0) {\n sum += n % 10;\n n /= 10;\n }\n return sum;\n }\n\n static long sumDigits(long n) {\n long sum = 0;\n while (n != 0) {\n sum += n % 10;\n n /= 10;\n }\n return sum;\n }\n\n static List getIntegerList(Scanner sc, int size) {\n List list = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n list.add(nint(sc));\n }\n return list;\n }\n\n static List getLongList(Scanner sc, int size) {\n List list = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n list.add(nlong(sc));\n }\n return list;\n }\n\n static long gcd(long m, long n) {\n if (m < n) return gcd(n, m);\n if (n == 0) return m;\n return gcd(n, m % n);\n }\n}\n", "language": "Java", "metadata": {"date": 1536468087, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03262.html", "problem_id": "p03262", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03262/input.txt", "sample_output_relpath": "derived/input_output/data/p03262/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03262/Java/s442090719.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s442090719", "user_id": "u742776718"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "\nimport java.io.PrintWriter;\nimport java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n try (PrintWriter out = new PrintWriter(System.out);\n Scanner sc = new Scanner(System.in)) {\n Task task = new Task();\n task.solve(sc, out);\n out.flush();\n\n } catch (Exception e) {\n // DO NOT USE\n }\n }\n\n static class Task {\n public void solve(Scanner sc, PrintWriter out) {\n // TODO\n int n = nint(sc);\n long x = nlong(sc);\n\n List list = getLongList(sc, n);\n list.add(x);\n Collections.sort(list);\n long max = 0;\n long stock = list.get(0);\n for (int i = 1; i < list.size(); i++) {\n if (gcd(list.get(i), stock) > max) {\n max = gcd(list.get(i), stock);\n }\n }\n\n if (max == 0) {\n max = 1;\n }\n out.println(max);\n }\n }\n\n // method\n static int nint(Scanner sc) {\n return Integer.parseInt(sc.next());\n }\n\n static long nlong(Scanner sc) {\n return Long.parseLong(sc.next());\n }\n\n static double ndouble(Scanner sc) {\n return Double.parseDouble(sc.next());\n }\n\n static float nfloat(Scanner sc) {\n return Float.parseFloat(sc.next());\n }\n\n static String nstr(Scanner sc) {\n return sc.next();\n }\n\n static long[] longLine(Scanner sc, int size) {\n long[] lLine = new long[size];\n for (int i = 0; i < size; i++) {\n lLine[i] = nlong(sc);\n }\n return lLine;\n }\n\n static int[] intLine(Scanner sc, int size) {\n int[] iLine = new int[size];\n for (int i = 0; i < size; i++) {\n iLine[i] = nint(sc);\n }\n return iLine;\n }\n\n static String[] strLine(Scanner sc, int size) {\n String[] strLine = new String[size];\n for (int i = 0; i < size; i++) {\n strLine[i] = nstr(sc);\n }\n return strLine;\n }\n\n static long maxFromList(List longList) {\n return longList.stream().max(Comparator.naturalOrder()).get();\n }\n\n static long minFromList(List longList) {\n return longList.stream().min(Comparator.naturalOrder()).get();\n }\n\n static int sumDigits(int n) {\n int sum = 0;\n while (n != 0) {\n sum += n % 10;\n n /= 10;\n }\n return sum;\n }\n\n static long sumDigits(long n) {\n long sum = 0;\n while (n != 0) {\n sum += n % 10;\n n /= 10;\n }\n return sum;\n }\n\n static List getIntegerList(Scanner sc, int size) {\n List list = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n list.add(nint(sc));\n }\n return list;\n }\n\n static List getLongList(Scanner sc, int size) {\n List list = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n list.add(nlong(sc));\n }\n return list;\n }\n\n static long gcd(long m, long n) {\n if (m < n) return gcd(n, m);\n if (n == 0) return m;\n return gcd(n, m % n);\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N cities on a number line. The i-th city is located at coordinate x_i.\n\nYour objective is to visit all these cities at least once.\n\nIn order to do so, you will first set a positive integer D.\n\nThen, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like:\n\nMove 1: travel from coordinate y to coordinate y + D.\n\nMove 2: travel from coordinate y to coordinate y - D.\n\nFind the maximum value of D that enables you to visit all the cities.\n\nHere, to visit a city is to travel to the coordinate where that city is located.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq X \\leq 10^9\n\n1 \\leq x_i \\leq 10^9\n\nx_i are all different.\n\nx_1, x_2, ..., x_N \\neq X\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the maximum value of D that enables you to visit all the cities.\n\nSample Input 1\n\n3 3\n1 7 11\n\nSample Output 1\n\n2\n\nSetting D = 2 enables you to visit all the cities as follows, and this is the maximum value of such D.\n\nPerform Move 2 to travel to coordinate 1.\n\nPerform Move 1 to travel to coordinate 3.\n\nPerform Move 1 to travel to coordinate 5.\n\nPerform Move 1 to travel to coordinate 7.\n\nPerform Move 1 to travel to coordinate 9.\n\nPerform Move 1 to travel to coordinate 11.\n\nSample Input 2\n\n3 81\n33 105 57\n\nSample Output 2\n\n24\n\nSample Input 3\n\n1 1\n1000000000\n\nSample Output 3\n\n999999999", "sample_input": "3 3\n1 7 11\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03262", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N cities on a number line. The i-th city is located at coordinate x_i.\n\nYour objective is to visit all these cities at least once.\n\nIn order to do so, you will first set a positive integer D.\n\nThen, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like:\n\nMove 1: travel from coordinate y to coordinate y + D.\n\nMove 2: travel from coordinate y to coordinate y - D.\n\nFind the maximum value of D that enables you to visit all the cities.\n\nHere, to visit a city is to travel to the coordinate where that city is located.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq X \\leq 10^9\n\n1 \\leq x_i \\leq 10^9\n\nx_i are all different.\n\nx_1, x_2, ..., x_N \\neq X\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the maximum value of D that enables you to visit all the cities.\n\nSample Input 1\n\n3 3\n1 7 11\n\nSample Output 1\n\n2\n\nSetting D = 2 enables you to visit all the cities as follows, and this is the maximum value of such D.\n\nPerform Move 2 to travel to coordinate 1.\n\nPerform Move 1 to travel to coordinate 3.\n\nPerform Move 1 to travel to coordinate 5.\n\nPerform Move 1 to travel to coordinate 7.\n\nPerform Move 1 to travel to coordinate 9.\n\nPerform Move 1 to travel to coordinate 11.\n\nSample Input 2\n\n3 81\n33 105 57\n\nSample Output 2\n\n24\n\nSample Input 3\n\n1 1\n1000000000\n\nSample Output 3\n\n999999999", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2827, "cpu_time_ms": 536, "memory_kb": 48504}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s009701895", "group_id": "codeNet:p03262", "input_text": "import java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tint Zahyou = sc.nextInt();\n\n\t\tList list = new ArrayList<>();\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tlist.add(sc.nextInt());\n\t\t}\n\t\tlist.add(Zahyou);\n\t\tCollections.sort(list);\n\n\n\t\tint kyori = 1000000001;\n\t\tint num = 0;\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tnum = Math.abs(list.get(i+1)-list.get(i));\n\n\t\t\tif(num == 0) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif(kyori == 1000000001) {\n\t\t\t\tkyori = num;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tkyori = gcd(kyori,num);\n\n\t\t}\n\n\t\tif(kyori == 1000000001) {\n\t\t\tkyori = 0;\n\t\t}\n\t\tSystem.out.println(kyori);\n\t\tsc.close();\n\t}\n\n\n\t//最大公約数gcd\n\tstatic int gcd (int a, int b) {\n\t\tif(b == 0) {\n\t\t\treturn a;\n\t\t}\n\t\tif(b % a == 0) {\n\t\t\treturn a;\n\t\t}\n\t\tif(a % b == 0) {\n\t\t\treturn b;\n\t\t}\n\n\t\tint temp;\n\t\twhile((temp = a%b)!=0) {\n\t\t\ta = b;\n\t\t\tb = temp;\n\t\t}\n\t\treturn b;\n\t}\n\n}", "language": "Java", "metadata": {"date": 1536464794, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03262.html", "problem_id": "p03262", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03262/input.txt", "sample_output_relpath": "derived/input_output/data/p03262/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03262/Java/s009701895.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s009701895", "user_id": "u908039151"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tint Zahyou = sc.nextInt();\n\n\t\tList list = new ArrayList<>();\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tlist.add(sc.nextInt());\n\t\t}\n\t\tlist.add(Zahyou);\n\t\tCollections.sort(list);\n\n\n\t\tint kyori = 1000000001;\n\t\tint num = 0;\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tnum = Math.abs(list.get(i+1)-list.get(i));\n\n\t\t\tif(num == 0) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif(kyori == 1000000001) {\n\t\t\t\tkyori = num;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tkyori = gcd(kyori,num);\n\n\t\t}\n\n\t\tif(kyori == 1000000001) {\n\t\t\tkyori = 0;\n\t\t}\n\t\tSystem.out.println(kyori);\n\t\tsc.close();\n\t}\n\n\n\t//最大公約数gcd\n\tstatic int gcd (int a, int b) {\n\t\tif(b == 0) {\n\t\t\treturn a;\n\t\t}\n\t\tif(b % a == 0) {\n\t\t\treturn a;\n\t\t}\n\t\tif(a % b == 0) {\n\t\t\treturn b;\n\t\t}\n\n\t\tint temp;\n\t\twhile((temp = a%b)!=0) {\n\t\t\ta = b;\n\t\t\tb = temp;\n\t\t}\n\t\treturn b;\n\t}\n\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N cities on a number line. The i-th city is located at coordinate x_i.\n\nYour objective is to visit all these cities at least once.\n\nIn order to do so, you will first set a positive integer D.\n\nThen, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like:\n\nMove 1: travel from coordinate y to coordinate y + D.\n\nMove 2: travel from coordinate y to coordinate y - D.\n\nFind the maximum value of D that enables you to visit all the cities.\n\nHere, to visit a city is to travel to the coordinate where that city is located.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq X \\leq 10^9\n\n1 \\leq x_i \\leq 10^9\n\nx_i are all different.\n\nx_1, x_2, ..., x_N \\neq X\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the maximum value of D that enables you to visit all the cities.\n\nSample Input 1\n\n3 3\n1 7 11\n\nSample Output 1\n\n2\n\nSetting D = 2 enables you to visit all the cities as follows, and this is the maximum value of such D.\n\nPerform Move 2 to travel to coordinate 1.\n\nPerform Move 1 to travel to coordinate 3.\n\nPerform Move 1 to travel to coordinate 5.\n\nPerform Move 1 to travel to coordinate 7.\n\nPerform Move 1 to travel to coordinate 9.\n\nPerform Move 1 to travel to coordinate 11.\n\nSample Input 2\n\n3 81\n33 105 57\n\nSample Output 2\n\n24\n\nSample Input 3\n\n1 1\n1000000000\n\nSample Output 3\n\n999999999", "sample_input": "3 3\n1 7 11\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03262", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N cities on a number line. The i-th city is located at coordinate x_i.\n\nYour objective is to visit all these cities at least once.\n\nIn order to do so, you will first set a positive integer D.\n\nThen, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like:\n\nMove 1: travel from coordinate y to coordinate y + D.\n\nMove 2: travel from coordinate y to coordinate y - D.\n\nFind the maximum value of D that enables you to visit all the cities.\n\nHere, to visit a city is to travel to the coordinate where that city is located.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq X \\leq 10^9\n\n1 \\leq x_i \\leq 10^9\n\nx_i are all different.\n\nx_1, x_2, ..., x_N \\neq X\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the maximum value of D that enables you to visit all the cities.\n\nSample Input 1\n\n3 3\n1 7 11\n\nSample Output 1\n\n2\n\nSetting D = 2 enables you to visit all the cities as follows, and this is the maximum value of such D.\n\nPerform Move 2 to travel to coordinate 1.\n\nPerform Move 1 to travel to coordinate 3.\n\nPerform Move 1 to travel to coordinate 5.\n\nPerform Move 1 to travel to coordinate 7.\n\nPerform Move 1 to travel to coordinate 9.\n\nPerform Move 1 to travel to coordinate 11.\n\nSample Input 2\n\n3 81\n33 105 57\n\nSample Output 2\n\n24\n\nSample Input 3\n\n1 1\n1000000000\n\nSample Output 3\n\n999999999", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1007, "cpu_time_ms": 590, "memory_kb": 59848}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s130204178", "group_id": "codeNet:p03262", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\t\n\t\tScanner in = new Scanner(System.in);\n\t\t\n\t\tint N = in.nextInt();\n\t\tint S = in.nextInt();\n\t\t\n\t\tint[] x = new int[N+1];\n\t\tint[] y = new int[N+1];\n\t\t\n\t\tint min = Integer.MAX_VALUE;\n\t\tint key = -1;\n\t\t\n\t\tfor (int i=1;i<=N;i++)\n\t\t{\n\t\t\tx[i]= in.nextInt();\n\t\t\ty[i]= Math.abs(x[i] - S);\n\t\t\t\n\t\t\t\tif ( y[i] < min)\n\t\t\t\t{\n\t\t\t\t\tmin = y[i];\n\t\t\t\t\tkey = i;\n\t\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\tint D=min;\n\t\t\n\t\twhile (D>=1) {\n\t\t\tfor (int i=1;i<=N;i++) {\n\t\t\t\tif (y[i]%D!=0) {\n\t\t\t\t\tD--;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(D);\n\t\t\tbreak;\n\t\t}\n\t}\n}\n\n", "language": "Java", "metadata": {"date": 1536461329, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03262.html", "problem_id": "p03262", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03262/input.txt", "sample_output_relpath": "derived/input_output/data/p03262/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03262/Java/s130204178.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s130204178", "user_id": "u585828120"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\t\n\t\tScanner in = new Scanner(System.in);\n\t\t\n\t\tint N = in.nextInt();\n\t\tint S = in.nextInt();\n\t\t\n\t\tint[] x = new int[N+1];\n\t\tint[] y = new int[N+1];\n\t\t\n\t\tint min = Integer.MAX_VALUE;\n\t\tint key = -1;\n\t\t\n\t\tfor (int i=1;i<=N;i++)\n\t\t{\n\t\t\tx[i]= in.nextInt();\n\t\t\ty[i]= Math.abs(x[i] - S);\n\t\t\t\n\t\t\t\tif ( y[i] < min)\n\t\t\t\t{\n\t\t\t\t\tmin = y[i];\n\t\t\t\t\tkey = i;\n\t\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\tint D=min;\n\t\t\n\t\twhile (D>=1) {\n\t\t\tfor (int i=1;i<=N;i++) {\n\t\t\t\tif (y[i]%D!=0) {\n\t\t\t\t\tD--;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(D);\n\t\t\tbreak;\n\t\t}\n\t}\n}\n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N cities on a number line. The i-th city is located at coordinate x_i.\n\nYour objective is to visit all these cities at least once.\n\nIn order to do so, you will first set a positive integer D.\n\nThen, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like:\n\nMove 1: travel from coordinate y to coordinate y + D.\n\nMove 2: travel from coordinate y to coordinate y - D.\n\nFind the maximum value of D that enables you to visit all the cities.\n\nHere, to visit a city is to travel to the coordinate where that city is located.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq X \\leq 10^9\n\n1 \\leq x_i \\leq 10^9\n\nx_i are all different.\n\nx_1, x_2, ..., x_N \\neq X\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the maximum value of D that enables you to visit all the cities.\n\nSample Input 1\n\n3 3\n1 7 11\n\nSample Output 1\n\n2\n\nSetting D = 2 enables you to visit all the cities as follows, and this is the maximum value of such D.\n\nPerform Move 2 to travel to coordinate 1.\n\nPerform Move 1 to travel to coordinate 3.\n\nPerform Move 1 to travel to coordinate 5.\n\nPerform Move 1 to travel to coordinate 7.\n\nPerform Move 1 to travel to coordinate 9.\n\nPerform Move 1 to travel to coordinate 11.\n\nSample Input 2\n\n3 81\n33 105 57\n\nSample Output 2\n\n24\n\nSample Input 3\n\n1 1\n1000000000\n\nSample Output 3\n\n999999999", "sample_input": "3 3\n1 7 11\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03262", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N cities on a number line. The i-th city is located at coordinate x_i.\n\nYour objective is to visit all these cities at least once.\n\nIn order to do so, you will first set a positive integer D.\n\nThen, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like:\n\nMove 1: travel from coordinate y to coordinate y + D.\n\nMove 2: travel from coordinate y to coordinate y - D.\n\nFind the maximum value of D that enables you to visit all the cities.\n\nHere, to visit a city is to travel to the coordinate where that city is located.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq X \\leq 10^9\n\n1 \\leq x_i \\leq 10^9\n\nx_i are all different.\n\nx_1, x_2, ..., x_N \\neq X\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the maximum value of D that enables you to visit all the cities.\n\nSample Input 1\n\n3 3\n1 7 11\n\nSample Output 1\n\n2\n\nSetting D = 2 enables you to visit all the cities as follows, and this is the maximum value of such D.\n\nPerform Move 2 to travel to coordinate 1.\n\nPerform Move 1 to travel to coordinate 3.\n\nPerform Move 1 to travel to coordinate 5.\n\nPerform Move 1 to travel to coordinate 7.\n\nPerform Move 1 to travel to coordinate 9.\n\nPerform Move 1 to travel to coordinate 11.\n\nSample Input 2\n\n3 81\n33 105 57\n\nSample Output 2\n\n24\n\nSample Input 3\n\n1 1\n1000000000\n\nSample Output 3\n\n999999999", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 466, "memory_kb": 58268}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s600089088", "group_id": "codeNet:p03262", "input_text": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.Scanner;\nimport java.math.BigInteger;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author Kenji\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n ABC109C solver = new ABC109C();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class ABC109C {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int N = in.nextInt();\n int X = in.nextInt();\n long[] arr = new long[N + 1];\n for (int i = 0; i < N; i++) {\n arr[i] = in.nextLong();\n }\n arr[N] = X;\n Arrays.sort(arr);\n long ans = 0;\n for (int i = 0; i < N; i++) {\n long a = arr[i];\n long b = arr[i + 1];\n if (i == 0) {\n ans = b - a;\n } else {\n ans = gcd(ans, b - a);\n }\n }\n out.println(ans);\n }\n\n public static long gcd(long m, long n) {\n return BigInteger.valueOf(m).gcd(BigInteger.valueOf(n)).longValue();\n }\n\n }\n}\n\n", "language": "Java", "metadata": {"date": 1536456311, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03262.html", "problem_id": "p03262", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03262/input.txt", "sample_output_relpath": "derived/input_output/data/p03262/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03262/Java/s600089088.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s600089088", "user_id": "u796228844"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.Scanner;\nimport java.math.BigInteger;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author Kenji\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n ABC109C solver = new ABC109C();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class ABC109C {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int N = in.nextInt();\n int X = in.nextInt();\n long[] arr = new long[N + 1];\n for (int i = 0; i < N; i++) {\n arr[i] = in.nextLong();\n }\n arr[N] = X;\n Arrays.sort(arr);\n long ans = 0;\n for (int i = 0; i < N; i++) {\n long a = arr[i];\n long b = arr[i + 1];\n if (i == 0) {\n ans = b - a;\n } else {\n ans = gcd(ans, b - a);\n }\n }\n out.println(ans);\n }\n\n public static long gcd(long m, long n) {\n return BigInteger.valueOf(m).gcd(BigInteger.valueOf(n)).longValue();\n }\n\n }\n}\n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N cities on a number line. The i-th city is located at coordinate x_i.\n\nYour objective is to visit all these cities at least once.\n\nIn order to do so, you will first set a positive integer D.\n\nThen, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like:\n\nMove 1: travel from coordinate y to coordinate y + D.\n\nMove 2: travel from coordinate y to coordinate y - D.\n\nFind the maximum value of D that enables you to visit all the cities.\n\nHere, to visit a city is to travel to the coordinate where that city is located.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq X \\leq 10^9\n\n1 \\leq x_i \\leq 10^9\n\nx_i are all different.\n\nx_1, x_2, ..., x_N \\neq X\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the maximum value of D that enables you to visit all the cities.\n\nSample Input 1\n\n3 3\n1 7 11\n\nSample Output 1\n\n2\n\nSetting D = 2 enables you to visit all the cities as follows, and this is the maximum value of such D.\n\nPerform Move 2 to travel to coordinate 1.\n\nPerform Move 1 to travel to coordinate 3.\n\nPerform Move 1 to travel to coordinate 5.\n\nPerform Move 1 to travel to coordinate 7.\n\nPerform Move 1 to travel to coordinate 9.\n\nPerform Move 1 to travel to coordinate 11.\n\nSample Input 2\n\n3 81\n33 105 57\n\nSample Output 2\n\n24\n\nSample Input 3\n\n1 1\n1000000000\n\nSample Output 3\n\n999999999", "sample_input": "3 3\n1 7 11\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03262", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N cities on a number line. The i-th city is located at coordinate x_i.\n\nYour objective is to visit all these cities at least once.\n\nIn order to do so, you will first set a positive integer D.\n\nThen, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like:\n\nMove 1: travel from coordinate y to coordinate y + D.\n\nMove 2: travel from coordinate y to coordinate y - D.\n\nFind the maximum value of D that enables you to visit all the cities.\n\nHere, to visit a city is to travel to the coordinate where that city is located.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq X \\leq 10^9\n\n1 \\leq x_i \\leq 10^9\n\nx_i are all different.\n\nx_1, x_2, ..., x_N \\neq X\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the maximum value of D that enables you to visit all the cities.\n\nSample Input 1\n\n3 3\n1 7 11\n\nSample Output 1\n\n2\n\nSetting D = 2 enables you to visit all the cities as follows, and this is the maximum value of such D.\n\nPerform Move 2 to travel to coordinate 1.\n\nPerform Move 1 to travel to coordinate 3.\n\nPerform Move 1 to travel to coordinate 5.\n\nPerform Move 1 to travel to coordinate 7.\n\nPerform Move 1 to travel to coordinate 9.\n\nPerform Move 1 to travel to coordinate 11.\n\nSample Input 2\n\n3 81\n33 105 57\n\nSample Output 2\n\n24\n\nSample Input 3\n\n1 1\n1000000000\n\nSample Output 3\n\n999999999", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1502, "cpu_time_ms": 563, "memory_kb": 60296}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s927412026", "group_id": "codeNet:p03324", "input_text": "\nimport java.util.Scanner;\n\n\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tlong D = sc.nextLong();\n\t\tlong N = sc.nextLong();\n\t\tlong ans = 0;\n\t\tif ((long)Math.pow(100, D) * N % (long)Math.pow(100, D) == 0 ) {\n\t\t\tans = (long)Math.pow(100, D) * N;\n\t\t}else {\n\t\t\tans = (long)Math.pow(100, D) * (N + 1);\n\t\t}\n\n\t\tSystem.out.println(ans);\n\n\t}\n}\n", "language": "Java", "metadata": {"date": 1599013455, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p03324.html", "problem_id": "p03324", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03324/input.txt", "sample_output_relpath": "derived/input_output/data/p03324/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03324/Java/s927412026.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s927412026", "user_id": "u240515443"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "\nimport java.util.Scanner;\n\n\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tlong D = sc.nextLong();\n\t\tlong N = sc.nextLong();\n\t\tlong ans = 0;\n\t\tif ((long)Math.pow(100, D) * N % (long)Math.pow(100, D) == 0 ) {\n\t\t\tans = (long)Math.pow(100, D) * N;\n\t\t}else {\n\t\t\tans = (long)Math.pow(100, D) * (N + 1);\n\t\t}\n\n\t\tSystem.out.println(ans);\n\n\t}\n}\n", "problem_context": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "sample_input": "0 5\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03324", "source_text": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 118, "memory_kb": 35660}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s207221185", "group_id": "codeNet:p03324", "input_text": "import java.util.*;\nimport java.lang.Math;\npublic class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n int D = sc.nextInt();\n int N = sc.nextInt();\n if(D == 0){\n if(N == 100){\n System.out.println(101);\n }else{\n System.out.println(N);\n }\n }\n if(D == 1){\n if(N == 100){\n System.out.println(10100);\n }else{\n System.out.println(N * 100);\n }\n }\n if(D == 2){\n if(N == 100){\n System.out.println(1010000);\n }else{\n System.out.println(N * 10000);\n }\n }\n }\n}\n ", "language": "Java", "metadata": {"date": 1598753570, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p03324.html", "problem_id": "p03324", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03324/input.txt", "sample_output_relpath": "derived/input_output/data/p03324/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03324/Java/s207221185.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s207221185", "user_id": "u155138322"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.util.*;\nimport java.lang.Math;\npublic class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n int D = sc.nextInt();\n int N = sc.nextInt();\n if(D == 0){\n if(N == 100){\n System.out.println(101);\n }else{\n System.out.println(N);\n }\n }\n if(D == 1){\n if(N == 100){\n System.out.println(10100);\n }else{\n System.out.println(N * 100);\n }\n }\n if(D == 2){\n if(N == 100){\n System.out.println(1010000);\n }else{\n System.out.println(N * 10000);\n }\n }\n }\n}\n ", "problem_context": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "sample_input": "0 5\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03324", "source_text": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 761, "cpu_time_ms": 124, "memory_kb": 35540}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s612618412", "group_id": "codeNet:p03324", "input_text": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\t//数値\n\t\tint d = Integer.parseInt(sc.next());\n\t\tint n = Integer.parseInt(sc.next());\n\t\tif(d==0) {\n\t\t System.out.println(n);\n\t\t}\n\t\tif(d==1) {\n\t\t\tSystem.out.println(n*100);\n\t\t}\n\t\tif(d==2) {\n\t\t System.out.println(n*10000);\n\t\t}\n }\n}", "language": "Java", "metadata": {"date": 1595855689, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p03324.html", "problem_id": "p03324", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03324/input.txt", "sample_output_relpath": "derived/input_output/data/p03324/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03324/Java/s612618412.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s612618412", "user_id": "u778581260"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\t//数値\n\t\tint d = Integer.parseInt(sc.next());\n\t\tint n = Integer.parseInt(sc.next());\n\t\tif(d==0) {\n\t\t System.out.println(n);\n\t\t}\n\t\tif(d==1) {\n\t\t\tSystem.out.println(n*100);\n\t\t}\n\t\tif(d==2) {\n\t\t System.out.println(n*10000);\n\t\t}\n }\n}", "problem_context": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "sample_input": "0 5\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03324", "source_text": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 112, "memory_kb": 35856}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s788536892", "group_id": "codeNet:p03324", "input_text": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n \n Scanner sc = new Scanner(System.in);\n int D = sc.nextInt();\n int N = sc.nextInt();\n \n int ans = 0;\n if( N == 100 ) {\n ans = (int)Math.pow(100, D) * (N + 1);\n } else {\n ans = (int)Math.pow(100, D) * N;\n }\n System.out.println( ans );\n }\n}\n", "language": "Java", "metadata": {"date": 1593270470, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p03324.html", "problem_id": "p03324", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03324/input.txt", "sample_output_relpath": "derived/input_output/data/p03324/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03324/Java/s788536892.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s788536892", "user_id": "u428922728"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n \n Scanner sc = new Scanner(System.in);\n int D = sc.nextInt();\n int N = sc.nextInt();\n \n int ans = 0;\n if( N == 100 ) {\n ans = (int)Math.pow(100, D) * (N + 1);\n } else {\n ans = (int)Math.pow(100, D) * N;\n }\n System.out.println( ans );\n }\n}\n", "problem_context": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "sample_input": "0 5\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03324", "source_text": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 439, "cpu_time_ms": 116, "memory_kb": 35704}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s912439818", "group_id": "codeNet:p03324", "input_text": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\nimport java.math.*;\n\npublic class Main {\n private static Scanner sc;\n\n public static void main(final String[] args) {\n final Main instance = new Main();\n sc = instance.new Scanner();\n instance.solve();\n }\n\n private class Scanner {\n String[] s;\n int i;\n BufferedReader br;\n String regex = \" \";\n\n public Scanner() {\n s = new String[0];\n i = 0;\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n @Override\n protected void finalize() throws Throwable {\n try {\n super.finalize();\n } finally {\n destruction();\n }\n }\n\n private void destruction() throws IOException {\n if (br != null)\n br.close();\n }\n\n public String next() throws IOException {\n if (i < s.length)\n return s[i++];\n String st = br.readLine();\n while (st == \"\")\n st = br.readLine();\n s = st.split(regex, 0);\n i = 0;\n return s[i++];\n }\n\n public int nextInt() throws NumberFormatException, IOException {\n return Integer.parseInt(next());\n }\n\n public Long nextLong() throws NumberFormatException, IOException {\n return Long.parseLong(next());\n }\n\n public Double nextDouble() throws NumberFormatException, IOException {\n return Double.parseDouble(next());\n }\n }\n\n private void solve() {\n try {\n\n int a = sc.nextInt();\n int b = sc.nextInt();\n\n if (a == 0) {\n System.out.println(b);\n\n } else if (a == 1) {\n System.out.println(b * 100);\n } else {\n System.out.println(b * 10000);\n }\n } catch (Exception e) {\n e.printStackTrace();\n }\n }\n\n}\n", "language": "Java", "metadata": {"date": 1591492176, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03324.html", "problem_id": "p03324", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03324/input.txt", "sample_output_relpath": "derived/input_output/data/p03324/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03324/Java/s912439818.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s912439818", "user_id": "u490452536"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\nimport java.math.*;\n\npublic class Main {\n private static Scanner sc;\n\n public static void main(final String[] args) {\n final Main instance = new Main();\n sc = instance.new Scanner();\n instance.solve();\n }\n\n private class Scanner {\n String[] s;\n int i;\n BufferedReader br;\n String regex = \" \";\n\n public Scanner() {\n s = new String[0];\n i = 0;\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n @Override\n protected void finalize() throws Throwable {\n try {\n super.finalize();\n } finally {\n destruction();\n }\n }\n\n private void destruction() throws IOException {\n if (br != null)\n br.close();\n }\n\n public String next() throws IOException {\n if (i < s.length)\n return s[i++];\n String st = br.readLine();\n while (st == \"\")\n st = br.readLine();\n s = st.split(regex, 0);\n i = 0;\n return s[i++];\n }\n\n public int nextInt() throws NumberFormatException, IOException {\n return Integer.parseInt(next());\n }\n\n public Long nextLong() throws NumberFormatException, IOException {\n return Long.parseLong(next());\n }\n\n public Double nextDouble() throws NumberFormatException, IOException {\n return Double.parseDouble(next());\n }\n }\n\n private void solve() {\n try {\n\n int a = sc.nextInt();\n int b = sc.nextInt();\n\n if (a == 0) {\n System.out.println(b);\n\n } else if (a == 1) {\n System.out.println(b * 100);\n } else {\n System.out.println(b * 10000);\n }\n } catch (Exception e) {\n e.printStackTrace();\n }\n }\n\n}\n", "problem_context": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "sample_input": "0 5\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03324", "source_text": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2169, "cpu_time_ms": 72, "memory_kb": 22612}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s752853345", "group_id": "codeNet:p03324", "input_text": "import java.util.*;\nimport java.util.function.BiPredicate;\nimport java.util.function.BinaryOperator;\nimport java.util.stream.IntStream;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int inputD = Integer.parseInt(sc.next());\n int inputN = Integer.parseInt(sc.next());\n\n int[] arr = IntStream.range(1, 10000000)\n .filter(num -> calc(num,inputD)).toArray();\n System.out.println(arr[inputN -1]);\n }\n private static boolean calc(int x, int d) {\n int count = 0;\n int tmp = x;\n while (true) {\n if (tmp % 100 == 0) {\n count++;\n tmp = tmp/ 100;\n } else {\n break;\n }\n }\n if (count == d) {\n return true;\n } else {\n return false;\n }\n };\n}\n", "language": "Java", "metadata": {"date": 1586031780, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03324.html", "problem_id": "p03324", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03324/input.txt", "sample_output_relpath": "derived/input_output/data/p03324/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03324/Java/s752853345.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s752853345", "user_id": "u285237428"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.util.*;\nimport java.util.function.BiPredicate;\nimport java.util.function.BinaryOperator;\nimport java.util.stream.IntStream;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int inputD = Integer.parseInt(sc.next());\n int inputN = Integer.parseInt(sc.next());\n\n int[] arr = IntStream.range(1, 10000000)\n .filter(num -> calc(num,inputD)).toArray();\n System.out.println(arr[inputN -1]);\n }\n private static boolean calc(int x, int d) {\n int count = 0;\n int tmp = x;\n while (true) {\n if (tmp % 100 == 0) {\n count++;\n tmp = tmp/ 100;\n } else {\n break;\n }\n }\n if (count == d) {\n return true;\n } else {\n return false;\n }\n };\n}\n", "problem_context": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "sample_input": "0 5\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03324", "source_text": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 895, "cpu_time_ms": 278, "memory_kb": 131920}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s001002762", "group_id": "codeNet:p03324", "input_text": "import java.util.*;\npublic class Main{\n public static void main(String arg[]){\n Scanner sc=new Scanner(System.in);\n int a=sc.nextInt();\n int b=sc.nextInt();\n\tint c=0;\n\tint arr[]={1,100,10000,1000000};\n\tfor(int i=1;;i++){\n\t\tif((i%arr[a]==0)&&(i%arr[a+1]!=0))\n\t\t\tc++;\n\t\tif(c==b){\n\t\t\tSystem.out.println(i);\n\t\t\tbreak;\n\t\t}\n\t}\n\t\n }\n}", "language": "Java", "metadata": {"date": 1574932453, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03324.html", "problem_id": "p03324", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03324/input.txt", "sample_output_relpath": "derived/input_output/data/p03324/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03324/Java/s001002762.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s001002762", "user_id": "u379464460"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.util.*;\npublic class Main{\n public static void main(String arg[]){\n Scanner sc=new Scanner(System.in);\n int a=sc.nextInt();\n int b=sc.nextInt();\n\tint c=0;\n\tint arr[]={1,100,10000,1000000};\n\tfor(int i=1;;i++){\n\t\tif((i%arr[a]==0)&&(i%arr[a+1]!=0))\n\t\t\tc++;\n\t\tif(c==b){\n\t\t\tSystem.out.println(i);\n\t\t\tbreak;\n\t\t}\n\t}\n\t\n }\n}", "problem_context": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "sample_input": "0 5\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03324", "source_text": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 336, "cpu_time_ms": 108, "memory_kb": 22100}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s132210390", "group_id": "codeNet:p03324", "input_text": "import java.util.*;\npublic class Main {\n\tpublic static void myout(Object text){//standard output\n\t\tSystem.out.println(text);\n\t}\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\t//String tmp = sc.next();\n\t\t//int tmp = sc.nextInt();\n\t\t//Long tmp = sc.nextLong();\n int D = sc.nextInt();\n int N = sc.nextInt();\n int output = (int)Math.pow(100,D);\n myout(output * N);\n\t}\n}\n", "language": "Java", "metadata": {"date": 1569545899, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03324.html", "problem_id": "p03324", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03324/input.txt", "sample_output_relpath": "derived/input_output/data/p03324/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03324/Java/s132210390.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s132210390", "user_id": "u222822036"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n\tpublic static void myout(Object text){//standard output\n\t\tSystem.out.println(text);\n\t}\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\t//String tmp = sc.next();\n\t\t//int tmp = sc.nextInt();\n\t\t//Long tmp = sc.nextLong();\n int D = sc.nextInt();\n int N = sc.nextInt();\n int output = (int)Math.pow(100,D);\n myout(output * N);\n\t}\n}\n", "problem_context": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "sample_input": "0 5\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03324", "source_text": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 94, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s903624683", "group_id": "codeNet:p03324", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint d = sc.nextInt();\n\t\tint n = sc.nextInt();\n\n\t\tint x = 0;\n\t\tif (d == 0) {\n\t\t\tx = 1;\n\t\t} else if (d == 1) {\n\t\t\tx = 100;\n\t\t} else {\n\t\t\tx = 10000;\n\t\t}\n\n\t\tSystem.out.println(x*n);\n\n\t\tsc.close();\n\n\t}\n}", "language": "Java", "metadata": {"date": 1568740389, "filename_ext": "java", "original_language": "Java7 (OpenJDK 1.7.0)", "problem_description_relpath": "problem_descriptions/p03324.html", "problem_id": "p03324", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03324/input.txt", "sample_output_relpath": "derived/input_output/data/p03324/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03324/Java/s903624683.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s903624683", "user_id": "u362743886"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint d = sc.nextInt();\n\t\tint n = sc.nextInt();\n\n\t\tint x = 0;\n\t\tif (d == 0) {\n\t\t\tx = 1;\n\t\t} else if (d == 1) {\n\t\t\tx = 100;\n\t\t} else {\n\t\t\tx = 10000;\n\t\t}\n\n\t\tSystem.out.println(x*n);\n\n\t\tsc.close();\n\n\t}\n}", "problem_context": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "sample_input": "0 5\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03324", "source_text": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 100, "memory_kb": 22868}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s755675376", "group_id": "codeNet:p03324", "input_text": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int time = in.nextInt();\n int num = in.nextInt();\n in.close();\n int ans = (int)Math.pow(100, time) * num;\n System.out.println(ans);\n }\n}", "language": "Java", "metadata": {"date": 1559920057, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03324.html", "problem_id": "p03324", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03324/input.txt", "sample_output_relpath": "derived/input_output/data/p03324/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03324/Java/s755675376.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s755675376", "user_id": "u018916376"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int time = in.nextInt();\n int num = in.nextInt();\n in.close();\n int ans = (int)Math.pow(100, time) * num;\n System.out.println(ans);\n }\n}", "problem_context": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "sample_input": "0 5\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03324", "source_text": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 95, "memory_kb": 21972}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s449651527", "group_id": "codeNet:p03324", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main (String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint D = sc.nextInt();\n\t\tint N = sc.nextInt();\n\n\t\tif (D == 0 && N != 100) {\n\t\t\tSystem.out.println(N);\n\t\t} else if (D == 0 && N == 100){\n\t\t\tSystem.out.println(N + 1);\n\t\t} else if (D == 1 && N != 100){\n\t\t\tSystem.out.println(N * 100);\n\t\t} else if (D == 1 && N == 100){\n\t\t\tSystem.out.println((N + 1)* 100);\n\t\t} else if (D == 2 && N != 100){\n\t\t\tSystem.out.println(N * 10000);\n\t\t} else if (D == 2 && N == 100){\n\t\t\tSystem.out.println((N + 1)* 10000);\n\t\t}\n\n\t}\n}", "language": "Java", "metadata": {"date": 1557845724, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03324.html", "problem_id": "p03324", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03324/input.txt", "sample_output_relpath": "derived/input_output/data/p03324/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03324/Java/s449651527.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s449651527", "user_id": "u704373596"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main (String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint D = sc.nextInt();\n\t\tint N = sc.nextInt();\n\n\t\tif (D == 0 && N != 100) {\n\t\t\tSystem.out.println(N);\n\t\t} else if (D == 0 && N == 100){\n\t\t\tSystem.out.println(N + 1);\n\t\t} else if (D == 1 && N != 100){\n\t\t\tSystem.out.println(N * 100);\n\t\t} else if (D == 1 && N == 100){\n\t\t\tSystem.out.println((N + 1)* 100);\n\t\t} else if (D == 2 && N != 100){\n\t\t\tSystem.out.println(N * 10000);\n\t\t} else if (D == 2 && N == 100){\n\t\t\tSystem.out.println((N + 1)* 10000);\n\t\t}\n\n\t}\n}", "problem_context": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "sample_input": "0 5\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03324", "source_text": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 94, "memory_kb": 23764}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s919867213", "group_id": "codeNet:p03324", "input_text": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint d = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tSystem.out.println((int)(n+n/100)*(Math.pow(100,d)));\n\t}\n}\n", "language": "Java", "metadata": {"date": 1553948673, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03324.html", "problem_id": "p03324", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03324/input.txt", "sample_output_relpath": "derived/input_output/data/p03324/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03324/Java/s919867213.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s919867213", "user_id": "u622400537"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint d = sc.nextInt();\n\t\tint n = sc.nextInt();\n\t\tSystem.out.println((int)(n+n/100)*(Math.pow(100,d)));\n\t}\n}\n", "problem_context": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "sample_input": "0 5\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03324", "source_text": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 96, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s672236082", "group_id": "codeNet:p03324", "input_text": "/*\n......................................................................................................................................\n..................................... ________ ____ __________________________________________ .....................................\n..................................... / _____/| | \\ \\__ ___/\\_ _____/\\______ \\.....................................\n...................................../ \\ ___| | / | \\| | | __)_ | _/.....................................\n.....................................\\ \\_\\ \\ | / | \\ | | \\ | | \\.....................................\n..................................... \\______ /______/\\____|__ /____| /_______ / |____|_ /.....................................\n..................................... \\/ \\/ \\/ \\/ .....................................\n......................................................................................................................................\n.............................................................,;'';:...................................................................\n........................................................+@@@@@@@@@@@@@@'..............................................................\n.....................................................#@@@##############@@@:...........................................................\n...................................................@@@####################@@,.........................................................\n.................................................@@#########################@@........................................................\n...............................................:@############################@@.......................................................\n..............................................@@######@@@#';;'#@@@############@@:.....................................................\n.............................................@#####@@,````````````,@@###########@:....................................................\n............................................@####@;``````````````````+@##########@....................................................\n...........................................@###@:``````````````````````#@########@@...................................................\n..........................................@####``````````````````````````@########@@..................................................\n.........................................###@.````````````````````````````@########@+.................................................\n.........................................@#@```````````````````````````````#########@.................................................\n........................................@#@`````````````````````````````````########@@................................................\n.......................................,@@```````````````````````````````````@#######@:...............................................\n.......................................@@`````````````````````````````````````@#######@...............................................\n.......................................@:````````````````````#@@'``````````````@######@+..............................................\n......................................#@```````````````````@@@@@@@#````````````########@..............................................\n......................................@```````````````````@@@@@@@@@@````````````@######@+.............................................\n......................................@``````````````````@@@@@@@+ +```````````+#######@.............................................\n.....................................;:``````````````````@@@@@@@ @````````````@######@'............................................\n.....................................@``````````````````:@@@@@@@ @````````````@#######@............................................\n.....................................@```,@@@#``````````;@@@@@@@ @````````````:#######@:...........................................\n.....................................@``@@@@@@@@````````.@@@@@@@# ,#`````````````@#######@...........................................\n.....................................@`@@@@@@@+'@````````@@@@@@@@@@@``````````````@#######@...........................................\n.....................................@,@@@@@@ ,```:+:``:@@@@@@@@@.``````````````@########@..........................................\n.....................................#@@@@@@@ ;@@#;,,,@``:@@@@@@@````````````````#########@..........................................\n.....................................+@@@@@@@@',,,,,,,,;,```.'+;``````````````````'########@;.........................................\n.....................................'@@@@',,,,,,,,,,,,,@`````````````````````````:#########@.........................................\n....................................:@#,,,,,:;;;;;:,,,,,@`````````````````````````.#########@.........................................\n.................................:@#@@@@#++';;;;;;;;;;;;@``````````````````````````##########+........................................\n...............................#@#+;;;;;;;;;;;;;;;;;;;;':``````````````````````````##########@........................................\n....................................,@#@@@@@#+'';;;;;+@#```````````````````````````##########@........................................\n.....................................@``````````.,,,.``````````````````````````````############.......................................\n.....................................@`````````````````````````````````````````````#######+'+#@.......................................\n.....................................@`````````````````````````````````````````````##########'@.......................................\n.....................................#`````````````````````````````````````````````############@#.....................................\n.....................................:.````````````````````````````````````````````##############@,...................................\n......................................+```````````````````````````````````````````.###############@#..................................\n......................................@```````````````````````````````````````````.################@@.................................\n......................................@```````````````````````````````````````````.###+##############@................................\n......................................@```````````````````````````````````````````.###+###############@...............................\n......................................',``````````````````````````````````````````.####'##############@@..............................\n.......................................@```````````````````````````````````````````#####+##############@:.............................\n.......................................@```````````````````````````````````````````#####'###############@.............................\n.......................................@```````````````````````````````````````````######'################............................\n.......................................#,``````````````````````````````````````````#######'##############@............................\n........................................@``````````````````````````````````````````@######++##############+...........................\n........................................@``````````````````````````````````````````@#######'##############@...........................\n........................................@``````````````````````````````````````````@########'#############@...........................\n.......................................@#'`````````````````````````````````````````@#########'##############..........................\n.......................................@#@`````````````````````````````````````````+#########+'############@..........................\n......................................@##@`````````````````````````````````````````.##########+'###########@..........................\n......................................@##@:`````````````````````````````````````````###########+'###########..........................\n.....................................:@###@`````````````````````````````````````````@###########+'+#########,.........................\n.....................................@####@`````````````````````````````````````````@#############''########..........................\n.....................................@####@.````````````````````````````````````````;##############+'######@..........................\n.....................................@#####@`````````````````````````````````````````################@@@###+..........................\n.....................................@#####@`````````````````````````````````````````@###############@..;;............................\n....................................,@#####@.````````````````````````````````````````+################'...............................\n....................................:#######@`````````````````````````````````````````################@...............................\n....................................:#######@`````````````````````````````````````````@###############@...............................\n....................................,@#######,````````````````````````````````````````:###############@...............................\n.....................................@######@@`````````````````````````````````````````@##############@...............................\n.....................................@######@@`````````````````````````````````````````+##############@...............................\n.....................................@#####@,;;`````````````````````````````````````````@#############@...............................\n.....................................@####@@..@`````````````````````````````````````````+#############@...............................\n.....................................,####@...@``````````````````````````````````````````@############+...............................\n......................................@##@.....@`````````````````````````````````````````:###########@,...............................\n.......................................@+......@``````````````````````````````````````````@##########@................................\n...............................................:#``````````````````````````````````````````##########@................................\n................................................@``````````````````````````````````````````+########@,................................\n................................................'+``````````````````````````````````````````@#######@.................................\n.................................................@```````````````````````````````````````````@#####@:.................................\n.................................................'#``````````````````````````````````````````.#####@..................................\n..................................................@```````````````````````````````````````````;###@...................................\n...................................................@```````````````````````````````````````````+#@'...................................\n...................................................'#```````````````````````````````````````````@#....................................\n....................................................##`````````````````````````````````````````@#.....................................\n.....................................................#@```````````````````````````````````````@+......................................\n......................................................:@;```````````````````````````````````;@,.......................................\n.......................................................;@@'```````````````````````````````:@@+;.......................................\n.......................................................@,,'@@'``````````````````````````@@@,,,@.......................................\n......................................................@,,,,,,'@@@@;````````````````.+@@@;,,,,,@.......................................\n......................................................#@+@,,,,,,,,+@@@@@@@@@@@@@@@@@;,,,,,'@@@........................................\n.........................................................+,,,#',,@@..............@,,,,,,,,@...........................................\n..........................................................@@@,#@@,...............:+,,,'@,,@...........................................\n..................................................................................@,,,@.##............................................\n...................................................................................@;@................................................\n....................................................................................:.................................................\n......................................................................................................................................\n......................................................................................................................................\n */\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.math.BigInteger;\nimport java.util.*;\nimport java.util.List;\nimport java.util.stream.Collectors;\nimport java.util.stream.IntStream;\nimport java.util.stream.Stream;\n\nimport static java.lang.Math.max;\nimport static java.lang.Math.min;\nimport static java.lang.Math.pow;\nimport static java.lang.Math.abs;\n\nimport static java.lang.String.format;\n\n\npublic class Main {\n final static int INF = Integer.MAX_VALUE>>1;\n final static int MOD = 1_000_000_007;\n final static int[] dx4 = { 0, 1, 0, -1 };\n final static int[] dy4 = { 1, 0, -1, 0 };\n final static int[] dx8 = {0, 1, 1, 1, 0, -1, -1, -1};\n final static int[] dy8 = {1, 1, 0, -1, -1, -1, 0, 1};\n public static void main(String[] args) {\n Scanner sc=new Scanner();\n int d=sc.nextInt();\n int n=sc.nextInt();\n int count=0;\n for(int i=1;i Integer.MAX_VALUE)\n throw new NumberFormatException();\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n }\n final static private class FixedIntPair {\n final public int x, y;\n final static public FixedIntPair ZEROS=new FixedIntPair(0,0);\n FixedIntPair(int x, int y) {\n this.x = x;\n this.y = y;\n }\n public static double distance(FixedIntPair fip1,FixedIntPair fip2){\n double x = (double) fip1.x - fip2.x;\n double y = (double) fip1.y - fip2.y;\n return Math.sqrt(x*x+y*y);\n }\n\n @Override\n public int hashCode() {\n return x+y;\n }\n\n @Override\n public boolean equals(Object obj) {\n boolean result=super.equals(obj);\n if(obj.getClass()!=this.getClass()){\n return false;\n }\n FixedIntPair pair=(FixedIntPair) obj;\n if(this.x==pair.x&&this.y==pair.y) return true;\n return false;\n }\n\n @Override\n public String toString() {\n return String.format(FixedIntPair.class.getSimpleName()+\":(%d,%d)\", x, y);\n }\n }\n final static private class FixedLongPair {\n final public long x, y;\n final static public FixedLongPair ZEROS=new FixedLongPair(0,0);\n FixedLongPair(long x, long y) {\n this.x = x;\n this.y = y;\n }\n public static double distance(FixedLongPair flp1,FixedLongPair flp2){\n double x = (double) flp1.x - flp2.x;\n double y = (double) flp1.y - flp2.y;\n return Math.sqrt(x*x+y*y);\n }\n\n @Override\n public int hashCode() {\n return (int)x+(int)y;\n }\n\n @Override\n public boolean equals(Object obj) {\n boolean result=super.equals(obj);\n if(obj.getClass()!=this.getClass()){\n return false;\n }\n FixedLongPair pair=(FixedLongPair)obj;\n if(this.x==pair.x&&this.y==pair.y) return true;\n return false;\n }\n\n @Override\n public String toString() {\n return String.format(FixedLongPair.class.getSimpleName()+\":(%d,%d)\", x, y);\n }\n }\n final static private class Binary{\n public static String toZeroPadding(int i){\n return String.format(\"%\"+Integer.toBinaryString(-1).length()+\"s\",Integer.toBinaryString(i)).replace(' ','0');\n }\n public static String toZeroPadding(long i){\n return String.format(\"%\"+Long.toBinaryString(-1).length()+\"s\",Long.toBinaryString(i)).replace(' ','0');\n }\n }\n\n final static private class Util {\n static long gcd(long a,long b){\n //最大公約数 \n if(a%b==0)return b;\n return gcd(b,a%b);\n }\n static long lcm(long a,long b){\n //最小公倍数\n long gcd=gcd(a,b);\n long result=b/gcd;\n return a*result;\n }\n static > Map count(List list){\n //副作用\n Collections.sort(list);\n Map result=new HashMap<>();\n int l=0,r=0;\n while(l count(int[] array){\n //副作用\n Arrays.sort(array);\n Map result=new HashMap<>();\n int l=0,r=0;\n while(l String toStringBWS(Iterable iterable){\n Iterator ite=iterable.iterator();\n return toStringBWS(ite);\n }\n static String toStringBWS(Iterator ite){\n StringBuilder sb=new StringBuilder();\n sb.append(ite.next());\n while(ite.hasNext()){\n sb.append(\" \");\n sb.append(ite.next());\n }\n return sb.toString();\n }\n static long factoringInPrimeNumbers(long n,int[] a){\n //素因数分解\n for(int i=2;n>1&&i< a.length;i++){\n while(n%i==0){\n a[i]++;\n n/=i;\n }\n }\n return n;\n\n }\n static boolean isValidCell(int i,int j,int h,int w){\n return i>=0&&i=0&&j>1;\n final static int MOD = 1_000_000_007;\n final static int[] dx4 = { 0, 1, 0, -1 };\n final static int[] dy4 = { 1, 0, -1, 0 };\n final static int[] dx8 = {0, 1, 1, 1, 0, -1, -1, -1};\n final static int[] dy8 = {1, 1, 0, -1, -1, -1, 0, 1};\n public static void main(String[] args) {\n Scanner sc=new Scanner();\n int d=sc.nextInt();\n int n=sc.nextInt();\n int count=0;\n for(int i=1;i Integer.MAX_VALUE)\n throw new NumberFormatException();\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n }\n final static private class FixedIntPair {\n final public int x, y;\n final static public FixedIntPair ZEROS=new FixedIntPair(0,0);\n FixedIntPair(int x, int y) {\n this.x = x;\n this.y = y;\n }\n public static double distance(FixedIntPair fip1,FixedIntPair fip2){\n double x = (double) fip1.x - fip2.x;\n double y = (double) fip1.y - fip2.y;\n return Math.sqrt(x*x+y*y);\n }\n\n @Override\n public int hashCode() {\n return x+y;\n }\n\n @Override\n public boolean equals(Object obj) {\n boolean result=super.equals(obj);\n if(obj.getClass()!=this.getClass()){\n return false;\n }\n FixedIntPair pair=(FixedIntPair) obj;\n if(this.x==pair.x&&this.y==pair.y) return true;\n return false;\n }\n\n @Override\n public String toString() {\n return String.format(FixedIntPair.class.getSimpleName()+\":(%d,%d)\", x, y);\n }\n }\n final static private class FixedLongPair {\n final public long x, y;\n final static public FixedLongPair ZEROS=new FixedLongPair(0,0);\n FixedLongPair(long x, long y) {\n this.x = x;\n this.y = y;\n }\n public static double distance(FixedLongPair flp1,FixedLongPair flp2){\n double x = (double) flp1.x - flp2.x;\n double y = (double) flp1.y - flp2.y;\n return Math.sqrt(x*x+y*y);\n }\n\n @Override\n public int hashCode() {\n return (int)x+(int)y;\n }\n\n @Override\n public boolean equals(Object obj) {\n boolean result=super.equals(obj);\n if(obj.getClass()!=this.getClass()){\n return false;\n }\n FixedLongPair pair=(FixedLongPair)obj;\n if(this.x==pair.x&&this.y==pair.y) return true;\n return false;\n }\n\n @Override\n public String toString() {\n return String.format(FixedLongPair.class.getSimpleName()+\":(%d,%d)\", x, y);\n }\n }\n final static private class Binary{\n public static String toZeroPadding(int i){\n return String.format(\"%\"+Integer.toBinaryString(-1).length()+\"s\",Integer.toBinaryString(i)).replace(' ','0');\n }\n public static String toZeroPadding(long i){\n return String.format(\"%\"+Long.toBinaryString(-1).length()+\"s\",Long.toBinaryString(i)).replace(' ','0');\n }\n }\n\n final static private class Util {\n static long gcd(long a,long b){\n //最大公約数 \n if(a%b==0)return b;\n return gcd(b,a%b);\n }\n static long lcm(long a,long b){\n //最小公倍数\n long gcd=gcd(a,b);\n long result=b/gcd;\n return a*result;\n }\n static > Map count(List list){\n //副作用\n Collections.sort(list);\n Map result=new HashMap<>();\n int l=0,r=0;\n while(l count(int[] array){\n //副作用\n Arrays.sort(array);\n Map result=new HashMap<>();\n int l=0,r=0;\n while(l String toStringBWS(Iterable iterable){\n Iterator ite=iterable.iterator();\n return toStringBWS(ite);\n }\n static String toStringBWS(Iterator ite){\n StringBuilder sb=new StringBuilder();\n sb.append(ite.next());\n while(ite.hasNext()){\n sb.append(\" \");\n sb.append(ite.next());\n }\n return sb.toString();\n }\n static long factoringInPrimeNumbers(long n,int[] a){\n //素因数分解\n for(int i=2;n>1&&i< a.length;i++){\n while(n%i==0){\n a[i]++;\n n/=i;\n }\n }\n return n;\n\n }\n static boolean isValidCell(int i,int j,int h,int w){\n return i>=0&&i=0&&j void output(List list) {\n\n\t\tfor (int i = 0; i < list.size(); i++) {\n\t\t\tSystem.out.print(list.get(i));\n\n\t\t\tif (i != list.size() - 1) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t} else {\n\t\t\t\tnl();\n\t\t\t}\n\t\t}\n\n\t}\n\n\tstatic void output(String[][] str) {\n\n\t\tfor (int i = 0; i < str.length; i++) {\n\t\t\tfor (int j = 0; j < str[i].length; j++) {\n\t\t\t\tprint(str[i][j]);\n\t\t\t}\n\n\t\t\tnl();\n\t\t}\n\n\t}\n\n\tstatic void output(boolean flg, String Yes, String No) {\n\n\t\tif (flg) {\n\t\t\tpln(Yes);\n\t\t} else {\n\t\t\tpln(No);\n\t\t}\n\n\t}\n\n\tstatic void output(String[][] str, int digit) {\n\n\t\tString dig = \"%\" + String.valueOf(digit) + \"s\";\n\n\t\tfor (int i = 0; i < str.length; i++) {\n\t\t\tfor (int j = 0; j < str[i].length; j++) {\n\t\t\t\tSystem.out.printf(dig, str[i][j]);\n\t\t\t}\n\t\t\tnl();\n\t\t}\n\n\t}\n\n\tstatic void pln(String str) {\n\t\tSystem.out.println(str);\n\t}\n\n\tstatic void pln(int x) {\n\t\tSystem.out.println(x);\n\t}\n\n\tstatic void print(String str) {\n\t\tSystem.out.print(str);\n\t}\n\n\tstatic void print(int x) {\n\t\tSystem.out.print(x);\n\t}\n\n\tstatic void print(String str, int times) {\n\t\tfor (int i = 0; i < times; i++) {\n\t\t\tprint(str);\n\t\t}\n\t}\n\n\tstatic void print(int x, int times) {\n\t\tfor (int i = 0; i < times; i++) {\n\t\t\tprint(x);\n\t\t}\n\t}\n\n\tstatic void nl() {\n\t\tSystem.out.println();\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1531177632, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03324.html", "problem_id": "p03324", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03324/input.txt", "sample_output_relpath": "derived/input_output/data/p03324/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03324/Java/s039728002.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s039728002", "user_id": "u874996917"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tMain main = new Main();\n\t\tmain.run();\n\t}\n\n\tvoid run() {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint D = sc.nextInt();\n\t\tint N = sc.nextInt();\n\n\t\tint q=(N-1)/99;\n\n\t\tint base=0;\n\t\tif(D==0) {\n\t\t\tbase=1;\n\t\t}else if(D==1) {\n\t\t\tbase=100;\n\t\t}else {\n\t\t\tbase=100*100;\n\t\t}\n\n\t\tint ans=(N+q)*base;\n\t\tSystem.out.println(ans);\n\t}\n\n\t//以下テンプレート\n\n\tpublic static int[] extgcd(int a, int b) {\n\n\t\tint x0 = 1;\n\t\tint x1 = 0;\n\n\t\tint y0 = 0;\n\t\tint y1 = 1;\n\n\t\twhile (b != 0) {\n\t\t\tint q = a / b;\n\t\t\tint r = a % b;\n\n\t\t\tint x2 = x0 - q * x1;\n\t\t\tint y2 = y0 - q * y1;\n\n\t\t\ta = b;\n\t\t\tb = r;\n\n\t\t\tx0 = x1;\n\t\t\tx1 = x2;\n\n\t\t\ty0 = y1;\n\t\t\ty1 = y2;\n\t\t}\n\n\t\treturn new int[] { a, x0, y0 };\n\n\t}\n\n\tstatic int gcd(int a, int b) {\n\n\t\tif (b == 0)\n\t\t\treturn a;\n\n\t\tif (a < b) {\n\t\t\tint t = a;\n\t\t\ta = b;\n\t\t\tb = t;\n\t\t}\n\n\t\treturn gcd(b, a % b);\n\n\t}\n\n\tstatic int lcm(int a, int b) {\n\t\treturn a * b / gcd(a, b);\n\t}\n\n\tstatic void swap(int[] a) {\n\t\tint t;\n\n\t\tt = a[0];\n\t\ta[0] = a[1];\n\t\ta[1] = t;\n\n\t\treturn;\n\t}\n\n\tstatic void output(List list) {\n\n\t\tfor (int i = 0; i < list.size(); i++) {\n\t\t\tSystem.out.print(list.get(i));\n\n\t\t\tif (i != list.size() - 1) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t} else {\n\t\t\t\tnl();\n\t\t\t}\n\t\t}\n\n\t}\n\n\tstatic void output(String[][] str) {\n\n\t\tfor (int i = 0; i < str.length; i++) {\n\t\t\tfor (int j = 0; j < str[i].length; j++) {\n\t\t\t\tprint(str[i][j]);\n\t\t\t}\n\n\t\t\tnl();\n\t\t}\n\n\t}\n\n\tstatic void output(boolean flg, String Yes, String No) {\n\n\t\tif (flg) {\n\t\t\tpln(Yes);\n\t\t} else {\n\t\t\tpln(No);\n\t\t}\n\n\t}\n\n\tstatic void output(String[][] str, int digit) {\n\n\t\tString dig = \"%\" + String.valueOf(digit) + \"s\";\n\n\t\tfor (int i = 0; i < str.length; i++) {\n\t\t\tfor (int j = 0; j < str[i].length; j++) {\n\t\t\t\tSystem.out.printf(dig, str[i][j]);\n\t\t\t}\n\t\t\tnl();\n\t\t}\n\n\t}\n\n\tstatic void pln(String str) {\n\t\tSystem.out.println(str);\n\t}\n\n\tstatic void pln(int x) {\n\t\tSystem.out.println(x);\n\t}\n\n\tstatic void print(String str) {\n\t\tSystem.out.print(str);\n\t}\n\n\tstatic void print(int x) {\n\t\tSystem.out.print(x);\n\t}\n\n\tstatic void print(String str, int times) {\n\t\tfor (int i = 0; i < times; i++) {\n\t\t\tprint(str);\n\t\t}\n\t}\n\n\tstatic void print(int x, int times) {\n\t\tfor (int i = 0; i < times; i++) {\n\t\t\tprint(x);\n\t\t}\n\t}\n\n\tstatic void nl() {\n\t\tSystem.out.println();\n\t}\n\n}\n", "problem_context": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "sample_input": "0 5\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03324", "source_text": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2320, "cpu_time_ms": 102, "memory_kb": 21716}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s852572132", "group_id": "codeNet:p03324", "input_text": "import java.util.Scanner;\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int d = sc.nextInt(),\n n = sc.nextInt();\n if(d == 0)\n System.out.println(n);\n else{\n int p = 1;\n for(int j = 0; j < d; j++)\n p *= 100;\n if(d == 100)\n System.out.println(p * n + p);\n else\n System.out.println(p * n);\n \n }\n }\n}", "language": "Java", "metadata": {"date": 1530398737, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03324.html", "problem_id": "p03324", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03324/input.txt", "sample_output_relpath": "derived/input_output/data/p03324/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03324/Java/s852572132.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s852572132", "user_id": "u003018968"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.util.Scanner;\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int d = sc.nextInt(),\n n = sc.nextInt();\n if(d == 0)\n System.out.println(n);\n else{\n int p = 1;\n for(int j = 0; j < d; j++)\n p *= 100;\n if(d == 100)\n System.out.println(p * n + p);\n else\n System.out.println(p * n);\n \n }\n }\n}", "problem_context": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "sample_input": "0 5\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03324", "source_text": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 424, "cpu_time_ms": 97, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s041718901", "group_id": "codeNet:p03324", "input_text": "import java.util.Scanner;\n\nclass Main{\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint A = scan.nextInt();\n\t\tint B = scan.nextInt();\n\t\tif(A == 0){\n\t\t\tSystem.out.println(B);\n\t\t}else{\n\t\tint x = (int)Math.pow(100.0, (double)A);\n\t\tSystem.out.println(x*B);\n\t\t}\n\n\t}\n\n\n\n\n\n}", "language": "Java", "metadata": {"date": 1529555819, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03324.html", "problem_id": "p03324", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03324/input.txt", "sample_output_relpath": "derived/input_output/data/p03324/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03324/Java/s041718901.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s041718901", "user_id": "u632953742"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.util.Scanner;\n\nclass Main{\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint A = scan.nextInt();\n\t\tint B = scan.nextInt();\n\t\tif(A == 0){\n\t\t\tSystem.out.println(B);\n\t\t}else{\n\t\tint x = (int)Math.pow(100.0, (double)A);\n\t\tSystem.out.println(x*B);\n\t\t}\n\n\t}\n\n\n\n\n\n}", "problem_context": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "sample_input": "0 5\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03324", "source_text": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 93, "memory_kb": 23764}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s214619641", "group_id": "codeNet:p03324", "input_text": "import java.io.ByteArrayInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.InputMismatchException;\nimport java.util.Random;\n\npublic class Main\n{\n\tInputStream is;\n\tPrintWriter out;\n\tString INPUT = \"\";\n\t\n\tvoid solve()\n\t{\n\t\tint D = ni(), N = ni();\n\t\tif(D == 0) {\n\t\t\t//if(N == 100) {\n\t\t\t\t//out.println(101);\n\t\t\t//}\n\t\t\t//else {\n\t\t\t\tout.println(N);\n\t\t//\t}\n\t\t}\n\t\telse if(D == 1) {\n\t\t\tout.println(N*100);\n\t\t}\n\t\telse if(D == 2) {\n\t\t\tout.println(N*10000);\n\t\t}\n\t}\n\t\t\t\t\t\t\n\tvoid run() throws Exception\n\t{\n\t\tis = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());\n\t\tout = new PrintWriter(System.out);\n\t\t\n\t\tlong s = System.currentTimeMillis();\n\t\tsolve();\n\t\tout.flush();\n\t\tif(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+\"ms\");\n\t}\n\t\n\tpublic static void main(String[] args) throws Exception \n\t{ new Main().run(); }\n\t\n\tprivate byte[] inbuf = new byte[1024];\n\tpublic int lenbuf = 0, ptrbuf = 0;\n\t\n\tprivate int readByte()\n\t{\n\t\tif(lenbuf == -1)throw new InputMismatchException();\n\t\tif(ptrbuf >= lenbuf)\n\t\t{\n\t\t\tptrbuf = 0;\n\t\t\ttry \n\t\t\t{ lenbuf = is.read(inbuf); } \n\t\t\tcatch (IOException e) \n\t\t\t{ throw new InputMismatchException(); }\n\t\t\tif(lenbuf <= 0)return -1;\n\t\t}\n\t\treturn inbuf[ptrbuf++];\n\t}\n\t\n\tprivate boolean isSpaceChar(int c)\n\t{ return !(c >= 33 && c <= 126); }\n\tprivate int skip() \n\t{ int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }\n\t\n\tprivate double nd() \n\t{ return Double.parseDouble(ns()); }\n\tprivate char nc()\n\t{ return (char)skip(); }\n\t\n\tprivate String ns()\n\t{\n\t\tint b = skip();\n\t\tStringBuilder sb = new StringBuilder();\n\t\twhile(!(isSpaceChar(b)))\n\t\t{ // when nextLine, (isSpaceChar(b) && b != ' ')\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\t\n\tprivate String nsl()\n\t{\n\t\tint b = skip();\n\t\tStringBuilder sb = new StringBuilder();\n\t\twhile(!(isSpaceChar(b) && b != ' '))\n\t\t{ // when nextLine, (isSpaceChar(b) && b != ' ')\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\t\n\tprivate char[] ns(int n)\n\t{\n\t\tchar[] buf = new char[n];\n\t\tint b = skip(), p = 0;\n\t\twhile(p < n && !(isSpaceChar(b)))\n\t\t{\n\t\t\tbuf[p++] = (char)b;\n\t\t\tb = readByte();\n\t\t}\n\t\treturn n == p ? buf : Arrays.copyOf(buf, p);\n\t}\n\t\n\tprivate char[][] nm(int n, int m)\n\t{\n\t\tchar[][] map = new char[n][];\n\t\tfor(int i = 0;i < n;i++)map[i] = ns(m);\n\t\treturn map;\n\t}\n\t\n\tprivate int[] na(int n)\n\t{\n\t\tint[] a = new int[n];\n\t\tfor(int i = 0;i < n;i++)a[i] = ni();\n\t\treturn a;\n\t}\n\t\n\tprivate int ni()\n\t{\n\t\tint num = 0, b;\n\t\tboolean minus = false;\n\t\twhile((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));\n\t\tif(b == '-')\n\t\t{\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\t\n\t\twhile(true)\n\t\t{\n\t\t\tif(b >= '0' && b <= '9')\n\t\t\t{\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t}else\n\t\t\t{\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\t\n\tprivate long nl()\n\t{\n\t\tlong num = 0;\n\t\tint b;\n\t\tboolean minus = false;\n\t\twhile((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));\n\t\tif(b == '-')\n\t\t{\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\t\n\t\twhile(true){\n\t\t\tif(b >= '0' && b <= '9')\n\t\t\t{\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t}else\n\t\t\t{\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\t\n\tprivate static void tr(Object... o) \n\t{ System.out.println(Arrays.deepToString(o)); }\n}\n", "language": "Java", "metadata": {"date": 1529340675, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03324.html", "problem_id": "p03324", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03324/input.txt", "sample_output_relpath": "derived/input_output/data/p03324/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03324/Java/s214619641.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s214619641", "user_id": "u781719273"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.io.ByteArrayInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.InputMismatchException;\nimport java.util.Random;\n\npublic class Main\n{\n\tInputStream is;\n\tPrintWriter out;\n\tString INPUT = \"\";\n\t\n\tvoid solve()\n\t{\n\t\tint D = ni(), N = ni();\n\t\tif(D == 0) {\n\t\t\t//if(N == 100) {\n\t\t\t\t//out.println(101);\n\t\t\t//}\n\t\t\t//else {\n\t\t\t\tout.println(N);\n\t\t//\t}\n\t\t}\n\t\telse if(D == 1) {\n\t\t\tout.println(N*100);\n\t\t}\n\t\telse if(D == 2) {\n\t\t\tout.println(N*10000);\n\t\t}\n\t}\n\t\t\t\t\t\t\n\tvoid run() throws Exception\n\t{\n\t\tis = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());\n\t\tout = new PrintWriter(System.out);\n\t\t\n\t\tlong s = System.currentTimeMillis();\n\t\tsolve();\n\t\tout.flush();\n\t\tif(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+\"ms\");\n\t}\n\t\n\tpublic static void main(String[] args) throws Exception \n\t{ new Main().run(); }\n\t\n\tprivate byte[] inbuf = new byte[1024];\n\tpublic int lenbuf = 0, ptrbuf = 0;\n\t\n\tprivate int readByte()\n\t{\n\t\tif(lenbuf == -1)throw new InputMismatchException();\n\t\tif(ptrbuf >= lenbuf)\n\t\t{\n\t\t\tptrbuf = 0;\n\t\t\ttry \n\t\t\t{ lenbuf = is.read(inbuf); } \n\t\t\tcatch (IOException e) \n\t\t\t{ throw new InputMismatchException(); }\n\t\t\tif(lenbuf <= 0)return -1;\n\t\t}\n\t\treturn inbuf[ptrbuf++];\n\t}\n\t\n\tprivate boolean isSpaceChar(int c)\n\t{ return !(c >= 33 && c <= 126); }\n\tprivate int skip() \n\t{ int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }\n\t\n\tprivate double nd() \n\t{ return Double.parseDouble(ns()); }\n\tprivate char nc()\n\t{ return (char)skip(); }\n\t\n\tprivate String ns()\n\t{\n\t\tint b = skip();\n\t\tStringBuilder sb = new StringBuilder();\n\t\twhile(!(isSpaceChar(b)))\n\t\t{ // when nextLine, (isSpaceChar(b) && b != ' ')\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\t\n\tprivate String nsl()\n\t{\n\t\tint b = skip();\n\t\tStringBuilder sb = new StringBuilder();\n\t\twhile(!(isSpaceChar(b) && b != ' '))\n\t\t{ // when nextLine, (isSpaceChar(b) && b != ' ')\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\t\n\tprivate char[] ns(int n)\n\t{\n\t\tchar[] buf = new char[n];\n\t\tint b = skip(), p = 0;\n\t\twhile(p < n && !(isSpaceChar(b)))\n\t\t{\n\t\t\tbuf[p++] = (char)b;\n\t\t\tb = readByte();\n\t\t}\n\t\treturn n == p ? buf : Arrays.copyOf(buf, p);\n\t}\n\t\n\tprivate char[][] nm(int n, int m)\n\t{\n\t\tchar[][] map = new char[n][];\n\t\tfor(int i = 0;i < n;i++)map[i] = ns(m);\n\t\treturn map;\n\t}\n\t\n\tprivate int[] na(int n)\n\t{\n\t\tint[] a = new int[n];\n\t\tfor(int i = 0;i < n;i++)a[i] = ni();\n\t\treturn a;\n\t}\n\t\n\tprivate int ni()\n\t{\n\t\tint num = 0, b;\n\t\tboolean minus = false;\n\t\twhile((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));\n\t\tif(b == '-')\n\t\t{\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\t\n\t\twhile(true)\n\t\t{\n\t\t\tif(b >= '0' && b <= '9')\n\t\t\t{\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t}else\n\t\t\t{\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\t\n\tprivate long nl()\n\t{\n\t\tlong num = 0;\n\t\tint b;\n\t\tboolean minus = false;\n\t\twhile((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));\n\t\tif(b == '-')\n\t\t{\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\t\n\t\twhile(true){\n\t\t\tif(b >= '0' && b <= '9')\n\t\t\t{\n\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t}else\n\t\t\t{\n\t\t\t\treturn minus ? -num : num;\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\t\n\tprivate static void tr(Object... o) \n\t{ System.out.println(Arrays.deepToString(o)); }\n}\n", "problem_context": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "sample_input": "0 5\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03324", "source_text": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3331, "cpu_time_ms": 69, "memory_kb": 23252}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s791571599", "group_id": "codeNet:p03324", "input_text": "import java.util.*;\nimport java.lang.*;\nimport java.io.*;\nimport java.math.BigDecimal;\n\npublic class Main{\n public static void main (String[] args) throws java.lang.Exception {\n InputReader in = new InputReader(System.in);\n PrintWriter w = new PrintWriter(System.out);\n int n = in.nextInt(), d = in.nextInt();\n int temp = (int)Math.pow(100, n), ans = 0;\n \n while (d-- > 0)\n ans += temp;\n w.println(ans);\n w.close();\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1)\n throw new UnknownError();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new UnknownError();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public int peek() {\n if (numChars == -1)\n return -1;\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n return -1;\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar];\n }\n\n public void skip(int x) {\n while (x-- > 0)\n read();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public String nextString() {\n return next();\n }\n\n public String next() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuffer res = new StringBuffer();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isSpaceChar(c));\n\n return res.toString();\n }\n\n public String nextLine() {\n StringBuffer buf = new StringBuffer();\n int c = read();\n while (c != '\\n' && c != -1) {\n if (c != '\\r')\n buf.appendCodePoint(c);\n c = read();\n }\n return buf.toString();\n }\n\n public double nextDouble() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n double res = 0;\n while (!isSpaceChar(c) && c != '.') {\n if (c == 'e' || c == 'E')\n return res * Math.pow(10, nextInt());\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n }\n if (c == '.') {\n c = read();\n double m = 1;\n while (!isSpaceChar(c)) {\n if (c == 'e' || c == 'E')\n return res * Math.pow(10, nextInt());\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n m /= 10;\n res += (c - '0') * m;\n c = read();\n }\n }\n return res * sgn;\n }\n public int[] nextIntArray(int n) {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n return a;\n }\n public long[] nextLongArray(int n) {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = nextLong();\n return a;\n }\n public boolean hasNext() {\n int value;\n while (isSpaceChar(value = peek()) && value != -1)\n read();\n return value != -1;\n }\n\n private boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n }\n}", "language": "Java", "metadata": {"date": 1529208304, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03324.html", "problem_id": "p03324", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03324/input.txt", "sample_output_relpath": "derived/input_output/data/p03324/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03324/Java/s791571599.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s791571599", "user_id": "u616866689"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.util.*;\nimport java.lang.*;\nimport java.io.*;\nimport java.math.BigDecimal;\n\npublic class Main{\n public static void main (String[] args) throws java.lang.Exception {\n InputReader in = new InputReader(System.in);\n PrintWriter w = new PrintWriter(System.out);\n int n = in.nextInt(), d = in.nextInt();\n int temp = (int)Math.pow(100, n), ans = 0;\n \n while (d-- > 0)\n ans += temp;\n w.println(ans);\n w.close();\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1)\n throw new UnknownError();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new UnknownError();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public int peek() {\n if (numChars == -1)\n return -1;\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n return -1;\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar];\n }\n\n public void skip(int x) {\n while (x-- > 0)\n read();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public String nextString() {\n return next();\n }\n\n public String next() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuffer res = new StringBuffer();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isSpaceChar(c));\n\n return res.toString();\n }\n\n public String nextLine() {\n StringBuffer buf = new StringBuffer();\n int c = read();\n while (c != '\\n' && c != -1) {\n if (c != '\\r')\n buf.appendCodePoint(c);\n c = read();\n }\n return buf.toString();\n }\n\n public double nextDouble() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n double res = 0;\n while (!isSpaceChar(c) && c != '.') {\n if (c == 'e' || c == 'E')\n return res * Math.pow(10, nextInt());\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n }\n if (c == '.') {\n c = read();\n double m = 1;\n while (!isSpaceChar(c)) {\n if (c == 'e' || c == 'E')\n return res * Math.pow(10, nextInt());\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n m /= 10;\n res += (c - '0') * m;\n c = read();\n }\n }\n return res * sgn;\n }\n public int[] nextIntArray(int n) {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n return a;\n }\n public long[] nextLongArray(int n) {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = nextLong();\n return a;\n }\n public boolean hasNext() {\n int value;\n while (isSpaceChar(value = peek()) && value != -1)\n read();\n return value != -1;\n }\n\n private boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n }\n}", "problem_context": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "sample_input": "0 5\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03324", "source_text": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 4523, "cpu_time_ms": 70, "memory_kb": 21204}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s616967437", "group_id": "codeNet:p03324", "input_text": "import java.util.*;\n public class Main{\n\tpublic static void main(String[] args){\n\t Scanner scan = new Scanner(System.in);\n\t int numD = scan.nextInt();\n\t int numN = scan.nextInt();\n\t if(numD == 0 ){\n\t\tSystem.out.println(numN);\n\t \n\t }else if(numD == 1){\n\t\tSystem.out.println(numN*100);\n\t }else if(numD == 2){\n\t\tSystem.out.println(numN*10000);\n\t }\n\t\t\n\t}\n\n\t\n }", "language": "Java", "metadata": {"date": 1529201449, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03324.html", "problem_id": "p03324", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03324/input.txt", "sample_output_relpath": "derived/input_output/data/p03324/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03324/Java/s616967437.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s616967437", "user_id": "u969816482"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.util.*;\n public class Main{\n\tpublic static void main(String[] args){\n\t Scanner scan = new Scanner(System.in);\n\t int numD = scan.nextInt();\n\t int numN = scan.nextInt();\n\t if(numD == 0 ){\n\t\tSystem.out.println(numN);\n\t \n\t }else if(numD == 1){\n\t\tSystem.out.println(numN*100);\n\t }else if(numD == 2){\n\t\tSystem.out.println(numN*10000);\n\t }\n\t\t\n\t}\n\n\t\n }", "problem_context": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "sample_input": "0 5\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03324", "source_text": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 96, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s301332095", "group_id": "codeNet:p03324", "input_text": "import java.util.*;\n\nclass Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int D = sc.nextInt();\n int N = sc.nextInt();\n if(D == 0) {\n System.out.println(N);\n } else {\n System.out.println(N * (int)Math.pow(100, D));\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1529201448, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03324.html", "problem_id": "p03324", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03324/input.txt", "sample_output_relpath": "derived/input_output/data/p03324/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03324/Java/s301332095.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s301332095", "user_id": "u917503576"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.util.*;\n\nclass Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int D = sc.nextInt();\n int N = sc.nextInt();\n if(D == 0) {\n System.out.println(N);\n } else {\n System.out.println(N * (int)Math.pow(100, D));\n }\n }\n}\n", "problem_context": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "sample_input": "0 5\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03324", "source_text": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 334, "cpu_time_ms": 180, "memory_kb": 23252}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s978951875", "group_id": "codeNet:p03324", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int D = sc.nextInt();\n\n if(N == 0){\n System.out.println(D);\n return;\n }\n\n int pow = (int)Math.pow(100, N);\n int res = pow * D;\n if (N == 100){\n res = res - 1;\n }\n System.out.println(res);\n\n }\n}\n", "language": "Java", "metadata": {"date": 1529200815, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03324.html", "problem_id": "p03324", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03324/input.txt", "sample_output_relpath": "derived/input_output/data/p03324/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03324/Java/s978951875.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s978951875", "user_id": "u684359182"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int D = sc.nextInt();\n\n if(N == 0){\n System.out.println(D);\n return;\n }\n\n int pow = (int)Math.pow(100, N);\n int res = pow * D;\n if (N == 100){\n res = res - 1;\n }\n System.out.println(res);\n\n }\n}\n", "problem_context": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "sample_input": "0 5\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03324", "source_text": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 455, "cpu_time_ms": 99, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s272117408", "group_id": "codeNet:p03324", "input_text": "import java.util.Scanner;\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int d = sc.nextInt();\n int n = sc.nextInt();\n long x = 1;\n for(int i = 1;i <= d;i++){\n x *= 100;\n }\n if(n < 100){\n System.out.println(x*n);\n }\n else{\n System.out.println(x*n+x);\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1529200141, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03324.html", "problem_id": "p03324", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03324/input.txt", "sample_output_relpath": "derived/input_output/data/p03324/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03324/Java/s272117408.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s272117408", "user_id": "u076522215"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.util.Scanner;\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int d = sc.nextInt();\n int n = sc.nextInt();\n long x = 1;\n for(int i = 1;i <= d;i++){\n x *= 100;\n }\n if(n < 100){\n System.out.println(x*n);\n }\n else{\n System.out.println(x*n+x);\n }\n }\n}\n", "problem_context": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "sample_input": "0 5\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03324", "source_text": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 420, "cpu_time_ms": 133, "memory_kb": 21716}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s585487196", "group_id": "codeNet:p03324", "input_text": "import java.util.Scanner;\n\n/*\n * AtCoder Beginner Contest 100 B\n */\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint D = scanner.nextInt();\n\t\tint N = scanner.nextInt();\n\n\t\tint result = (int) Math.pow(100, D) * N;\n\n\n\t\tSystem.out.println(result);\n\n\t}\n\n}", "language": "Java", "metadata": {"date": 1529198414, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03324.html", "problem_id": "p03324", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03324/input.txt", "sample_output_relpath": "derived/input_output/data/p03324/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03324/Java/s585487196.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s585487196", "user_id": "u839442578"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.util.Scanner;\n\n/*\n * AtCoder Beginner Contest 100 B\n */\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint D = scanner.nextInt();\n\t\tint N = scanner.nextInt();\n\n\t\tint result = (int) Math.pow(100, D) * N;\n\n\n\t\tSystem.out.println(result);\n\n\t}\n\n}", "problem_context": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "sample_input": "0 5\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03324", "source_text": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 130, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s290661301", "group_id": "codeNet:p03324", "input_text": "import java.util.Scanner;\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint D = sc.nextInt();\n\t\tint N = sc.nextInt();\n\n\t\tSystem.out.println((int)Math.pow(100, D)*N);\n\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1529198185, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03324.html", "problem_id": "p03324", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03324/input.txt", "sample_output_relpath": "derived/input_output/data/p03324/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03324/Java/s290661301.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s290661301", "user_id": "u725133562"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.util.Scanner;\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint D = sc.nextInt();\n\t\tint N = sc.nextInt();\n\n\t\tSystem.out.println((int)Math.pow(100, D)*N);\n\n\t}\n\n}\n", "problem_context": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "sample_input": "0 5\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03324", "source_text": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 128, "memory_kb": 21972}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s514122103", "group_id": "codeNet:p03324", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint a = sc.nextInt();\n\t\tint b = sc.nextInt();\n\n\t\tint ans = 0;\n\n\t\tswitch (a) {\n\t\tcase 0:\n\t\t\tans = b;\n\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tans = 100 * b;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tans = 10000 * b;\n\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tbreak;\n\t\t}\n\n\t\tSystem.out.println(ans);\n\n\t\tsc.close();\n\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1529198180, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03324.html", "problem_id": "p03324", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03324/input.txt", "sample_output_relpath": "derived/input_output/data/p03324/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03324/Java/s514122103.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s514122103", "user_id": "u212941574"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint a = sc.nextInt();\n\t\tint b = sc.nextInt();\n\n\t\tint ans = 0;\n\n\t\tswitch (a) {\n\t\tcase 0:\n\t\t\tans = b;\n\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tans = 100 * b;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tans = 10000 * b;\n\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tbreak;\n\t\t}\n\n\t\tSystem.out.println(ans);\n\n\t\tsc.close();\n\n\t}\n\n}\n", "problem_context": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "sample_input": "0 5\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03324", "source_text": "Score: 200 points\n\nProblem Statement\n\nToday, the memorable AtCoder Beginner Contest 100 takes place. On this occasion, Takahashi would like to give an integer to Ringo.\n\nAs the name of the contest is AtCoder Beginner Contest 100, Ringo would be happy if he is given a positive integer that can be divided by 100 exactly D times.\n\nFind the N-th smallest integer that would make Ringo happy.\n\nConstraints\n\nD is 0, 1 or 2.\n\nN is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD N\n\nOutput\n\nPrint the N-th smallest integer that can be divided by 100 exactly D times.\n\nSample Input 1\n\n0 5\n\nSample Output 1\n\n5\n\nThe integers that can be divided by 100 exactly 0 times (that is, not divisible by 100) are as follows: 1, 2, 3, 4, 5, 6, 7, ...\n\nThus, the 5-th smallest integer that would make Ringo happy is 5.\n\nSample Input 2\n\n1 11\n\nSample Output 2\n\n1100\n\nThe integers that can be divided by 100 exactly once are as follows: 100, 200, 300, 400, 500, 600, 700, 800, 900, 1 \\ 000, 1 \\ 100, ...\n\nThus, the integer we are seeking is 1 \\ 100.\n\nSample Input 3\n\n2 85\n\nSample Output 3\n\n850000\n\nThe integers that can be divided by 100 exactly twice are as follows: 10 \\ 000, 20 \\ 000, 30 \\ 000, ...\n\nThus, the integer we are seeking is 850 \\ 000.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 104, "memory_kb": 21972}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s664375707", "group_id": "codeNet:p03448", "input_text": "import java.util.*;\nclass Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt(),b=sc.nextInt(),c=sc.nextInt(),x=sc.nextInt();\n int count = 0;\n for(int i = 0;i<=a;i++){\n for(int j =0;j<=b;j++){\n for(int k =0;k<=c;k++){\n if(i*500+j*100+k*50==x){\n count++;\n }\n }\n }\n }\n System.out.println(count);\n }\n}", "language": "Java", "metadata": {"date": 1590202582, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03448.html", "problem_id": "p03448", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03448/input.txt", "sample_output_relpath": "derived/input_output/data/p03448/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03448/Java/s664375707.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s664375707", "user_id": "u551325550"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.*;\nclass Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt(),b=sc.nextInt(),c=sc.nextInt(),x=sc.nextInt();\n int count = 0;\n for(int i = 0;i<=a;i++){\n for(int j =0;j<=b;j++){\n for(int k =0;k<=c;k++){\n if(i*500+j*100+k*50==x){\n count++;\n }\n }\n }\n }\n System.out.println(count);\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan).\nIn how many ways can we select some of these coins so that they are X yen in total?\n\nCoins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that coin are different.\n\nConstraints\n\n0 \\leq A, B, C \\leq 50\n\nA + B + C \\geq 1\n\n50 \\leq X \\leq 20 000\n\nA, B and C are integers.\n\nX is a multiple of 50.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nX\n\nOutput\n\nPrint the number of ways to select coins.\n\nSample Input 1\n\n2\n2\n2\n100\n\nSample Output 1\n\n2\n\nThere are two ways to satisfy the condition:\n\nSelect zero 500-yen coins, one 100-yen coin and zero 50-yen coins.\n\nSelect zero 500-yen coins, zero 100-yen coins and two 50-yen coins.\n\nSample Input 2\n\n5\n1\n0\n150\n\nSample Output 2\n\n0\n\nNote that the total must be exactly X yen.\n\nSample Input 3\n\n30\n40\n50\n6000\n\nSample Output 3\n\n213", "sample_input": "2\n2\n2\n100\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03448", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan).\nIn how many ways can we select some of these coins so that they are X yen in total?\n\nCoins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that coin are different.\n\nConstraints\n\n0 \\leq A, B, C \\leq 50\n\nA + B + C \\geq 1\n\n50 \\leq X \\leq 20 000\n\nA, B and C are integers.\n\nX is a multiple of 50.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nX\n\nOutput\n\nPrint the number of ways to select coins.\n\nSample Input 1\n\n2\n2\n2\n100\n\nSample Output 1\n\n2\n\nThere are two ways to satisfy the condition:\n\nSelect zero 500-yen coins, one 100-yen coin and zero 50-yen coins.\n\nSelect zero 500-yen coins, zero 100-yen coins and two 50-yen coins.\n\nSample Input 2\n\n5\n1\n0\n150\n\nSample Output 2\n\n0\n\nNote that the total must be exactly X yen.\n\nSample Input 3\n\n30\n40\n50\n6000\n\nSample Output 3\n\n213", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 108, "memory_kb": 23764}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s253969717", "group_id": "codeNet:p03448", "input_text": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint a = sc.nextInt();\n\t\tint b = sc.nextInt();\n\t\tint c = sc.nextInt();\n\t\tint x = sc.nextInt();\n\n\t\tint count = 0;\n\t\tfor(int numA = 0;numA <= a;numA++) {\n\t\t for(int numB = 0;numB <= b;numB++) {\n\t\t int numC = (x - (500 * numA + 100 * numB)) / 50;\n\t\t int total = 500 * numA + 100 * numB + 50 * numC;\n\t\t if(numC >= 0 && numC <= c && total == x) count++;\n\t\t }\n\t\t}\n\n\t\tSystem.out.println(count);\n }\n}", "language": "Java", "metadata": {"date": 1588298790, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03448.html", "problem_id": "p03448", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03448/input.txt", "sample_output_relpath": "derived/input_output/data/p03448/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03448/Java/s253969717.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s253969717", "user_id": "u861445290"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint a = sc.nextInt();\n\t\tint b = sc.nextInt();\n\t\tint c = sc.nextInt();\n\t\tint x = sc.nextInt();\n\n\t\tint count = 0;\n\t\tfor(int numA = 0;numA <= a;numA++) {\n\t\t for(int numB = 0;numB <= b;numB++) {\n\t\t int numC = (x - (500 * numA + 100 * numB)) / 50;\n\t\t int total = 500 * numA + 100 * numB + 50 * numC;\n\t\t if(numC >= 0 && numC <= c && total == x) count++;\n\t\t }\n\t\t}\n\n\t\tSystem.out.println(count);\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan).\nIn how many ways can we select some of these coins so that they are X yen in total?\n\nCoins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that coin are different.\n\nConstraints\n\n0 \\leq A, B, C \\leq 50\n\nA + B + C \\geq 1\n\n50 \\leq X \\leq 20 000\n\nA, B and C are integers.\n\nX is a multiple of 50.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nX\n\nOutput\n\nPrint the number of ways to select coins.\n\nSample Input 1\n\n2\n2\n2\n100\n\nSample Output 1\n\n2\n\nThere are two ways to satisfy the condition:\n\nSelect zero 500-yen coins, one 100-yen coin and zero 50-yen coins.\n\nSelect zero 500-yen coins, zero 100-yen coins and two 50-yen coins.\n\nSample Input 2\n\n5\n1\n0\n150\n\nSample Output 2\n\n0\n\nNote that the total must be exactly X yen.\n\nSample Input 3\n\n30\n40\n50\n6000\n\nSample Output 3\n\n213", "sample_input": "2\n2\n2\n100\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03448", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan).\nIn how many ways can we select some of these coins so that they are X yen in total?\n\nCoins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that coin are different.\n\nConstraints\n\n0 \\leq A, B, C \\leq 50\n\nA + B + C \\geq 1\n\n50 \\leq X \\leq 20 000\n\nA, B and C are integers.\n\nX is a multiple of 50.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nX\n\nOutput\n\nPrint the number of ways to select coins.\n\nSample Input 1\n\n2\n2\n2\n100\n\nSample Output 1\n\n2\n\nThere are two ways to satisfy the condition:\n\nSelect zero 500-yen coins, one 100-yen coin and zero 50-yen coins.\n\nSelect zero 500-yen coins, zero 100-yen coins and two 50-yen coins.\n\nSample Input 2\n\n5\n1\n0\n150\n\nSample Output 2\n\n0\n\nNote that the total must be exactly X yen.\n\nSample Input 3\n\n30\n40\n50\n6000\n\nSample Output 3\n\n213", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 554, "cpu_time_ms": 103, "memory_kb": 23124}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s507930829", "group_id": "codeNet:p03448", "input_text": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Scanner;\n\npublic class Main{\n\tpublic static void main(String[] args){\n \tInputStream input = System.in;\n \tOutputStream output = System.out;\n \tScanner sc = new Scanner(input);\n \tPrintWriter out = new PrintWriter(output);\n \tint A = sc.nextInt();\n \tint B = sc.nextInt();\n \tint C = sc.nextInt();\n \tint X = sc.nextInt();\n \tint count = 0;\n \tfor(int i = 0; i <= A; i++){\n \tfor(int j = 0; j <= B; j++){\n \tfor(int l = 0; l <= C; l++){\n \tif((500 * i) + (100 * j) + (50 * l) == X){\n \tcount++;\n }\n }\n }\n }\n \tout.println(count);\n \tout.close();\n }\n}", "language": "Java", "metadata": {"date": 1576988790, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03448.html", "problem_id": "p03448", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03448/input.txt", "sample_output_relpath": "derived/input_output/data/p03448/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03448/Java/s507930829.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s507930829", "user_id": "u154345532"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Scanner;\n\npublic class Main{\n\tpublic static void main(String[] args){\n \tInputStream input = System.in;\n \tOutputStream output = System.out;\n \tScanner sc = new Scanner(input);\n \tPrintWriter out = new PrintWriter(output);\n \tint A = sc.nextInt();\n \tint B = sc.nextInt();\n \tint C = sc.nextInt();\n \tint X = sc.nextInt();\n \tint count = 0;\n \tfor(int i = 0; i <= A; i++){\n \tfor(int j = 0; j <= B; j++){\n \tfor(int l = 0; l <= C; l++){\n \tif((500 * i) + (100 * j) + (50 * l) == X){\n \tcount++;\n }\n }\n }\n }\n \tout.println(count);\n \tout.close();\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan).\nIn how many ways can we select some of these coins so that they are X yen in total?\n\nCoins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that coin are different.\n\nConstraints\n\n0 \\leq A, B, C \\leq 50\n\nA + B + C \\geq 1\n\n50 \\leq X \\leq 20 000\n\nA, B and C are integers.\n\nX is a multiple of 50.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nX\n\nOutput\n\nPrint the number of ways to select coins.\n\nSample Input 1\n\n2\n2\n2\n100\n\nSample Output 1\n\n2\n\nThere are two ways to satisfy the condition:\n\nSelect zero 500-yen coins, one 100-yen coin and zero 50-yen coins.\n\nSelect zero 500-yen coins, zero 100-yen coins and two 50-yen coins.\n\nSample Input 2\n\n5\n1\n0\n150\n\nSample Output 2\n\n0\n\nNote that the total must be exactly X yen.\n\nSample Input 3\n\n30\n40\n50\n6000\n\nSample Output 3\n\n213", "sample_input": "2\n2\n2\n100\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03448", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan).\nIn how many ways can we select some of these coins so that they are X yen in total?\n\nCoins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that coin are different.\n\nConstraints\n\n0 \\leq A, B, C \\leq 50\n\nA + B + C \\geq 1\n\n50 \\leq X \\leq 20 000\n\nA, B and C are integers.\n\nX is a multiple of 50.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nX\n\nOutput\n\nPrint the number of ways to select coins.\n\nSample Input 1\n\n2\n2\n2\n100\n\nSample Output 1\n\n2\n\nThere are two ways to satisfy the condition:\n\nSelect zero 500-yen coins, one 100-yen coin and zero 50-yen coins.\n\nSelect zero 500-yen coins, zero 100-yen coins and two 50-yen coins.\n\nSample Input 2\n\n5\n1\n0\n150\n\nSample Output 2\n\n0\n\nNote that the total must be exactly X yen.\n\nSample Input 3\n\n30\n40\n50\n6000\n\nSample Output 3\n\n213", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 829, "cpu_time_ms": 104, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s421950089", "group_id": "codeNet:p03448", "input_text": "import java.util.*;\n\npublic class Main {\n public static void main(String... args) {\n Scanner sc = new Scanner(System.in);\n int A = sc.nextInt();\n int B = sc.nextInt();\n int C = sc.nextInt();\n int X = sc.nextInt();\n sc.close();\n\n int ans = 0;\n for (int i = 0; i <= A; i++) {\n for (int j = 0; j <= B; j++) {\n for (int k = 0; k <= C; k++) {\n if (X == 500 * i + 100 * j + 50 * k)\n ans++;\n }\n }\n }\n System.out.println(ans);\n }\n}", "language": "Java", "metadata": {"date": 1567631770, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03448.html", "problem_id": "p03448", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03448/input.txt", "sample_output_relpath": "derived/input_output/data/p03448/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03448/Java/s421950089.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s421950089", "user_id": "u104612990"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n public static void main(String... args) {\n Scanner sc = new Scanner(System.in);\n int A = sc.nextInt();\n int B = sc.nextInt();\n int C = sc.nextInt();\n int X = sc.nextInt();\n sc.close();\n\n int ans = 0;\n for (int i = 0; i <= A; i++) {\n for (int j = 0; j <= B; j++) {\n for (int k = 0; k <= C; k++) {\n if (X == 500 * i + 100 * j + 50 * k)\n ans++;\n }\n }\n }\n System.out.println(ans);\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan).\nIn how many ways can we select some of these coins so that they are X yen in total?\n\nCoins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that coin are different.\n\nConstraints\n\n0 \\leq A, B, C \\leq 50\n\nA + B + C \\geq 1\n\n50 \\leq X \\leq 20 000\n\nA, B and C are integers.\n\nX is a multiple of 50.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nX\n\nOutput\n\nPrint the number of ways to select coins.\n\nSample Input 1\n\n2\n2\n2\n100\n\nSample Output 1\n\n2\n\nThere are two ways to satisfy the condition:\n\nSelect zero 500-yen coins, one 100-yen coin and zero 50-yen coins.\n\nSelect zero 500-yen coins, zero 100-yen coins and two 50-yen coins.\n\nSample Input 2\n\n5\n1\n0\n150\n\nSample Output 2\n\n0\n\nNote that the total must be exactly X yen.\n\nSample Input 3\n\n30\n40\n50\n6000\n\nSample Output 3\n\n213", "sample_input": "2\n2\n2\n100\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03448", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan).\nIn how many ways can we select some of these coins so that they are X yen in total?\n\nCoins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that coin are different.\n\nConstraints\n\n0 \\leq A, B, C \\leq 50\n\nA + B + C \\geq 1\n\n50 \\leq X \\leq 20 000\n\nA, B and C are integers.\n\nX is a multiple of 50.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nX\n\nOutput\n\nPrint the number of ways to select coins.\n\nSample Input 1\n\n2\n2\n2\n100\n\nSample Output 1\n\n2\n\nThere are two ways to satisfy the condition:\n\nSelect zero 500-yen coins, one 100-yen coin and zero 50-yen coins.\n\nSelect zero 500-yen coins, zero 100-yen coins and two 50-yen coins.\n\nSample Input 2\n\n5\n1\n0\n150\n\nSample Output 2\n\n0\n\nNote that the total must be exactly X yen.\n\nSample Input 3\n\n30\n40\n50\n6000\n\nSample Output 3\n\n213", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 103, "memory_kb": 21972}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s133895960", "group_id": "codeNet:p03448", "input_text": "import java.util.Scanner;\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint a = sc.nextInt();\n\t\tint b = sc.nextInt();\n\t\tint c = sc.nextInt();\n\t\tint x = sc.nextInt();\n\t\tint count = 0;\n\n\t\tfor (int ia = 0; ia <= a; ia++) {\n\t\t\tfor (int ib = 0; ib <= b; ib++) {\n\t\t\t\tfor (int ic = 0; ic <= c; ic++) {\n\t\t\t\t\tif (x == ia * 500 + ib * 100 + ic * 50) {\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(count);\n\t}\n}", "language": "Java", "metadata": {"date": 1564995135, "filename_ext": "java", "original_language": "Java7 (OpenJDK 1.7.0)", "problem_description_relpath": "problem_descriptions/p03448.html", "problem_id": "p03448", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03448/input.txt", "sample_output_relpath": "derived/input_output/data/p03448/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03448/Java/s133895960.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s133895960", "user_id": "u404850460"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.Scanner;\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint a = sc.nextInt();\n\t\tint b = sc.nextInt();\n\t\tint c = sc.nextInt();\n\t\tint x = sc.nextInt();\n\t\tint count = 0;\n\n\t\tfor (int ia = 0; ia <= a; ia++) {\n\t\t\tfor (int ib = 0; ib <= b; ib++) {\n\t\t\t\tfor (int ic = 0; ic <= c; ic++) {\n\t\t\t\t\tif (x == ia * 500 + ib * 100 + ic * 50) {\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(count);\n\t}\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan).\nIn how many ways can we select some of these coins so that they are X yen in total?\n\nCoins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that coin are different.\n\nConstraints\n\n0 \\leq A, B, C \\leq 50\n\nA + B + C \\geq 1\n\n50 \\leq X \\leq 20 000\n\nA, B and C are integers.\n\nX is a multiple of 50.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nX\n\nOutput\n\nPrint the number of ways to select coins.\n\nSample Input 1\n\n2\n2\n2\n100\n\nSample Output 1\n\n2\n\nThere are two ways to satisfy the condition:\n\nSelect zero 500-yen coins, one 100-yen coin and zero 50-yen coins.\n\nSelect zero 500-yen coins, zero 100-yen coins and two 50-yen coins.\n\nSample Input 2\n\n5\n1\n0\n150\n\nSample Output 2\n\n0\n\nNote that the total must be exactly X yen.\n\nSample Input 3\n\n30\n40\n50\n6000\n\nSample Output 3\n\n213", "sample_input": "2\n2\n2\n100\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03448", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan).\nIn how many ways can we select some of these coins so that they are X yen in total?\n\nCoins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that coin are different.\n\nConstraints\n\n0 \\leq A, B, C \\leq 50\n\nA + B + C \\geq 1\n\n50 \\leq X \\leq 20 000\n\nA, B and C are integers.\n\nX is a multiple of 50.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nX\n\nOutput\n\nPrint the number of ways to select coins.\n\nSample Input 1\n\n2\n2\n2\n100\n\nSample Output 1\n\n2\n\nThere are two ways to satisfy the condition:\n\nSelect zero 500-yen coins, one 100-yen coin and zero 50-yen coins.\n\nSelect zero 500-yen coins, zero 100-yen coins and two 50-yen coins.\n\nSample Input 2\n\n5\n1\n0\n150\n\nSample Output 2\n\n0\n\nNote that the total must be exactly X yen.\n\nSample Input 3\n\n30\n40\n50\n6000\n\nSample Output 3\n\n213", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 471, "cpu_time_ms": 110, "memory_kb": 21076}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s704507700", "group_id": "codeNet:p03448", "input_text": "\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint a = sc.nextInt();\n\t\tint b = sc.nextInt();\n\t\tint c = sc.nextInt();\n\t\tint x = sc.nextInt();\n\t\tint ans = 0;\n\t\tfor(int i = 0; i < a + 1; i++) {\n\t\t\tfor(int j = 0; j < b + 1; j++) {\n\t\t\t\tfor(int k = 0; k < c + 1; k++) {\n\t\t\t\t\tint tmp = 50 * k + 100 * j + 500 * i;\n\t\t\t\t\tif(tmp > x)\n\t\t\t\t\t\tbreak;\n\t\t\t\t\telse if(tmp == x)\n\t\t\t\t\t\tans++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}\n", "language": "Java", "metadata": {"date": 1563412099, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03448.html", "problem_id": "p03448", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03448/input.txt", "sample_output_relpath": "derived/input_output/data/p03448/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03448/Java/s704507700.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s704507700", "user_id": "u153556810"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint a = sc.nextInt();\n\t\tint b = sc.nextInt();\n\t\tint c = sc.nextInt();\n\t\tint x = sc.nextInt();\n\t\tint ans = 0;\n\t\tfor(int i = 0; i < a + 1; i++) {\n\t\t\tfor(int j = 0; j < b + 1; j++) {\n\t\t\t\tfor(int k = 0; k < c + 1; k++) {\n\t\t\t\t\tint tmp = 50 * k + 100 * j + 500 * i;\n\t\t\t\t\tif(tmp > x)\n\t\t\t\t\t\tbreak;\n\t\t\t\t\telse if(tmp == x)\n\t\t\t\t\t\tans++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan).\nIn how many ways can we select some of these coins so that they are X yen in total?\n\nCoins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that coin are different.\n\nConstraints\n\n0 \\leq A, B, C \\leq 50\n\nA + B + C \\geq 1\n\n50 \\leq X \\leq 20 000\n\nA, B and C are integers.\n\nX is a multiple of 50.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nX\n\nOutput\n\nPrint the number of ways to select coins.\n\nSample Input 1\n\n2\n2\n2\n100\n\nSample Output 1\n\n2\n\nThere are two ways to satisfy the condition:\n\nSelect zero 500-yen coins, one 100-yen coin and zero 50-yen coins.\n\nSelect zero 500-yen coins, zero 100-yen coins and two 50-yen coins.\n\nSample Input 2\n\n5\n1\n0\n150\n\nSample Output 2\n\n0\n\nNote that the total must be exactly X yen.\n\nSample Input 3\n\n30\n40\n50\n6000\n\nSample Output 3\n\n213", "sample_input": "2\n2\n2\n100\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03448", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan).\nIn how many ways can we select some of these coins so that they are X yen in total?\n\nCoins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that coin are different.\n\nConstraints\n\n0 \\leq A, B, C \\leq 50\n\nA + B + C \\geq 1\n\n50 \\leq X \\leq 20 000\n\nA, B and C are integers.\n\nX is a multiple of 50.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nX\n\nOutput\n\nPrint the number of ways to select coins.\n\nSample Input 1\n\n2\n2\n2\n100\n\nSample Output 1\n\n2\n\nThere are two ways to satisfy the condition:\n\nSelect zero 500-yen coins, one 100-yen coin and zero 50-yen coins.\n\nSelect zero 500-yen coins, zero 100-yen coins and two 50-yen coins.\n\nSample Input 2\n\n5\n1\n0\n150\n\nSample Output 2\n\n0\n\nNote that the total must be exactly X yen.\n\nSample Input 3\n\n30\n40\n50\n6000\n\nSample Output 3\n\n213", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 504, "cpu_time_ms": 104, "memory_kb": 21716}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s136944696", "group_id": "codeNet:p03448", "input_text": "import java.util.*;\n\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint a = sc.nextInt();\n\t\tint b = sc.nextInt();\n\t\tint c = sc.nextInt();\n\t\tint x = sc.nextInt();\n\t\t\n\t\tint count = 0;\n\t\tfor(int i=0; i=0){\n cnt++;\n }\n }\n }\n System.out.println(cnt);\n }\n}\n", "language": "Java", "metadata": {"date": 1556468034, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03448.html", "problem_id": "p03448", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03448/input.txt", "sample_output_relpath": "derived/input_output/data/p03448/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03448/Java/s810658995.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s810658995", "user_id": "u024824950"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.*;\npublic class Main{\n\tpublic static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n int b = sc.nextInt();\n int c = sc.nextInt();\n int x = sc.nextInt();\n int cnt = 0;\n for(int i=0; i<=a; i++){\n for(int j=0; j<=b; j++){\n int nd_c = (x - i*500 - j*100)/50;\n if(nd_c<=c && nd_c>=0){\n cnt++;\n }\n }\n }\n System.out.println(cnt);\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan).\nIn how many ways can we select some of these coins so that they are X yen in total?\n\nCoins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that coin are different.\n\nConstraints\n\n0 \\leq A, B, C \\leq 50\n\nA + B + C \\geq 1\n\n50 \\leq X \\leq 20 000\n\nA, B and C are integers.\n\nX is a multiple of 50.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nX\n\nOutput\n\nPrint the number of ways to select coins.\n\nSample Input 1\n\n2\n2\n2\n100\n\nSample Output 1\n\n2\n\nThere are two ways to satisfy the condition:\n\nSelect zero 500-yen coins, one 100-yen coin and zero 50-yen coins.\n\nSelect zero 500-yen coins, zero 100-yen coins and two 50-yen coins.\n\nSample Input 2\n\n5\n1\n0\n150\n\nSample Output 2\n\n0\n\nNote that the total must be exactly X yen.\n\nSample Input 3\n\n30\n40\n50\n6000\n\nSample Output 3\n\n213", "sample_input": "2\n2\n2\n100\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03448", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan).\nIn how many ways can we select some of these coins so that they are X yen in total?\n\nCoins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that coin are different.\n\nConstraints\n\n0 \\leq A, B, C \\leq 50\n\nA + B + C \\geq 1\n\n50 \\leq X \\leq 20 000\n\nA, B and C are integers.\n\nX is a multiple of 50.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nX\n\nOutput\n\nPrint the number of ways to select coins.\n\nSample Input 1\n\n2\n2\n2\n100\n\nSample Output 1\n\n2\n\nThere are two ways to satisfy the condition:\n\nSelect zero 500-yen coins, one 100-yen coin and zero 50-yen coins.\n\nSelect zero 500-yen coins, zero 100-yen coins and two 50-yen coins.\n\nSample Input 2\n\n5\n1\n0\n150\n\nSample Output 2\n\n0\n\nNote that the total must be exactly X yen.\n\nSample Input 3\n\n30\n40\n50\n6000\n\nSample Output 3\n\n213", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 99, "memory_kb": 23636}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s401499621", "group_id": "codeNet:p03448", "input_text": "\n\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint A = sc.nextInt();\n\t\tint B = sc.nextInt();\n\t\tint C = sc.nextInt();\n\t\tint X = sc.nextInt();\n\t\tint pattern = 0;\n\t\tfor(int i = 0; i < A + 1; i++) {\n\t\t\tint sumi = 500 * i;\n\t\t\tif(!(sumi > X)) {\n\t\t\t\tfor(int j = 0; j < B + 1; j++) {\n\t\t\t\t\tint sumj = sumi + 100 * j;\n\t\t\t\t\tif(!(sumj > X)) {\n\t\t\t\t\t\tif(!((X - sumj) / 50 > C)) {\n\t\t\t\t\t\t\tpattern++;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(pattern);\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1555938737, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03448.html", "problem_id": "p03448", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03448/input.txt", "sample_output_relpath": "derived/input_output/data/p03448/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03448/Java/s401499621.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s401499621", "user_id": "u153556810"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "\n\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint A = sc.nextInt();\n\t\tint B = sc.nextInt();\n\t\tint C = sc.nextInt();\n\t\tint X = sc.nextInt();\n\t\tint pattern = 0;\n\t\tfor(int i = 0; i < A + 1; i++) {\n\t\t\tint sumi = 500 * i;\n\t\t\tif(!(sumi > X)) {\n\t\t\t\tfor(int j = 0; j < B + 1; j++) {\n\t\t\t\t\tint sumj = sumi + 100 * j;\n\t\t\t\t\tif(!(sumj > X)) {\n\t\t\t\t\t\tif(!((X - sumj) / 50 > C)) {\n\t\t\t\t\t\t\tpattern++;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(pattern);\n\t}\n\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan).\nIn how many ways can we select some of these coins so that they are X yen in total?\n\nCoins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that coin are different.\n\nConstraints\n\n0 \\leq A, B, C \\leq 50\n\nA + B + C \\geq 1\n\n50 \\leq X \\leq 20 000\n\nA, B and C are integers.\n\nX is a multiple of 50.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nX\n\nOutput\n\nPrint the number of ways to select coins.\n\nSample Input 1\n\n2\n2\n2\n100\n\nSample Output 1\n\n2\n\nThere are two ways to satisfy the condition:\n\nSelect zero 500-yen coins, one 100-yen coin and zero 50-yen coins.\n\nSelect zero 500-yen coins, zero 100-yen coins and two 50-yen coins.\n\nSample Input 2\n\n5\n1\n0\n150\n\nSample Output 2\n\n0\n\nNote that the total must be exactly X yen.\n\nSample Input 3\n\n30\n40\n50\n6000\n\nSample Output 3\n\n213", "sample_input": "2\n2\n2\n100\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03448", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan).\nIn how many ways can we select some of these coins so that they are X yen in total?\n\nCoins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that coin are different.\n\nConstraints\n\n0 \\leq A, B, C \\leq 50\n\nA + B + C \\geq 1\n\n50 \\leq X \\leq 20 000\n\nA, B and C are integers.\n\nX is a multiple of 50.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nX\n\nOutput\n\nPrint the number of ways to select coins.\n\nSample Input 1\n\n2\n2\n2\n100\n\nSample Output 1\n\n2\n\nThere are two ways to satisfy the condition:\n\nSelect zero 500-yen coins, one 100-yen coin and zero 50-yen coins.\n\nSelect zero 500-yen coins, zero 100-yen coins and two 50-yen coins.\n\nSample Input 2\n\n5\n1\n0\n150\n\nSample Output 2\n\n0\n\nNote that the total must be exactly X yen.\n\nSample Input 3\n\n30\n40\n50\n6000\n\nSample Output 3\n\n213", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 587, "cpu_time_ms": 96, "memory_kb": 25172}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s132903261", "group_id": "codeNet:p03448", "input_text": "\n\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint A = sc.nextInt();\n\t\tint B = sc.nextInt();\n\t\tint C = sc.nextInt();\n\t\tint X = sc.nextInt();\n\t\tint pattern = 0;\n\t\tfor(int i = 0; i < A + 1; i++) {\n\t\t\tint sum = 500 * i;\n\t\t\tif(!(sum > X)) {\n\t\t\t\tfor(int j = 0; j < B + 1; j++) {\n\t\t\t\t\tsum += 100 * j;\n\t\t\t\t\tif(!(sum > X)) {\n\t\t\t\t\t\tif(!((X - sum) / 50 > C)) {\n\t\t\t\t\t\t\tpattern++;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(pattern);\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1555938214, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03448.html", "problem_id": "p03448", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03448/input.txt", "sample_output_relpath": "derived/input_output/data/p03448/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03448/Java/s132903261.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s132903261", "user_id": "u153556810"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "\n\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint A = sc.nextInt();\n\t\tint B = sc.nextInt();\n\t\tint C = sc.nextInt();\n\t\tint X = sc.nextInt();\n\t\tint pattern = 0;\n\t\tfor(int i = 0; i < A + 1; i++) {\n\t\t\tint sum = 500 * i;\n\t\t\tif(!(sum > X)) {\n\t\t\t\tfor(int j = 0; j < B + 1; j++) {\n\t\t\t\t\tsum += 100 * j;\n\t\t\t\t\tif(!(sum > X)) {\n\t\t\t\t\t\tif(!((X - sum) / 50 > C)) {\n\t\t\t\t\t\t\tpattern++;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(pattern);\n\t}\n\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan).\nIn how many ways can we select some of these coins so that they are X yen in total?\n\nCoins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that coin are different.\n\nConstraints\n\n0 \\leq A, B, C \\leq 50\n\nA + B + C \\geq 1\n\n50 \\leq X \\leq 20 000\n\nA, B and C are integers.\n\nX is a multiple of 50.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nX\n\nOutput\n\nPrint the number of ways to select coins.\n\nSample Input 1\n\n2\n2\n2\n100\n\nSample Output 1\n\n2\n\nThere are two ways to satisfy the condition:\n\nSelect zero 500-yen coins, one 100-yen coin and zero 50-yen coins.\n\nSelect zero 500-yen coins, zero 100-yen coins and two 50-yen coins.\n\nSample Input 2\n\n5\n1\n0\n150\n\nSample Output 2\n\n0\n\nNote that the total must be exactly X yen.\n\nSample Input 3\n\n30\n40\n50\n6000\n\nSample Output 3\n\n213", "sample_input": "2\n2\n2\n100\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03448", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan).\nIn how many ways can we select some of these coins so that they are X yen in total?\n\nCoins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that coin are different.\n\nConstraints\n\n0 \\leq A, B, C \\leq 50\n\nA + B + C \\geq 1\n\n50 \\leq X \\leq 20 000\n\nA, B and C are integers.\n\nX is a multiple of 50.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nX\n\nOutput\n\nPrint the number of ways to select coins.\n\nSample Input 1\n\n2\n2\n2\n100\n\nSample Output 1\n\n2\n\nThere are two ways to satisfy the condition:\n\nSelect zero 500-yen coins, one 100-yen coin and zero 50-yen coins.\n\nSelect zero 500-yen coins, zero 100-yen coins and two 50-yen coins.\n\nSample Input 2\n\n5\n1\n0\n150\n\nSample Output 2\n\n0\n\nNote that the total must be exactly X yen.\n\nSample Input 3\n\n30\n40\n50\n6000\n\nSample Output 3\n\n213", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 572, "cpu_time_ms": 94, "memory_kb": 21332}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s045087756", "group_id": "codeNet:p03448", "input_text": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();// 500\n int b = sc.nextInt();// 100\n int c = sc.nextInt();// 50\n int x = sc.nextInt();\n int count = 0;\n for (int i = 0; i <= c; i++) {\n for (int j = 0; j <= b; j++) {\n for (int k = 0; k <= a; k++) {\n if ((50 * i) + (100 * j) + (500 * k) == x) {\n count++;\n }\n }\n }\n }\n System.out.println(count);\n }\n}", "language": "Java", "metadata": {"date": 1537240367, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03448.html", "problem_id": "p03448", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03448/input.txt", "sample_output_relpath": "derived/input_output/data/p03448/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03448/Java/s045087756.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s045087756", "user_id": "u045712871"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();// 500\n int b = sc.nextInt();// 100\n int c = sc.nextInt();// 50\n int x = sc.nextInt();\n int count = 0;\n for (int i = 0; i <= c; i++) {\n for (int j = 0; j <= b; j++) {\n for (int k = 0; k <= a; k++) {\n if ((50 * i) + (100 * j) + (500 * k) == x) {\n count++;\n }\n }\n }\n }\n System.out.println(count);\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan).\nIn how many ways can we select some of these coins so that they are X yen in total?\n\nCoins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that coin are different.\n\nConstraints\n\n0 \\leq A, B, C \\leq 50\n\nA + B + C \\geq 1\n\n50 \\leq X \\leq 20 000\n\nA, B and C are integers.\n\nX is a multiple of 50.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nX\n\nOutput\n\nPrint the number of ways to select coins.\n\nSample Input 1\n\n2\n2\n2\n100\n\nSample Output 1\n\n2\n\nThere are two ways to satisfy the condition:\n\nSelect zero 500-yen coins, one 100-yen coin and zero 50-yen coins.\n\nSelect zero 500-yen coins, zero 100-yen coins and two 50-yen coins.\n\nSample Input 2\n\n5\n1\n0\n150\n\nSample Output 2\n\n0\n\nNote that the total must be exactly X yen.\n\nSample Input 3\n\n30\n40\n50\n6000\n\nSample Output 3\n\n213", "sample_input": "2\n2\n2\n100\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03448", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan).\nIn how many ways can we select some of these coins so that they are X yen in total?\n\nCoins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that coin are different.\n\nConstraints\n\n0 \\leq A, B, C \\leq 50\n\nA + B + C \\geq 1\n\n50 \\leq X \\leq 20 000\n\nA, B and C are integers.\n\nX is a multiple of 50.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nX\n\nOutput\n\nPrint the number of ways to select coins.\n\nSample Input 1\n\n2\n2\n2\n100\n\nSample Output 1\n\n2\n\nThere are two ways to satisfy the condition:\n\nSelect zero 500-yen coins, one 100-yen coin and zero 50-yen coins.\n\nSelect zero 500-yen coins, zero 100-yen coins and two 50-yen coins.\n\nSample Input 2\n\n5\n1\n0\n150\n\nSample Output 2\n\n0\n\nNote that the total must be exactly X yen.\n\nSample Input 3\n\n30\n40\n50\n6000\n\nSample Output 3\n\n213", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 630, "cpu_time_ms": 95, "memory_kb": 22612}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s951821786", "group_id": "codeNet:p03448", "input_text": "import java.util.Scanner;\n\npublic class Main{\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint A = sc.nextInt();// 几个500\n\t\tint B = sc.nextInt();// 几个100\n\t\tint C = sc.nextInt();// 几个50\n\t\tint X = sc.nextInt();\n\t\tint ans = 0;\n\t\tint i,j,k;\n\t\tfor (i = 0; i <= A; i++) {\n\t\t\tfor (j = 0; j <= B; j++) {\n\t\t\t\tfor (k = 0; k <= C; k++) {\n\t\t\t\t\tif (500 * i + 100 * j + 50 * k == X)\n\t\t\t\t\t\tans+=1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\n\t\t\n\t}\n}", "language": "Java", "metadata": {"date": 1517770641, "filename_ext": "java", "original_language": "Java7 (OpenJDK 1.7.0)", "problem_description_relpath": "problem_descriptions/p03448.html", "problem_id": "p03448", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03448/input.txt", "sample_output_relpath": "derived/input_output/data/p03448/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03448/Java/s951821786.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s951821786", "user_id": "u018679195"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main{\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint A = sc.nextInt();// 几个500\n\t\tint B = sc.nextInt();// 几个100\n\t\tint C = sc.nextInt();// 几个50\n\t\tint X = sc.nextInt();\n\t\tint ans = 0;\n\t\tint i,j,k;\n\t\tfor (i = 0; i <= A; i++) {\n\t\t\tfor (j = 0; j <= B; j++) {\n\t\t\t\tfor (k = 0; k <= C; k++) {\n\t\t\t\t\tif (500 * i + 100 * j + 50 * k == X)\n\t\t\t\t\t\tans+=1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\n\t\t\n\t}\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan).\nIn how many ways can we select some of these coins so that they are X yen in total?\n\nCoins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that coin are different.\n\nConstraints\n\n0 \\leq A, B, C \\leq 50\n\nA + B + C \\geq 1\n\n50 \\leq X \\leq 20 000\n\nA, B and C are integers.\n\nX is a multiple of 50.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nX\n\nOutput\n\nPrint the number of ways to select coins.\n\nSample Input 1\n\n2\n2\n2\n100\n\nSample Output 1\n\n2\n\nThere are two ways to satisfy the condition:\n\nSelect zero 500-yen coins, one 100-yen coin and zero 50-yen coins.\n\nSelect zero 500-yen coins, zero 100-yen coins and two 50-yen coins.\n\nSample Input 2\n\n5\n1\n0\n150\n\nSample Output 2\n\n0\n\nNote that the total must be exactly X yen.\n\nSample Input 3\n\n30\n40\n50\n6000\n\nSample Output 3\n\n213", "sample_input": "2\n2\n2\n100\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03448", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan).\nIn how many ways can we select some of these coins so that they are X yen in total?\n\nCoins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that coin are different.\n\nConstraints\n\n0 \\leq A, B, C \\leq 50\n\nA + B + C \\geq 1\n\n50 \\leq X \\leq 20 000\n\nA, B and C are integers.\n\nX is a multiple of 50.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nX\n\nOutput\n\nPrint the number of ways to select coins.\n\nSample Input 1\n\n2\n2\n2\n100\n\nSample Output 1\n\n2\n\nThere are two ways to satisfy the condition:\n\nSelect zero 500-yen coins, one 100-yen coin and zero 50-yen coins.\n\nSelect zero 500-yen coins, zero 100-yen coins and two 50-yen coins.\n\nSample Input 2\n\n5\n1\n0\n150\n\nSample Output 2\n\n0\n\nNote that the total must be exactly X yen.\n\nSample Input 3\n\n30\n40\n50\n6000\n\nSample Output 3\n\n213", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 483, "cpu_time_ms": 115, "memory_kb": 21076}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s126169895", "group_id": "codeNet:p03448", "input_text": "import java.util.*;\n\npublic class Main {\n\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint fh,oh,ft,result,count;\n\t\tcount = 0;\n\t\tfh = sc.nextInt();\n\t\toh = sc.nextInt();\n\t\tft = sc.nextInt();\n\t\tresult = sc.nextInt();\n\t\tfor(int i=0;i<=fh;i++){\n\t\t\tfor(int j=0;j<=oh;j++){\n\t\t\t\tfor(int l=0;l<=ft;l++){\n\t\t\t\t\tif(i*500 + j*100 + l*50 == result){\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}", "language": "Java", "metadata": {"date": 1517192174, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03448.html", "problem_id": "p03448", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03448/input.txt", "sample_output_relpath": "derived/input_output/data/p03448/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03448/Java/s126169895.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s126169895", "user_id": "u854126959"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint fh,oh,ft,result,count;\n\t\tcount = 0;\n\t\tfh = sc.nextInt();\n\t\toh = sc.nextInt();\n\t\tft = sc.nextInt();\n\t\tresult = sc.nextInt();\n\t\tfor(int i=0;i<=fh;i++){\n\t\t\tfor(int j=0;j<=oh;j++){\n\t\t\t\tfor(int l=0;l<=ft;l++){\n\t\t\t\t\tif(i*500 + j*100 + l*50 == result){\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan).\nIn how many ways can we select some of these coins so that they are X yen in total?\n\nCoins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that coin are different.\n\nConstraints\n\n0 \\leq A, B, C \\leq 50\n\nA + B + C \\geq 1\n\n50 \\leq X \\leq 20 000\n\nA, B and C are integers.\n\nX is a multiple of 50.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nX\n\nOutput\n\nPrint the number of ways to select coins.\n\nSample Input 1\n\n2\n2\n2\n100\n\nSample Output 1\n\n2\n\nThere are two ways to satisfy the condition:\n\nSelect zero 500-yen coins, one 100-yen coin and zero 50-yen coins.\n\nSelect zero 500-yen coins, zero 100-yen coins and two 50-yen coins.\n\nSample Input 2\n\n5\n1\n0\n150\n\nSample Output 2\n\n0\n\nNote that the total must be exactly X yen.\n\nSample Input 3\n\n30\n40\n50\n6000\n\nSample Output 3\n\n213", "sample_input": "2\n2\n2\n100\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03448", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan).\nIn how many ways can we select some of these coins so that they are X yen in total?\n\nCoins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that coin are different.\n\nConstraints\n\n0 \\leq A, B, C \\leq 50\n\nA + B + C \\geq 1\n\n50 \\leq X \\leq 20 000\n\nA, B and C are integers.\n\nX is a multiple of 50.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nX\n\nOutput\n\nPrint the number of ways to select coins.\n\nSample Input 1\n\n2\n2\n2\n100\n\nSample Output 1\n\n2\n\nThere are two ways to satisfy the condition:\n\nSelect zero 500-yen coins, one 100-yen coin and zero 50-yen coins.\n\nSelect zero 500-yen coins, zero 100-yen coins and two 50-yen coins.\n\nSample Input 2\n\n5\n1\n0\n150\n\nSample Output 2\n\n0\n\nNote that the total must be exactly X yen.\n\nSample Input 3\n\n30\n40\n50\n6000\n\nSample Output 3\n\n213", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 444, "cpu_time_ms": 102, "memory_kb": 21972}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s027134309", "group_id": "codeNet:p03455", "input_text": "import java.util.*;\nimport java.io.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));\n \n String[] input = br.readLine().split(\" \");\n int a = Integer.parseInt(input[0]);\n int b = Integer.parseInt(input[1]);\n \n out.println(a * b % 2 == 0 ? \"Even\" : \"Odd\");\n out.close();\n \n }\n}", "language": "Java", "metadata": {"date": 1594333247, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p03455.html", "problem_id": "p03455", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03455/input.txt", "sample_output_relpath": "derived/input_output/data/p03455/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03455/Java/s027134309.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s027134309", "user_id": "u834978593"}, "prompt_components": {"gold_output": "Even\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));\n \n String[] input = br.readLine().split(\" \");\n int a = Integer.parseInt(input[0]);\n int b = Integer.parseInt(input[1]);\n \n out.println(a * b % 2 == 0 ? \"Even\" : \"Odd\");\n out.close();\n \n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer the deer found two positive integers, a and b.\nDetermine whether the product of a and b is even or odd.\n\nConstraints\n\n1 ≤ a,b ≤ 10000\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\nIf the product is odd, print Odd; if it is even, print Even.\n\nSample Input 1\n\n3 4\n\nSample Output 1\n\nEven\n\nAs 3 × 4 = 12 is even, print Even.\n\nSample Input 2\n\n1 21\n\nSample Output 2\n\nOdd\n\nAs 1 × 21 = 21 is odd, print Odd.", "sample_input": "3 4\n"}, "reference_outputs": ["Even\n"], "source_document_id": "p03455", "source_text": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer the deer found two positive integers, a and b.\nDetermine whether the product of a and b is even or odd.\n\nConstraints\n\n1 ≤ a,b ≤ 10000\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\nIf the product is odd, print Odd; if it is even, print Even.\n\nSample Input 1\n\n3 4\n\nSample Output 1\n\nEven\n\nAs 3 × 4 = 12 is even, print Even.\n\nSample Input 2\n\n1 21\n\nSample Output 2\n\nOdd\n\nAs 1 × 21 = 21 is odd, print Odd.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 531, "cpu_time_ms": 80, "memory_kb": 32532}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s216250453", "group_id": "codeNet:p03455", "input_text": "import java.util.*;\n \npublic class Main {\n public static void main(String[] args) throws Exception{\n // Your code here!\n \t\tScanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n int b = sc.nextInt();\n int i = a * b;\n if(i % 2==0){\n System.out.println(\"Even\");\n \n }\n if(i % 2!=0){\n System.out.println(\"Odd\");\n \n }\n \n }\n}", "language": "Java", "metadata": {"date": 1593438621, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p03455.html", "problem_id": "p03455", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03455/input.txt", "sample_output_relpath": "derived/input_output/data/p03455/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03455/Java/s216250453.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s216250453", "user_id": "u918923596"}, "prompt_components": {"gold_output": "Even\n", "input_to_evaluate": "import java.util.*;\n \npublic class Main {\n public static void main(String[] args) throws Exception{\n // Your code here!\n \t\tScanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n int b = sc.nextInt();\n int i = a * b;\n if(i % 2==0){\n System.out.println(\"Even\");\n \n }\n if(i % 2!=0){\n System.out.println(\"Odd\");\n \n }\n \n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer the deer found two positive integers, a and b.\nDetermine whether the product of a and b is even or odd.\n\nConstraints\n\n1 ≤ a,b ≤ 10000\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\nIf the product is odd, print Odd; if it is even, print Even.\n\nSample Input 1\n\n3 4\n\nSample Output 1\n\nEven\n\nAs 3 × 4 = 12 is even, print Even.\n\nSample Input 2\n\n1 21\n\nSample Output 2\n\nOdd\n\nAs 1 × 21 = 21 is odd, print Odd.", "sample_input": "3 4\n"}, "reference_outputs": ["Even\n"], "source_document_id": "p03455", "source_text": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer the deer found two positive integers, a and b.\nDetermine whether the product of a and b is even or odd.\n\nConstraints\n\n1 ≤ a,b ≤ 10000\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\nIf the product is odd, print Odd; if it is even, print Even.\n\nSample Input 1\n\n3 4\n\nSample Output 1\n\nEven\n\nAs 3 × 4 = 12 is even, print Even.\n\nSample Input 2\n\n1 21\n\nSample Output 2\n\nOdd\n\nAs 1 × 21 = 21 is odd, print Odd.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 120, "memory_kb": 35772}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s273621430", "group_id": "codeNet:p03455", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tstatic int[][] bingo = new int[3][3];\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint a = Integer.parseInt(sc.next());\n\t\tint b = Integer.parseInt(sc.next());\n\t\tif(a*b%2==0) {\n\t\t\tSystem.out.println(\"Even\");\n\t\t}else {\n\t\t\tSystem.out.println(\"Odd\");\n\t\t}\n\t}\n\n\n}\n", "language": "Java", "metadata": {"date": 1589290272, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03455.html", "problem_id": "p03455", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03455/input.txt", "sample_output_relpath": "derived/input_output/data/p03455/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03455/Java/s273621430.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s273621430", "user_id": "u762019716"}, "prompt_components": {"gold_output": "Even\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tstatic int[][] bingo = new int[3][3];\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint a = Integer.parseInt(sc.next());\n\t\tint b = Integer.parseInt(sc.next());\n\t\tif(a*b%2==0) {\n\t\t\tSystem.out.println(\"Even\");\n\t\t}else {\n\t\t\tSystem.out.println(\"Odd\");\n\t\t}\n\t}\n\n\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer the deer found two positive integers, a and b.\nDetermine whether the product of a and b is even or odd.\n\nConstraints\n\n1 ≤ a,b ≤ 10000\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\nIf the product is odd, print Odd; if it is even, print Even.\n\nSample Input 1\n\n3 4\n\nSample Output 1\n\nEven\n\nAs 3 × 4 = 12 is even, print Even.\n\nSample Input 2\n\n1 21\n\nSample Output 2\n\nOdd\n\nAs 1 × 21 = 21 is odd, print Odd.", "sample_input": "3 4\n"}, "reference_outputs": ["Even\n"], "source_document_id": "p03455", "source_text": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer the deer found two positive integers, a and b.\nDetermine whether the product of a and b is even or odd.\n\nConstraints\n\n1 ≤ a,b ≤ 10000\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\nIf the product is odd, print Odd; if it is even, print Even.\n\nSample Input 1\n\n3 4\n\nSample Output 1\n\nEven\n\nAs 3 × 4 = 12 is even, print Even.\n\nSample Input 2\n\n1 21\n\nSample Output 2\n\nOdd\n\nAs 1 × 21 = 21 is odd, print Odd.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 92, "memory_kb": 20948}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s363548588", "group_id": "codeNet:p03455", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint a = sc.nextInt();\n\t\tint b = sc.nextInt();\n\t\tsc.close();\n\t\t\n\t\tif(a % 2 == 0 || b % 2 == 0) {\n\t\t\tSystem.out.println(\"Even\");\n\t\t} else {\n\t\t\tSystem.out.println(\"Odd\");\n\t\t}\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1588614771, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03455.html", "problem_id": "p03455", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03455/input.txt", "sample_output_relpath": "derived/input_output/data/p03455/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03455/Java/s363548588.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s363548588", "user_id": "u829710756"}, "prompt_components": {"gold_output": "Even\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint a = sc.nextInt();\n\t\tint b = sc.nextInt();\n\t\tsc.close();\n\t\t\n\t\tif(a % 2 == 0 || b % 2 == 0) {\n\t\t\tSystem.out.println(\"Even\");\n\t\t} else {\n\t\t\tSystem.out.println(\"Odd\");\n\t\t}\n\t}\n\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer the deer found two positive integers, a and b.\nDetermine whether the product of a and b is even or odd.\n\nConstraints\n\n1 ≤ a,b ≤ 10000\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\nIf the product is odd, print Odd; if it is even, print Even.\n\nSample Input 1\n\n3 4\n\nSample Output 1\n\nEven\n\nAs 3 × 4 = 12 is even, print Even.\n\nSample Input 2\n\n1 21\n\nSample Output 2\n\nOdd\n\nAs 1 × 21 = 21 is odd, print Odd.", "sample_input": "3 4\n"}, "reference_outputs": ["Even\n"], "source_document_id": "p03455", "source_text": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer the deer found two positive integers, a and b.\nDetermine whether the product of a and b is even or odd.\n\nConstraints\n\n1 ≤ a,b ≤ 10000\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\nIf the product is odd, print Odd; if it is even, print Even.\n\nSample Input 1\n\n3 4\n\nSample Output 1\n\nEven\n\nAs 3 × 4 = 12 is even, print Even.\n\nSample Input 2\n\n1 21\n\nSample Output 2\n\nOdd\n\nAs 1 × 21 = 21 is odd, print Odd.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 93, "memory_kb": 21716}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s477894831", "group_id": "codeNet:p03455", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner scan =new Scanner(System.in);\n\n\n\n int a=scan.nextInt();\n int b=scan.nextInt();\n\n if ((a*b)%2==0){System.out.println(\"Even\");}\n else{System.out.println(\"Odd\");}\n\n\t// write your code here\n\n }\n}\n", "language": "Java", "metadata": {"date": 1587682957, "filename_ext": "java", "original_language": "Java7 (OpenJDK 1.7.0)", "problem_description_relpath": "problem_descriptions/p03455.html", "problem_id": "p03455", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03455/input.txt", "sample_output_relpath": "derived/input_output/data/p03455/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03455/Java/s477894831.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s477894831", "user_id": "u655325849"}, "prompt_components": {"gold_output": "Even\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner scan =new Scanner(System.in);\n\n\n\n int a=scan.nextInt();\n int b=scan.nextInt();\n\n if ((a*b)%2==0){System.out.println(\"Even\");}\n else{System.out.println(\"Odd\");}\n\n\t// write your code here\n\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer the deer found two positive integers, a and b.\nDetermine whether the product of a and b is even or odd.\n\nConstraints\n\n1 ≤ a,b ≤ 10000\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\nIf the product is odd, print Odd; if it is even, print Even.\n\nSample Input 1\n\n3 4\n\nSample Output 1\n\nEven\n\nAs 3 × 4 = 12 is even, print Even.\n\nSample Input 2\n\n1 21\n\nSample Output 2\n\nOdd\n\nAs 1 × 21 = 21 is odd, print Odd.", "sample_input": "3 4\n"}, "reference_outputs": ["Even\n"], "source_document_id": "p03455", "source_text": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer the deer found two positive integers, a and b.\nDetermine whether the product of a and b is even or odd.\n\nConstraints\n\n1 ≤ a,b ≤ 10000\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\nIf the product is odd, print Odd; if it is even, print Even.\n\nSample Input 1\n\n3 4\n\nSample Output 1\n\nEven\n\nAs 3 × 4 = 12 is even, print Even.\n\nSample Input 2\n\n1 21\n\nSample Output 2\n\nOdd\n\nAs 1 × 21 = 21 is odd, print Odd.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 97, "memory_kb": 20948}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s437760524", "group_id": "codeNet:p03455", "input_text": "\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.math.BigInteger;\nimport java.util.*;\nimport java.util.stream.LongStream;\n\npublic class Main {\n\n public Main() throws IOException {\n }\n\n public static void main(String[] args) throws IOException {\n new Main().solve();\n }\n\n // private final InputStream in = Files.newInputStream(Paths.get(\"C:\\\\Users\\\\ryo.suzuki\\\\Downloads\\\\02.txt\"));\n private final InputStream in = System.in;\n private final PrintWriter out = new PrintWriter(System.out);\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n private void solve() throws IOException {\n try {\n solveA();\n// solveB();\n// solveC();\n// solveD();\n// solveE();\n// solveF();\n } finally {\n if (in != null) {\n in.close();\n }\n if (out != null) {\n out.flush();\n out.close();\n }\n }\n\n }\n\n // mods\n long MOD = (long) Math.pow(10, 9) + 7;\n\n private void solveA() {\n int a = nextInt();\n int b = nextInt();\n out.println((a * b) % 2 == 0 ? \"Even\" : \"Odd\");\n }\n\n private void solveB() {\n\n }\n\n private void solveC() {\n\n }\n\n private void solveD() {\n\n }\n\n private void solveE() {\n\n }\n\n private void solveF() {\n\n }\n\n static final long CONST_INF = Long.MAX_VALUE / 4;\n\n\n private static class VectorCalculation {\n /**\n * 点Pと線(AB)の距離\n *\n * @param p\n * @param a\n * @param b\n * @return\n */\n private double distanceDotAndLine(DoublePair p, DoublePair a, DoublePair b) {\n DoublePair ab = new DoublePair(b.x - a.x, b.y - a.y);\n DoublePair ap = new DoublePair(p.x - a.x, p.y - a.y);\n\n // ベクトルAB、APの外積の絶対値が平行四辺形Dの面積になる\n double d = Math.abs(crossVector(ab, ap));\n\n double l = distanceVertex(a, b); // AB間の距離\n\n double h = d / l;\n return h;\n }\n\n /**\n * 2点間距離\n *\n * @param p1\n * @param p2\n * @return\n */\n private double distanceVertex(DoublePair p1, DoublePair p2) {\n double dx = p1.x - p2.x;\n double dy = p1.y - p2.y;\n return Math.sqrt(dx * dx + dy * dy);\n }\n\n /**\n * ベクトル外積\n *\n * @param vl\n * @param vr\n * @return\n */\n private double crossVector(DoublePair vl, DoublePair vr) {\n return vl.x * vr.y - vl.y * vr.x;\n }\n }\n\n private static class DoublePair implements Comparable {\n double x;\n double y;\n\n public DoublePair(double k, double v) {\n this.x = k;\n this.y = v;\n }\n\n public int compareTo(DoublePair pair) {\n return Double.compare(this.y, pair.y);\n }\n }\n\n private static class SimplePair implements Comparable {\n long k;\n long v;\n\n public SimplePair(int k, int v) {\n this.k = k;\n this.v = v;\n }\n\n public SimplePair(long k, long v) {\n this.k = k;\n this.v = v;\n }\n\n public int compareTo(SimplePair pair) {\n return Long.compare(this.v, pair.v);\n }\n }\n\n\n private static class SimpleGraphNode {\n private int n;\n private Map childs;\n\n public SimpleGraphNode(int n) {\n this.n = n;\n childs = new HashMap();\n }\n\n public void addChild(int child, int d) {\n this.childs.put(child, d);\n }\n }\n\n private static class SimpleGraph {\n\n private Map graph;\n\n public SimpleGraph(int[][] list) {\n graph = new HashMap();\n Arrays.stream(list).forEach(l -> {\n int a = l[0];\n int b = l[1];\n int d = l[2];\n graph.put(a, graph.getOrDefault(a, new SimpleGraphNode(a)));\n graph.get(a).addChild(b, d);\n graph.put(b, graph.getOrDefault(b, new SimpleGraphNode(b)));\n graph.get(b).addChild(a, d);\n });\n }\n\n public SimpleGraphNode getNode(int i) {\n return graph.getOrDefault(i, new SimpleGraphNode(-1));\n }\n\n }\n\n private static class GraphNode {\n private long n;\n private Map childs;\n\n public GraphNode(long n) {\n this.n = n;\n childs = new TreeMap();\n }\n\n /**\n * not update\n *\n * @param child\n * @param d\n */\n public void addChild(long child, long d) {\n this.childs.put(child, this.childs.getOrDefault(child, new SimplePair(child, d)));\n }\n\n public SimplePair getChild(long child) {\n return this.childs.getOrDefault(child, new SimplePair(child, CONST_INF));\n }\n }\n\n private static class Graph {\n\n private Map graph;\n int n;\n\n /**\n * @param n 頂点数\n * @param list\n */\n public Graph(int n, int[][] list) {\n this.n = n;\n graph = new HashMap();\n /*\n 隣接行列作成\n 0-indexed\n */\n Arrays.stream(list).forEach(l -> {\n long a = l[0] - 1;\n long b = l[1] - 1;\n long d = l[2];\n graph.put(a, graph.getOrDefault(a, new GraphNode(a)));\n graph.get(a).addChild(b, d);\n graph.put(b, graph.getOrDefault(b, new GraphNode(b)));\n graph.get(b).addChild(a, d);\n });\n /*\n たどり着けない場所はCONST_INFで埋める\n 自分へはCOST=0でたどり着ける\n */\n for (long i = 0; i < n; i++) {\n graph.put(i, graph.getOrDefault(i, new GraphNode(i)));\n GraphNode node = graph.get(i);\n for (int j = 0; j < n; j++) {\n if (i == j)\n node.addChild(j, 0L);\n else\n node.addChild(j, CONST_INF);\n }\n }\n }\n\n /**\n * ワーシャルフロイド\n */\n public void warshallFloyd() {\n for (long k = 0; k < n; k++) {\n for (long i = 0; i < n; i++) {\n for (long j = 0; j < n; j++) {\n long min = Math.min(graph.get(i).getChild(j).v, graph.get(i).getChild(k).v + graph.get(k).getChild(j).v);\n graph.get(i).getChild(j).v = min;\n }\n }\n }\n }\n\n public void partialUpdateAndWarshallFloyd(long x, long y, long w) {\n if (graph.get(x).getChild(y).v > w)\n graph.get(x).getChild(y).v = graph.get(y).getChild(x).v = w;\n long[] l = {x, y};\n for (long k : l) {\n for (long i = 0; i < n; i++) {\n for (long j = 0; j < n; j++) {\n if (graph.get(i).getChild(j).v > graph.get(i).getChild(k).v + graph.get(k).getChild(j).v) {\n graph.get(i).getChild(j).v = graph.get(i).getChild(k).v + graph.get(k).getChild(j).v;\n }\n }\n }\n }\n }\n\n /**\n * 2点間の距離\n *\n * @param from\n * @param to\n * @return\n */\n public long getDistance(long from, long to) {\n return graph.get(from).getChild(to).v;\n }\n\n }\n\n public long calcSimpleCombination(long n, long m, long CONST_MOD) {\n long mole = 1;\n for (long i = 1; i <= n + m; i++) {\n mole *= i;\n mole %= CONST_MOD;\n }\n long deno = 1;\n for (long i = 1; i <= n; i++) {\n deno *= i;\n deno %= CONST_MOD;\n }\n for (int i = 1; i <= m; i++) {\n deno *= i;\n deno %= CONST_MOD;\n }\n deno = modInverse(deno, CONST_MOD);\n return (mole * deno) % CONST_MOD;\n }\n\n long abs(double x) {\n return (long) Math.abs(x);\n }\n\n long round(double x) {\n return Math.round(x);\n }\n\n long floor(double x) {\n return (long) Math.floor(x);\n }\n\n long ceil(double x) {\n return (long) Math.ceil(x);\n }\n\n double sqrt(double x) {\n return Math.sqrt(x);\n }\n\n double pow(double x, double y) {\n return Math.pow(x, y);\n }\n\n long pow(long x, long y) {\n return (long) Math.pow(x, y);\n }\n\n int gcd(int a, int b) {\n return b == 0 ? a : gcd(b, a % b);\n }\n\n long gcd(long a, long b) {\n return b == 0 ? a : gcd(b, a % b);\n }\n\n long lcm(long a, long b) {\n return a * b / gcd(a, b);\n }\n\n public long lcmMod(long... ab) {\n\n Map ps = new HashMap();\n\n for (int abl = 0; abl < ab.length; abl++) {\n long target = ab[abl];\n long l = target;\n for (long p = 2; p * p <= l; p++) {\n long cnt = 0;\n while (target > 1 && target % p == 0) {\n cnt++;\n target /= p;\n }\n if (cnt == 0)\n continue;\n ps.put(p, Long.max(cnt, ps.getOrDefault(p, 0L)));\n }\n if (target > 1)\n ps.put(target, Long.max(1, ps.getOrDefault(target, 0L)));\n }\n long res = 1L;\n for (Map.Entry e : ps.entrySet()) {\n res *= powMod(e.getKey(), e.getValue());\n res %= MOD;\n }\n return res;\n }\n\n int upperToInt(char a) {\n return a - 'A';\n }\n\n int lowerToInt(char a) {\n return a - 'a';\n }\n\n int numToInt(char a) {\n return a - '0';\n }\n\n int charToInt(char a) {\n return a >= 'a' ? lowerToInt(a) : a >= 'A' ? upperToInt(a) : numToInt(a);\n }\n\n char intToUpper(int a) {\n return (char) (a + 'A');\n }\n\n char intToLower(int a) {\n return (char) (a + 'a');\n }\n\n char intToNum(int a) {\n return (char) (a + '0');\n }\n\n void reverse(String array[]) {\n String reversed[] = new String[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void reverse(int array[]) {\n int reversed[] = new int[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void reverse(long array[]) {\n long reversed[] = new long[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void reverse(double array[]) {\n double reversed[] = new double[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void reverse(boolean array[]) {\n boolean reversed[] = new boolean[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void fill(int array[][], int x) {\n for (int a[] : array) {\n Arrays.fill(a, x);\n }\n }\n\n void fill(long array[][], long x) {\n for (long a[] : array) {\n Arrays.fill(a, x);\n }\n }\n\n void fill(double array[][], double x) {\n for (double a[] : array) {\n Arrays.fill(a, x);\n }\n }\n\n void fill(boolean array[][], boolean x) {\n for (boolean a[] : array) {\n Arrays.fill(a, x);\n }\n }\n\n void fill(int array[][][], int x) {\n for (int a[][] : array) {\n fill(a, x);\n }\n }\n\n void fill(long array[][][], long x) {\n for (long a[][] : array) {\n fill(a, x);\n }\n }\n\n void fill(double array[][][], double x) {\n for (double a[][] : array) {\n fill(a, x);\n }\n }\n\n void fill(boolean array[][][], boolean x) {\n for (boolean a[][] : array) {\n fill(a, x);\n }\n }\n\n long L_INF = (long) 1e18 + 7;\n\n boolean isINF(long a) {\n return abs(a) > L_INF / 1000;\n }\n\n boolean isPlusINF(long a) {\n return a > 0 && isINF(a);\n }\n\n boolean isMinusINF(long a) {\n return isPlusINF(-a);\n }\n\n int I_INF = (int) 1e9 + 7;\n\n boolean isINF(int a) {\n return abs(a) > I_INF / 1000;\n }\n\n boolean isPlusINF(int a) {\n return a > 0 && isINF(a);\n }\n\n boolean isMinusINF(int a) {\n return isPlusINF(-a);\n }\n\n /**\n * 指定したx以下の素数をリストアップする\n */\n public long[] getPrimesUnderX(long x) {\n return LongStream.rangeClosed(2, x)\n .filter(i -> LongStream.rangeClosed(2, (long) Math.sqrt(i)).allMatch(j -> i % j != 0)).toArray();\n }\n\n\n public long mod(long i) {\n return i % MOD + ((i % MOD) < 0 ? MOD : 0);\n }\n\n long powMod(long x, long y) {\n if (y == 0) {\n return 1;\n } else {\n long tmp = powMod(x, y / 2);\n return mod(mod(tmp * tmp) * (y % 2 == 0 ? 1 : x));\n }\n }\n\n long inv(long x) {\n return powMod(x, MOD - 2);\n }\n\n int MAX_FACT = 5_000_100;\n long fact[];\n long invFact[];\n\n /**\n * Combination簡易版\n * 5 C 2\n * 異なる n個のものから r個を選ぶ組み合わせの総数 nCr を求めます。\n * 5!(5*4*3*2*1)\n * /\n * 2!(2*1) * (5-2)!(3*2*1)\n *\n * @param n\n * @param r\n * @return\n */\n private long getComb(int n, int r) {\n long tmp = 1;\n for (int i = 1; i <= r; i++) {\n tmp *= n - i + 1;\n tmp = mod(tmp);\n tmp *= inv(i);\n tmp = mod(tmp);\n }\n return tmp;\n }\n\n /**\n * 階乗計算の事前累積和\n * [1, 1, 2, 3, 4, 5, … FACTORIAL_NUM]\n * mod済\n */\n void prepareFact() {\n fact = new long[MAX_FACT];\n Arrays.fill(fact, 0);\n invFact = new long[MAX_FACT];\n Arrays.fill(invFact, 0);\n fact[0] = 1;\n int maxIndex = (int) min(MAX_FACT, (int) MOD);\n for (int i = 1; i < maxIndex; i++) {\n fact[i] = mod(fact[i - 1] * i);\n }\n invFact[maxIndex - 1] = inv(fact[maxIndex - 1]);\n for (int i = maxIndex - 1; i > 0; i--) {\n invFact[i - 1] = mod(invFact[i] * i);\n }\n }\n\n /**\n * 順列\n * nPk -> n! / (n-k)!\n *\n * @param n\n * @param r\n * @return\n */\n long permutation(int n, int r) {\n if (n < 0 || r < 0 || n < r) {\n return 0;\n }\n return mod(fact[n] * invFact[n - r]);\n }\n\n /**\n * 組み合わせ\n * nCk -> n! / k!・(n-k)!\n *\n * @param n\n * @param r\n * @return\n */\n long combination(int n, int r) {\n if (n < 0 || r < 0 || n < r) {\n return 0;\n }\n return mod(permutation(n, r) * invFact[r]);\n }\n\n /**\n * 重複組合せ nHr (同次積)\n * nHr = (n+r-1)Cr\n * 異なるn個のものから重複を許してr個取る組合せの総数\n * 例:\n * リンゴ,ミカン,牛肉の3種類の果物があります.これらの中から6個の食材を買って帰ります.\n * このとき,何通りの買い方がありますか?ただし,含まれない食材があってもよいものとします\n *\n * @param n\n * @param r\n * @return\n */\n long homogeneousProduct(int n, int r) {\n return combination((n - 1) + r, r);\n }\n\n /**\n * 多項係数\n * 文字aをp個,bをq個,cをr個, dをs個 あわせてn個を1列に並べるときの並べ方\n * n! / p!・q!・r!・s!\n *\n * @param n\n * @param strNum\n * @param mod\n * @return\n */\n\n /**\n * フェルマーの小定理を用いて逆元を求める。\n * ある数xのmod p(pは素数)の逆数x'はx' = x^(p-2)\n * 繰り返し二乗法を用いて計算する。\n * http://satanic0258.hatenablog.com/entry/2016/04/29/004730\n * {@link BigInteger#modInverse(BigInteger)}とどちらが速いか?\n *\n * @param x\n * @return\n */\n private long modInverse(long x, long mod) {\n long res = 1L;\n long k = mod - 2L;\n long y = x;\n while (k != 0) {\n if (k % 2 != 0) {\n res = (res * y) % mod;\n }\n y = (y * y) % mod;\n k /= 2;\n }\n return res;\n }\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte())\n return buffer[ptr++];\n else\n return -1;\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n private void skipUnprintable() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr]))\n ptr++;\n }\n\n public boolean hasNext() {\n skipUnprintable();\n return hasNextByte();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public String next() {\n if (!hasNext())\n throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext())\n throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public long min(long... v) {\n long min = Long.MAX_VALUE;\n for (long i : v) min = Math.min(min, i);\n return min;\n }\n\n public long max(long... v) {\n long max = Long.MIN_VALUE;\n for (long i : v) max = Math.max(max, i);\n return max;\n }\n}\n", "language": "Java", "metadata": {"date": 1586604764, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03455.html", "problem_id": "p03455", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03455/input.txt", "sample_output_relpath": "derived/input_output/data/p03455/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03455/Java/s437760524.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s437760524", "user_id": "u345932819"}, "prompt_components": {"gold_output": "Even\n", "input_to_evaluate": "\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.math.BigInteger;\nimport java.util.*;\nimport java.util.stream.LongStream;\n\npublic class Main {\n\n public Main() throws IOException {\n }\n\n public static void main(String[] args) throws IOException {\n new Main().solve();\n }\n\n // private final InputStream in = Files.newInputStream(Paths.get(\"C:\\\\Users\\\\ryo.suzuki\\\\Downloads\\\\02.txt\"));\n private final InputStream in = System.in;\n private final PrintWriter out = new PrintWriter(System.out);\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n private void solve() throws IOException {\n try {\n solveA();\n// solveB();\n// solveC();\n// solveD();\n// solveE();\n// solveF();\n } finally {\n if (in != null) {\n in.close();\n }\n if (out != null) {\n out.flush();\n out.close();\n }\n }\n\n }\n\n // mods\n long MOD = (long) Math.pow(10, 9) + 7;\n\n private void solveA() {\n int a = nextInt();\n int b = nextInt();\n out.println((a * b) % 2 == 0 ? \"Even\" : \"Odd\");\n }\n\n private void solveB() {\n\n }\n\n private void solveC() {\n\n }\n\n private void solveD() {\n\n }\n\n private void solveE() {\n\n }\n\n private void solveF() {\n\n }\n\n static final long CONST_INF = Long.MAX_VALUE / 4;\n\n\n private static class VectorCalculation {\n /**\n * 点Pと線(AB)の距離\n *\n * @param p\n * @param a\n * @param b\n * @return\n */\n private double distanceDotAndLine(DoublePair p, DoublePair a, DoublePair b) {\n DoublePair ab = new DoublePair(b.x - a.x, b.y - a.y);\n DoublePair ap = new DoublePair(p.x - a.x, p.y - a.y);\n\n // ベクトルAB、APの外積の絶対値が平行四辺形Dの面積になる\n double d = Math.abs(crossVector(ab, ap));\n\n double l = distanceVertex(a, b); // AB間の距離\n\n double h = d / l;\n return h;\n }\n\n /**\n * 2点間距離\n *\n * @param p1\n * @param p2\n * @return\n */\n private double distanceVertex(DoublePair p1, DoublePair p2) {\n double dx = p1.x - p2.x;\n double dy = p1.y - p2.y;\n return Math.sqrt(dx * dx + dy * dy);\n }\n\n /**\n * ベクトル外積\n *\n * @param vl\n * @param vr\n * @return\n */\n private double crossVector(DoublePair vl, DoublePair vr) {\n return vl.x * vr.y - vl.y * vr.x;\n }\n }\n\n private static class DoublePair implements Comparable {\n double x;\n double y;\n\n public DoublePair(double k, double v) {\n this.x = k;\n this.y = v;\n }\n\n public int compareTo(DoublePair pair) {\n return Double.compare(this.y, pair.y);\n }\n }\n\n private static class SimplePair implements Comparable {\n long k;\n long v;\n\n public SimplePair(int k, int v) {\n this.k = k;\n this.v = v;\n }\n\n public SimplePair(long k, long v) {\n this.k = k;\n this.v = v;\n }\n\n public int compareTo(SimplePair pair) {\n return Long.compare(this.v, pair.v);\n }\n }\n\n\n private static class SimpleGraphNode {\n private int n;\n private Map childs;\n\n public SimpleGraphNode(int n) {\n this.n = n;\n childs = new HashMap();\n }\n\n public void addChild(int child, int d) {\n this.childs.put(child, d);\n }\n }\n\n private static class SimpleGraph {\n\n private Map graph;\n\n public SimpleGraph(int[][] list) {\n graph = new HashMap();\n Arrays.stream(list).forEach(l -> {\n int a = l[0];\n int b = l[1];\n int d = l[2];\n graph.put(a, graph.getOrDefault(a, new SimpleGraphNode(a)));\n graph.get(a).addChild(b, d);\n graph.put(b, graph.getOrDefault(b, new SimpleGraphNode(b)));\n graph.get(b).addChild(a, d);\n });\n }\n\n public SimpleGraphNode getNode(int i) {\n return graph.getOrDefault(i, new SimpleGraphNode(-1));\n }\n\n }\n\n private static class GraphNode {\n private long n;\n private Map childs;\n\n public GraphNode(long n) {\n this.n = n;\n childs = new TreeMap();\n }\n\n /**\n * not update\n *\n * @param child\n * @param d\n */\n public void addChild(long child, long d) {\n this.childs.put(child, this.childs.getOrDefault(child, new SimplePair(child, d)));\n }\n\n public SimplePair getChild(long child) {\n return this.childs.getOrDefault(child, new SimplePair(child, CONST_INF));\n }\n }\n\n private static class Graph {\n\n private Map graph;\n int n;\n\n /**\n * @param n 頂点数\n * @param list\n */\n public Graph(int n, int[][] list) {\n this.n = n;\n graph = new HashMap();\n /*\n 隣接行列作成\n 0-indexed\n */\n Arrays.stream(list).forEach(l -> {\n long a = l[0] - 1;\n long b = l[1] - 1;\n long d = l[2];\n graph.put(a, graph.getOrDefault(a, new GraphNode(a)));\n graph.get(a).addChild(b, d);\n graph.put(b, graph.getOrDefault(b, new GraphNode(b)));\n graph.get(b).addChild(a, d);\n });\n /*\n たどり着けない場所はCONST_INFで埋める\n 自分へはCOST=0でたどり着ける\n */\n for (long i = 0; i < n; i++) {\n graph.put(i, graph.getOrDefault(i, new GraphNode(i)));\n GraphNode node = graph.get(i);\n for (int j = 0; j < n; j++) {\n if (i == j)\n node.addChild(j, 0L);\n else\n node.addChild(j, CONST_INF);\n }\n }\n }\n\n /**\n * ワーシャルフロイド\n */\n public void warshallFloyd() {\n for (long k = 0; k < n; k++) {\n for (long i = 0; i < n; i++) {\n for (long j = 0; j < n; j++) {\n long min = Math.min(graph.get(i).getChild(j).v, graph.get(i).getChild(k).v + graph.get(k).getChild(j).v);\n graph.get(i).getChild(j).v = min;\n }\n }\n }\n }\n\n public void partialUpdateAndWarshallFloyd(long x, long y, long w) {\n if (graph.get(x).getChild(y).v > w)\n graph.get(x).getChild(y).v = graph.get(y).getChild(x).v = w;\n long[] l = {x, y};\n for (long k : l) {\n for (long i = 0; i < n; i++) {\n for (long j = 0; j < n; j++) {\n if (graph.get(i).getChild(j).v > graph.get(i).getChild(k).v + graph.get(k).getChild(j).v) {\n graph.get(i).getChild(j).v = graph.get(i).getChild(k).v + graph.get(k).getChild(j).v;\n }\n }\n }\n }\n }\n\n /**\n * 2点間の距離\n *\n * @param from\n * @param to\n * @return\n */\n public long getDistance(long from, long to) {\n return graph.get(from).getChild(to).v;\n }\n\n }\n\n public long calcSimpleCombination(long n, long m, long CONST_MOD) {\n long mole = 1;\n for (long i = 1; i <= n + m; i++) {\n mole *= i;\n mole %= CONST_MOD;\n }\n long deno = 1;\n for (long i = 1; i <= n; i++) {\n deno *= i;\n deno %= CONST_MOD;\n }\n for (int i = 1; i <= m; i++) {\n deno *= i;\n deno %= CONST_MOD;\n }\n deno = modInverse(deno, CONST_MOD);\n return (mole * deno) % CONST_MOD;\n }\n\n long abs(double x) {\n return (long) Math.abs(x);\n }\n\n long round(double x) {\n return Math.round(x);\n }\n\n long floor(double x) {\n return (long) Math.floor(x);\n }\n\n long ceil(double x) {\n return (long) Math.ceil(x);\n }\n\n double sqrt(double x) {\n return Math.sqrt(x);\n }\n\n double pow(double x, double y) {\n return Math.pow(x, y);\n }\n\n long pow(long x, long y) {\n return (long) Math.pow(x, y);\n }\n\n int gcd(int a, int b) {\n return b == 0 ? a : gcd(b, a % b);\n }\n\n long gcd(long a, long b) {\n return b == 0 ? a : gcd(b, a % b);\n }\n\n long lcm(long a, long b) {\n return a * b / gcd(a, b);\n }\n\n public long lcmMod(long... ab) {\n\n Map ps = new HashMap();\n\n for (int abl = 0; abl < ab.length; abl++) {\n long target = ab[abl];\n long l = target;\n for (long p = 2; p * p <= l; p++) {\n long cnt = 0;\n while (target > 1 && target % p == 0) {\n cnt++;\n target /= p;\n }\n if (cnt == 0)\n continue;\n ps.put(p, Long.max(cnt, ps.getOrDefault(p, 0L)));\n }\n if (target > 1)\n ps.put(target, Long.max(1, ps.getOrDefault(target, 0L)));\n }\n long res = 1L;\n for (Map.Entry e : ps.entrySet()) {\n res *= powMod(e.getKey(), e.getValue());\n res %= MOD;\n }\n return res;\n }\n\n int upperToInt(char a) {\n return a - 'A';\n }\n\n int lowerToInt(char a) {\n return a - 'a';\n }\n\n int numToInt(char a) {\n return a - '0';\n }\n\n int charToInt(char a) {\n return a >= 'a' ? lowerToInt(a) : a >= 'A' ? upperToInt(a) : numToInt(a);\n }\n\n char intToUpper(int a) {\n return (char) (a + 'A');\n }\n\n char intToLower(int a) {\n return (char) (a + 'a');\n }\n\n char intToNum(int a) {\n return (char) (a + '0');\n }\n\n void reverse(String array[]) {\n String reversed[] = new String[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void reverse(int array[]) {\n int reversed[] = new int[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void reverse(long array[]) {\n long reversed[] = new long[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void reverse(double array[]) {\n double reversed[] = new double[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void reverse(boolean array[]) {\n boolean reversed[] = new boolean[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void fill(int array[][], int x) {\n for (int a[] : array) {\n Arrays.fill(a, x);\n }\n }\n\n void fill(long array[][], long x) {\n for (long a[] : array) {\n Arrays.fill(a, x);\n }\n }\n\n void fill(double array[][], double x) {\n for (double a[] : array) {\n Arrays.fill(a, x);\n }\n }\n\n void fill(boolean array[][], boolean x) {\n for (boolean a[] : array) {\n Arrays.fill(a, x);\n }\n }\n\n void fill(int array[][][], int x) {\n for (int a[][] : array) {\n fill(a, x);\n }\n }\n\n void fill(long array[][][], long x) {\n for (long a[][] : array) {\n fill(a, x);\n }\n }\n\n void fill(double array[][][], double x) {\n for (double a[][] : array) {\n fill(a, x);\n }\n }\n\n void fill(boolean array[][][], boolean x) {\n for (boolean a[][] : array) {\n fill(a, x);\n }\n }\n\n long L_INF = (long) 1e18 + 7;\n\n boolean isINF(long a) {\n return abs(a) > L_INF / 1000;\n }\n\n boolean isPlusINF(long a) {\n return a > 0 && isINF(a);\n }\n\n boolean isMinusINF(long a) {\n return isPlusINF(-a);\n }\n\n int I_INF = (int) 1e9 + 7;\n\n boolean isINF(int a) {\n return abs(a) > I_INF / 1000;\n }\n\n boolean isPlusINF(int a) {\n return a > 0 && isINF(a);\n }\n\n boolean isMinusINF(int a) {\n return isPlusINF(-a);\n }\n\n /**\n * 指定したx以下の素数をリストアップする\n */\n public long[] getPrimesUnderX(long x) {\n return LongStream.rangeClosed(2, x)\n .filter(i -> LongStream.rangeClosed(2, (long) Math.sqrt(i)).allMatch(j -> i % j != 0)).toArray();\n }\n\n\n public long mod(long i) {\n return i % MOD + ((i % MOD) < 0 ? MOD : 0);\n }\n\n long powMod(long x, long y) {\n if (y == 0) {\n return 1;\n } else {\n long tmp = powMod(x, y / 2);\n return mod(mod(tmp * tmp) * (y % 2 == 0 ? 1 : x));\n }\n }\n\n long inv(long x) {\n return powMod(x, MOD - 2);\n }\n\n int MAX_FACT = 5_000_100;\n long fact[];\n long invFact[];\n\n /**\n * Combination簡易版\n * 5 C 2\n * 異なる n個のものから r個を選ぶ組み合わせの総数 nCr を求めます。\n * 5!(5*4*3*2*1)\n * /\n * 2!(2*1) * (5-2)!(3*2*1)\n *\n * @param n\n * @param r\n * @return\n */\n private long getComb(int n, int r) {\n long tmp = 1;\n for (int i = 1; i <= r; i++) {\n tmp *= n - i + 1;\n tmp = mod(tmp);\n tmp *= inv(i);\n tmp = mod(tmp);\n }\n return tmp;\n }\n\n /**\n * 階乗計算の事前累積和\n * [1, 1, 2, 3, 4, 5, … FACTORIAL_NUM]\n * mod済\n */\n void prepareFact() {\n fact = new long[MAX_FACT];\n Arrays.fill(fact, 0);\n invFact = new long[MAX_FACT];\n Arrays.fill(invFact, 0);\n fact[0] = 1;\n int maxIndex = (int) min(MAX_FACT, (int) MOD);\n for (int i = 1; i < maxIndex; i++) {\n fact[i] = mod(fact[i - 1] * i);\n }\n invFact[maxIndex - 1] = inv(fact[maxIndex - 1]);\n for (int i = maxIndex - 1; i > 0; i--) {\n invFact[i - 1] = mod(invFact[i] * i);\n }\n }\n\n /**\n * 順列\n * nPk -> n! / (n-k)!\n *\n * @param n\n * @param r\n * @return\n */\n long permutation(int n, int r) {\n if (n < 0 || r < 0 || n < r) {\n return 0;\n }\n return mod(fact[n] * invFact[n - r]);\n }\n\n /**\n * 組み合わせ\n * nCk -> n! / k!・(n-k)!\n *\n * @param n\n * @param r\n * @return\n */\n long combination(int n, int r) {\n if (n < 0 || r < 0 || n < r) {\n return 0;\n }\n return mod(permutation(n, r) * invFact[r]);\n }\n\n /**\n * 重複組合せ nHr (同次積)\n * nHr = (n+r-1)Cr\n * 異なるn個のものから重複を許してr個取る組合せの総数\n * 例:\n * リンゴ,ミカン,牛肉の3種類の果物があります.これらの中から6個の食材を買って帰ります.\n * このとき,何通りの買い方がありますか?ただし,含まれない食材があってもよいものとします\n *\n * @param n\n * @param r\n * @return\n */\n long homogeneousProduct(int n, int r) {\n return combination((n - 1) + r, r);\n }\n\n /**\n * 多項係数\n * 文字aをp個,bをq個,cをr個, dをs個 あわせてn個を1列に並べるときの並べ方\n * n! / p!・q!・r!・s!\n *\n * @param n\n * @param strNum\n * @param mod\n * @return\n */\n\n /**\n * フェルマーの小定理を用いて逆元を求める。\n * ある数xのmod p(pは素数)の逆数x'はx' = x^(p-2)\n * 繰り返し二乗法を用いて計算する。\n * http://satanic0258.hatenablog.com/entry/2016/04/29/004730\n * {@link BigInteger#modInverse(BigInteger)}とどちらが速いか?\n *\n * @param x\n * @return\n */\n private long modInverse(long x, long mod) {\n long res = 1L;\n long k = mod - 2L;\n long y = x;\n while (k != 0) {\n if (k % 2 != 0) {\n res = (res * y) % mod;\n }\n y = (y * y) % mod;\n k /= 2;\n }\n return res;\n }\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte())\n return buffer[ptr++];\n else\n return -1;\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n private void skipUnprintable() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr]))\n ptr++;\n }\n\n public boolean hasNext() {\n skipUnprintable();\n return hasNextByte();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public String next() {\n if (!hasNext())\n throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext())\n throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public long min(long... v) {\n long min = Long.MAX_VALUE;\n for (long i : v) min = Math.min(min, i);\n return min;\n }\n\n public long max(long... v) {\n long max = Long.MIN_VALUE;\n for (long i : v) max = Math.max(max, i);\n return max;\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer the deer found two positive integers, a and b.\nDetermine whether the product of a and b is even or odd.\n\nConstraints\n\n1 ≤ a,b ≤ 10000\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\nIf the product is odd, print Odd; if it is even, print Even.\n\nSample Input 1\n\n3 4\n\nSample Output 1\n\nEven\n\nAs 3 × 4 = 12 is even, print Even.\n\nSample Input 2\n\n1 21\n\nSample Output 2\n\nOdd\n\nAs 1 × 21 = 21 is odd, print Odd.", "sample_input": "3 4\n"}, "reference_outputs": ["Even\n"], "source_document_id": "p03455", "source_text": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer the deer found two positive integers, a and b.\nDetermine whether the product of a and b is even or odd.\n\nConstraints\n\n1 ≤ a,b ≤ 10000\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\nIf the product is odd, print Odd; if it is even, print Even.\n\nSample Input 1\n\n3 4\n\nSample Output 1\n\nEven\n\nAs 3 × 4 = 12 is even, print Even.\n\nSample Input 2\n\n1 21\n\nSample Output 2\n\nOdd\n\nAs 1 × 21 = 21 is odd, print Odd.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 19839, "cpu_time_ms": 73, "memory_kb": 21332}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s477302708", "group_id": "codeNet:p03455", "input_text": "import java.util.*;\n\npublic class Main {\n\n\tpublic static void main(String[]$) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint a = sc.nextInt();\n\t\tint b = sc.nextInt();\n\t\tif ((a*b)%2 == 0) {\n\t\t\tSystem.out.println(\"Even\");\n\t\t} else {\n\t\t\tSystem.out.println(\"Odd\");\n\t\t}\n\n\t}\n\n}", "language": "Java", "metadata": {"date": 1576199728, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03455.html", "problem_id": "p03455", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03455/input.txt", "sample_output_relpath": "derived/input_output/data/p03455/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03455/Java/s477302708.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s477302708", "user_id": "u818283165"}, "prompt_components": {"gold_output": "Even\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n\n\tpublic static void main(String[]$) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint a = sc.nextInt();\n\t\tint b = sc.nextInt();\n\t\tif ((a*b)%2 == 0) {\n\t\t\tSystem.out.println(\"Even\");\n\t\t} else {\n\t\t\tSystem.out.println(\"Odd\");\n\t\t}\n\n\t}\n\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer the deer found two positive integers, a and b.\nDetermine whether the product of a and b is even or odd.\n\nConstraints\n\n1 ≤ a,b ≤ 10000\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\nIf the product is odd, print Odd; if it is even, print Even.\n\nSample Input 1\n\n3 4\n\nSample Output 1\n\nEven\n\nAs 3 × 4 = 12 is even, print Even.\n\nSample Input 2\n\n1 21\n\nSample Output 2\n\nOdd\n\nAs 1 × 21 = 21 is odd, print Odd.", "sample_input": "3 4\n"}, "reference_outputs": ["Even\n"], "source_document_id": "p03455", "source_text": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer the deer found two positive integers, a and b.\nDetermine whether the product of a and b is even or odd.\n\nConstraints\n\n1 ≤ a,b ≤ 10000\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\nIf the product is odd, print Odd; if it is even, print Even.\n\nSample Input 1\n\n3 4\n\nSample Output 1\n\nEven\n\nAs 3 × 4 = 12 is even, print Even.\n\nSample Input 2\n\n1 21\n\nSample Output 2\n\nOdd\n\nAs 1 × 21 = 21 is odd, print Odd.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 97, "memory_kb": 23636}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s281675725", "group_id": "codeNet:p03455", "input_text": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.util.Arrays;\nimport java.util.NoSuchElementException;\nimport java.util.Scanner;\nclass FastScanner {\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n }else{\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}\n private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}\n public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}\n public String next() {\n if (!hasNext()) throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while(isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n public long nextLong() {\n if (!hasNext()) throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while(true){\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n }else if(b == -1 || !isPrintableChar(b)){\n return minus ? -n : n;\n }else{\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }\n public double nextDouble() { return Double.parseDouble(next());}\n}\npublic class Main {\n static FastScanner scan=new FastScanner();\n static Scanner scanner=new Scanner(System.in);\n static long gcd (long a, long b) {return b>0?gcd(b,a%b):a;}\n static long lcm (long a, long b) {return a*b/gcd(a,b);}\n static int max(int a,int b) {return a>b?a:b;}\n static int min(int a,int b) {return a=0;i--) {\n strr+=str.charAt(i);\n }\n return strr;\n }\n public static void printArray(int[] a) {\n for(int i=0;iInteger.compare(x[0],y[0]));\n return a;\n }\n static long modpow(long x,long n,long mo) {//x^n%mo\n long sum=1;\n while(n>0) {\n if((n&1)==1) {\n sum=sum*x%mo;\n }\n x=x*x%mo;\n n>>=1;\n }\n return sum;\n }\n public static void main(String[] args) {\n \tint a=scan.nextInt();\n \tint b=scan.nextInt();\n \tSystem.out.println(a*b%2==0?\"Even\":\"Odd\");\n }\n}", "language": "Java", "metadata": {"date": 1572109273, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03455.html", "problem_id": "p03455", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03455/input.txt", "sample_output_relpath": "derived/input_output/data/p03455/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03455/Java/s281675725.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s281675725", "user_id": "u274962354"}, "prompt_components": {"gold_output": "Even\n", "input_to_evaluate": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.util.Arrays;\nimport java.util.NoSuchElementException;\nimport java.util.Scanner;\nclass FastScanner {\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n }else{\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}\n private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}\n public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}\n public String next() {\n if (!hasNext()) throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while(isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n public long nextLong() {\n if (!hasNext()) throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while(true){\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n }else if(b == -1 || !isPrintableChar(b)){\n return minus ? -n : n;\n }else{\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }\n public double nextDouble() { return Double.parseDouble(next());}\n}\npublic class Main {\n static FastScanner scan=new FastScanner();\n static Scanner scanner=new Scanner(System.in);\n static long gcd (long a, long b) {return b>0?gcd(b,a%b):a;}\n static long lcm (long a, long b) {return a*b/gcd(a,b);}\n static int max(int a,int b) {return a>b?a:b;}\n static int min(int a,int b) {return a=0;i--) {\n strr+=str.charAt(i);\n }\n return strr;\n }\n public static void printArray(int[] a) {\n for(int i=0;iInteger.compare(x[0],y[0]));\n return a;\n }\n static long modpow(long x,long n,long mo) {//x^n%mo\n long sum=1;\n while(n>0) {\n if((n&1)==1) {\n sum=sum*x%mo;\n }\n x=x*x%mo;\n n>>=1;\n }\n return sum;\n }\n public static void main(String[] args) {\n \tint a=scan.nextInt();\n \tint b=scan.nextInt();\n \tSystem.out.println(a*b%2==0?\"Even\":\"Odd\");\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer the deer found two positive integers, a and b.\nDetermine whether the product of a and b is even or odd.\n\nConstraints\n\n1 ≤ a,b ≤ 10000\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\nIf the product is odd, print Odd; if it is even, print Even.\n\nSample Input 1\n\n3 4\n\nSample Output 1\n\nEven\n\nAs 3 × 4 = 12 is even, print Even.\n\nSample Input 2\n\n1 21\n\nSample Output 2\n\nOdd\n\nAs 1 × 21 = 21 is odd, print Odd.", "sample_input": "3 4\n"}, "reference_outputs": ["Even\n"], "source_document_id": "p03455", "source_text": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer the deer found two positive integers, a and b.\nDetermine whether the product of a and b is even or odd.\n\nConstraints\n\n1 ≤ a,b ≤ 10000\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\nIf the product is odd, print Odd; if it is even, print Even.\n\nSample Input 1\n\n3 4\n\nSample Output 1\n\nEven\n\nAs 3 × 4 = 12 is even, print Even.\n\nSample Input 2\n\n1 21\n\nSample Output 2\n\nOdd\n\nAs 1 × 21 = 21 is odd, print Odd.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 4863, "cpu_time_ms": 93, "memory_kb": 21972}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s824754848", "group_id": "codeNet:p03455", "input_text": "import java.util.Scanner;\n\npublic class Main{\n\tpublic static void main(String[] args){\n\t\tScanner sc=new Scanner(System.in);\n\t\tint a=sc.nextInt();\n\t\tint b=sc.nextInt();\n\n\t\tif((a*b)%2==0){\n\t\t\tSystem.out.println(\"Even\");\n\t\t}else{\n\t\t\tSystem.out.println(\"Odd\");\n\t\t}\n\t}\n}", "language": "Java", "metadata": {"date": 1572049686, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03455.html", "problem_id": "p03455", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03455/input.txt", "sample_output_relpath": "derived/input_output/data/p03455/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03455/Java/s824754848.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s824754848", "user_id": "u818697039"}, "prompt_components": {"gold_output": "Even\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main{\n\tpublic static void main(String[] args){\n\t\tScanner sc=new Scanner(System.in);\n\t\tint a=sc.nextInt();\n\t\tint b=sc.nextInt();\n\n\t\tif((a*b)%2==0){\n\t\t\tSystem.out.println(\"Even\");\n\t\t}else{\n\t\t\tSystem.out.println(\"Odd\");\n\t\t}\n\t}\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer the deer found two positive integers, a and b.\nDetermine whether the product of a and b is even or odd.\n\nConstraints\n\n1 ≤ a,b ≤ 10000\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\nIf the product is odd, print Odd; if it is even, print Even.\n\nSample Input 1\n\n3 4\n\nSample Output 1\n\nEven\n\nAs 3 × 4 = 12 is even, print Even.\n\nSample Input 2\n\n1 21\n\nSample Output 2\n\nOdd\n\nAs 1 × 21 = 21 is odd, print Odd.", "sample_input": "3 4\n"}, "reference_outputs": ["Even\n"], "source_document_id": "p03455", "source_text": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer the deer found two positive integers, a and b.\nDetermine whether the product of a and b is even or odd.\n\nConstraints\n\n1 ≤ a,b ≤ 10000\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\nIf the product is odd, print Odd; if it is even, print Even.\n\nSample Input 1\n\n3 4\n\nSample Output 1\n\nEven\n\nAs 3 × 4 = 12 is even, print Even.\n\nSample Input 2\n\n1 21\n\nSample Output 2\n\nOdd\n\nAs 1 × 21 = 21 is odd, print Odd.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 94, "memory_kb": 23892}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s105649153", "group_id": "codeNet:p03455", "input_text": "import java.util.*;\n\nclass Main{\n public static void main(String[] args){\n try(Scanner sc = new Scanner(System.in)){\n int a = Integer.parseInt(sc.next());\n int b = Integer.parseInt(sc.next());\n int term = a * b;\n if((term % 2) == 0){\n System.out.println(\"Even\");\n }else{\n System.out.println(\"Odd\");\n }\n }\n }\n}\n \n ", "language": "Java", "metadata": {"date": 1565188778, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03455.html", "problem_id": "p03455", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03455/input.txt", "sample_output_relpath": "derived/input_output/data/p03455/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03455/Java/s105649153.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s105649153", "user_id": "u224040141"}, "prompt_components": {"gold_output": "Even\n", "input_to_evaluate": "import java.util.*;\n\nclass Main{\n public static void main(String[] args){\n try(Scanner sc = new Scanner(System.in)){\n int a = Integer.parseInt(sc.next());\n int b = Integer.parseInt(sc.next());\n int term = a * b;\n if((term % 2) == 0){\n System.out.println(\"Even\");\n }else{\n System.out.println(\"Odd\");\n }\n }\n }\n}\n \n ", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer the deer found two positive integers, a and b.\nDetermine whether the product of a and b is even or odd.\n\nConstraints\n\n1 ≤ a,b ≤ 10000\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\nIf the product is odd, print Odd; if it is even, print Even.\n\nSample Input 1\n\n3 4\n\nSample Output 1\n\nEven\n\nAs 3 × 4 = 12 is even, print Even.\n\nSample Input 2\n\n1 21\n\nSample Output 2\n\nOdd\n\nAs 1 × 21 = 21 is odd, print Odd.", "sample_input": "3 4\n"}, "reference_outputs": ["Even\n"], "source_document_id": "p03455", "source_text": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer the deer found two positive integers, a and b.\nDetermine whether the product of a and b is even or odd.\n\nConstraints\n\n1 ≤ a,b ≤ 10000\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\nIf the product is odd, print Odd; if it is even, print Even.\n\nSample Input 1\n\n3 4\n\nSample Output 1\n\nEven\n\nAs 3 × 4 = 12 is even, print Even.\n\nSample Input 2\n\n1 21\n\nSample Output 2\n\nOdd\n\nAs 1 × 21 = 21 is odd, print Odd.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 373, "cpu_time_ms": 91, "memory_kb": 23380}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s878233586", "group_id": "codeNet:p03455", "input_text": "import java.util.*;\npublic class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n int b = sc.nextInt();\n if (a % 2 == 1 && b % 2 == 1) {\n System.out.println(\"Odd\");\n }else{\n System.out.println(\"Even\");\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1562292399, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03455.html", "problem_id": "p03455", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03455/input.txt", "sample_output_relpath": "derived/input_output/data/p03455/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03455/Java/s878233586.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s878233586", "user_id": "u818640918"}, "prompt_components": {"gold_output": "Even\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n int b = sc.nextInt();\n if (a % 2 == 1 && b % 2 == 1) {\n System.out.println(\"Odd\");\n }else{\n System.out.println(\"Even\");\n }\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer the deer found two positive integers, a and b.\nDetermine whether the product of a and b is even or odd.\n\nConstraints\n\n1 ≤ a,b ≤ 10000\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\nIf the product is odd, print Odd; if it is even, print Even.\n\nSample Input 1\n\n3 4\n\nSample Output 1\n\nEven\n\nAs 3 × 4 = 12 is even, print Even.\n\nSample Input 2\n\n1 21\n\nSample Output 2\n\nOdd\n\nAs 1 × 21 = 21 is odd, print Odd.", "sample_input": "3 4\n"}, "reference_outputs": ["Even\n"], "source_document_id": "p03455", "source_text": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer the deer found two positive integers, a and b.\nDetermine whether the product of a and b is even or odd.\n\nConstraints\n\n1 ≤ a,b ≤ 10000\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\nIf the product is odd, print Odd; if it is even, print Even.\n\nSample Input 1\n\n3 4\n\nSample Output 1\n\nEven\n\nAs 3 × 4 = 12 is even, print Even.\n\nSample Input 2\n\n1 21\n\nSample Output 2\n\nOdd\n\nAs 1 × 21 = 21 is odd, print Odd.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 341, "cpu_time_ms": 95, "memory_kb": 21716}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s311308304", "group_id": "codeNet:p03455", "input_text": "import java.util.*;\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n int b = sc.nextInt();\n if((a*b) %2 == 0)\n System.out.println(\"Even\");\n else\n System.out.println(\"Odd\");\n }\n}", "language": "Java", "metadata": {"date": 1557285002, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03455.html", "problem_id": "p03455", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03455/input.txt", "sample_output_relpath": "derived/input_output/data/p03455/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03455/Java/s311308304.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s311308304", "user_id": "u432805419"}, "prompt_components": {"gold_output": "Even\n", "input_to_evaluate": "import java.util.*;\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n int b = sc.nextInt();\n if((a*b) %2 == 0)\n System.out.println(\"Even\");\n else\n System.out.println(\"Odd\");\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer the deer found two positive integers, a and b.\nDetermine whether the product of a and b is even or odd.\n\nConstraints\n\n1 ≤ a,b ≤ 10000\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\nIf the product is odd, print Odd; if it is even, print Even.\n\nSample Input 1\n\n3 4\n\nSample Output 1\n\nEven\n\nAs 3 × 4 = 12 is even, print Even.\n\nSample Input 2\n\n1 21\n\nSample Output 2\n\nOdd\n\nAs 1 × 21 = 21 is odd, print Odd.", "sample_input": "3 4\n"}, "reference_outputs": ["Even\n"], "source_document_id": "p03455", "source_text": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer the deer found two positive integers, a and b.\nDetermine whether the product of a and b is even or odd.\n\nConstraints\n\n1 ≤ a,b ≤ 10000\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\nIf the product is odd, print Odd; if it is even, print Even.\n\nSample Input 1\n\n3 4\n\nSample Output 1\n\nEven\n\nAs 3 × 4 = 12 is even, print Even.\n\nSample Input 2\n\n1 21\n\nSample Output 2\n\nOdd\n\nAs 1 × 21 = 21 is odd, print Odd.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 102, "memory_kb": 22868}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s520221528", "group_id": "codeNet:p03455", "input_text": "import java.util.Scanner;\n\nclass Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n int b = sc.nextInt();\n\n if ( (a * b) % 2 == 0 ){\n System.out.println( \"Even\" );\n }else{\n System.out.println(\"Odd\");\n }\n }\n}", "language": "Java", "metadata": {"date": 1552849962, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03455.html", "problem_id": "p03455", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03455/input.txt", "sample_output_relpath": "derived/input_output/data/p03455/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03455/Java/s520221528.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s520221528", "user_id": "u397065106"}, "prompt_components": {"gold_output": "Even\n", "input_to_evaluate": "import java.util.Scanner;\n\nclass Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int a = sc.nextInt();\n int b = sc.nextInt();\n\n if ( (a * b) % 2 == 0 ){\n System.out.println( \"Even\" );\n }else{\n System.out.println(\"Odd\");\n }\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer the deer found two positive integers, a and b.\nDetermine whether the product of a and b is even or odd.\n\nConstraints\n\n1 ≤ a,b ≤ 10000\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\nIf the product is odd, print Odd; if it is even, print Even.\n\nSample Input 1\n\n3 4\n\nSample Output 1\n\nEven\n\nAs 3 × 4 = 12 is even, print Even.\n\nSample Input 2\n\n1 21\n\nSample Output 2\n\nOdd\n\nAs 1 × 21 = 21 is odd, print Odd.", "sample_input": "3 4\n"}, "reference_outputs": ["Even\n"], "source_document_id": "p03455", "source_text": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer the deer found two positive integers, a and b.\nDetermine whether the product of a and b is even or odd.\n\nConstraints\n\n1 ≤ a,b ≤ 10000\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\nIf the product is odd, print Odd; if it is even, print Even.\n\nSample Input 1\n\n3 4\n\nSample Output 1\n\nEven\n\nAs 3 × 4 = 12 is even, print Even.\n\nSample Input 2\n\n1 21\n\nSample Output 2\n\nOdd\n\nAs 1 × 21 = 21 is odd, print Odd.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 93, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s053887210", "group_id": "codeNet:p03455", "input_text": "// https://atcoder.jp/contests/abc086/tasks/abc086_a\n\nimport java.util.Scanner;\n\npublic class Main {\n public static void main() {\n Scanner sc = new Scanner(System.in);\n\n int a = sc.nextInt();\n int b = sc.nextInt();\n\n if ((a * b % 2) == 0) {\n System.out.println(\"Even\");\n } else {\n System.out.println(\"Odd\");\n }\n }\n}", "language": "Java", "metadata": {"date": 1551650950, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03455.html", "problem_id": "p03455", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03455/input.txt", "sample_output_relpath": "derived/input_output/data/p03455/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03455/Java/s053887210.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s053887210", "user_id": "u766168866"}, "prompt_components": {"gold_output": "Even\n", "input_to_evaluate": "// https://atcoder.jp/contests/abc086/tasks/abc086_a\n\nimport java.util.Scanner;\n\npublic class Main {\n public static void main() {\n Scanner sc = new Scanner(System.in);\n\n int a = sc.nextInt();\n int b = sc.nextInt();\n\n if ((a * b % 2) == 0) {\n System.out.println(\"Even\");\n } else {\n System.out.println(\"Odd\");\n }\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer the deer found two positive integers, a and b.\nDetermine whether the product of a and b is even or odd.\n\nConstraints\n\n1 ≤ a,b ≤ 10000\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\nIf the product is odd, print Odd; if it is even, print Even.\n\nSample Input 1\n\n3 4\n\nSample Output 1\n\nEven\n\nAs 3 × 4 = 12 is even, print Even.\n\nSample Input 2\n\n1 21\n\nSample Output 2\n\nOdd\n\nAs 1 × 21 = 21 is odd, print Odd.", "sample_input": "3 4\n"}, "reference_outputs": ["Even\n"], "source_document_id": "p03455", "source_text": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer the deer found two positive integers, a and b.\nDetermine whether the product of a and b is even or odd.\n\nConstraints\n\n1 ≤ a,b ≤ 10000\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\nIf the product is odd, print Odd; if it is even, print Even.\n\nSample Input 1\n\n3 4\n\nSample Output 1\n\nEven\n\nAs 3 × 4 = 12 is even, print Even.\n\nSample Input 2\n\n1 21\n\nSample Output 2\n\nOdd\n\nAs 1 × 21 = 21 is odd, print Odd.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 91, "memory_kb": 21332}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s479607079", "group_id": "codeNet:p03455", "input_text": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tList list = new ArrayList<>();\n\t\tlist.add(\"Even\");\n\t\tlist.add(\"Odd\");\n\t\tScanner sc = new Scanner(System.in);\n\t\t// 整数の入力\n\t\tint a = sc.nextInt();\n\t\t// スペース区切りの整数の入力\n\t\tint b = sc.nextInt();\n\t\t\n\t\tSystem.out.println(list.get(a*b % 2));\n\n\t}\n}", "language": "Java", "metadata": {"date": 1521962605, "filename_ext": "java", "original_language": "Java7 (OpenJDK 1.7.0)", "problem_description_relpath": "problem_descriptions/p03455.html", "problem_id": "p03455", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03455/input.txt", "sample_output_relpath": "derived/input_output/data/p03455/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03455/Java/s479607079.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s479607079", "user_id": "u243953503"}, "prompt_components": {"gold_output": "Even\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tList list = new ArrayList<>();\n\t\tlist.add(\"Even\");\n\t\tlist.add(\"Odd\");\n\t\tScanner sc = new Scanner(System.in);\n\t\t// 整数の入力\n\t\tint a = sc.nextInt();\n\t\t// スペース区切りの整数の入力\n\t\tint b = sc.nextInt();\n\t\t\n\t\tSystem.out.println(list.get(a*b % 2));\n\n\t}\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer the deer found two positive integers, a and b.\nDetermine whether the product of a and b is even or odd.\n\nConstraints\n\n1 ≤ a,b ≤ 10000\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\nIf the product is odd, print Odd; if it is even, print Even.\n\nSample Input 1\n\n3 4\n\nSample Output 1\n\nEven\n\nAs 3 × 4 = 12 is even, print Even.\n\nSample Input 2\n\n1 21\n\nSample Output 2\n\nOdd\n\nAs 1 × 21 = 21 is odd, print Odd.", "sample_input": "3 4\n"}, "reference_outputs": ["Even\n"], "source_document_id": "p03455", "source_text": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer the deer found two positive integers, a and b.\nDetermine whether the product of a and b is even or odd.\n\nConstraints\n\n1 ≤ a,b ≤ 10000\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\nIf the product is odd, print Odd; if it is even, print Even.\n\nSample Input 1\n\n3 4\n\nSample Output 1\n\nEven\n\nAs 3 × 4 = 12 is even, print Even.\n\nSample Input 2\n\n1 21\n\nSample Output 2\n\nOdd\n\nAs 1 × 21 = 21 is odd, print Odd.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 95, "memory_kb": 22612}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s338209713", "group_id": "codeNet:p03455", "input_text": "import java.util.Scanner;\nclass Main \n{\n public static void main(String[] args) \n {\n Scanner input=new Scanner(System.in);\n int a=input.nextInt();\n int b=input.nextInt();\n if(a>=1 && b>=1 && a<=10000 && b<=10000)\n {\n a=a*b;\n if(a%2==0)\n {\n System.out.println(\"Even\");\n }else\n System.out.println(\"Odd\");\n }\n }\n}", "language": "Java", "metadata": {"date": 1518317066, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03455.html", "problem_id": "p03455", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03455/input.txt", "sample_output_relpath": "derived/input_output/data/p03455/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03455/Java/s338209713.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s338209713", "user_id": "u018679195"}, "prompt_components": {"gold_output": "Even\n", "input_to_evaluate": "import java.util.Scanner;\nclass Main \n{\n public static void main(String[] args) \n {\n Scanner input=new Scanner(System.in);\n int a=input.nextInt();\n int b=input.nextInt();\n if(a>=1 && b>=1 && a<=10000 && b<=10000)\n {\n a=a*b;\n if(a%2==0)\n {\n System.out.println(\"Even\");\n }else\n System.out.println(\"Odd\");\n }\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer the deer found two positive integers, a and b.\nDetermine whether the product of a and b is even or odd.\n\nConstraints\n\n1 ≤ a,b ≤ 10000\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\nIf the product is odd, print Odd; if it is even, print Even.\n\nSample Input 1\n\n3 4\n\nSample Output 1\n\nEven\n\nAs 3 × 4 = 12 is even, print Even.\n\nSample Input 2\n\n1 21\n\nSample Output 2\n\nOdd\n\nAs 1 × 21 = 21 is odd, print Odd.", "sample_input": "3 4\n"}, "reference_outputs": ["Even\n"], "source_document_id": "p03455", "source_text": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer the deer found two positive integers, a and b.\nDetermine whether the product of a and b is even or odd.\n\nConstraints\n\n1 ≤ a,b ≤ 10000\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\nIf the product is odd, print Odd; if it is even, print Even.\n\nSample Input 1\n\n3 4\n\nSample Output 1\n\nEven\n\nAs 3 × 4 = 12 is even, print Even.\n\nSample Input 2\n\n1 21\n\nSample Output 2\n\nOdd\n\nAs 1 × 21 = 21 is odd, print Odd.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 102, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s724634781", "group_id": "codeNet:p03455", "input_text": "import java.util.Scanner;\npublic class Main {\n\n\tpublic static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\t\t\n int a = sc.nextInt();\n int b = sc.nextInt();\n\t\t\n\t\tString odd = \"Odd\";\n\t\tString even = \"Even\";\n\t\tString answer = \"\";\n\t\t\n\t\tint result = a * b;\n\t\tif (result % 2 == 1 ) {\n\t\t\tanswer = odd;\n\t\t}else{\n\t\t\tanswer = even;\n\t\t}\n\t\t\n\t\tSystem.out.println(answer);\n\n\t}\n\n}", "language": "Java", "metadata": {"date": 1516669564, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03455.html", "problem_id": "p03455", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03455/input.txt", "sample_output_relpath": "derived/input_output/data/p03455/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03455/Java/s724634781.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s724634781", "user_id": "u391807262"}, "prompt_components": {"gold_output": "Even\n", "input_to_evaluate": "import java.util.Scanner;\npublic class Main {\n\n\tpublic static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\t\t\n int a = sc.nextInt();\n int b = sc.nextInt();\n\t\t\n\t\tString odd = \"Odd\";\n\t\tString even = \"Even\";\n\t\tString answer = \"\";\n\t\t\n\t\tint result = a * b;\n\t\tif (result % 2 == 1 ) {\n\t\t\tanswer = odd;\n\t\t}else{\n\t\t\tanswer = even;\n\t\t}\n\t\t\n\t\tSystem.out.println(answer);\n\n\t}\n\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer the deer found two positive integers, a and b.\nDetermine whether the product of a and b is even or odd.\n\nConstraints\n\n1 ≤ a,b ≤ 10000\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\nIf the product is odd, print Odd; if it is even, print Even.\n\nSample Input 1\n\n3 4\n\nSample Output 1\n\nEven\n\nAs 3 × 4 = 12 is even, print Even.\n\nSample Input 2\n\n1 21\n\nSample Output 2\n\nOdd\n\nAs 1 × 21 = 21 is odd, print Odd.", "sample_input": "3 4\n"}, "reference_outputs": ["Even\n"], "source_document_id": "p03455", "source_text": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer the deer found two positive integers, a and b.\nDetermine whether the product of a and b is even or odd.\n\nConstraints\n\n1 ≤ a,b ≤ 10000\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\nIf the product is odd, print Odd; if it is even, print Even.\n\nSample Input 1\n\n3 4\n\nSample Output 1\n\nEven\n\nAs 3 × 4 = 12 is even, print Even.\n\nSample Input 2\n\n1 21\n\nSample Output 2\n\nOdd\n\nAs 1 × 21 = 21 is odd, print Odd.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 94, "memory_kb": 23764}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s174572470", "group_id": "codeNet:p03455", "input_text": "import java.io.IOException;\nimport java.io.PrintWriter;\nimport java.io.InputStream;\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\nclass Main {\n static class Reader {\n private BufferedReader br;\n private StringTokenizer token;\n\n protected Reader(InputStream obj) {\n br = new BufferedReader(new InputStreamReader(obj));\n token = null;\n }\n protected String next() {\n while (token == null || !token.hasMoreElements()) {\n try {\n token = new StringTokenizer(br.readLine());\n } catch (IOException e) {e.printStackTrace();}\n }\n return token.nextToken();\n }\n protected int[] nextIntArr(int n) {\n int[] arr = new int[n];\n for (int i=0; in) continue;\n\t\t\t\tfor(int k=0; k<=n; k++) {\n\t\t\t\t\tif(i+j+k>n) continue;\n\t\t\t\t\tif(10000*i + 5000*j + 1000*k == y) {\n\t\t\t\t\t\tSystem.out.println(i+\" \"+j+\" \"+k);\n\t\t\t\t\t\tsc.close();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"-1 -1 -1\");\n\t\tsc.close();\n\t}\n}\n", "language": "Java", "metadata": {"date": 1601152227, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p03471.html", "problem_id": "p03471", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03471/input.txt", "sample_output_relpath": "derived/input_output/data/p03471/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03471/Java/s866650872.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s866650872", "user_id": "u235169423"}, "prompt_components": {"gold_output": "4 0 5\n", "input_to_evaluate": "\nimport java.util.*;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tMain main = new Main();\n\t\tmain.run();\n\t}\n\n\n\n\tpublic void run() {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\tint y=sc.nextInt();\n\t\tfor(int i=0; i<=n; i++) {\n\t\t\tfor(int j=0; j<=n; j++) {\n\t\t\t\tif(i+j>n) continue;\n\t\t\t\tfor(int k=0; k<=n; k++) {\n\t\t\t\t\tif(i+j+k>n) continue;\n\t\t\t\t\tif(10000*i + 5000*j + 1000*k == y) {\n\t\t\t\t\t\tSystem.out.println(i+\" \"+j+\" \"+k);\n\t\t\t\t\t\tsc.close();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"-1 -1 -1\");\n\t\tsc.close();\n\t}\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThe commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word \"bill\" refers to only these.\n\nAccording to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.\n\nConstraints\n\n1 ≤ N ≤ 2000\n\n1000 ≤ Y ≤ 2 × 10^7\n\nN is an integer.\n\nY is a multiple of 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Y\n\nOutput\n\nIf the total value of N bills cannot be Y yen, print -1 -1 -1.\n\nIf the total value of N bills can be Y yen, let one such set of bills be \"x 10000-yen bills, y 5000-yen bills and z 1000-yen bills\", and print x, y, z with spaces in between. If there are multiple possibilities, any of them may be printed.\n\nSample Input 1\n\n9 45000\n\nSample Output 1\n\n4 0 5\n\nIf the envelope contained 4 10000-yen bills and 5 1000-yen bills, he had 9 bills and 45000 yen in total. It is also possible that the envelope contained 9 5000-yen bills, so the output 0 9 0 is also correct.\n\nSample Input 2\n\n20 196000\n\nSample Output 2\n\n-1 -1 -1\n\nWhen the envelope contained 20 bills in total, the total value would be 200000 yen if all the bills were 10000-yen bills, and would be at most 195000 yen otherwise, so it would never be 196000 yen.\n\nSample Input 3\n\n1000 1234000\n\nSample Output 3\n\n14 27 959\n\nThere are also many other possibilities.\n\nSample Input 4\n\n2000 20000000\n\nSample Output 4\n\n2000 0 0", "sample_input": "9 45000\n"}, "reference_outputs": ["4 0 5\n"], "source_document_id": "p03471", "source_text": "Score : 300 points\n\nProblem Statement\n\nThe commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word \"bill\" refers to only these.\n\nAccording to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.\n\nConstraints\n\n1 ≤ N ≤ 2000\n\n1000 ≤ Y ≤ 2 × 10^7\n\nN is an integer.\n\nY is a multiple of 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Y\n\nOutput\n\nIf the total value of N bills cannot be Y yen, print -1 -1 -1.\n\nIf the total value of N bills can be Y yen, let one such set of bills be \"x 10000-yen bills, y 5000-yen bills and z 1000-yen bills\", and print x, y, z with spaces in between. If there are multiple possibilities, any of them may be printed.\n\nSample Input 1\n\n9 45000\n\nSample Output 1\n\n4 0 5\n\nIf the envelope contained 4 10000-yen bills and 5 1000-yen bills, he had 9 bills and 45000 yen in total. It is also possible that the envelope contained 9 5000-yen bills, so the output 0 9 0 is also correct.\n\nSample Input 2\n\n20 196000\n\nSample Output 2\n\n-1 -1 -1\n\nWhen the envelope contained 20 bills in total, the total value would be 200000 yen if all the bills were 10000-yen bills, and would be at most 195000 yen otherwise, so it would never be 196000 yen.\n\nSample Input 3\n\n1000 1234000\n\nSample Output 3\n\n14 27 959\n\nThere are also many other possibilities.\n\nSample Input 4\n\n2000 20000000\n\nSample Output 4\n\n2000 0 0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 563, "cpu_time_ms": 2207, "memory_kb": 39576}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s858987741", "group_id": "codeNet:p03471", "input_text": "import java.io.*;\nimport java.math.*;\nimport java.util.*;\npublic class Main { //CASH MONEY\n \n\tpublic static void main(String[] args) { //Ball out dawg\n\t\tFastScanner I = new FastScanner(); //Input\n\t\tOutPut O = new OutPut(); //Output\n\t\tlong N = I.nextLong();\n\t\tlong Y = I.nextLong();\n\t\tlong x = -1;\n\t\tlong y = -1;\n\t\tlong z = -1;\n\t\tboolean good=false;\n\t\tfor (long a = 0; a<=2000; a++) {\n\t\t\tfor (long b = 0; b <= 2000; b++) {\n\t\t\t\tlong cur = a*1000+b*5000;\n\t\t\t\tif (Y-cur>=0) {\n\t\t\t\t\tlong diff = Y-cur;\n\t\t\t\t\tif ((N-a-b)*10000==diff) {\n\t\t\t\t\t\tx=a;\n\t\t\t\t\t\ty=b;\n\t\t\t\t\t\tz=N-a-b;\n\t\t\t\t\t\tgood=true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (good) break;\n\t\t} \n\t\tO.p(z+\" \"+y+\" \"+x);\n\t}\n\tpublic static long ceil(long num, long den) {long ans = num/den; if (num%den!=0) \n\tans++; return ans;}\n\tpublic static long GCD(long a, long b) {\n\t\tif (a==0||b==0) return Math.max(a,b);\n\t\treturn GCD(Math.min(a, b),Math.max(a, b)%Math.min(a, b));\n\t}\n\tpublic static long FastExp(long base, long exp, long mod) {\n\t\tlong ans=1;\n\t\twhile (exp>0) {\n\t\t\tif (exp%2==1) ans*=base;\n\t\t\texp/=2;\n\t\t\tbase*=base;\n\t\t\tbase%=mod;\n\t\t\tans%=mod;\n\t\t}\n\t\treturn ans;\n\t}\n\tpublic static long ModInv(long num,long mod) {return FastExp(num,mod-2,mod);}\n\tstatic class FastScanner {\n\t\tBufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n\t\tStringTokenizer st=new StringTokenizer(\"\");\n\t\tString next() {\n\t\t\twhile (!st.hasMoreTokens())\n\t\t\t\ttry {\n\t\t\t\t\tst=new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\t\tint nextInt() {return Integer.parseInt(next());}\n\t\tlong nextLong() {return Long.parseLong(next());};\n\t}\n\tstatic class OutPut{\n\t\tPrintWriter w = new PrintWriter(System.out);\n\t\tvoid pln(int x) {w.println(x);w.flush();}\n\t\tvoid pln(long x) {w.println(x);w.flush();}\n\t\tvoid pln(String x) {w.println(x);w.flush();}\n\t\tvoid pln(char x) {w.println(x);w.flush();}\n\t\tvoid pln(StringBuilder x) {w.println(x);w.flush();}\n\t\tvoid p(int x) {w.print(x);w.flush();}\n\t\tvoid p(long x) {w.print(x);w.flush();}\n\t\tvoid p(String x) {w.print(x);w.flush();}\n\t\tvoid p(char x) {w.print(x);w.flush();}\n\t\tvoid p(StringBuilder x) {w.print(x);w.flush();}\n\t}\n}", "language": "Java", "metadata": {"date": 1593947321, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03471.html", "problem_id": "p03471", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03471/input.txt", "sample_output_relpath": "derived/input_output/data/p03471/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03471/Java/s858987741.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s858987741", "user_id": "u263333739"}, "prompt_components": {"gold_output": "4 0 5\n", "input_to_evaluate": "import java.io.*;\nimport java.math.*;\nimport java.util.*;\npublic class Main { //CASH MONEY\n \n\tpublic static void main(String[] args) { //Ball out dawg\n\t\tFastScanner I = new FastScanner(); //Input\n\t\tOutPut O = new OutPut(); //Output\n\t\tlong N = I.nextLong();\n\t\tlong Y = I.nextLong();\n\t\tlong x = -1;\n\t\tlong y = -1;\n\t\tlong z = -1;\n\t\tboolean good=false;\n\t\tfor (long a = 0; a<=2000; a++) {\n\t\t\tfor (long b = 0; b <= 2000; b++) {\n\t\t\t\tlong cur = a*1000+b*5000;\n\t\t\t\tif (Y-cur>=0) {\n\t\t\t\t\tlong diff = Y-cur;\n\t\t\t\t\tif ((N-a-b)*10000==diff) {\n\t\t\t\t\t\tx=a;\n\t\t\t\t\t\ty=b;\n\t\t\t\t\t\tz=N-a-b;\n\t\t\t\t\t\tgood=true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (good) break;\n\t\t} \n\t\tO.p(z+\" \"+y+\" \"+x);\n\t}\n\tpublic static long ceil(long num, long den) {long ans = num/den; if (num%den!=0) \n\tans++; return ans;}\n\tpublic static long GCD(long a, long b) {\n\t\tif (a==0||b==0) return Math.max(a,b);\n\t\treturn GCD(Math.min(a, b),Math.max(a, b)%Math.min(a, b));\n\t}\n\tpublic static long FastExp(long base, long exp, long mod) {\n\t\tlong ans=1;\n\t\twhile (exp>0) {\n\t\t\tif (exp%2==1) ans*=base;\n\t\t\texp/=2;\n\t\t\tbase*=base;\n\t\t\tbase%=mod;\n\t\t\tans%=mod;\n\t\t}\n\t\treturn ans;\n\t}\n\tpublic static long ModInv(long num,long mod) {return FastExp(num,mod-2,mod);}\n\tstatic class FastScanner {\n\t\tBufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n\t\tStringTokenizer st=new StringTokenizer(\"\");\n\t\tString next() {\n\t\t\twhile (!st.hasMoreTokens())\n\t\t\t\ttry {\n\t\t\t\t\tst=new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\t\tint nextInt() {return Integer.parseInt(next());}\n\t\tlong nextLong() {return Long.parseLong(next());};\n\t}\n\tstatic class OutPut{\n\t\tPrintWriter w = new PrintWriter(System.out);\n\t\tvoid pln(int x) {w.println(x);w.flush();}\n\t\tvoid pln(long x) {w.println(x);w.flush();}\n\t\tvoid pln(String x) {w.println(x);w.flush();}\n\t\tvoid pln(char x) {w.println(x);w.flush();}\n\t\tvoid pln(StringBuilder x) {w.println(x);w.flush();}\n\t\tvoid p(int x) {w.print(x);w.flush();}\n\t\tvoid p(long x) {w.print(x);w.flush();}\n\t\tvoid p(String x) {w.print(x);w.flush();}\n\t\tvoid p(char x) {w.print(x);w.flush();}\n\t\tvoid p(StringBuilder x) {w.print(x);w.flush();}\n\t}\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThe commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word \"bill\" refers to only these.\n\nAccording to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.\n\nConstraints\n\n1 ≤ N ≤ 2000\n\n1000 ≤ Y ≤ 2 × 10^7\n\nN is an integer.\n\nY is a multiple of 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Y\n\nOutput\n\nIf the total value of N bills cannot be Y yen, print -1 -1 -1.\n\nIf the total value of N bills can be Y yen, let one such set of bills be \"x 10000-yen bills, y 5000-yen bills and z 1000-yen bills\", and print x, y, z with spaces in between. If there are multiple possibilities, any of them may be printed.\n\nSample Input 1\n\n9 45000\n\nSample Output 1\n\n4 0 5\n\nIf the envelope contained 4 10000-yen bills and 5 1000-yen bills, he had 9 bills and 45000 yen in total. It is also possible that the envelope contained 9 5000-yen bills, so the output 0 9 0 is also correct.\n\nSample Input 2\n\n20 196000\n\nSample Output 2\n\n-1 -1 -1\n\nWhen the envelope contained 20 bills in total, the total value would be 200000 yen if all the bills were 10000-yen bills, and would be at most 195000 yen otherwise, so it would never be 196000 yen.\n\nSample Input 3\n\n1000 1234000\n\nSample Output 3\n\n14 27 959\n\nThere are also many other possibilities.\n\nSample Input 4\n\n2000 20000000\n\nSample Output 4\n\n2000 0 0", "sample_input": "9 45000\n"}, "reference_outputs": ["4 0 5\n"], "source_document_id": "p03471", "source_text": "Score : 300 points\n\nProblem Statement\n\nThe commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word \"bill\" refers to only these.\n\nAccording to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.\n\nConstraints\n\n1 ≤ N ≤ 2000\n\n1000 ≤ Y ≤ 2 × 10^7\n\nN is an integer.\n\nY is a multiple of 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Y\n\nOutput\n\nIf the total value of N bills cannot be Y yen, print -1 -1 -1.\n\nIf the total value of N bills can be Y yen, let one such set of bills be \"x 10000-yen bills, y 5000-yen bills and z 1000-yen bills\", and print x, y, z with spaces in between. If there are multiple possibilities, any of them may be printed.\n\nSample Input 1\n\n9 45000\n\nSample Output 1\n\n4 0 5\n\nIf the envelope contained 4 10000-yen bills and 5 1000-yen bills, he had 9 bills and 45000 yen in total. It is also possible that the envelope contained 9 5000-yen bills, so the output 0 9 0 is also correct.\n\nSample Input 2\n\n20 196000\n\nSample Output 2\n\n-1 -1 -1\n\nWhen the envelope contained 20 bills in total, the total value would be 200000 yen if all the bills were 10000-yen bills, and would be at most 195000 yen otherwise, so it would never be 196000 yen.\n\nSample Input 3\n\n1000 1234000\n\nSample Output 3\n\n14 27 959\n\nThere are also many other possibilities.\n\nSample Input 4\n\n2000 20000000\n\nSample Output 4\n\n2000 0 0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2158, "cpu_time_ms": 85, "memory_kb": 25992}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s962030933", "group_id": "codeNet:p03471", "input_text": "import java.util.Scanner;\n\npublic class Main { \n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int Y = sc.nextInt();\n for (int i =0; i<=N; i++) {\n for (int j =0; j<=N-i; j++) {\n int k = N - i - j;\n if (i * 10000 + j * 5000 + k * 1000 == Y) {\n System.out.println(i + \" \" + j + \" \" + k);\n return;\n }\n }\n }\n System.out.println(\"-1 -1 -1\"); \n }\n} ", "language": "Java", "metadata": {"date": 1592492417, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03471.html", "problem_id": "p03471", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03471/input.txt", "sample_output_relpath": "derived/input_output/data/p03471/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03471/Java/s962030933.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s962030933", "user_id": "u538283043"}, "prompt_components": {"gold_output": "4 0 5\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main { \n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int Y = sc.nextInt();\n for (int i =0; i<=N; i++) {\n for (int j =0; j<=N-i; j++) {\n int k = N - i - j;\n if (i * 10000 + j * 5000 + k * 1000 == Y) {\n System.out.println(i + \" \" + j + \" \" + k);\n return;\n }\n }\n }\n System.out.println(\"-1 -1 -1\"); \n }\n} ", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThe commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word \"bill\" refers to only these.\n\nAccording to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.\n\nConstraints\n\n1 ≤ N ≤ 2000\n\n1000 ≤ Y ≤ 2 × 10^7\n\nN is an integer.\n\nY is a multiple of 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Y\n\nOutput\n\nIf the total value of N bills cannot be Y yen, print -1 -1 -1.\n\nIf the total value of N bills can be Y yen, let one such set of bills be \"x 10000-yen bills, y 5000-yen bills and z 1000-yen bills\", and print x, y, z with spaces in between. If there are multiple possibilities, any of them may be printed.\n\nSample Input 1\n\n9 45000\n\nSample Output 1\n\n4 0 5\n\nIf the envelope contained 4 10000-yen bills and 5 1000-yen bills, he had 9 bills and 45000 yen in total. It is also possible that the envelope contained 9 5000-yen bills, so the output 0 9 0 is also correct.\n\nSample Input 2\n\n20 196000\n\nSample Output 2\n\n-1 -1 -1\n\nWhen the envelope contained 20 bills in total, the total value would be 200000 yen if all the bills were 10000-yen bills, and would be at most 195000 yen otherwise, so it would never be 196000 yen.\n\nSample Input 3\n\n1000 1234000\n\nSample Output 3\n\n14 27 959\n\nThere are also many other possibilities.\n\nSample Input 4\n\n2000 20000000\n\nSample Output 4\n\n2000 0 0", "sample_input": "9 45000\n"}, "reference_outputs": ["4 0 5\n"], "source_document_id": "p03471", "source_text": "Score : 300 points\n\nProblem Statement\n\nThe commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word \"bill\" refers to only these.\n\nAccording to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.\n\nConstraints\n\n1 ≤ N ≤ 2000\n\n1000 ≤ Y ≤ 2 × 10^7\n\nN is an integer.\n\nY is a multiple of 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Y\n\nOutput\n\nIf the total value of N bills cannot be Y yen, print -1 -1 -1.\n\nIf the total value of N bills can be Y yen, let one such set of bills be \"x 10000-yen bills, y 5000-yen bills and z 1000-yen bills\", and print x, y, z with spaces in between. If there are multiple possibilities, any of them may be printed.\n\nSample Input 1\n\n9 45000\n\nSample Output 1\n\n4 0 5\n\nIf the envelope contained 4 10000-yen bills and 5 1000-yen bills, he had 9 bills and 45000 yen in total. It is also possible that the envelope contained 9 5000-yen bills, so the output 0 9 0 is also correct.\n\nSample Input 2\n\n20 196000\n\nSample Output 2\n\n-1 -1 -1\n\nWhen the envelope contained 20 bills in total, the total value would be 200000 yen if all the bills were 10000-yen bills, and would be at most 195000 yen otherwise, so it would never be 196000 yen.\n\nSample Input 3\n\n1000 1234000\n\nSample Output 3\n\n14 27 959\n\nThere are also many other possibilities.\n\nSample Input 4\n\n2000 20000000\n\nSample Output 4\n\n2000 0 0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 472, "cpu_time_ms": 100, "memory_kb": 25300}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s876895196", "group_id": "codeNet:p03471", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int y = sc.nextInt();\n\n for (int i = 0; i <= n; i++) {\n for (int j = 0; j + i <= n; j++) {\n\n int k = n - i - j;\n int total = 10000 *i + 5000*j + 1000*k;\n if (total == y) {\n System.out.println(i+\" \"+j+\" \"+k);\n return;\n }\n }\n }\n System.out.println(\"-1 -1 -1\");\n\n }\n}", "language": "Java", "metadata": {"date": 1589231370, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03471.html", "problem_id": "p03471", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03471/input.txt", "sample_output_relpath": "derived/input_output/data/p03471/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03471/Java/s876895196.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s876895196", "user_id": "u434997850"}, "prompt_components": {"gold_output": "4 0 5\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int y = sc.nextInt();\n\n for (int i = 0; i <= n; i++) {\n for (int j = 0; j + i <= n; j++) {\n\n int k = n - i - j;\n int total = 10000 *i + 5000*j + 1000*k;\n if (total == y) {\n System.out.println(i+\" \"+j+\" \"+k);\n return;\n }\n }\n }\n System.out.println(\"-1 -1 -1\");\n\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThe commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word \"bill\" refers to only these.\n\nAccording to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.\n\nConstraints\n\n1 ≤ N ≤ 2000\n\n1000 ≤ Y ≤ 2 × 10^7\n\nN is an integer.\n\nY is a multiple of 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Y\n\nOutput\n\nIf the total value of N bills cannot be Y yen, print -1 -1 -1.\n\nIf the total value of N bills can be Y yen, let one such set of bills be \"x 10000-yen bills, y 5000-yen bills and z 1000-yen bills\", and print x, y, z with spaces in between. If there are multiple possibilities, any of them may be printed.\n\nSample Input 1\n\n9 45000\n\nSample Output 1\n\n4 0 5\n\nIf the envelope contained 4 10000-yen bills and 5 1000-yen bills, he had 9 bills and 45000 yen in total. It is also possible that the envelope contained 9 5000-yen bills, so the output 0 9 0 is also correct.\n\nSample Input 2\n\n20 196000\n\nSample Output 2\n\n-1 -1 -1\n\nWhen the envelope contained 20 bills in total, the total value would be 200000 yen if all the bills were 10000-yen bills, and would be at most 195000 yen otherwise, so it would never be 196000 yen.\n\nSample Input 3\n\n1000 1234000\n\nSample Output 3\n\n14 27 959\n\nThere are also many other possibilities.\n\nSample Input 4\n\n2000 20000000\n\nSample Output 4\n\n2000 0 0", "sample_input": "9 45000\n"}, "reference_outputs": ["4 0 5\n"], "source_document_id": "p03471", "source_text": "Score : 300 points\n\nProblem Statement\n\nThe commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word \"bill\" refers to only these.\n\nAccording to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.\n\nConstraints\n\n1 ≤ N ≤ 2000\n\n1000 ≤ Y ≤ 2 × 10^7\n\nN is an integer.\n\nY is a multiple of 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Y\n\nOutput\n\nIf the total value of N bills cannot be Y yen, print -1 -1 -1.\n\nIf the total value of N bills can be Y yen, let one such set of bills be \"x 10000-yen bills, y 5000-yen bills and z 1000-yen bills\", and print x, y, z with spaces in between. If there are multiple possibilities, any of them may be printed.\n\nSample Input 1\n\n9 45000\n\nSample Output 1\n\n4 0 5\n\nIf the envelope contained 4 10000-yen bills and 5 1000-yen bills, he had 9 bills and 45000 yen in total. It is also possible that the envelope contained 9 5000-yen bills, so the output 0 9 0 is also correct.\n\nSample Input 2\n\n20 196000\n\nSample Output 2\n\n-1 -1 -1\n\nWhen the envelope contained 20 bills in total, the total value would be 200000 yen if all the bills were 10000-yen bills, and would be at most 195000 yen otherwise, so it would never be 196000 yen.\n\nSample Input 3\n\n1000 1234000\n\nSample Output 3\n\n14 27 959\n\nThere are also many other possibilities.\n\nSample Input 4\n\n2000 20000000\n\nSample Output 4\n\n2000 0 0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 585, "cpu_time_ms": 101, "memory_kb": 23252}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s190465721", "group_id": "codeNet:p03471", "input_text": "import java.util.*;\nimport static java.lang.System.*;\nimport java.io.*;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner();\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tint n = sc.nextInt();\n\t\tint y = sc.nextInt();\n\t\tint[] ans = {-1, -1, -1};\n\t\tfor(int i = 0; i <= n; i++) {\n\t\t\tfor(int j = 0; j <= n; j++) {\n\t\t\t\tint ten = i;\n\t\t\t\tint five = j;\n\t\t\t\tint one = n - (ten + five);\n\t\t\t\tif (one < 0) break;\n\t\t\t\tint value = ten * 10000 + five * 5000 + one * 1000;\n\t\t\t\tif (value == y) {\n\t\t\t\t\tans[0] = ten;\n\t\t\t\t\tans[1] = five;\n\t\t\t\t\tans[2] = one;\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t}\t\t\n\n\t\tfor(int i: ans)\n\t\t\tout.print(i + \" \");\n\n\t\tout.close();\n\t}\n\n\t\n\nstatic class FastScanner {\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n }else{\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}\n private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}\n public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}\n public String next() {\n if (!hasNext()) throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while(isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n public long nextLong() {\n if (!hasNext()) throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while(true){\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n }else if(b == -1 || !isPrintableChar(b)){\n return minus ? -n : n;\n }else{\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }\n public double nextDouble() { return Double.parseDouble(next());}\n}\n}\n", "language": "Java", "metadata": {"date": 1586450605, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03471.html", "problem_id": "p03471", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03471/input.txt", "sample_output_relpath": "derived/input_output/data/p03471/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03471/Java/s190465721.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s190465721", "user_id": "u062736195"}, "prompt_components": {"gold_output": "4 0 5\n", "input_to_evaluate": "import java.util.*;\nimport static java.lang.System.*;\nimport java.io.*;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner();\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\tint n = sc.nextInt();\n\t\tint y = sc.nextInt();\n\t\tint[] ans = {-1, -1, -1};\n\t\tfor(int i = 0; i <= n; i++) {\n\t\t\tfor(int j = 0; j <= n; j++) {\n\t\t\t\tint ten = i;\n\t\t\t\tint five = j;\n\t\t\t\tint one = n - (ten + five);\n\t\t\t\tif (one < 0) break;\n\t\t\t\tint value = ten * 10000 + five * 5000 + one * 1000;\n\t\t\t\tif (value == y) {\n\t\t\t\t\tans[0] = ten;\n\t\t\t\t\tans[1] = five;\n\t\t\t\t\tans[2] = one;\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t}\t\t\n\n\t\tfor(int i: ans)\n\t\t\tout.print(i + \" \");\n\n\t\tout.close();\n\t}\n\n\t\n\nstatic class FastScanner {\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n }else{\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}\n private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}\n public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}\n public String next() {\n if (!hasNext()) throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while(isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n public long nextLong() {\n if (!hasNext()) throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while(true){\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n }else if(b == -1 || !isPrintableChar(b)){\n return minus ? -n : n;\n }else{\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }\n public double nextDouble() { return Double.parseDouble(next());}\n}\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThe commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word \"bill\" refers to only these.\n\nAccording to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.\n\nConstraints\n\n1 ≤ N ≤ 2000\n\n1000 ≤ Y ≤ 2 × 10^7\n\nN is an integer.\n\nY is a multiple of 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Y\n\nOutput\n\nIf the total value of N bills cannot be Y yen, print -1 -1 -1.\n\nIf the total value of N bills can be Y yen, let one such set of bills be \"x 10000-yen bills, y 5000-yen bills and z 1000-yen bills\", and print x, y, z with spaces in between. If there are multiple possibilities, any of them may be printed.\n\nSample Input 1\n\n9 45000\n\nSample Output 1\n\n4 0 5\n\nIf the envelope contained 4 10000-yen bills and 5 1000-yen bills, he had 9 bills and 45000 yen in total. It is also possible that the envelope contained 9 5000-yen bills, so the output 0 9 0 is also correct.\n\nSample Input 2\n\n20 196000\n\nSample Output 2\n\n-1 -1 -1\n\nWhen the envelope contained 20 bills in total, the total value would be 200000 yen if all the bills were 10000-yen bills, and would be at most 195000 yen otherwise, so it would never be 196000 yen.\n\nSample Input 3\n\n1000 1234000\n\nSample Output 3\n\n14 27 959\n\nThere are also many other possibilities.\n\nSample Input 4\n\n2000 20000000\n\nSample Output 4\n\n2000 0 0", "sample_input": "9 45000\n"}, "reference_outputs": ["4 0 5\n"], "source_document_id": "p03471", "source_text": "Score : 300 points\n\nProblem Statement\n\nThe commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word \"bill\" refers to only these.\n\nAccording to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.\n\nConstraints\n\n1 ≤ N ≤ 2000\n\n1000 ≤ Y ≤ 2 × 10^7\n\nN is an integer.\n\nY is a multiple of 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Y\n\nOutput\n\nIf the total value of N bills cannot be Y yen, print -1 -1 -1.\n\nIf the total value of N bills can be Y yen, let one such set of bills be \"x 10000-yen bills, y 5000-yen bills and z 1000-yen bills\", and print x, y, z with spaces in between. If there are multiple possibilities, any of them may be printed.\n\nSample Input 1\n\n9 45000\n\nSample Output 1\n\n4 0 5\n\nIf the envelope contained 4 10000-yen bills and 5 1000-yen bills, he had 9 bills and 45000 yen in total. It is also possible that the envelope contained 9 5000-yen bills, so the output 0 9 0 is also correct.\n\nSample Input 2\n\n20 196000\n\nSample Output 2\n\n-1 -1 -1\n\nWhen the envelope contained 20 bills in total, the total value would be 200000 yen if all the bills were 10000-yen bills, and would be at most 195000 yen otherwise, so it would never be 196000 yen.\n\nSample Input 3\n\n1000 1234000\n\nSample Output 3\n\n14 27 959\n\nThere are also many other possibilities.\n\nSample Input 4\n\n2000 20000000\n\nSample Output 4\n\n2000 0 0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2772, "cpu_time_ms": 83, "memory_kb": 22868}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s114322428", "group_id": "codeNet:p03471", "input_text": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n void run() {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int y = sc.nextInt();\n\n for (int i = 0; i <= n; i++) {\n for (int j = 0; j <= n - i; j++) {\n int k = n - j - i;\n if (10000 * i + 5000 * j + 1000 * k == y) {\n System.out.println(i + \" \" + j + \" \" + k);\n return;\n }\n }\n }\n System.out.println(\"-1 -1 -1\");\n }\n\n void debug(Object... os) {\n System.err.println(Arrays.deepToString(os));\n }\n\n public static void main(String[] args) {\n new Main().run();\n }\n\n}\n", "language": "Java", "metadata": {"date": 1583710867, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03471.html", "problem_id": "p03471", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03471/input.txt", "sample_output_relpath": "derived/input_output/data/p03471/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03471/Java/s114322428.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s114322428", "user_id": "u149419355"}, "prompt_components": {"gold_output": "4 0 5\n", "input_to_evaluate": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n void run() {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int y = sc.nextInt();\n\n for (int i = 0; i <= n; i++) {\n for (int j = 0; j <= n - i; j++) {\n int k = n - j - i;\n if (10000 * i + 5000 * j + 1000 * k == y) {\n System.out.println(i + \" \" + j + \" \" + k);\n return;\n }\n }\n }\n System.out.println(\"-1 -1 -1\");\n }\n\n void debug(Object... os) {\n System.err.println(Arrays.deepToString(os));\n }\n\n public static void main(String[] args) {\n new Main().run();\n }\n\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThe commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word \"bill\" refers to only these.\n\nAccording to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.\n\nConstraints\n\n1 ≤ N ≤ 2000\n\n1000 ≤ Y ≤ 2 × 10^7\n\nN is an integer.\n\nY is a multiple of 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Y\n\nOutput\n\nIf the total value of N bills cannot be Y yen, print -1 -1 -1.\n\nIf the total value of N bills can be Y yen, let one such set of bills be \"x 10000-yen bills, y 5000-yen bills and z 1000-yen bills\", and print x, y, z with spaces in between. If there are multiple possibilities, any of them may be printed.\n\nSample Input 1\n\n9 45000\n\nSample Output 1\n\n4 0 5\n\nIf the envelope contained 4 10000-yen bills and 5 1000-yen bills, he had 9 bills and 45000 yen in total. It is also possible that the envelope contained 9 5000-yen bills, so the output 0 9 0 is also correct.\n\nSample Input 2\n\n20 196000\n\nSample Output 2\n\n-1 -1 -1\n\nWhen the envelope contained 20 bills in total, the total value would be 200000 yen if all the bills were 10000-yen bills, and would be at most 195000 yen otherwise, so it would never be 196000 yen.\n\nSample Input 3\n\n1000 1234000\n\nSample Output 3\n\n14 27 959\n\nThere are also many other possibilities.\n\nSample Input 4\n\n2000 20000000\n\nSample Output 4\n\n2000 0 0", "sample_input": "9 45000\n"}, "reference_outputs": ["4 0 5\n"], "source_document_id": "p03471", "source_text": "Score : 300 points\n\nProblem Statement\n\nThe commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word \"bill\" refers to only these.\n\nAccording to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.\n\nConstraints\n\n1 ≤ N ≤ 2000\n\n1000 ≤ Y ≤ 2 × 10^7\n\nN is an integer.\n\nY is a multiple of 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Y\n\nOutput\n\nIf the total value of N bills cannot be Y yen, print -1 -1 -1.\n\nIf the total value of N bills can be Y yen, let one such set of bills be \"x 10000-yen bills, y 5000-yen bills and z 1000-yen bills\", and print x, y, z with spaces in between. If there are multiple possibilities, any of them may be printed.\n\nSample Input 1\n\n9 45000\n\nSample Output 1\n\n4 0 5\n\nIf the envelope contained 4 10000-yen bills and 5 1000-yen bills, he had 9 bills and 45000 yen in total. It is also possible that the envelope contained 9 5000-yen bills, so the output 0 9 0 is also correct.\n\nSample Input 2\n\n20 196000\n\nSample Output 2\n\n-1 -1 -1\n\nWhen the envelope contained 20 bills in total, the total value would be 200000 yen if all the bills were 10000-yen bills, and would be at most 195000 yen otherwise, so it would never be 196000 yen.\n\nSample Input 3\n\n1000 1234000\n\nSample Output 3\n\n14 27 959\n\nThere are also many other possibilities.\n\nSample Input 4\n\n2000 20000000\n\nSample Output 4\n\n2000 0 0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 727, "cpu_time_ms": 108, "memory_kb": 24660}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s775877949", "group_id": "codeNet:p03471", "input_text": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int number, one, five, ten, value;\n boolean flag = true;\n number = Integer.parseInt(sc.next());\n value = Integer.parseInt(sc.next());\n for(ten = 0; ten <= number; ten++) {\n for(five = 0; five <= number - ten; five++) {\n one = number - ten - five;\n if(one * 1000 + five * 5000 + ten * 10000 == value) {\n flag = false;\n System.out.println(ten + \" \" + five + \" \" + one);\n return;\n }\n }\n }\n if(flag) System.out.println(\"-1 -1 -1\");\n }\n}\n", "language": "Java", "metadata": {"date": 1573668863, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03471.html", "problem_id": "p03471", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03471/input.txt", "sample_output_relpath": "derived/input_output/data/p03471/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03471/Java/s775877949.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s775877949", "user_id": "u675751622"}, "prompt_components": {"gold_output": "4 0 5\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int number, one, five, ten, value;\n boolean flag = true;\n number = Integer.parseInt(sc.next());\n value = Integer.parseInt(sc.next());\n for(ten = 0; ten <= number; ten++) {\n for(five = 0; five <= number - ten; five++) {\n one = number - ten - five;\n if(one * 1000 + five * 5000 + ten * 10000 == value) {\n flag = false;\n System.out.println(ten + \" \" + five + \" \" + one);\n return;\n }\n }\n }\n if(flag) System.out.println(\"-1 -1 -1\");\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThe commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word \"bill\" refers to only these.\n\nAccording to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.\n\nConstraints\n\n1 ≤ N ≤ 2000\n\n1000 ≤ Y ≤ 2 × 10^7\n\nN is an integer.\n\nY is a multiple of 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Y\n\nOutput\n\nIf the total value of N bills cannot be Y yen, print -1 -1 -1.\n\nIf the total value of N bills can be Y yen, let one such set of bills be \"x 10000-yen bills, y 5000-yen bills and z 1000-yen bills\", and print x, y, z with spaces in between. If there are multiple possibilities, any of them may be printed.\n\nSample Input 1\n\n9 45000\n\nSample Output 1\n\n4 0 5\n\nIf the envelope contained 4 10000-yen bills and 5 1000-yen bills, he had 9 bills and 45000 yen in total. It is also possible that the envelope contained 9 5000-yen bills, so the output 0 9 0 is also correct.\n\nSample Input 2\n\n20 196000\n\nSample Output 2\n\n-1 -1 -1\n\nWhen the envelope contained 20 bills in total, the total value would be 200000 yen if all the bills were 10000-yen bills, and would be at most 195000 yen otherwise, so it would never be 196000 yen.\n\nSample Input 3\n\n1000 1234000\n\nSample Output 3\n\n14 27 959\n\nThere are also many other possibilities.\n\nSample Input 4\n\n2000 20000000\n\nSample Output 4\n\n2000 0 0", "sample_input": "9 45000\n"}, "reference_outputs": ["4 0 5\n"], "source_document_id": "p03471", "source_text": "Score : 300 points\n\nProblem Statement\n\nThe commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word \"bill\" refers to only these.\n\nAccording to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.\n\nConstraints\n\n1 ≤ N ≤ 2000\n\n1000 ≤ Y ≤ 2 × 10^7\n\nN is an integer.\n\nY is a multiple of 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Y\n\nOutput\n\nIf the total value of N bills cannot be Y yen, print -1 -1 -1.\n\nIf the total value of N bills can be Y yen, let one such set of bills be \"x 10000-yen bills, y 5000-yen bills and z 1000-yen bills\", and print x, y, z with spaces in between. If there are multiple possibilities, any of them may be printed.\n\nSample Input 1\n\n9 45000\n\nSample Output 1\n\n4 0 5\n\nIf the envelope contained 4 10000-yen bills and 5 1000-yen bills, he had 9 bills and 45000 yen in total. It is also possible that the envelope contained 9 5000-yen bills, so the output 0 9 0 is also correct.\n\nSample Input 2\n\n20 196000\n\nSample Output 2\n\n-1 -1 -1\n\nWhen the envelope contained 20 bills in total, the total value would be 200000 yen if all the bills were 10000-yen bills, and would be at most 195000 yen otherwise, so it would never be 196000 yen.\n\nSample Input 3\n\n1000 1234000\n\nSample Output 3\n\n14 27 959\n\nThere are also many other possibilities.\n\nSample Input 4\n\n2000 20000000\n\nSample Output 4\n\n2000 0 0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 104, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s290638809", "group_id": "codeNet:p03471", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint n = sc.nextInt();\n\t\tint y = sc.nextInt();\n\t\tfor(int im=0;n+1>im;im++) {\n\t\t\tint x=0;\n\t\t\tx=(10000*im);\n\t\t\tif(x==y&&im==n) {\n\t\t\t\tSystem.out.println(String.valueOf(im)+\" \"+\"0\"+\" \"+\"0\");\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t\tfor(int gs=0;n+1>gs;gs++) {\n\t\t\t\tx=0;\n\t\t\t\tx=(10000*im)+(5000*gs);\n\t\t\t\tif(x==y&&im+gs==n) {\n\t\t\t\t\tSystem.out.println(String.valueOf(im)+\" \"+String.valueOf(gs)+\" \"+\"0\");\n\t\t\t\t\tSystem.exit(0);\n\t\t\t\t}\n\n\t\t\t\tfor(int s=0;n+1>s;s++) {\n\t\t\t\t\tx=0;\n\t\t\t\t\tx=(10000*im)+(5000*gs)+(1000*s);\n\t\t\t\t\tif(x==y&&im+gs+s==n) {\n\t\t\t\t\t\tSystem.out.println(String.valueOf(im)+\" \"+String.valueOf(gs)+\" \"+String.valueOf(s));\n\t\t\t\t\t\tSystem.exit(0);\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"-1 -1 -1\");\n\t\t//List list=new ArrayList();\n\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1561145064, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03471.html", "problem_id": "p03471", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03471/input.txt", "sample_output_relpath": "derived/input_output/data/p03471/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03471/Java/s290638809.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s290638809", "user_id": "u543569321"}, "prompt_components": {"gold_output": "4 0 5\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint n = sc.nextInt();\n\t\tint y = sc.nextInt();\n\t\tfor(int im=0;n+1>im;im++) {\n\t\t\tint x=0;\n\t\t\tx=(10000*im);\n\t\t\tif(x==y&&im==n) {\n\t\t\t\tSystem.out.println(String.valueOf(im)+\" \"+\"0\"+\" \"+\"0\");\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t\tfor(int gs=0;n+1>gs;gs++) {\n\t\t\t\tx=0;\n\t\t\t\tx=(10000*im)+(5000*gs);\n\t\t\t\tif(x==y&&im+gs==n) {\n\t\t\t\t\tSystem.out.println(String.valueOf(im)+\" \"+String.valueOf(gs)+\" \"+\"0\");\n\t\t\t\t\tSystem.exit(0);\n\t\t\t\t}\n\n\t\t\t\tfor(int s=0;n+1>s;s++) {\n\t\t\t\t\tx=0;\n\t\t\t\t\tx=(10000*im)+(5000*gs)+(1000*s);\n\t\t\t\t\tif(x==y&&im+gs+s==n) {\n\t\t\t\t\t\tSystem.out.println(String.valueOf(im)+\" \"+String.valueOf(gs)+\" \"+String.valueOf(s));\n\t\t\t\t\t\tSystem.exit(0);\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"-1 -1 -1\");\n\t\t//List list=new ArrayList();\n\n\t}\n\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThe commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word \"bill\" refers to only these.\n\nAccording to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.\n\nConstraints\n\n1 ≤ N ≤ 2000\n\n1000 ≤ Y ≤ 2 × 10^7\n\nN is an integer.\n\nY is a multiple of 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Y\n\nOutput\n\nIf the total value of N bills cannot be Y yen, print -1 -1 -1.\n\nIf the total value of N bills can be Y yen, let one such set of bills be \"x 10000-yen bills, y 5000-yen bills and z 1000-yen bills\", and print x, y, z with spaces in between. If there are multiple possibilities, any of them may be printed.\n\nSample Input 1\n\n9 45000\n\nSample Output 1\n\n4 0 5\n\nIf the envelope contained 4 10000-yen bills and 5 1000-yen bills, he had 9 bills and 45000 yen in total. It is also possible that the envelope contained 9 5000-yen bills, so the output 0 9 0 is also correct.\n\nSample Input 2\n\n20 196000\n\nSample Output 2\n\n-1 -1 -1\n\nWhen the envelope contained 20 bills in total, the total value would be 200000 yen if all the bills were 10000-yen bills, and would be at most 195000 yen otherwise, so it would never be 196000 yen.\n\nSample Input 3\n\n1000 1234000\n\nSample Output 3\n\n14 27 959\n\nThere are also many other possibilities.\n\nSample Input 4\n\n2000 20000000\n\nSample Output 4\n\n2000 0 0", "sample_input": "9 45000\n"}, "reference_outputs": ["4 0 5\n"], "source_document_id": "p03471", "source_text": "Score : 300 points\n\nProblem Statement\n\nThe commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word \"bill\" refers to only these.\n\nAccording to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.\n\nConstraints\n\n1 ≤ N ≤ 2000\n\n1000 ≤ Y ≤ 2 × 10^7\n\nN is an integer.\n\nY is a multiple of 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Y\n\nOutput\n\nIf the total value of N bills cannot be Y yen, print -1 -1 -1.\n\nIf the total value of N bills can be Y yen, let one such set of bills be \"x 10000-yen bills, y 5000-yen bills and z 1000-yen bills\", and print x, y, z with spaces in between. If there are multiple possibilities, any of them may be printed.\n\nSample Input 1\n\n9 45000\n\nSample Output 1\n\n4 0 5\n\nIf the envelope contained 4 10000-yen bills and 5 1000-yen bills, he had 9 bills and 45000 yen in total. It is also possible that the envelope contained 9 5000-yen bills, so the output 0 9 0 is also correct.\n\nSample Input 2\n\n20 196000\n\nSample Output 2\n\n-1 -1 -1\n\nWhen the envelope contained 20 bills in total, the total value would be 200000 yen if all the bills were 10000-yen bills, and would be at most 195000 yen otherwise, so it would never be 196000 yen.\n\nSample Input 3\n\n1000 1234000\n\nSample Output 3\n\n14 27 959\n\nThere are also many other possibilities.\n\nSample Input 4\n\n2000 20000000\n\nSample Output 4\n\n2000 0 0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2108, "memory_kb": 22228}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s568834265", "group_id": "codeNet:p03471", "input_text": "import java.util.*;\n\nclass Main {\n\n public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n\n int N = sc.nextInt();\n int Y = sc.nextInt();\n for (int a = 0; a <= N; a++) {\n for (int b = 0; a + b <= N; b++) {\n int c = N - (a + b);\n if (10000 * a + 5000 * b + 1000 * c == Y) {\n System.out.println(a + \" \" + b + \" \" + c);\n return;\n }\n }\n }\n System.out.println(\"-1 -1 -1\");\n }\n}\n", "language": "Java", "metadata": {"date": 1560995141, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03471.html", "problem_id": "p03471", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03471/input.txt", "sample_output_relpath": "derived/input_output/data/p03471/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03471/Java/s568834265.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s568834265", "user_id": "u533482278"}, "prompt_components": {"gold_output": "4 0 5\n", "input_to_evaluate": "import java.util.*;\n\nclass Main {\n\n public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n\n int N = sc.nextInt();\n int Y = sc.nextInt();\n for (int a = 0; a <= N; a++) {\n for (int b = 0; a + b <= N; b++) {\n int c = N - (a + b);\n if (10000 * a + 5000 * b + 1000 * c == Y) {\n System.out.println(a + \" \" + b + \" \" + c);\n return;\n }\n }\n }\n System.out.println(\"-1 -1 -1\");\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThe commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word \"bill\" refers to only these.\n\nAccording to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.\n\nConstraints\n\n1 ≤ N ≤ 2000\n\n1000 ≤ Y ≤ 2 × 10^7\n\nN is an integer.\n\nY is a multiple of 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Y\n\nOutput\n\nIf the total value of N bills cannot be Y yen, print -1 -1 -1.\n\nIf the total value of N bills can be Y yen, let one such set of bills be \"x 10000-yen bills, y 5000-yen bills and z 1000-yen bills\", and print x, y, z with spaces in between. If there are multiple possibilities, any of them may be printed.\n\nSample Input 1\n\n9 45000\n\nSample Output 1\n\n4 0 5\n\nIf the envelope contained 4 10000-yen bills and 5 1000-yen bills, he had 9 bills and 45000 yen in total. It is also possible that the envelope contained 9 5000-yen bills, so the output 0 9 0 is also correct.\n\nSample Input 2\n\n20 196000\n\nSample Output 2\n\n-1 -1 -1\n\nWhen the envelope contained 20 bills in total, the total value would be 200000 yen if all the bills were 10000-yen bills, and would be at most 195000 yen otherwise, so it would never be 196000 yen.\n\nSample Input 3\n\n1000 1234000\n\nSample Output 3\n\n14 27 959\n\nThere are also many other possibilities.\n\nSample Input 4\n\n2000 20000000\n\nSample Output 4\n\n2000 0 0", "sample_input": "9 45000\n"}, "reference_outputs": ["4 0 5\n"], "source_document_id": "p03471", "source_text": "Score : 300 points\n\nProblem Statement\n\nThe commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word \"bill\" refers to only these.\n\nAccording to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.\n\nConstraints\n\n1 ≤ N ≤ 2000\n\n1000 ≤ Y ≤ 2 × 10^7\n\nN is an integer.\n\nY is a multiple of 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Y\n\nOutput\n\nIf the total value of N bills cannot be Y yen, print -1 -1 -1.\n\nIf the total value of N bills can be Y yen, let one such set of bills be \"x 10000-yen bills, y 5000-yen bills and z 1000-yen bills\", and print x, y, z with spaces in between. If there are multiple possibilities, any of them may be printed.\n\nSample Input 1\n\n9 45000\n\nSample Output 1\n\n4 0 5\n\nIf the envelope contained 4 10000-yen bills and 5 1000-yen bills, he had 9 bills and 45000 yen in total. It is also possible that the envelope contained 9 5000-yen bills, so the output 0 9 0 is also correct.\n\nSample Input 2\n\n20 196000\n\nSample Output 2\n\n-1 -1 -1\n\nWhen the envelope contained 20 bills in total, the total value would be 200000 yen if all the bills were 10000-yen bills, and would be at most 195000 yen otherwise, so it would never be 196000 yen.\n\nSample Input 3\n\n1000 1234000\n\nSample Output 3\n\n14 27 959\n\nThere are also many other possibilities.\n\nSample Input 4\n\n2000 20000000\n\nSample Output 4\n\n2000 0 0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 104, "memory_kb": 21972}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s520414594", "group_id": "codeNet:p03471", "input_text": "import java.util.*;\n \nclass Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int y = sc.nextInt();\n\n int a = -1;\n int b = -1;\n int c = -1;\n\n for(int i=0; i<=n; i++){\n \tfor(int j=0; j<=n-i; j++){\n if(10000*i+5000*j+1000*(n-i-j) == y){\n a = i;\n b = j;\n c = n-i-j;\n break;\n }\n }\n }\n System.out.print(a+\" \"+b+\" \"+c);\n }\n}\n", "language": "Java", "metadata": {"date": 1558660627, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03471.html", "problem_id": "p03471", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03471/input.txt", "sample_output_relpath": "derived/input_output/data/p03471/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03471/Java/s520414594.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s520414594", "user_id": "u207391881"}, "prompt_components": {"gold_output": "4 0 5\n", "input_to_evaluate": "import java.util.*;\n \nclass Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int y = sc.nextInt();\n\n int a = -1;\n int b = -1;\n int c = -1;\n\n for(int i=0; i<=n; i++){\n \tfor(int j=0; j<=n-i; j++){\n if(10000*i+5000*j+1000*(n-i-j) == y){\n a = i;\n b = j;\n c = n-i-j;\n break;\n }\n }\n }\n System.out.print(a+\" \"+b+\" \"+c);\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThe commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word \"bill\" refers to only these.\n\nAccording to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.\n\nConstraints\n\n1 ≤ N ≤ 2000\n\n1000 ≤ Y ≤ 2 × 10^7\n\nN is an integer.\n\nY is a multiple of 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Y\n\nOutput\n\nIf the total value of N bills cannot be Y yen, print -1 -1 -1.\n\nIf the total value of N bills can be Y yen, let one such set of bills be \"x 10000-yen bills, y 5000-yen bills and z 1000-yen bills\", and print x, y, z with spaces in between. If there are multiple possibilities, any of them may be printed.\n\nSample Input 1\n\n9 45000\n\nSample Output 1\n\n4 0 5\n\nIf the envelope contained 4 10000-yen bills and 5 1000-yen bills, he had 9 bills and 45000 yen in total. It is also possible that the envelope contained 9 5000-yen bills, so the output 0 9 0 is also correct.\n\nSample Input 2\n\n20 196000\n\nSample Output 2\n\n-1 -1 -1\n\nWhen the envelope contained 20 bills in total, the total value would be 200000 yen if all the bills were 10000-yen bills, and would be at most 195000 yen otherwise, so it would never be 196000 yen.\n\nSample Input 3\n\n1000 1234000\n\nSample Output 3\n\n14 27 959\n\nThere are also many other possibilities.\n\nSample Input 4\n\n2000 20000000\n\nSample Output 4\n\n2000 0 0", "sample_input": "9 45000\n"}, "reference_outputs": ["4 0 5\n"], "source_document_id": "p03471", "source_text": "Score : 300 points\n\nProblem Statement\n\nThe commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word \"bill\" refers to only these.\n\nAccording to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.\n\nConstraints\n\n1 ≤ N ≤ 2000\n\n1000 ≤ Y ≤ 2 × 10^7\n\nN is an integer.\n\nY is a multiple of 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Y\n\nOutput\n\nIf the total value of N bills cannot be Y yen, print -1 -1 -1.\n\nIf the total value of N bills can be Y yen, let one such set of bills be \"x 10000-yen bills, y 5000-yen bills and z 1000-yen bills\", and print x, y, z with spaces in between. If there are multiple possibilities, any of them may be printed.\n\nSample Input 1\n\n9 45000\n\nSample Output 1\n\n4 0 5\n\nIf the envelope contained 4 10000-yen bills and 5 1000-yen bills, he had 9 bills and 45000 yen in total. It is also possible that the envelope contained 9 5000-yen bills, so the output 0 9 0 is also correct.\n\nSample Input 2\n\n20 196000\n\nSample Output 2\n\n-1 -1 -1\n\nWhen the envelope contained 20 bills in total, the total value would be 200000 yen if all the bills were 10000-yen bills, and would be at most 195000 yen otherwise, so it would never be 196000 yen.\n\nSample Input 3\n\n1000 1234000\n\nSample Output 3\n\n14 27 959\n\nThere are also many other possibilities.\n\nSample Input 4\n\n2000 20000000\n\nSample Output 4\n\n2000 0 0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 573, "cpu_time_ms": 103, "memory_kb": 23764}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s591524882", "group_id": "codeNet:p03471", "input_text": "import java.util.Scanner;\n\nclass Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int Y = sc.nextInt() / 1000;\n for (int i = 0; i <= Y / 10; i++) {\n for (int j = 0; j <= Y / 5; j++) {\n if (i * 10 + j * 5 > Y || i + j > N) {\n break;\n }\n for (int k = 0; k <= Y; k++) {\n if (i * 10 + j * 5 + k > Y || i + j + k > N) {\n break;\n }\n if (i * 10 + j * 5 + k == Y && i + j + k == N) {\n System.out.println(String.format(\"%d %d %d\", i, j, k));\n return;\n }\n }\n }\n }\n System.out.println(\"-1 -1 -1\");\n }\n\n}\n", "language": "Java", "metadata": {"date": 1556747031, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03471.html", "problem_id": "p03471", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03471/input.txt", "sample_output_relpath": "derived/input_output/data/p03471/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03471/Java/s591524882.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s591524882", "user_id": "u003018968"}, "prompt_components": {"gold_output": "4 0 5\n", "input_to_evaluate": "import java.util.Scanner;\n\nclass Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int Y = sc.nextInt() / 1000;\n for (int i = 0; i <= Y / 10; i++) {\n for (int j = 0; j <= Y / 5; j++) {\n if (i * 10 + j * 5 > Y || i + j > N) {\n break;\n }\n for (int k = 0; k <= Y; k++) {\n if (i * 10 + j * 5 + k > Y || i + j + k > N) {\n break;\n }\n if (i * 10 + j * 5 + k == Y && i + j + k == N) {\n System.out.println(String.format(\"%d %d %d\", i, j, k));\n return;\n }\n }\n }\n }\n System.out.println(\"-1 -1 -1\");\n }\n\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThe commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word \"bill\" refers to only these.\n\nAccording to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.\n\nConstraints\n\n1 ≤ N ≤ 2000\n\n1000 ≤ Y ≤ 2 × 10^7\n\nN is an integer.\n\nY is a multiple of 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Y\n\nOutput\n\nIf the total value of N bills cannot be Y yen, print -1 -1 -1.\n\nIf the total value of N bills can be Y yen, let one such set of bills be \"x 10000-yen bills, y 5000-yen bills and z 1000-yen bills\", and print x, y, z with spaces in between. If there are multiple possibilities, any of them may be printed.\n\nSample Input 1\n\n9 45000\n\nSample Output 1\n\n4 0 5\n\nIf the envelope contained 4 10000-yen bills and 5 1000-yen bills, he had 9 bills and 45000 yen in total. It is also possible that the envelope contained 9 5000-yen bills, so the output 0 9 0 is also correct.\n\nSample Input 2\n\n20 196000\n\nSample Output 2\n\n-1 -1 -1\n\nWhen the envelope contained 20 bills in total, the total value would be 200000 yen if all the bills were 10000-yen bills, and would be at most 195000 yen otherwise, so it would never be 196000 yen.\n\nSample Input 3\n\n1000 1234000\n\nSample Output 3\n\n14 27 959\n\nThere are also many other possibilities.\n\nSample Input 4\n\n2000 20000000\n\nSample Output 4\n\n2000 0 0", "sample_input": "9 45000\n"}, "reference_outputs": ["4 0 5\n"], "source_document_id": "p03471", "source_text": "Score : 300 points\n\nProblem Statement\n\nThe commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word \"bill\" refers to only these.\n\nAccording to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.\n\nConstraints\n\n1 ≤ N ≤ 2000\n\n1000 ≤ Y ≤ 2 × 10^7\n\nN is an integer.\n\nY is a multiple of 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Y\n\nOutput\n\nIf the total value of N bills cannot be Y yen, print -1 -1 -1.\n\nIf the total value of N bills can be Y yen, let one such set of bills be \"x 10000-yen bills, y 5000-yen bills and z 1000-yen bills\", and print x, y, z with spaces in between. If there are multiple possibilities, any of them may be printed.\n\nSample Input 1\n\n9 45000\n\nSample Output 1\n\n4 0 5\n\nIf the envelope contained 4 10000-yen bills and 5 1000-yen bills, he had 9 bills and 45000 yen in total. It is also possible that the envelope contained 9 5000-yen bills, so the output 0 9 0 is also correct.\n\nSample Input 2\n\n20 196000\n\nSample Output 2\n\n-1 -1 -1\n\nWhen the envelope contained 20 bills in total, the total value would be 200000 yen if all the bills were 10000-yen bills, and would be at most 195000 yen otherwise, so it would never be 196000 yen.\n\nSample Input 3\n\n1000 1234000\n\nSample Output 3\n\n14 27 959\n\nThere are also many other possibilities.\n\nSample Input 4\n\n2000 20000000\n\nSample Output 4\n\n2000 0 0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 692, "cpu_time_ms": 1865, "memory_kb": 23124}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s026804901", "group_id": "codeNet:p03471", "input_text": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner(System.in);\n\n\t\tint N = sc.nextInt();\n\t\tint Y = sc.nextInt();\n\n\t\tY /= 1000;\n\n\t\tfor (int x = 0; x <= N; x++) {\n\t\t\tfor (int y = 0; x + y <= N; y++) {\n\t\t\t\tfor (int z = 0; x + y + z <= N; z++) {\n\t\t\t\t\tif (Y == 10*x + 5 * y + z) {\n\t\t\t\t\t\tSystem.out.println(x + \" \" + y + \" \" + z);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(\"-1 -1 -1\");\n\n\t}\n\n\n\tstatic class FastScanner {\n\n\t\tprivate BufferedReader reader = null;\n\t private StringTokenizer tokenizer = null;\n\n\t public FastScanner(InputStream in) {\n\t reader = new BufferedReader(new InputStreamReader(in));\n\t tokenizer = null;\n\t }\n\n\t public String next() {\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t tokenizer = new StringTokenizer(reader.readLine());\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\t return tokenizer.nextToken();\n\t }\n\n\t public String nextLine() {\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t return reader.readLine();\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\n\t return tokenizer.nextToken(\"\\n\");\n\t }\n\n\t public long nextLong() {\n\t return Long.parseLong(next());\n\t }\n\n\t public int nextInt() {\n\t return Integer.parseInt(next());\n\t }\n\n\t public double nextDouble() {\n\t return Double.parseDouble(next());\n\t }\n\n\t public int[] nextIntArray(int n) {\n\t int[] a = new int[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextInt();\n\t return a;\n\t }\n\n\t public long[] nextLongArray(int n) {\n\t long[] a = new long[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextLong();\n\t return a;\n\t }\n\n\t}\n\n\n}\n", "language": "Java", "metadata": {"date": 1551746782, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03471.html", "problem_id": "p03471", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03471/input.txt", "sample_output_relpath": "derived/input_output/data/p03471/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03471/Java/s026804901.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s026804901", "user_id": "u315868385"}, "prompt_components": {"gold_output": "4 0 5\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner(System.in);\n\n\t\tint N = sc.nextInt();\n\t\tint Y = sc.nextInt();\n\n\t\tY /= 1000;\n\n\t\tfor (int x = 0; x <= N; x++) {\n\t\t\tfor (int y = 0; x + y <= N; y++) {\n\t\t\t\tfor (int z = 0; x + y + z <= N; z++) {\n\t\t\t\t\tif (Y == 10*x + 5 * y + z) {\n\t\t\t\t\t\tSystem.out.println(x + \" \" + y + \" \" + z);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(\"-1 -1 -1\");\n\n\t}\n\n\n\tstatic class FastScanner {\n\n\t\tprivate BufferedReader reader = null;\n\t private StringTokenizer tokenizer = null;\n\n\t public FastScanner(InputStream in) {\n\t reader = new BufferedReader(new InputStreamReader(in));\n\t tokenizer = null;\n\t }\n\n\t public String next() {\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t tokenizer = new StringTokenizer(reader.readLine());\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\t return tokenizer.nextToken();\n\t }\n\n\t public String nextLine() {\n\t if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n\t try {\n\t return reader.readLine();\n\t } catch (IOException e) {\n\t throw new RuntimeException(e);\n\t }\n\t }\n\n\t return tokenizer.nextToken(\"\\n\");\n\t }\n\n\t public long nextLong() {\n\t return Long.parseLong(next());\n\t }\n\n\t public int nextInt() {\n\t return Integer.parseInt(next());\n\t }\n\n\t public double nextDouble() {\n\t return Double.parseDouble(next());\n\t }\n\n\t public int[] nextIntArray(int n) {\n\t int[] a = new int[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextInt();\n\t return a;\n\t }\n\n\t public long[] nextLongArray(int n) {\n\t long[] a = new long[n];\n\t for (int i = 0; i < n; i++)\n\t a[i] = nextLong();\n\t return a;\n\t }\n\n\t}\n\n\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThe commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word \"bill\" refers to only these.\n\nAccording to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.\n\nConstraints\n\n1 ≤ N ≤ 2000\n\n1000 ≤ Y ≤ 2 × 10^7\n\nN is an integer.\n\nY is a multiple of 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Y\n\nOutput\n\nIf the total value of N bills cannot be Y yen, print -1 -1 -1.\n\nIf the total value of N bills can be Y yen, let one such set of bills be \"x 10000-yen bills, y 5000-yen bills and z 1000-yen bills\", and print x, y, z with spaces in between. If there are multiple possibilities, any of them may be printed.\n\nSample Input 1\n\n9 45000\n\nSample Output 1\n\n4 0 5\n\nIf the envelope contained 4 10000-yen bills and 5 1000-yen bills, he had 9 bills and 45000 yen in total. It is also possible that the envelope contained 9 5000-yen bills, so the output 0 9 0 is also correct.\n\nSample Input 2\n\n20 196000\n\nSample Output 2\n\n-1 -1 -1\n\nWhen the envelope contained 20 bills in total, the total value would be 200000 yen if all the bills were 10000-yen bills, and would be at most 195000 yen otherwise, so it would never be 196000 yen.\n\nSample Input 3\n\n1000 1234000\n\nSample Output 3\n\n14 27 959\n\nThere are also many other possibilities.\n\nSample Input 4\n\n2000 20000000\n\nSample Output 4\n\n2000 0 0", "sample_input": "9 45000\n"}, "reference_outputs": ["4 0 5\n"], "source_document_id": "p03471", "source_text": "Score : 300 points\n\nProblem Statement\n\nThe commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word \"bill\" refers to only these.\n\nAccording to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.\n\nConstraints\n\n1 ≤ N ≤ 2000\n\n1000 ≤ Y ≤ 2 × 10^7\n\nN is an integer.\n\nY is a multiple of 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Y\n\nOutput\n\nIf the total value of N bills cannot be Y yen, print -1 -1 -1.\n\nIf the total value of N bills can be Y yen, let one such set of bills be \"x 10000-yen bills, y 5000-yen bills and z 1000-yen bills\", and print x, y, z with spaces in between. If there are multiple possibilities, any of them may be printed.\n\nSample Input 1\n\n9 45000\n\nSample Output 1\n\n4 0 5\n\nIf the envelope contained 4 10000-yen bills and 5 1000-yen bills, he had 9 bills and 45000 yen in total. It is also possible that the envelope contained 9 5000-yen bills, so the output 0 9 0 is also correct.\n\nSample Input 2\n\n20 196000\n\nSample Output 2\n\n-1 -1 -1\n\nWhen the envelope contained 20 bills in total, the total value would be 200000 yen if all the bills were 10000-yen bills, and would be at most 195000 yen otherwise, so it would never be 196000 yen.\n\nSample Input 3\n\n1000 1234000\n\nSample Output 3\n\n14 27 959\n\nThere are also many other possibilities.\n\nSample Input 4\n\n2000 20000000\n\nSample Output 4\n\n2000 0 0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2114, "cpu_time_ms": 1048, "memory_kb": 23380}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s259927759", "group_id": "codeNet:p03471", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint n, y;\n\t\tn = sc.nextInt();\n\t\ty = sc.nextInt();\n\t\t\n\t\tsc.close();\n\t\t\n\t\ty /= 1000;\n\n\t\tint x = -1, z = -1, ans = -1;\n\t\t\n\t\tfor(int i = 0; i <= n; ++i) {\n\t\t\tfor(int j = 0; j + i <= n; ++j) {\n\t\t\t\tint tmp = y - 5 * i - 10 * j;\n\t\t\t\tif(tmp + i + j == n && tmp >= 0) {\n\t\t\t\t\tx = i;\n\t\t\t\t\tz = j;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(x != -1)ans = y - 5 * x - 10 * z;\n\t\tSystem.out.println(z + \" \" + x + \" \" + ans);\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1550632894, "filename_ext": "java", "original_language": "Java7 (OpenJDK 1.7.0)", "problem_description_relpath": "problem_descriptions/p03471.html", "problem_id": "p03471", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03471/input.txt", "sample_output_relpath": "derived/input_output/data/p03471/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03471/Java/s259927759.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s259927759", "user_id": "u949927271"}, "prompt_components": {"gold_output": "4 0 5\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint n, y;\n\t\tn = sc.nextInt();\n\t\ty = sc.nextInt();\n\t\t\n\t\tsc.close();\n\t\t\n\t\ty /= 1000;\n\n\t\tint x = -1, z = -1, ans = -1;\n\t\t\n\t\tfor(int i = 0; i <= n; ++i) {\n\t\t\tfor(int j = 0; j + i <= n; ++j) {\n\t\t\t\tint tmp = y - 5 * i - 10 * j;\n\t\t\t\tif(tmp + i + j == n && tmp >= 0) {\n\t\t\t\t\tx = i;\n\t\t\t\t\tz = j;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(x != -1)ans = y - 5 * x - 10 * z;\n\t\tSystem.out.println(z + \" \" + x + \" \" + ans);\n\t}\n\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThe commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word \"bill\" refers to only these.\n\nAccording to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.\n\nConstraints\n\n1 ≤ N ≤ 2000\n\n1000 ≤ Y ≤ 2 × 10^7\n\nN is an integer.\n\nY is a multiple of 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Y\n\nOutput\n\nIf the total value of N bills cannot be Y yen, print -1 -1 -1.\n\nIf the total value of N bills can be Y yen, let one such set of bills be \"x 10000-yen bills, y 5000-yen bills and z 1000-yen bills\", and print x, y, z with spaces in between. If there are multiple possibilities, any of them may be printed.\n\nSample Input 1\n\n9 45000\n\nSample Output 1\n\n4 0 5\n\nIf the envelope contained 4 10000-yen bills and 5 1000-yen bills, he had 9 bills and 45000 yen in total. It is also possible that the envelope contained 9 5000-yen bills, so the output 0 9 0 is also correct.\n\nSample Input 2\n\n20 196000\n\nSample Output 2\n\n-1 -1 -1\n\nWhen the envelope contained 20 bills in total, the total value would be 200000 yen if all the bills were 10000-yen bills, and would be at most 195000 yen otherwise, so it would never be 196000 yen.\n\nSample Input 3\n\n1000 1234000\n\nSample Output 3\n\n14 27 959\n\nThere are also many other possibilities.\n\nSample Input 4\n\n2000 20000000\n\nSample Output 4\n\n2000 0 0", "sample_input": "9 45000\n"}, "reference_outputs": ["4 0 5\n"], "source_document_id": "p03471", "source_text": "Score : 300 points\n\nProblem Statement\n\nThe commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word \"bill\" refers to only these.\n\nAccording to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.\n\nConstraints\n\n1 ≤ N ≤ 2000\n\n1000 ≤ Y ≤ 2 × 10^7\n\nN is an integer.\n\nY is a multiple of 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Y\n\nOutput\n\nIf the total value of N bills cannot be Y yen, print -1 -1 -1.\n\nIf the total value of N bills can be Y yen, let one such set of bills be \"x 10000-yen bills, y 5000-yen bills and z 1000-yen bills\", and print x, y, z with spaces in between. If there are multiple possibilities, any of them may be printed.\n\nSample Input 1\n\n9 45000\n\nSample Output 1\n\n4 0 5\n\nIf the envelope contained 4 10000-yen bills and 5 1000-yen bills, he had 9 bills and 45000 yen in total. It is also possible that the envelope contained 9 5000-yen bills, so the output 0 9 0 is also correct.\n\nSample Input 2\n\n20 196000\n\nSample Output 2\n\n-1 -1 -1\n\nWhen the envelope contained 20 bills in total, the total value would be 200000 yen if all the bills were 10000-yen bills, and would be at most 195000 yen otherwise, so it would never be 196000 yen.\n\nSample Input 3\n\n1000 1234000\n\nSample Output 3\n\n14 27 959\n\nThere are also many other possibilities.\n\nSample Input 4\n\n2000 20000000\n\nSample Output 4\n\n2000 0 0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 111, "memory_kb": 22996}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s840175757", "group_id": "codeNet:p03471", "input_text": "import java.io.File;\nimport java.io.IOException;\nimport java.util.*;\n \npublic class Main {\n \n\tpublic static void main(String[] args) throws IOException {\n\t\tFile file = new File(\"input.txt\");\n\t\tScanner sc = new Scanner(file);\n\t\t\n\t\t//Scanner sc = new Scanner(System.in);\n\t\t\n\t\tint N = sc.nextInt();\n\t\tint Y = sc.nextInt();\n\t\t\n\t\tfor(int x = 0; x <= N; x++){\n\t\t\tif(10000 * x > Y) continue;\n\t\t\tfor(int y = 0; y <= N - x; y++){\n\t\t\t\tint z = N - x - y;\n\t\t\t\tint xx = 10000 * x;\n\t\t\t\tint yy = 5000 * y;\n\t\t\t\tint zz = 1000 * z;\n\t\t\t\tif(xx + yy + zz == Y){\n\t\t\t\t\tSystem.out.println(x + \" \" + y + \" \" + z);\n\t\t\t\t\t//System.out.println(xx + \" \" + yy + \" \" + zz);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(\"-1 -1 -1\");\n\t}\n}", "language": "Java", "metadata": {"date": 1541535687, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03471.html", "problem_id": "p03471", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03471/input.txt", "sample_output_relpath": "derived/input_output/data/p03471/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03471/Java/s840175757.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s840175757", "user_id": "u234826697"}, "prompt_components": {"gold_output": "4 0 5\n", "input_to_evaluate": "import java.io.File;\nimport java.io.IOException;\nimport java.util.*;\n \npublic class Main {\n \n\tpublic static void main(String[] args) throws IOException {\n\t\tFile file = new File(\"input.txt\");\n\t\tScanner sc = new Scanner(file);\n\t\t\n\t\t//Scanner sc = new Scanner(System.in);\n\t\t\n\t\tint N = sc.nextInt();\n\t\tint Y = sc.nextInt();\n\t\t\n\t\tfor(int x = 0; x <= N; x++){\n\t\t\tif(10000 * x > Y) continue;\n\t\t\tfor(int y = 0; y <= N - x; y++){\n\t\t\t\tint z = N - x - y;\n\t\t\t\tint xx = 10000 * x;\n\t\t\t\tint yy = 5000 * y;\n\t\t\t\tint zz = 1000 * z;\n\t\t\t\tif(xx + yy + zz == Y){\n\t\t\t\t\tSystem.out.println(x + \" \" + y + \" \" + z);\n\t\t\t\t\t//System.out.println(xx + \" \" + yy + \" \" + zz);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(\"-1 -1 -1\");\n\t}\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThe commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word \"bill\" refers to only these.\n\nAccording to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.\n\nConstraints\n\n1 ≤ N ≤ 2000\n\n1000 ≤ Y ≤ 2 × 10^7\n\nN is an integer.\n\nY is a multiple of 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Y\n\nOutput\n\nIf the total value of N bills cannot be Y yen, print -1 -1 -1.\n\nIf the total value of N bills can be Y yen, let one such set of bills be \"x 10000-yen bills, y 5000-yen bills and z 1000-yen bills\", and print x, y, z with spaces in between. If there are multiple possibilities, any of them may be printed.\n\nSample Input 1\n\n9 45000\n\nSample Output 1\n\n4 0 5\n\nIf the envelope contained 4 10000-yen bills and 5 1000-yen bills, he had 9 bills and 45000 yen in total. It is also possible that the envelope contained 9 5000-yen bills, so the output 0 9 0 is also correct.\n\nSample Input 2\n\n20 196000\n\nSample Output 2\n\n-1 -1 -1\n\nWhen the envelope contained 20 bills in total, the total value would be 200000 yen if all the bills were 10000-yen bills, and would be at most 195000 yen otherwise, so it would never be 196000 yen.\n\nSample Input 3\n\n1000 1234000\n\nSample Output 3\n\n14 27 959\n\nThere are also many other possibilities.\n\nSample Input 4\n\n2000 20000000\n\nSample Output 4\n\n2000 0 0", "sample_input": "9 45000\n"}, "reference_outputs": ["4 0 5\n"], "source_document_id": "p03471", "source_text": "Score : 300 points\n\nProblem Statement\n\nThe commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word \"bill\" refers to only these.\n\nAccording to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.\n\nConstraints\n\n1 ≤ N ≤ 2000\n\n1000 ≤ Y ≤ 2 × 10^7\n\nN is an integer.\n\nY is a multiple of 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Y\n\nOutput\n\nIf the total value of N bills cannot be Y yen, print -1 -1 -1.\n\nIf the total value of N bills can be Y yen, let one such set of bills be \"x 10000-yen bills, y 5000-yen bills and z 1000-yen bills\", and print x, y, z with spaces in between. If there are multiple possibilities, any of them may be printed.\n\nSample Input 1\n\n9 45000\n\nSample Output 1\n\n4 0 5\n\nIf the envelope contained 4 10000-yen bills and 5 1000-yen bills, he had 9 bills and 45000 yen in total. It is also possible that the envelope contained 9 5000-yen bills, so the output 0 9 0 is also correct.\n\nSample Input 2\n\n20 196000\n\nSample Output 2\n\n-1 -1 -1\n\nWhen the envelope contained 20 bills in total, the total value would be 200000 yen if all the bills were 10000-yen bills, and would be at most 195000 yen otherwise, so it would never be 196000 yen.\n\nSample Input 3\n\n1000 1234000\n\nSample Output 3\n\n14 27 959\n\nThere are also many other possibilities.\n\nSample Input 4\n\n2000 20000000\n\nSample Output 4\n\n2000 0 0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 711, "cpu_time_ms": 73, "memory_kb": 22612}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s664769731", "group_id": "codeNet:p03471", "input_text": "import java.util.*;\nimport java.io.*;\n\npublic class Main{\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n int y = scan.nextInt();\n boolean flag = false;\n\n outside:for(int i = 0; i <= n; i++){\n for(int j = 0; j <=n-i; j++){\n if(10000*i + 5000*j + 1000*(n-i-j) == y){\n System.out.println(i + \" \" + j + \" \" + (n-i-j));\n flag = true;\n break outside;\n }\n }\n }\n if(flag == false){System.out.println((-1) + \" \" + (-1) + \" \" + (-1));}\n }\n}\n", "language": "Java", "metadata": {"date": 1541033515, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03471.html", "problem_id": "p03471", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03471/input.txt", "sample_output_relpath": "derived/input_output/data/p03471/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03471/Java/s664769731.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s664769731", "user_id": "u075367840"}, "prompt_components": {"gold_output": "4 0 5\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\n\npublic class Main{\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n int y = scan.nextInt();\n boolean flag = false;\n\n outside:for(int i = 0; i <= n; i++){\n for(int j = 0; j <=n-i; j++){\n if(10000*i + 5000*j + 1000*(n-i-j) == y){\n System.out.println(i + \" \" + j + \" \" + (n-i-j));\n flag = true;\n break outside;\n }\n }\n }\n if(flag == false){System.out.println((-1) + \" \" + (-1) + \" \" + (-1));}\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThe commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word \"bill\" refers to only these.\n\nAccording to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.\n\nConstraints\n\n1 ≤ N ≤ 2000\n\n1000 ≤ Y ≤ 2 × 10^7\n\nN is an integer.\n\nY is a multiple of 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Y\n\nOutput\n\nIf the total value of N bills cannot be Y yen, print -1 -1 -1.\n\nIf the total value of N bills can be Y yen, let one such set of bills be \"x 10000-yen bills, y 5000-yen bills and z 1000-yen bills\", and print x, y, z with spaces in between. If there are multiple possibilities, any of them may be printed.\n\nSample Input 1\n\n9 45000\n\nSample Output 1\n\n4 0 5\n\nIf the envelope contained 4 10000-yen bills and 5 1000-yen bills, he had 9 bills and 45000 yen in total. It is also possible that the envelope contained 9 5000-yen bills, so the output 0 9 0 is also correct.\n\nSample Input 2\n\n20 196000\n\nSample Output 2\n\n-1 -1 -1\n\nWhen the envelope contained 20 bills in total, the total value would be 200000 yen if all the bills were 10000-yen bills, and would be at most 195000 yen otherwise, so it would never be 196000 yen.\n\nSample Input 3\n\n1000 1234000\n\nSample Output 3\n\n14 27 959\n\nThere are also many other possibilities.\n\nSample Input 4\n\n2000 20000000\n\nSample Output 4\n\n2000 0 0", "sample_input": "9 45000\n"}, "reference_outputs": ["4 0 5\n"], "source_document_id": "p03471", "source_text": "Score : 300 points\n\nProblem Statement\n\nThe commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word \"bill\" refers to only these.\n\nAccording to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.\n\nConstraints\n\n1 ≤ N ≤ 2000\n\n1000 ≤ Y ≤ 2 × 10^7\n\nN is an integer.\n\nY is a multiple of 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Y\n\nOutput\n\nIf the total value of N bills cannot be Y yen, print -1 -1 -1.\n\nIf the total value of N bills can be Y yen, let one such set of bills be \"x 10000-yen bills, y 5000-yen bills and z 1000-yen bills\", and print x, y, z with spaces in between. If there are multiple possibilities, any of them may be printed.\n\nSample Input 1\n\n9 45000\n\nSample Output 1\n\n4 0 5\n\nIf the envelope contained 4 10000-yen bills and 5 1000-yen bills, he had 9 bills and 45000 yen in total. It is also possible that the envelope contained 9 5000-yen bills, so the output 0 9 0 is also correct.\n\nSample Input 2\n\n20 196000\n\nSample Output 2\n\n-1 -1 -1\n\nWhen the envelope contained 20 bills in total, the total value would be 200000 yen if all the bills were 10000-yen bills, and would be at most 195000 yen otherwise, so it would never be 196000 yen.\n\nSample Input 3\n\n1000 1234000\n\nSample Output 3\n\n14 27 959\n\nThere are also many other possibilities.\n\nSample Input 4\n\n2000 20000000\n\nSample Output 4\n\n2000 0 0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 100, "memory_kb": 23252}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s023325170", "group_id": "codeNet:p03471", "input_text": "import java.util.*;\n\npublic class Main {\n\n\tpublic static void main(\n\t\t\tString[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint y = sc.nextInt();\n\t\tfor (int i = 0; i <= n; i++) {\n\t\t\tfor (int j = 0; j <= n; j++) {\n\t\t\t\tif (i + j > n) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif ((n - i - j) * 10000 + j * 5000 + i * 1000 == y) {\n\t\t\t\t\tSystem.out.println((n - i - j) + \" \" + j + \" \" + i);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"-1 -1 -1\");\n\t}\n}\n", "language": "Java", "metadata": {"date": 1537387618, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03471.html", "problem_id": "p03471", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03471/input.txt", "sample_output_relpath": "derived/input_output/data/p03471/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03471/Java/s023325170.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s023325170", "user_id": "u631591148"}, "prompt_components": {"gold_output": "4 0 5\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n\n\tpublic static void main(\n\t\t\tString[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint y = sc.nextInt();\n\t\tfor (int i = 0; i <= n; i++) {\n\t\t\tfor (int j = 0; j <= n; j++) {\n\t\t\t\tif (i + j > n) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif ((n - i - j) * 10000 + j * 5000 + i * 1000 == y) {\n\t\t\t\t\tSystem.out.println((n - i - j) + \" \" + j + \" \" + i);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"-1 -1 -1\");\n\t}\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThe commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word \"bill\" refers to only these.\n\nAccording to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.\n\nConstraints\n\n1 ≤ N ≤ 2000\n\n1000 ≤ Y ≤ 2 × 10^7\n\nN is an integer.\n\nY is a multiple of 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Y\n\nOutput\n\nIf the total value of N bills cannot be Y yen, print -1 -1 -1.\n\nIf the total value of N bills can be Y yen, let one such set of bills be \"x 10000-yen bills, y 5000-yen bills and z 1000-yen bills\", and print x, y, z with spaces in between. If there are multiple possibilities, any of them may be printed.\n\nSample Input 1\n\n9 45000\n\nSample Output 1\n\n4 0 5\n\nIf the envelope contained 4 10000-yen bills and 5 1000-yen bills, he had 9 bills and 45000 yen in total. It is also possible that the envelope contained 9 5000-yen bills, so the output 0 9 0 is also correct.\n\nSample Input 2\n\n20 196000\n\nSample Output 2\n\n-1 -1 -1\n\nWhen the envelope contained 20 bills in total, the total value would be 200000 yen if all the bills were 10000-yen bills, and would be at most 195000 yen otherwise, so it would never be 196000 yen.\n\nSample Input 3\n\n1000 1234000\n\nSample Output 3\n\n14 27 959\n\nThere are also many other possibilities.\n\nSample Input 4\n\n2000 20000000\n\nSample Output 4\n\n2000 0 0", "sample_input": "9 45000\n"}, "reference_outputs": ["4 0 5\n"], "source_document_id": "p03471", "source_text": "Score : 300 points\n\nProblem Statement\n\nThe commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word \"bill\" refers to only these.\n\nAccording to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.\n\nConstraints\n\n1 ≤ N ≤ 2000\n\n1000 ≤ Y ≤ 2 × 10^7\n\nN is an integer.\n\nY is a multiple of 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Y\n\nOutput\n\nIf the total value of N bills cannot be Y yen, print -1 -1 -1.\n\nIf the total value of N bills can be Y yen, let one such set of bills be \"x 10000-yen bills, y 5000-yen bills and z 1000-yen bills\", and print x, y, z with spaces in between. If there are multiple possibilities, any of them may be printed.\n\nSample Input 1\n\n9 45000\n\nSample Output 1\n\n4 0 5\n\nIf the envelope contained 4 10000-yen bills and 5 1000-yen bills, he had 9 bills and 45000 yen in total. It is also possible that the envelope contained 9 5000-yen bills, so the output 0 9 0 is also correct.\n\nSample Input 2\n\n20 196000\n\nSample Output 2\n\n-1 -1 -1\n\nWhen the envelope contained 20 bills in total, the total value would be 200000 yen if all the bills were 10000-yen bills, and would be at most 195000 yen otherwise, so it would never be 196000 yen.\n\nSample Input 3\n\n1000 1234000\n\nSample Output 3\n\n14 27 959\n\nThere are also many other possibilities.\n\nSample Input 4\n\n2000 20000000\n\nSample Output 4\n\n2000 0 0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 102, "memory_kb": 23632}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s295167466", "group_id": "codeNet:p03471", "input_text": "import java.util.*;\n\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tint Y = sc.nextInt() / 1000;\n\t\tfor (int x=0; x<=2000; x++) {\n\t\t\tfor (int y=0; y<=4000; y++) {\n\t\t\t\tint z = N - x - y;\n\t\t\t\tif (z >= 0 && 10*x + 5*y + z == Y) {\n\t\t\t\t\tSystem.out.println(String.format(\"%d %d %d\", x, y, z));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"-1 -1 -1\");\n\t}\n}", "language": "Java", "metadata": {"date": 1520479143, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03471.html", "problem_id": "p03471", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03471/input.txt", "sample_output_relpath": "derived/input_output/data/p03471/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03471/Java/s295167466.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s295167466", "user_id": "u903215911"}, "prompt_components": {"gold_output": "4 0 5\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tint Y = sc.nextInt() / 1000;\n\t\tfor (int x=0; x<=2000; x++) {\n\t\t\tfor (int y=0; y<=4000; y++) {\n\t\t\t\tint z = N - x - y;\n\t\t\t\tif (z >= 0 && 10*x + 5*y + z == Y) {\n\t\t\t\t\tSystem.out.println(String.format(\"%d %d %d\", x, y, z));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"-1 -1 -1\");\n\t}\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThe commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word \"bill\" refers to only these.\n\nAccording to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.\n\nConstraints\n\n1 ≤ N ≤ 2000\n\n1000 ≤ Y ≤ 2 × 10^7\n\nN is an integer.\n\nY is a multiple of 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Y\n\nOutput\n\nIf the total value of N bills cannot be Y yen, print -1 -1 -1.\n\nIf the total value of N bills can be Y yen, let one such set of bills be \"x 10000-yen bills, y 5000-yen bills and z 1000-yen bills\", and print x, y, z with spaces in between. If there are multiple possibilities, any of them may be printed.\n\nSample Input 1\n\n9 45000\n\nSample Output 1\n\n4 0 5\n\nIf the envelope contained 4 10000-yen bills and 5 1000-yen bills, he had 9 bills and 45000 yen in total. It is also possible that the envelope contained 9 5000-yen bills, so the output 0 9 0 is also correct.\n\nSample Input 2\n\n20 196000\n\nSample Output 2\n\n-1 -1 -1\n\nWhen the envelope contained 20 bills in total, the total value would be 200000 yen if all the bills were 10000-yen bills, and would be at most 195000 yen otherwise, so it would never be 196000 yen.\n\nSample Input 3\n\n1000 1234000\n\nSample Output 3\n\n14 27 959\n\nThere are also many other possibilities.\n\nSample Input 4\n\n2000 20000000\n\nSample Output 4\n\n2000 0 0", "sample_input": "9 45000\n"}, "reference_outputs": ["4 0 5\n"], "source_document_id": "p03471", "source_text": "Score : 300 points\n\nProblem Statement\n\nThe commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word \"bill\" refers to only these.\n\nAccording to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.\n\nConstraints\n\n1 ≤ N ≤ 2000\n\n1000 ≤ Y ≤ 2 × 10^7\n\nN is an integer.\n\nY is a multiple of 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Y\n\nOutput\n\nIf the total value of N bills cannot be Y yen, print -1 -1 -1.\n\nIf the total value of N bills can be Y yen, let one such set of bills be \"x 10000-yen bills, y 5000-yen bills and z 1000-yen bills\", and print x, y, z with spaces in between. If there are multiple possibilities, any of them may be printed.\n\nSample Input 1\n\n9 45000\n\nSample Output 1\n\n4 0 5\n\nIf the envelope contained 4 10000-yen bills and 5 1000-yen bills, he had 9 bills and 45000 yen in total. It is also possible that the envelope contained 9 5000-yen bills, so the output 0 9 0 is also correct.\n\nSample Input 2\n\n20 196000\n\nSample Output 2\n\n-1 -1 -1\n\nWhen the envelope contained 20 bills in total, the total value would be 200000 yen if all the bills were 10000-yen bills, and would be at most 195000 yen otherwise, so it would never be 196000 yen.\n\nSample Input 3\n\n1000 1234000\n\nSample Output 3\n\n14 27 959\n\nThere are also many other possibilities.\n\nSample Input 4\n\n2000 20000000\n\nSample Output 4\n\n2000 0 0", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 107, "memory_kb": 23124}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s511003021", "group_id": "codeNet:p03472", "input_text": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static String Y = \"Yes\";\n\tpublic static String N = \"No\";\n\tpublic static long MOD = (long) (Math.pow(10, 9) + 7);\n\tpublic static Scanner sc = new Scanner(System.in);\n\n\tpublic static void main(String[] args) {\n\t\tint n = ni();\n\n\t\tlong h = ni();\n\n\t\tlong a[] = new long[n];\n\t\tlong b[] = new long[n];\n\t\tlong count = 0;\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = nl();\n\t\t\tb[i] = nl();\n\t\t}\n\t\ta = sort(a);\n\t\tb = sort(b);\n\n\t\tfor (int i = n - 1; i >= 0; i--) {\n\t\t\tif (b[i] < a[n - 1]) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\th -= b[i];\n\t\t\tcount++;\n\t\t\tif (h <= 0) {\n\t\t\t\tout(count);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tcount += h / a[n - 1];\n\t\tif (h % a[n - 1] != 0) {\n\t\t\tcount++;\n\t\t}\n\t\tout(count);\n\t\t//\t\tfor (;;) {\n\t\t//\t\t\th -= a[n - 1];\n\t\t//\t\t\tcount++;\n\t\t//\t\t\tif (h <= 0) {\n\t\t//\t\t\t\tout(count);\n\t\t//\t\t\t\treturn;\n\t\t//\t\t\t}\n\t\t//\t\t}\n\t}\n\n\t/*\n\t * 以下メソッド集\n\t */\n\tstatic int[] sort(int[] n) {\n\t\tArrays.sort(n);\n\t\treturn n;\n\t}\n\n\tstatic void debug() {\n\t\tout(\"---\");\n\t}\n\n\tstatic void debug(long a) {\n\t\tout(\"-------\");\n\t\tout(a);\n\t\tout(\"-------\");\n\t}\n\n\tstatic void debug(String a) {\n\t\tout(\"-------\");\n\t\tout(a);\n\t\tout(\"-------\");\n\t}\n\n\tstatic long[] sort(long[] n) {\n\t\tArrays.sort(n);\n\t\treturn n;\n\t}\n\n\tstatic int ketasuu(int n) {\n\t\tString str = \"\" + n;\n\t\treturn str.length();\n\t}\n\n\tstatic int account(String str) {\n\t\tString target = \"AC\";\n\t\tint count = 0;\n\t\tint len = str.length();\n\t\tfor (int i = 0; i < len - 1; i++) {\n\t\t\tif (target.equals(str.substring(i, i + target.length()))) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\treturn count;\n\t}\n\n\tstatic int ni() {\n\t\treturn sc.nextInt();\n\t}\n\n\tstatic long nl() {\n\t\treturn sc.nextLong();\n\t}\n\n\tstatic double nd() {\n\t\treturn sc.nextDouble();\n\t}\n\n\tstatic String n() {\n\t\treturn sc.next();\n\t}\n\n\tstatic char[] nc() {\n\t\treturn sc.next().toCharArray();\n\t}\n\n\tstatic int kaijo(int n) {\n\t\tif (n == 0 || n == 1) {\n\t\t\treturn 1;\n\t\t} else {\n\t\t\treturn n * kaijo(n - 1);\n\t\t}\n\t}\n\n\tstatic int fib(int n) {\n\t\treturn (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1);\n\t}\n\n\tstatic long lcm(long m, long n) {\n\n\t\treturn m * n / gcd(m, n);\n\t}\n\n\tstatic int lcm(int m, int n) {\n\n\t\treturn m * n / gcd(m, n);\n\t}\n\n\tstatic long gcd(long a, long b) {\n\t\treturn (b == 0) ? a : gcd(b, a % b);\n\t}\n\n\tstatic int gcd(int a, int b) {\n\t\treturn (b == 0) ? a : gcd(b, a % b);\n\t}\n\n\tstatic void out(String info) {\n\t\tSystem.out.println(info);\n\t}\n\n\tstatic void out(int info) {\n\t\tSystem.out.println(info);\n\t}\n\n\tstatic void out(double info) {\n\t\tSystem.out.println(info);\n\t}\n\n\tstatic void out(long info) {\n\t\tSystem.out.println(info);\n\t}\n\n\tstatic void out(char info) {\n\t\tSystem.out.println(info);\n\t}\n\n\tstatic void out(Object obj) {\n\t\tSystem.out.println(obj.toString());\n\t}\n\n\tstatic void outn(String info) {\n\t\tSystem.out.print(info);\n\t}\n\n\tstatic void outn(int info) {\n\t\tSystem.out.print(info);\n\t}\n\n\tstatic void outn(double info) {\n\t\tSystem.out.print(info);\n\t}\n\n\tstatic void outn(long info) {\n\t\tSystem.out.print(info);\n\t}\n\n\tstatic void outn(char info) {\n\t\tSystem.out.print(info);\n\t}\n\n\tstatic double max(double d, double e) {\n\t\treturn Math.max(d, e);\n\t}\n\n\tstatic long max(long a, long b) {\n\t\treturn Math.max(a, b);\n\t}\n\n\tstatic long min(long d, long e) {\n\t\treturn Math.min(d, e);\n\t}\n\n\tstatic int min(int a, int b) {\n\t\treturn (int) Math.min(a, b);\n\t}\n}\n\nclass XY {\n\tint h;\n\tint c;\n\n\tXY(int h, int c) {\n\t\tthis.h = h;\n\t\tthis.c = c;\n\t}\n}\n", "language": "Java", "metadata": {"date": 1593653767, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p03472.html", "problem_id": "p03472", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03472/input.txt", "sample_output_relpath": "derived/input_output/data/p03472/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03472/Java/s511003021.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s511003021", "user_id": "u061406236"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static String Y = \"Yes\";\n\tpublic static String N = \"No\";\n\tpublic static long MOD = (long) (Math.pow(10, 9) + 7);\n\tpublic static Scanner sc = new Scanner(System.in);\n\n\tpublic static void main(String[] args) {\n\t\tint n = ni();\n\n\t\tlong h = ni();\n\n\t\tlong a[] = new long[n];\n\t\tlong b[] = new long[n];\n\t\tlong count = 0;\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = nl();\n\t\t\tb[i] = nl();\n\t\t}\n\t\ta = sort(a);\n\t\tb = sort(b);\n\n\t\tfor (int i = n - 1; i >= 0; i--) {\n\t\t\tif (b[i] < a[n - 1]) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\th -= b[i];\n\t\t\tcount++;\n\t\t\tif (h <= 0) {\n\t\t\t\tout(count);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tcount += h / a[n - 1];\n\t\tif (h % a[n - 1] != 0) {\n\t\t\tcount++;\n\t\t}\n\t\tout(count);\n\t\t//\t\tfor (;;) {\n\t\t//\t\t\th -= a[n - 1];\n\t\t//\t\t\tcount++;\n\t\t//\t\t\tif (h <= 0) {\n\t\t//\t\t\t\tout(count);\n\t\t//\t\t\t\treturn;\n\t\t//\t\t\t}\n\t\t//\t\t}\n\t}\n\n\t/*\n\t * 以下メソッド集\n\t */\n\tstatic int[] sort(int[] n) {\n\t\tArrays.sort(n);\n\t\treturn n;\n\t}\n\n\tstatic void debug() {\n\t\tout(\"---\");\n\t}\n\n\tstatic void debug(long a) {\n\t\tout(\"-------\");\n\t\tout(a);\n\t\tout(\"-------\");\n\t}\n\n\tstatic void debug(String a) {\n\t\tout(\"-------\");\n\t\tout(a);\n\t\tout(\"-------\");\n\t}\n\n\tstatic long[] sort(long[] n) {\n\t\tArrays.sort(n);\n\t\treturn n;\n\t}\n\n\tstatic int ketasuu(int n) {\n\t\tString str = \"\" + n;\n\t\treturn str.length();\n\t}\n\n\tstatic int account(String str) {\n\t\tString target = \"AC\";\n\t\tint count = 0;\n\t\tint len = str.length();\n\t\tfor (int i = 0; i < len - 1; i++) {\n\t\t\tif (target.equals(str.substring(i, i + target.length()))) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\treturn count;\n\t}\n\n\tstatic int ni() {\n\t\treturn sc.nextInt();\n\t}\n\n\tstatic long nl() {\n\t\treturn sc.nextLong();\n\t}\n\n\tstatic double nd() {\n\t\treturn sc.nextDouble();\n\t}\n\n\tstatic String n() {\n\t\treturn sc.next();\n\t}\n\n\tstatic char[] nc() {\n\t\treturn sc.next().toCharArray();\n\t}\n\n\tstatic int kaijo(int n) {\n\t\tif (n == 0 || n == 1) {\n\t\t\treturn 1;\n\t\t} else {\n\t\t\treturn n * kaijo(n - 1);\n\t\t}\n\t}\n\n\tstatic int fib(int n) {\n\t\treturn (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1);\n\t}\n\n\tstatic long lcm(long m, long n) {\n\n\t\treturn m * n / gcd(m, n);\n\t}\n\n\tstatic int lcm(int m, int n) {\n\n\t\treturn m * n / gcd(m, n);\n\t}\n\n\tstatic long gcd(long a, long b) {\n\t\treturn (b == 0) ? a : gcd(b, a % b);\n\t}\n\n\tstatic int gcd(int a, int b) {\n\t\treturn (b == 0) ? a : gcd(b, a % b);\n\t}\n\n\tstatic void out(String info) {\n\t\tSystem.out.println(info);\n\t}\n\n\tstatic void out(int info) {\n\t\tSystem.out.println(info);\n\t}\n\n\tstatic void out(double info) {\n\t\tSystem.out.println(info);\n\t}\n\n\tstatic void out(long info) {\n\t\tSystem.out.println(info);\n\t}\n\n\tstatic void out(char info) {\n\t\tSystem.out.println(info);\n\t}\n\n\tstatic void out(Object obj) {\n\t\tSystem.out.println(obj.toString());\n\t}\n\n\tstatic void outn(String info) {\n\t\tSystem.out.print(info);\n\t}\n\n\tstatic void outn(int info) {\n\t\tSystem.out.print(info);\n\t}\n\n\tstatic void outn(double info) {\n\t\tSystem.out.print(info);\n\t}\n\n\tstatic void outn(long info) {\n\t\tSystem.out.print(info);\n\t}\n\n\tstatic void outn(char info) {\n\t\tSystem.out.print(info);\n\t}\n\n\tstatic double max(double d, double e) {\n\t\treturn Math.max(d, e);\n\t}\n\n\tstatic long max(long a, long b) {\n\t\treturn Math.max(a, b);\n\t}\n\n\tstatic long min(long d, long e) {\n\t\treturn Math.min(d, e);\n\t}\n\n\tstatic int min(int a, int b) {\n\t\treturn (int) Math.min(a, b);\n\t}\n}\n\nclass XY {\n\tint h;\n\tint c;\n\n\tXY(int h, int c) {\n\t\tthis.h = h;\n\t\tthis.c = c;\n\t}\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are going out for a walk, when you suddenly encounter a monster. Fortunately, you have N katana (swords), Katana 1, Katana 2, …, Katana N, and can perform the following two kinds of attacks in any order:\n\nWield one of the katana you have. When you wield Katana i (1 ≤ i ≤ N), the monster receives a_i points of damage. The same katana can be wielded any number of times.\n\nThrow one of the katana you have. When you throw Katana i (1 ≤ i ≤ N) at the monster, it receives b_i points of damage, and you lose the katana. That is, you can no longer wield or throw that katana.\n\nThe monster will vanish when the total damage it has received is H points or more. At least how many attacks do you need in order to vanish it in total?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ H ≤ 10^9\n\n1 ≤ a_i ≤ b_i ≤ 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN H\na_1 b_1\n:\na_N b_N\n\nOutput\n\nPrint the minimum total number of attacks required to vanish the monster.\n\nSample Input 1\n\n1 10\n3 5\n\nSample Output 1\n\n3\n\nYou have one katana. Wielding it deals 3 points of damage, and throwing it deals 5 points of damage. By wielding it twice and then throwing it, you will deal 3 + 3 + 5 = 11 points of damage in a total of three attacks, vanishing the monster.\n\nSample Input 2\n\n2 10\n3 5\n2 6\n\nSample Output 2\n\n2\n\nIn addition to the katana above, you also have another katana. Wielding it deals 2 points of damage, and throwing it deals 6 points of damage. By throwing both katana, you will deal 5 + 6 = 11 points of damage in two attacks, vanishing the monster.\n\nSample Input 3\n\n4 1000000000\n1 1\n1 10000000\n1 30000000\n1 99999999\n\nSample Output 3\n\n860000004\n\nSample Input 4\n\n5 500\n35 44\n28 83\n46 62\n31 79\n40 43\n\nSample Output 4\n\n9", "sample_input": "1 10\n3 5\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03472", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are going out for a walk, when you suddenly encounter a monster. Fortunately, you have N katana (swords), Katana 1, Katana 2, …, Katana N, and can perform the following two kinds of attacks in any order:\n\nWield one of the katana you have. When you wield Katana i (1 ≤ i ≤ N), the monster receives a_i points of damage. The same katana can be wielded any number of times.\n\nThrow one of the katana you have. When you throw Katana i (1 ≤ i ≤ N) at the monster, it receives b_i points of damage, and you lose the katana. That is, you can no longer wield or throw that katana.\n\nThe monster will vanish when the total damage it has received is H points or more. At least how many attacks do you need in order to vanish it in total?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ H ≤ 10^9\n\n1 ≤ a_i ≤ b_i ≤ 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN H\na_1 b_1\n:\na_N b_N\n\nOutput\n\nPrint the minimum total number of attacks required to vanish the monster.\n\nSample Input 1\n\n1 10\n3 5\n\nSample Output 1\n\n3\n\nYou have one katana. Wielding it deals 3 points of damage, and throwing it deals 5 points of damage. By wielding it twice and then throwing it, you will deal 3 + 3 + 5 = 11 points of damage in a total of three attacks, vanishing the monster.\n\nSample Input 2\n\n2 10\n3 5\n2 6\n\nSample Output 2\n\n2\n\nIn addition to the katana above, you also have another katana. Wielding it deals 2 points of damage, and throwing it deals 6 points of damage. By throwing both katana, you will deal 5 + 6 = 11 points of damage in two attacks, vanishing the monster.\n\nSample Input 3\n\n4 1000000000\n1 1\n1 10000000\n1 30000000\n1 99999999\n\nSample Output 3\n\n860000004\n\nSample Input 4\n\n5 500\n35 44\n28 83\n46 62\n31 79\n40 43\n\nSample Output 4\n\n9", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3338, "cpu_time_ms": 554, "memory_kb": 62868}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s467363931", "group_id": "codeNet:p03472", "input_text": "/**\n * Created at 12:27 on 2019-08-29\n */\n\nimport java.io.*;\nimport java.util.*;\nimport java.util.function.Predicate;\n\npublic class Main {\n\n static FastScanner sc = new FastScanner();\n static Output out = new Output(System.out);\n\n static final int[] dx = {0, 1, 0, -1};\n static final int[] dy = {-1, 0, 1, 0};\n\n static final long MOD = (long) (1e9 + 7);\n static final long INF = Long.MAX_VALUE / 2;\n\n public static class Solver {\n public Solver() {\n\n int N = sc.nextInt();\n long H = sc.nextLong();\n\n Katana[] katana = new Katana[N];\n for (int i=0; i Compare.L(o2.b, o1.b));\n\n long[] sumB = new long[N+1];\n for (int i=1; i<=N; i++) {\n sumB[i] = sumB[i-1] + katana[i-1].b;\n }\n\n long ans = INF;\n for (int i=0; i katana[j].b >= a, 0, N, false);\n long h = H - sumB[index+1];\n ans = Math.min(ans, (index+1) + ceil(h, a) );\n }\n\n out.println(ans);\n\n }\n\n /*\n * n >= a/b なる最小の整数nを返す\n */\n public long ceil(long a, long b) {\n if (b < 0) {\n a *= -1;\n b *= -1;\n }\n\n if (a > 0) {\n //よくある切り上げのテクニック\n return (a+b-1)/b;\n } else {\n //絶対値の小さい方に丸められる(負なら正の方向)\n return a/b;\n }\n }\n\n public static class BinarySearch {\n\n /*\n * [l, r)の区間でchecker.test()を実行する\n * rightOK ... 右側OK左側NGならtrue, 右側NG左側OKならfalse\n */\n public static long binarySearchLong(Predicate checker, long l, long r, boolean rightOK) {\n long ng, ok;\n\n if (rightOK) {\n ok = r-1;\n ng = l;\n if (!checker.test(ok)) {\n return r;\n }\n if (checker.test(ng)) {\n return l;\n }\n } else {\n ok = l;\n ng = r-1;\n if (!checker.test(ok)) {\n return l-1;\n }\n if (checker.test(ng)) {\n return r-1;\n }\n }\n\n /* ok と ng のどちらが大きいかわからないことを考慮 */\n while (Math.abs(ok - ng) > 1) {\n long mid = (ok + ng) / 2;\n\n if (checker.test(mid)) ok = mid;\n else ng = mid;\n }\n\n return ok;\n }\n\n /*\n * [l, r)の区間でchecker.test()を実行する\n */\n public static int binarySearch(Predicate checker, int l, int r, boolean rightOK) {\n\n int ng, ok;\n\n if (rightOK) {\n ok = r-1;\n ng = l;\n if (!checker.test(ok)) {\n return r;\n }\n if (checker.test(ng)) {\n return l;\n }\n } else {\n ok = l;\n ng = r-1;\n if (!checker.test(ok)) {\n return l-1;\n }\n if (checker.test(ng)) {\n return r-1;\n }\n }\n\n while (Math.abs(ok - ng) > 1) {\n int mid = (ok + ng) / 2;\n\n if (checker.test(mid)) ok = mid;\n else ng = mid;\n }\n\n return ok;\n }\n\n public static int lowerBound(long[] a, long v) {\n\n if (a[0] >= v) return 0;\n\n int l = 0, r = a.length;\n int mid = (r + l) / 2;\n\n while (r - l > 1) {\n\n if (a[mid] >= v) r = mid;\n else l = mid;\n\n mid = (r + l) / 2;\n }\n\n return r;\n\n }\n\n public static int upperBound(long[] a, long v) {\n\n if (a[0] > v) return 0;\n\n int l = 0, r = a.length;\n int mid = (r + l) / 2;\n\n while (r - l > 1) {\n\n if (a[mid] > v) r = mid;\n else l = mid;\n\n mid = (r + l) / 2;\n }\n\n return r;\n\n }\n\n public static int count(long[] a, long v) {\n int lower = lowerBound(a, v);\n int upper = upperBound(a, v);\n return upper - lower;\n }\n\n }\n\n class Katana {\n long a, b;\n Katana(long A, long B) {\n a = A;\n b = B;\n }\n }\n\n public static class Compare {\n public static int L(long l1, long l2) {\n if (l1 == l2) return 0;\n else if (l1 < l2) return -1;\n else return 1;\n }\n }\n\n }\n\n public static void main(String[] args) {\n new Solver();\n out.flush();\n }\n\n static class FastScanner {\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte()) return buffer[ptr++];\n else return -1;\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n private void skipUnprintable() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;\n }\n\n public boolean hasNext() {\n skipUnprintable();\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext()) throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext()) throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n return (int) nextLong();\n }\n\n public int[] nextIntArray(int N, boolean oneBased) {\n if (oneBased) {\n int[] array = new int[N + 1];\n for (int i = 1; i <= N; i++) {\n array[i] = sc.nextInt();\n }\n return array;\n } else {\n int[] array = new int[N];\n for (int i = 0; i < N; i++) {\n array[i] = sc.nextInt();\n }\n return array;\n }\n }\n\n public long[] nextLongArray(int N, boolean oneBased) {\n if (oneBased) {\n long[] array = new long[N + 1];\n for (int i = 1; i <= N; i++) {\n array[i] = sc.nextLong();\n }\n return array;\n } else {\n long[] array = new long[N];\n for (int i = 0; i < N; i++) {\n array[i] = sc.nextLong();\n }\n return array;\n }\n }\n }\n\n static class Output extends PrintWriter {\n\n public Output(PrintStream ps) {\n super(ps);\n }\n\n public void print(int[] a, String separator) {\n for (int i = 0; i < a.length; i++) {\n if (i == 0) print(a[i]);\n else print(separator + a[i]);\n }\n println();\n }\n\n public void print(long[] a, String separator) {\n for (int i = 0; i < a.length; i++) {\n if (i == 0) print(a[i]);\n else print(separator + a[i]);\n }\n println();\n }\n\n public void print(String[] a, String separator) {\n for (int i = 0; i < a.length; i++) {\n if (i == 0) print(a[i]);\n else print(separator + a[i]);\n }\n println();\n }\n\n public void print(ArrayList a, String separator) {\n for (int i = 0; i < a.size(); i++) {\n if (i == 0) print(a.get(i));\n else print(separator + a.get(i));\n }\n println();\n }\n }\n\n}\n", "language": "Java", "metadata": {"date": 1567097806, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03472.html", "problem_id": "p03472", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03472/input.txt", "sample_output_relpath": "derived/input_output/data/p03472/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03472/Java/s467363931.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s467363931", "user_id": "u951672936"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "/**\n * Created at 12:27 on 2019-08-29\n */\n\nimport java.io.*;\nimport java.util.*;\nimport java.util.function.Predicate;\n\npublic class Main {\n\n static FastScanner sc = new FastScanner();\n static Output out = new Output(System.out);\n\n static final int[] dx = {0, 1, 0, -1};\n static final int[] dy = {-1, 0, 1, 0};\n\n static final long MOD = (long) (1e9 + 7);\n static final long INF = Long.MAX_VALUE / 2;\n\n public static class Solver {\n public Solver() {\n\n int N = sc.nextInt();\n long H = sc.nextLong();\n\n Katana[] katana = new Katana[N];\n for (int i=0; i Compare.L(o2.b, o1.b));\n\n long[] sumB = new long[N+1];\n for (int i=1; i<=N; i++) {\n sumB[i] = sumB[i-1] + katana[i-1].b;\n }\n\n long ans = INF;\n for (int i=0; i katana[j].b >= a, 0, N, false);\n long h = H - sumB[index+1];\n ans = Math.min(ans, (index+1) + ceil(h, a) );\n }\n\n out.println(ans);\n\n }\n\n /*\n * n >= a/b なる最小の整数nを返す\n */\n public long ceil(long a, long b) {\n if (b < 0) {\n a *= -1;\n b *= -1;\n }\n\n if (a > 0) {\n //よくある切り上げのテクニック\n return (a+b-1)/b;\n } else {\n //絶対値の小さい方に丸められる(負なら正の方向)\n return a/b;\n }\n }\n\n public static class BinarySearch {\n\n /*\n * [l, r)の区間でchecker.test()を実行する\n * rightOK ... 右側OK左側NGならtrue, 右側NG左側OKならfalse\n */\n public static long binarySearchLong(Predicate checker, long l, long r, boolean rightOK) {\n long ng, ok;\n\n if (rightOK) {\n ok = r-1;\n ng = l;\n if (!checker.test(ok)) {\n return r;\n }\n if (checker.test(ng)) {\n return l;\n }\n } else {\n ok = l;\n ng = r-1;\n if (!checker.test(ok)) {\n return l-1;\n }\n if (checker.test(ng)) {\n return r-1;\n }\n }\n\n /* ok と ng のどちらが大きいかわからないことを考慮 */\n while (Math.abs(ok - ng) > 1) {\n long mid = (ok + ng) / 2;\n\n if (checker.test(mid)) ok = mid;\n else ng = mid;\n }\n\n return ok;\n }\n\n /*\n * [l, r)の区間でchecker.test()を実行する\n */\n public static int binarySearch(Predicate checker, int l, int r, boolean rightOK) {\n\n int ng, ok;\n\n if (rightOK) {\n ok = r-1;\n ng = l;\n if (!checker.test(ok)) {\n return r;\n }\n if (checker.test(ng)) {\n return l;\n }\n } else {\n ok = l;\n ng = r-1;\n if (!checker.test(ok)) {\n return l-1;\n }\n if (checker.test(ng)) {\n return r-1;\n }\n }\n\n while (Math.abs(ok - ng) > 1) {\n int mid = (ok + ng) / 2;\n\n if (checker.test(mid)) ok = mid;\n else ng = mid;\n }\n\n return ok;\n }\n\n public static int lowerBound(long[] a, long v) {\n\n if (a[0] >= v) return 0;\n\n int l = 0, r = a.length;\n int mid = (r + l) / 2;\n\n while (r - l > 1) {\n\n if (a[mid] >= v) r = mid;\n else l = mid;\n\n mid = (r + l) / 2;\n }\n\n return r;\n\n }\n\n public static int upperBound(long[] a, long v) {\n\n if (a[0] > v) return 0;\n\n int l = 0, r = a.length;\n int mid = (r + l) / 2;\n\n while (r - l > 1) {\n\n if (a[mid] > v) r = mid;\n else l = mid;\n\n mid = (r + l) / 2;\n }\n\n return r;\n\n }\n\n public static int count(long[] a, long v) {\n int lower = lowerBound(a, v);\n int upper = upperBound(a, v);\n return upper - lower;\n }\n\n }\n\n class Katana {\n long a, b;\n Katana(long A, long B) {\n a = A;\n b = B;\n }\n }\n\n public static class Compare {\n public static int L(long l1, long l2) {\n if (l1 == l2) return 0;\n else if (l1 < l2) return -1;\n else return 1;\n }\n }\n\n }\n\n public static void main(String[] args) {\n new Solver();\n out.flush();\n }\n\n static class FastScanner {\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte()) return buffer[ptr++];\n else return -1;\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n private void skipUnprintable() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;\n }\n\n public boolean hasNext() {\n skipUnprintable();\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext()) throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext()) throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n return (int) nextLong();\n }\n\n public int[] nextIntArray(int N, boolean oneBased) {\n if (oneBased) {\n int[] array = new int[N + 1];\n for (int i = 1; i <= N; i++) {\n array[i] = sc.nextInt();\n }\n return array;\n } else {\n int[] array = new int[N];\n for (int i = 0; i < N; i++) {\n array[i] = sc.nextInt();\n }\n return array;\n }\n }\n\n public long[] nextLongArray(int N, boolean oneBased) {\n if (oneBased) {\n long[] array = new long[N + 1];\n for (int i = 1; i <= N; i++) {\n array[i] = sc.nextLong();\n }\n return array;\n } else {\n long[] array = new long[N];\n for (int i = 0; i < N; i++) {\n array[i] = sc.nextLong();\n }\n return array;\n }\n }\n }\n\n static class Output extends PrintWriter {\n\n public Output(PrintStream ps) {\n super(ps);\n }\n\n public void print(int[] a, String separator) {\n for (int i = 0; i < a.length; i++) {\n if (i == 0) print(a[i]);\n else print(separator + a[i]);\n }\n println();\n }\n\n public void print(long[] a, String separator) {\n for (int i = 0; i < a.length; i++) {\n if (i == 0) print(a[i]);\n else print(separator + a[i]);\n }\n println();\n }\n\n public void print(String[] a, String separator) {\n for (int i = 0; i < a.length; i++) {\n if (i == 0) print(a[i]);\n else print(separator + a[i]);\n }\n println();\n }\n\n public void print(ArrayList a, String separator) {\n for (int i = 0; i < a.size(); i++) {\n if (i == 0) print(a.get(i));\n else print(separator + a.get(i));\n }\n println();\n }\n }\n\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are going out for a walk, when you suddenly encounter a monster. Fortunately, you have N katana (swords), Katana 1, Katana 2, …, Katana N, and can perform the following two kinds of attacks in any order:\n\nWield one of the katana you have. When you wield Katana i (1 ≤ i ≤ N), the monster receives a_i points of damage. The same katana can be wielded any number of times.\n\nThrow one of the katana you have. When you throw Katana i (1 ≤ i ≤ N) at the monster, it receives b_i points of damage, and you lose the katana. That is, you can no longer wield or throw that katana.\n\nThe monster will vanish when the total damage it has received is H points or more. At least how many attacks do you need in order to vanish it in total?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ H ≤ 10^9\n\n1 ≤ a_i ≤ b_i ≤ 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN H\na_1 b_1\n:\na_N b_N\n\nOutput\n\nPrint the minimum total number of attacks required to vanish the monster.\n\nSample Input 1\n\n1 10\n3 5\n\nSample Output 1\n\n3\n\nYou have one katana. Wielding it deals 3 points of damage, and throwing it deals 5 points of damage. By wielding it twice and then throwing it, you will deal 3 + 3 + 5 = 11 points of damage in a total of three attacks, vanishing the monster.\n\nSample Input 2\n\n2 10\n3 5\n2 6\n\nSample Output 2\n\n2\n\nIn addition to the katana above, you also have another katana. Wielding it deals 2 points of damage, and throwing it deals 6 points of damage. By throwing both katana, you will deal 5 + 6 = 11 points of damage in two attacks, vanishing the monster.\n\nSample Input 3\n\n4 1000000000\n1 1\n1 10000000\n1 30000000\n1 99999999\n\nSample Output 3\n\n860000004\n\nSample Input 4\n\n5 500\n35 44\n28 83\n46 62\n31 79\n40 43\n\nSample Output 4\n\n9", "sample_input": "1 10\n3 5\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03472", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are going out for a walk, when you suddenly encounter a monster. Fortunately, you have N katana (swords), Katana 1, Katana 2, …, Katana N, and can perform the following two kinds of attacks in any order:\n\nWield one of the katana you have. When you wield Katana i (1 ≤ i ≤ N), the monster receives a_i points of damage. The same katana can be wielded any number of times.\n\nThrow one of the katana you have. When you throw Katana i (1 ≤ i ≤ N) at the monster, it receives b_i points of damage, and you lose the katana. That is, you can no longer wield or throw that katana.\n\nThe monster will vanish when the total damage it has received is H points or more. At least how many attacks do you need in order to vanish it in total?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ H ≤ 10^9\n\n1 ≤ a_i ≤ b_i ≤ 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN H\na_1 b_1\n:\na_N b_N\n\nOutput\n\nPrint the minimum total number of attacks required to vanish the monster.\n\nSample Input 1\n\n1 10\n3 5\n\nSample Output 1\n\n3\n\nYou have one katana. Wielding it deals 3 points of damage, and throwing it deals 5 points of damage. By wielding it twice and then throwing it, you will deal 3 + 3 + 5 = 11 points of damage in a total of three attacks, vanishing the monster.\n\nSample Input 2\n\n2 10\n3 5\n2 6\n\nSample Output 2\n\n2\n\nIn addition to the katana above, you also have another katana. Wielding it deals 2 points of damage, and throwing it deals 6 points of damage. By throwing both katana, you will deal 5 + 6 = 11 points of damage in two attacks, vanishing the monster.\n\nSample Input 3\n\n4 1000000000\n1 1\n1 10000000\n1 30000000\n1 99999999\n\nSample Output 3\n\n860000004\n\nSample Input 4\n\n5 500\n35 44\n28 83\n46 62\n31 79\n40 43\n\nSample Output 4\n\n9", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 8082, "cpu_time_ms": 407, "memory_kb": 49188}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s669404203", "group_id": "codeNet:p03472", "input_text": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int h = sc.nextInt();\n int[] a = new int[n];\n int[] b = new int[n];\n Pair[] pairs = new Pair[n];\n for (int i = 0 ; i < n ; i++) {\n a[i] = sc.nextInt();\n b[i] = sc.nextInt();\n Pair p = new Pair();\n p.a = a[i];\n p.b = b[i];\n pairs[i] = p;\n }\n\n Arrays.sort(a);\n\n int aMax = a[n - 1];\n\n Arrays.sort(pairs);\n\n int count = 0;\n for (int i = n - 1 ; i >= 0 ; i--) {\n if (h > 0 && pairs[i].b > aMax) {\n count++;\n h -= pairs[i].b;\n }\n }\n\n if (h <= 0) {\n System.out.println(count);\n } else {\n int mod = h / aMax;\n h -= aMax * mod;\n count += mod;\n if (h > 0) {\n count++;\n }\n System.out.println(count);\n }\n\n\n }\n\n}\n\nclass Pair implements Comparable {\n int a;\n int b;\n @Override\n public int compareTo(Object other) {\n Pair otherpair = (Pair) other;\n return b - otherpair.b;\n }\n}\n", "language": "Java", "metadata": {"date": 1560114489, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03472.html", "problem_id": "p03472", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03472/input.txt", "sample_output_relpath": "derived/input_output/data/p03472/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03472/Java/s669404203.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s669404203", "user_id": "u845442981"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int h = sc.nextInt();\n int[] a = new int[n];\n int[] b = new int[n];\n Pair[] pairs = new Pair[n];\n for (int i = 0 ; i < n ; i++) {\n a[i] = sc.nextInt();\n b[i] = sc.nextInt();\n Pair p = new Pair();\n p.a = a[i];\n p.b = b[i];\n pairs[i] = p;\n }\n\n Arrays.sort(a);\n\n int aMax = a[n - 1];\n\n Arrays.sort(pairs);\n\n int count = 0;\n for (int i = n - 1 ; i >= 0 ; i--) {\n if (h > 0 && pairs[i].b > aMax) {\n count++;\n h -= pairs[i].b;\n }\n }\n\n if (h <= 0) {\n System.out.println(count);\n } else {\n int mod = h / aMax;\n h -= aMax * mod;\n count += mod;\n if (h > 0) {\n count++;\n }\n System.out.println(count);\n }\n\n\n }\n\n}\n\nclass Pair implements Comparable {\n int a;\n int b;\n @Override\n public int compareTo(Object other) {\n Pair otherpair = (Pair) other;\n return b - otherpair.b;\n }\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are going out for a walk, when you suddenly encounter a monster. Fortunately, you have N katana (swords), Katana 1, Katana 2, …, Katana N, and can perform the following two kinds of attacks in any order:\n\nWield one of the katana you have. When you wield Katana i (1 ≤ i ≤ N), the monster receives a_i points of damage. The same katana can be wielded any number of times.\n\nThrow one of the katana you have. When you throw Katana i (1 ≤ i ≤ N) at the monster, it receives b_i points of damage, and you lose the katana. That is, you can no longer wield or throw that katana.\n\nThe monster will vanish when the total damage it has received is H points or more. At least how many attacks do you need in order to vanish it in total?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ H ≤ 10^9\n\n1 ≤ a_i ≤ b_i ≤ 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN H\na_1 b_1\n:\na_N b_N\n\nOutput\n\nPrint the minimum total number of attacks required to vanish the monster.\n\nSample Input 1\n\n1 10\n3 5\n\nSample Output 1\n\n3\n\nYou have one katana. Wielding it deals 3 points of damage, and throwing it deals 5 points of damage. By wielding it twice and then throwing it, you will deal 3 + 3 + 5 = 11 points of damage in a total of three attacks, vanishing the monster.\n\nSample Input 2\n\n2 10\n3 5\n2 6\n\nSample Output 2\n\n2\n\nIn addition to the katana above, you also have another katana. Wielding it deals 2 points of damage, and throwing it deals 6 points of damage. By throwing both katana, you will deal 5 + 6 = 11 points of damage in two attacks, vanishing the monster.\n\nSample Input 3\n\n4 1000000000\n1 1\n1 10000000\n1 30000000\n1 99999999\n\nSample Output 3\n\n860000004\n\nSample Input 4\n\n5 500\n35 44\n28 83\n46 62\n31 79\n40 43\n\nSample Output 4\n\n9", "sample_input": "1 10\n3 5\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03472", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are going out for a walk, when you suddenly encounter a monster. Fortunately, you have N katana (swords), Katana 1, Katana 2, …, Katana N, and can perform the following two kinds of attacks in any order:\n\nWield one of the katana you have. When you wield Katana i (1 ≤ i ≤ N), the monster receives a_i points of damage. The same katana can be wielded any number of times.\n\nThrow one of the katana you have. When you throw Katana i (1 ≤ i ≤ N) at the monster, it receives b_i points of damage, and you lose the katana. That is, you can no longer wield or throw that katana.\n\nThe monster will vanish when the total damage it has received is H points or more. At least how many attacks do you need in order to vanish it in total?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ H ≤ 10^9\n\n1 ≤ a_i ≤ b_i ≤ 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN H\na_1 b_1\n:\na_N b_N\n\nOutput\n\nPrint the minimum total number of attacks required to vanish the monster.\n\nSample Input 1\n\n1 10\n3 5\n\nSample Output 1\n\n3\n\nYou have one katana. Wielding it deals 3 points of damage, and throwing it deals 5 points of damage. By wielding it twice and then throwing it, you will deal 3 + 3 + 5 = 11 points of damage in a total of three attacks, vanishing the monster.\n\nSample Input 2\n\n2 10\n3 5\n2 6\n\nSample Output 2\n\n2\n\nIn addition to the katana above, you also have another katana. Wielding it deals 2 points of damage, and throwing it deals 6 points of damage. By throwing both katana, you will deal 5 + 6 = 11 points of damage in two attacks, vanishing the monster.\n\nSample Input 3\n\n4 1000000000\n1 1\n1 10000000\n1 30000000\n1 99999999\n\nSample Output 3\n\n860000004\n\nSample Input 4\n\n5 500\n35 44\n28 83\n46 62\n31 79\n40 43\n\nSample Output 4\n\n9", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1327, "cpu_time_ms": 636, "memory_kb": 88368}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s885302417", "group_id": "codeNet:p03472", "input_text": "import java.util.*;\n\npublic class Main{\n private static void solve(int N, int H, int[][] ab){\n double count = 0;\n int result = 0;\n int countb = 0;\n int sum = 0;\n int sumb = 0;\n int maxa = ab[0][0];\n int[] b = new int[N]; \n\n for(int i = 0; i < N; i ++){\n sumb += ab[i][1];\n }\n for(int i = 1; i < N; i ++){\n if(ab[i][0] > maxa) maxa = ab[i][0];\n }\n for(int i = 0; i < N; i ++){\n b[i] = ab[i][1];\n }\n Arrays.sort(b);\n if(b[0] >= maxa){\n if(sumb >= H){\n int i = N - 1;\n while(sum < H){\n sum += b[i];\n i --;\n result ++;\n }\n System.out.print(result);\n return;\n }\n else{\n double cal = (double)(H - sumb) / maxa;\n count = N + Math.ceil(cal);\n result = (int)count;\n System.out.print(result);\n return;\n }\n }\n else{\n for(int i = N - 1; i > 0; -- i){\n if(b[i] > maxa){\n sum += b[i];\n countb ++;\n }\n else break;\n }\n double cala = (double)(H - sum) / maxa;\n count = countb + Math.ceil(cala);\n result = (int)count;\n System.out.print(result); \n return;\n } \n }\n public static void main(String args[]){\n Scanner input = new Scanner(System.in);\n int N = input.nextInt();\n int H = input.nextInt();\n int[][] ab = new int[N][2];\n for(int i = 0; i < N; i ++){\n for(int j = 0; j < 2; j ++){\n ab[i][j] = input.nextInt();\n }\n }\n input.close();\n solve(N, H, ab);\n }\n}", "language": "Java", "metadata": {"date": 1516308957, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03472.html", "problem_id": "p03472", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03472/input.txt", "sample_output_relpath": "derived/input_output/data/p03472/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03472/Java/s885302417.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s885302417", "user_id": "u343976835"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main{\n private static void solve(int N, int H, int[][] ab){\n double count = 0;\n int result = 0;\n int countb = 0;\n int sum = 0;\n int sumb = 0;\n int maxa = ab[0][0];\n int[] b = new int[N]; \n\n for(int i = 0; i < N; i ++){\n sumb += ab[i][1];\n }\n for(int i = 1; i < N; i ++){\n if(ab[i][0] > maxa) maxa = ab[i][0];\n }\n for(int i = 0; i < N; i ++){\n b[i] = ab[i][1];\n }\n Arrays.sort(b);\n if(b[0] >= maxa){\n if(sumb >= H){\n int i = N - 1;\n while(sum < H){\n sum += b[i];\n i --;\n result ++;\n }\n System.out.print(result);\n return;\n }\n else{\n double cal = (double)(H - sumb) / maxa;\n count = N + Math.ceil(cal);\n result = (int)count;\n System.out.print(result);\n return;\n }\n }\n else{\n for(int i = N - 1; i > 0; -- i){\n if(b[i] > maxa){\n sum += b[i];\n countb ++;\n }\n else break;\n }\n double cala = (double)(H - sum) / maxa;\n count = countb + Math.ceil(cala);\n result = (int)count;\n System.out.print(result); \n return;\n } \n }\n public static void main(String args[]){\n Scanner input = new Scanner(System.in);\n int N = input.nextInt();\n int H = input.nextInt();\n int[][] ab = new int[N][2];\n for(int i = 0; i < N; i ++){\n for(int j = 0; j < 2; j ++){\n ab[i][j] = input.nextInt();\n }\n }\n input.close();\n solve(N, H, ab);\n }\n}", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are going out for a walk, when you suddenly encounter a monster. Fortunately, you have N katana (swords), Katana 1, Katana 2, …, Katana N, and can perform the following two kinds of attacks in any order:\n\nWield one of the katana you have. When you wield Katana i (1 ≤ i ≤ N), the monster receives a_i points of damage. The same katana can be wielded any number of times.\n\nThrow one of the katana you have. When you throw Katana i (1 ≤ i ≤ N) at the monster, it receives b_i points of damage, and you lose the katana. That is, you can no longer wield or throw that katana.\n\nThe monster will vanish when the total damage it has received is H points or more. At least how many attacks do you need in order to vanish it in total?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ H ≤ 10^9\n\n1 ≤ a_i ≤ b_i ≤ 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN H\na_1 b_1\n:\na_N b_N\n\nOutput\n\nPrint the minimum total number of attacks required to vanish the monster.\n\nSample Input 1\n\n1 10\n3 5\n\nSample Output 1\n\n3\n\nYou have one katana. Wielding it deals 3 points of damage, and throwing it deals 5 points of damage. By wielding it twice and then throwing it, you will deal 3 + 3 + 5 = 11 points of damage in a total of three attacks, vanishing the monster.\n\nSample Input 2\n\n2 10\n3 5\n2 6\n\nSample Output 2\n\n2\n\nIn addition to the katana above, you also have another katana. Wielding it deals 2 points of damage, and throwing it deals 6 points of damage. By throwing both katana, you will deal 5 + 6 = 11 points of damage in two attacks, vanishing the monster.\n\nSample Input 3\n\n4 1000000000\n1 1\n1 10000000\n1 30000000\n1 99999999\n\nSample Output 3\n\n860000004\n\nSample Input 4\n\n5 500\n35 44\n28 83\n46 62\n31 79\n40 43\n\nSample Output 4\n\n9", "sample_input": "1 10\n3 5\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03472", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are going out for a walk, when you suddenly encounter a monster. Fortunately, you have N katana (swords), Katana 1, Katana 2, …, Katana N, and can perform the following two kinds of attacks in any order:\n\nWield one of the katana you have. When you wield Katana i (1 ≤ i ≤ N), the monster receives a_i points of damage. The same katana can be wielded any number of times.\n\nThrow one of the katana you have. When you throw Katana i (1 ≤ i ≤ N) at the monster, it receives b_i points of damage, and you lose the katana. That is, you can no longer wield or throw that katana.\n\nThe monster will vanish when the total damage it has received is H points or more. At least how many attacks do you need in order to vanish it in total?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ H ≤ 10^9\n\n1 ≤ a_i ≤ b_i ≤ 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN H\na_1 b_1\n:\na_N b_N\n\nOutput\n\nPrint the minimum total number of attacks required to vanish the monster.\n\nSample Input 1\n\n1 10\n3 5\n\nSample Output 1\n\n3\n\nYou have one katana. Wielding it deals 3 points of damage, and throwing it deals 5 points of damage. By wielding it twice and then throwing it, you will deal 3 + 3 + 5 = 11 points of damage in a total of three attacks, vanishing the monster.\n\nSample Input 2\n\n2 10\n3 5\n2 6\n\nSample Output 2\n\n2\n\nIn addition to the katana above, you also have another katana. Wielding it deals 2 points of damage, and throwing it deals 6 points of damage. By throwing both katana, you will deal 5 + 6 = 11 points of damage in two attacks, vanishing the monster.\n\nSample Input 3\n\n4 1000000000\n1 1\n1 10000000\n1 30000000\n1 99999999\n\nSample Output 3\n\n860000004\n\nSample Input 4\n\n5 500\n35 44\n28 83\n46 62\n31 79\n40 43\n\nSample Output 4\n\n9", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1939, "cpu_time_ms": 615, "memory_kb": 85976}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s798411095", "group_id": "codeNet:p03472", "input_text": "import java.util.*;\npublic class Main{\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tdouble hp = sc.nextInt();\n\t\tdouble a = 0;\n\t\tInteger b[] = new Integer [n];\n\t\tfor(int i = 0; i < n ; i++){\n\t\t\tint tmp = sc.nextInt();\n\t\t\tif( tmp > a){\n\t\t\t\ta = tmp;\n\t\t\t}\n\t\t\tb[i] = sc.nextInt();\n\t\t}\n\t\t/*for( int i = n; i > 0; i--){\n\t\t\tfor( int j = 0; j < i - 1 ; j++ ){\n\t\t\t\tif(b[j] < b[j+1]){\n\t\t\t\t\tint tmp = b[j];\n\t\t\t\t\tb[j] = b[j+1];\n\t\t\t\t\tb[j+1] = tmp;\n\t\t\t\t}\n\t\t\t}\n\t\t}*/\n\t\tArrays.sort(b,Collections.reverseOrder());\n\t\tint ans = 0;\n\t\tint index = 0;\n\t\twhile( hp > 0){\n\t\t\tif( index < n && b[index] >= a ){\n\t\t\t\thp -= b[index];\n\t\t\t\tans++;\n\t\t\t\tindex++;\n\t\t\t}else{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(hp%a == 0){\n\t\t\tans += hp/a;\n\t\t}else{\n\t\t\tDouble tmpA = hp/a;\n\t\t\tint tmpB = tmpA.intValue();\n\t\t\tif(tmpA - tmpB < 0){\n\t\t\t\tans += tmpB;\n\t\t\t}else{\n\t\t\t\tans += tmpB + 1;\n\t\t\t}\n\t\t}\n\t\tSystem.out.print(ans);\n\t}\n}\n", "language": "Java", "metadata": {"date": 1515552181, "filename_ext": "java", "original_language": "Java7 (OpenJDK 1.7.0)", "problem_description_relpath": "problem_descriptions/p03472.html", "problem_id": "p03472", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03472/input.txt", "sample_output_relpath": "derived/input_output/data/p03472/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03472/Java/s798411095.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s798411095", "user_id": "u913234250"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.*;\npublic class Main{\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tdouble hp = sc.nextInt();\n\t\tdouble a = 0;\n\t\tInteger b[] = new Integer [n];\n\t\tfor(int i = 0; i < n ; i++){\n\t\t\tint tmp = sc.nextInt();\n\t\t\tif( tmp > a){\n\t\t\t\ta = tmp;\n\t\t\t}\n\t\t\tb[i] = sc.nextInt();\n\t\t}\n\t\t/*for( int i = n; i > 0; i--){\n\t\t\tfor( int j = 0; j < i - 1 ; j++ ){\n\t\t\t\tif(b[j] < b[j+1]){\n\t\t\t\t\tint tmp = b[j];\n\t\t\t\t\tb[j] = b[j+1];\n\t\t\t\t\tb[j+1] = tmp;\n\t\t\t\t}\n\t\t\t}\n\t\t}*/\n\t\tArrays.sort(b,Collections.reverseOrder());\n\t\tint ans = 0;\n\t\tint index = 0;\n\t\twhile( hp > 0){\n\t\t\tif( index < n && b[index] >= a ){\n\t\t\t\thp -= b[index];\n\t\t\t\tans++;\n\t\t\t\tindex++;\n\t\t\t}else{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(hp%a == 0){\n\t\t\tans += hp/a;\n\t\t}else{\n\t\t\tDouble tmpA = hp/a;\n\t\t\tint tmpB = tmpA.intValue();\n\t\t\tif(tmpA - tmpB < 0){\n\t\t\t\tans += tmpB;\n\t\t\t}else{\n\t\t\t\tans += tmpB + 1;\n\t\t\t}\n\t\t}\n\t\tSystem.out.print(ans);\n\t}\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are going out for a walk, when you suddenly encounter a monster. Fortunately, you have N katana (swords), Katana 1, Katana 2, …, Katana N, and can perform the following two kinds of attacks in any order:\n\nWield one of the katana you have. When you wield Katana i (1 ≤ i ≤ N), the monster receives a_i points of damage. The same katana can be wielded any number of times.\n\nThrow one of the katana you have. When you throw Katana i (1 ≤ i ≤ N) at the monster, it receives b_i points of damage, and you lose the katana. That is, you can no longer wield or throw that katana.\n\nThe monster will vanish when the total damage it has received is H points or more. At least how many attacks do you need in order to vanish it in total?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ H ≤ 10^9\n\n1 ≤ a_i ≤ b_i ≤ 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN H\na_1 b_1\n:\na_N b_N\n\nOutput\n\nPrint the minimum total number of attacks required to vanish the monster.\n\nSample Input 1\n\n1 10\n3 5\n\nSample Output 1\n\n3\n\nYou have one katana. Wielding it deals 3 points of damage, and throwing it deals 5 points of damage. By wielding it twice and then throwing it, you will deal 3 + 3 + 5 = 11 points of damage in a total of three attacks, vanishing the monster.\n\nSample Input 2\n\n2 10\n3 5\n2 6\n\nSample Output 2\n\n2\n\nIn addition to the katana above, you also have another katana. Wielding it deals 2 points of damage, and throwing it deals 6 points of damage. By throwing both katana, you will deal 5 + 6 = 11 points of damage in two attacks, vanishing the monster.\n\nSample Input 3\n\n4 1000000000\n1 1\n1 10000000\n1 30000000\n1 99999999\n\nSample Output 3\n\n860000004\n\nSample Input 4\n\n5 500\n35 44\n28 83\n46 62\n31 79\n40 43\n\nSample Output 4\n\n9", "sample_input": "1 10\n3 5\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03472", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are going out for a walk, when you suddenly encounter a monster. Fortunately, you have N katana (swords), Katana 1, Katana 2, …, Katana N, and can perform the following two kinds of attacks in any order:\n\nWield one of the katana you have. When you wield Katana i (1 ≤ i ≤ N), the monster receives a_i points of damage. The same katana can be wielded any number of times.\n\nThrow one of the katana you have. When you throw Katana i (1 ≤ i ≤ N) at the monster, it receives b_i points of damage, and you lose the katana. That is, you can no longer wield or throw that katana.\n\nThe monster will vanish when the total damage it has received is H points or more. At least how many attacks do you need in order to vanish it in total?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ H ≤ 10^9\n\n1 ≤ a_i ≤ b_i ≤ 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN H\na_1 b_1\n:\na_N b_N\n\nOutput\n\nPrint the minimum total number of attacks required to vanish the monster.\n\nSample Input 1\n\n1 10\n3 5\n\nSample Output 1\n\n3\n\nYou have one katana. Wielding it deals 3 points of damage, and throwing it deals 5 points of damage. By wielding it twice and then throwing it, you will deal 3 + 3 + 5 = 11 points of damage in a total of three attacks, vanishing the monster.\n\nSample Input 2\n\n2 10\n3 5\n2 6\n\nSample Output 2\n\n2\n\nIn addition to the katana above, you also have another katana. Wielding it deals 2 points of damage, and throwing it deals 6 points of damage. By throwing both katana, you will deal 5 + 6 = 11 points of damage in two attacks, vanishing the monster.\n\nSample Input 3\n\n4 1000000000\n1 1\n1 10000000\n1 30000000\n1 99999999\n\nSample Output 3\n\n860000004\n\nSample Input 4\n\n5 500\n35 44\n28 83\n46 62\n31 79\n40 43\n\nSample Output 4\n\n9", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 925, "cpu_time_ms": 827, "memory_kb": 64764}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s090300991", "group_id": "codeNet:p03472", "input_text": "import java.util.*;\npublic class Main{\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint hp = sc.nextInt();\n\t\tint a = 0;\n\t\tint b[] = new int [n];\n\t\tfor(int i = 0; i < n ; i++){\n\t\t\tint tmp = sc.nextInt();\n\t\t\tif( tmp > a){\n\t\t\t\ta = tmp;\n\t\t\t}\n\t\t\tb[i] = sc.nextInt();\n\t\t}\n\t\tfor( int i = n; i > 0; i--){\n\t\t\tfor( int j = 0; j < i - 1 ; j++ ){\n\t\t\t\tif(b[j] < b[j+1]){\n\t\t\t\t\tint tmp = b[j];\n\t\t\t\t\tb[j] = b[j+1];\n\t\t\t\t\tb[j+1] = tmp;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tint ans = 0;\n\t\tint index = 0;\n\t\twhile( hp > 0){\n\t\t\tif( index < n && b[index] >= a ){\n\t\t\t\thp -= b[index];\n\t\t\t\tans++;\n\t\t\t\tindex++;\n\n\t\t\t}else{\n\t\t\t\tif(hp%a == 0){\n\t\t\t\t\tans += hp/a;\n\t\t\t\t}else{\n\t\t\t\t\tans += hp/a + 1;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tSystem.out.print(ans);\n\t}\n}\n", "language": "Java", "metadata": {"date": 1515545825, "filename_ext": "java", "original_language": "Java7 (OpenJDK 1.7.0)", "problem_description_relpath": "problem_descriptions/p03472.html", "problem_id": "p03472", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03472/input.txt", "sample_output_relpath": "derived/input_output/data/p03472/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03472/Java/s090300991.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s090300991", "user_id": "u913234250"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.util.*;\npublic class Main{\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint hp = sc.nextInt();\n\t\tint a = 0;\n\t\tint b[] = new int [n];\n\t\tfor(int i = 0; i < n ; i++){\n\t\t\tint tmp = sc.nextInt();\n\t\t\tif( tmp > a){\n\t\t\t\ta = tmp;\n\t\t\t}\n\t\t\tb[i] = sc.nextInt();\n\t\t}\n\t\tfor( int i = n; i > 0; i--){\n\t\t\tfor( int j = 0; j < i - 1 ; j++ ){\n\t\t\t\tif(b[j] < b[j+1]){\n\t\t\t\t\tint tmp = b[j];\n\t\t\t\t\tb[j] = b[j+1];\n\t\t\t\t\tb[j+1] = tmp;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tint ans = 0;\n\t\tint index = 0;\n\t\twhile( hp > 0){\n\t\t\tif( index < n && b[index] >= a ){\n\t\t\t\thp -= b[index];\n\t\t\t\tans++;\n\t\t\t\tindex++;\n\n\t\t\t}else{\n\t\t\t\tif(hp%a == 0){\n\t\t\t\t\tans += hp/a;\n\t\t\t\t}else{\n\t\t\t\t\tans += hp/a + 1;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tSystem.out.print(ans);\n\t}\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are going out for a walk, when you suddenly encounter a monster. Fortunately, you have N katana (swords), Katana 1, Katana 2, …, Katana N, and can perform the following two kinds of attacks in any order:\n\nWield one of the katana you have. When you wield Katana i (1 ≤ i ≤ N), the monster receives a_i points of damage. The same katana can be wielded any number of times.\n\nThrow one of the katana you have. When you throw Katana i (1 ≤ i ≤ N) at the monster, it receives b_i points of damage, and you lose the katana. That is, you can no longer wield or throw that katana.\n\nThe monster will vanish when the total damage it has received is H points or more. At least how many attacks do you need in order to vanish it in total?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ H ≤ 10^9\n\n1 ≤ a_i ≤ b_i ≤ 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN H\na_1 b_1\n:\na_N b_N\n\nOutput\n\nPrint the minimum total number of attacks required to vanish the monster.\n\nSample Input 1\n\n1 10\n3 5\n\nSample Output 1\n\n3\n\nYou have one katana. Wielding it deals 3 points of damage, and throwing it deals 5 points of damage. By wielding it twice and then throwing it, you will deal 3 + 3 + 5 = 11 points of damage in a total of three attacks, vanishing the monster.\n\nSample Input 2\n\n2 10\n3 5\n2 6\n\nSample Output 2\n\n2\n\nIn addition to the katana above, you also have another katana. Wielding it deals 2 points of damage, and throwing it deals 6 points of damage. By throwing both katana, you will deal 5 + 6 = 11 points of damage in two attacks, vanishing the monster.\n\nSample Input 3\n\n4 1000000000\n1 1\n1 10000000\n1 30000000\n1 99999999\n\nSample Output 3\n\n860000004\n\nSample Input 4\n\n5 500\n35 44\n28 83\n46 62\n31 79\n40 43\n\nSample Output 4\n\n9", "sample_input": "1 10\n3 5\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03472", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are going out for a walk, when you suddenly encounter a monster. Fortunately, you have N katana (swords), Katana 1, Katana 2, …, Katana N, and can perform the following two kinds of attacks in any order:\n\nWield one of the katana you have. When you wield Katana i (1 ≤ i ≤ N), the monster receives a_i points of damage. The same katana can be wielded any number of times.\n\nThrow one of the katana you have. When you throw Katana i (1 ≤ i ≤ N) at the monster, it receives b_i points of damage, and you lose the katana. That is, you can no longer wield or throw that katana.\n\nThe monster will vanish when the total damage it has received is H points or more. At least how many attacks do you need in order to vanish it in total?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ H ≤ 10^9\n\n1 ≤ a_i ≤ b_i ≤ 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN H\na_1 b_1\n:\na_N b_N\n\nOutput\n\nPrint the minimum total number of attacks required to vanish the monster.\n\nSample Input 1\n\n1 10\n3 5\n\nSample Output 1\n\n3\n\nYou have one katana. Wielding it deals 3 points of damage, and throwing it deals 5 points of damage. By wielding it twice and then throwing it, you will deal 3 + 3 + 5 = 11 points of damage in a total of three attacks, vanishing the monster.\n\nSample Input 2\n\n2 10\n3 5\n2 6\n\nSample Output 2\n\n2\n\nIn addition to the katana above, you also have another katana. Wielding it deals 2 points of damage, and throwing it deals 6 points of damage. By throwing both katana, you will deal 5 + 6 = 11 points of damage in two attacks, vanishing the monster.\n\nSample Input 3\n\n4 1000000000\n1 1\n1 10000000\n1 30000000\n1 99999999\n\nSample Output 3\n\n860000004\n\nSample Input 4\n\n5 500\n35 44\n28 83\n46 62\n31 79\n40 43\n\nSample Output 4\n\n9", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2108, "memory_kb": 65960}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s609781553", "group_id": "codeNet:p03472", "input_text": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\n\npublic class Main\n{\n\n public static void main(String[] args) throws IOException\n {\n BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);\n String[] sl = r.readLine().split(\"[\\\\s]+\");\n int N = Integer.parseInt(sl[0]);\n int H = Integer.parseInt(sl[1]);\n\n int[] a = new int[114514];\n int[] b = new int[114514];\n\n for(int i = 0; i < N; i++)\n {\n sl = r.readLine().split(\"[\\\\s]+\");\n a[i] = Integer.parseInt(sl[0]);\n b[i] = Integer.parseInt(sl[1]);\n }\n\n\n int mainw = 0;\n for(int i = 0; i < N; i++)\n {\n if(mainw < a[i])\n {\n mainw = a[i];\n }\n }\n\n List li = new ArrayList();\n for(int i = 0; i < N; i++)\n {\n if(mainw < b[i])\n {\n li.add(b[i]);\n }\n }\n\n Collections.sort(li);\n\n int dam = 0;\n int count = 0;\n for(int i = li.size() - 1; 0 <= i; i--)\n {\n dam += li.get(i);\n count++;\n if(H <= dam)\n {\n break;\n }\n }\n\n if(dam < H)\n {\n count += (H - dam + mainw - 1) / mainw;\n }\n\n System.out.println(count);\n\n\n }\n\n}\n", "language": "Java", "metadata": {"date": 1515382011, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03472.html", "problem_id": "p03472", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03472/input.txt", "sample_output_relpath": "derived/input_output/data/p03472/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03472/Java/s609781553.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s609781553", "user_id": "u974426361"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\n\npublic class Main\n{\n\n public static void main(String[] args) throws IOException\n {\n BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);\n String[] sl = r.readLine().split(\"[\\\\s]+\");\n int N = Integer.parseInt(sl[0]);\n int H = Integer.parseInt(sl[1]);\n\n int[] a = new int[114514];\n int[] b = new int[114514];\n\n for(int i = 0; i < N; i++)\n {\n sl = r.readLine().split(\"[\\\\s]+\");\n a[i] = Integer.parseInt(sl[0]);\n b[i] = Integer.parseInt(sl[1]);\n }\n\n\n int mainw = 0;\n for(int i = 0; i < N; i++)\n {\n if(mainw < a[i])\n {\n mainw = a[i];\n }\n }\n\n List li = new ArrayList();\n for(int i = 0; i < N; i++)\n {\n if(mainw < b[i])\n {\n li.add(b[i]);\n }\n }\n\n Collections.sort(li);\n\n int dam = 0;\n int count = 0;\n for(int i = li.size() - 1; 0 <= i; i--)\n {\n dam += li.get(i);\n count++;\n if(H <= dam)\n {\n break;\n }\n }\n\n if(dam < H)\n {\n count += (H - dam + mainw - 1) / mainw;\n }\n\n System.out.println(count);\n\n\n }\n\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are going out for a walk, when you suddenly encounter a monster. Fortunately, you have N katana (swords), Katana 1, Katana 2, …, Katana N, and can perform the following two kinds of attacks in any order:\n\nWield one of the katana you have. When you wield Katana i (1 ≤ i ≤ N), the monster receives a_i points of damage. The same katana can be wielded any number of times.\n\nThrow one of the katana you have. When you throw Katana i (1 ≤ i ≤ N) at the monster, it receives b_i points of damage, and you lose the katana. That is, you can no longer wield or throw that katana.\n\nThe monster will vanish when the total damage it has received is H points or more. At least how many attacks do you need in order to vanish it in total?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ H ≤ 10^9\n\n1 ≤ a_i ≤ b_i ≤ 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN H\na_1 b_1\n:\na_N b_N\n\nOutput\n\nPrint the minimum total number of attacks required to vanish the monster.\n\nSample Input 1\n\n1 10\n3 5\n\nSample Output 1\n\n3\n\nYou have one katana. Wielding it deals 3 points of damage, and throwing it deals 5 points of damage. By wielding it twice and then throwing it, you will deal 3 + 3 + 5 = 11 points of damage in a total of three attacks, vanishing the monster.\n\nSample Input 2\n\n2 10\n3 5\n2 6\n\nSample Output 2\n\n2\n\nIn addition to the katana above, you also have another katana. Wielding it deals 2 points of damage, and throwing it deals 6 points of damage. By throwing both katana, you will deal 5 + 6 = 11 points of damage in two attacks, vanishing the monster.\n\nSample Input 3\n\n4 1000000000\n1 1\n1 10000000\n1 30000000\n1 99999999\n\nSample Output 3\n\n860000004\n\nSample Input 4\n\n5 500\n35 44\n28 83\n46 62\n31 79\n40 43\n\nSample Output 4\n\n9", "sample_input": "1 10\n3 5\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03472", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are going out for a walk, when you suddenly encounter a monster. Fortunately, you have N katana (swords), Katana 1, Katana 2, …, Katana N, and can perform the following two kinds of attacks in any order:\n\nWield one of the katana you have. When you wield Katana i (1 ≤ i ≤ N), the monster receives a_i points of damage. The same katana can be wielded any number of times.\n\nThrow one of the katana you have. When you throw Katana i (1 ≤ i ≤ N) at the monster, it receives b_i points of damage, and you lose the katana. That is, you can no longer wield or throw that katana.\n\nThe monster will vanish when the total damage it has received is H points or more. At least how many attacks do you need in order to vanish it in total?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ H ≤ 10^9\n\n1 ≤ a_i ≤ b_i ≤ 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN H\na_1 b_1\n:\na_N b_N\n\nOutput\n\nPrint the minimum total number of attacks required to vanish the monster.\n\nSample Input 1\n\n1 10\n3 5\n\nSample Output 1\n\n3\n\nYou have one katana. Wielding it deals 3 points of damage, and throwing it deals 5 points of damage. By wielding it twice and then throwing it, you will deal 3 + 3 + 5 = 11 points of damage in a total of three attacks, vanishing the monster.\n\nSample Input 2\n\n2 10\n3 5\n2 6\n\nSample Output 2\n\n2\n\nIn addition to the katana above, you also have another katana. Wielding it deals 2 points of damage, and throwing it deals 6 points of damage. By throwing both katana, you will deal 5 + 6 = 11 points of damage in two attacks, vanishing the monster.\n\nSample Input 3\n\n4 1000000000\n1 1\n1 10000000\n1 30000000\n1 99999999\n\nSample Output 3\n\n860000004\n\nSample Input 4\n\n5 500\n35 44\n28 83\n46 62\n31 79\n40 43\n\nSample Output 4\n\n9", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1289, "cpu_time_ms": 782, "memory_kb": 92884}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s842760714", "group_id": "codeNet:p03472", "input_text": "import java.io.BufferedReader;\nimport java.io.Closeable;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.LinkedList;\nimport java.util.ListIterator;\nimport java.util.Map.Entry;\nimport java.util.PriorityQueue;\nimport java.util.Scanner;\nimport java.util.StringTokenizer;\nimport java.util.TreeMap;\nimport java.util.TreeSet;\n \npublic class Main {\n\t\n\tpublic static class Katana implements Comparable {\n\t\tlong a, b;\n\t\t\n\t\tpublic Katana(long a, long b){\n\t\t\tthis.a = a;\n\t\t\tthis.b = b;\n\t\t}\n\n\t\t@Override\n\t\tpublic int compareTo(Katana o) {\n\t\t\treturn -Long.compare(this.b, o.b);\n\t\t}\n\t}\n\t\n\tpublic static void main(String[] args) throws IOException {\n\t\ttry (Scanner sc = new Scanner(System.in)) {\n\t\t\tfinal int N = sc.nextInt();\n\t\t\tfinal long H = sc.nextLong();\n\t\t\t\n\t\t\tKatana[] ks = new Katana[N];\n\t\t\t\n\t\t\tlong[] bs= new long[N];\n\t\t\t\n\t\t\tfor(int i = 0; i < N; i++){\n\t\t\t\tfinal long a = sc.nextLong();\n\t\t\t\tfinal long b = sc.nextLong();\n\t\t\t\t\n\t\t\t\tks[i] = new Katana(a, b);\n\t\t\t\tbs[i] = b;\n\t\t\t}\n\t\t\t\n\t\t\tArrays.sort(bs);\n\t\t\tlong[] b_post_sum = new long[bs.length + 1];\n\t\t\tfor(int i = 1; i < b_post_sum.length; i++){\n\t\t\t\tb_post_sum[i] += b_post_sum[i - 1];\n\t\t\t\tb_post_sum[i] += bs[i - 1];\n\t\t\t}\n\t\t\t//System.out.println(Arrays.toString(bs));\n\t\t\t//System.out.println(Arrays.toString(b_post_sum));\n\t\t\t\n\t\t\tlong min = Long.MAX_VALUE;\n\t\t\tfor(final Katana katana : ks){\n\t\t\t\tfinal long curr_a = katana.a;\n\t\t\t\t\n\t\t\t\tint range_lower = -1, range_upper = N - 1;\n\t\t\t\twhile(range_lower + 1 < range_upper){\n\t\t\t\t\tfinal int middle = (range_lower + range_upper) / 2;\n\t\t\t\t\t//System.out.println(\"> \" + bs[middle] + \" \" + middle);\n\t\t\t\t\t\n\t\t\t\t\tif(bs[middle] < curr_a){\n\t\t\t\t\t\trange_lower = middle;\n\t\t\t\t\t}else{\n\t\t\t\t\t\trange_upper = middle;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//System.out.println(range_lower + \" \" + range_upper);\n\t\t\t\t\n\t\t\t\tint p_sum_lower = range_lower, p_sum_upper = N;\n\t\t\t\twhile(p_sum_lower + 1 < p_sum_upper){\n\t\t\t\t\tfinal int middle = (p_sum_lower + p_sum_upper) / 2;\n\t\t\t\t\t\n\t\t\t\t\tfinal long sum = b_post_sum[middle] - b_post_sum[range_upper];\n\t\t\t\t\tif(sum < H){\n\t\t\t\t\t\tp_sum_lower = middle;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tp_sum_upper = middle;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//System.out.println(p_sum_lower + \" \" + p_sum_upper);\n\t\t\t\t\n\t\t\t\tfinal int full_b_use_time = p_sum_upper - range_upper;\n\t\t\t\tfinal long full_b_use_sum = b_post_sum[p_sum_upper] - b_post_sum[range_upper];\n\t\t\t\t//System.out.println(full_b_use_time + \" \" + full_b_use_sum + \" \" + curr_a);\n\t\t\t\t\n\t\t\t\tif(full_b_use_sum < H){\n\t\t\t\t\tfinal long full_a_use_time = ((H - full_b_use_sum) + (curr_a - 1)) / (curr_a);\n\t\t\t\t\t//System.out.println(full_b_use_time + full_a_use_time);\n\t\t\t\t\tmin = Math.min(min, full_b_use_time + full_a_use_time);\n\t\t\t\t}else{\n\t\t\t\t\tmin = Math.min(min, full_b_use_time);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tSystem.out.println(min);\n\t\t}\n\t}\n \n\tpublic static class Scanner implements Closeable {\n\t\tprivate BufferedReader br;\n\t\tprivate StringTokenizer tok;\n \n\t\tpublic Scanner(InputStream is) throws IOException {\n\t\t\tbr = new BufferedReader(new InputStreamReader(is));\n\t\t}\n \n\t\tprivate void getLine() throws IOException {\n\t\t\twhile (!hasNext()) {\n\t\t\t\ttok = new StringTokenizer(br.readLine());\n\t\t\t}\n\t\t}\n \n\t\tprivate boolean hasNext() {\n\t\t\treturn tok != null && tok.hasMoreTokens();\n\t\t}\n \n\t\tpublic String next() throws IOException {\n\t\t\tgetLine();\n\t\t\treturn tok.nextToken();\n\t\t}\n \n\t\tpublic int nextInt() throws IOException {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n \n\t\tpublic long nextLong() throws IOException {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n \n\t\tpublic double nextDouble() throws IOException {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n \n\t\tpublic int[] nextIntArray(int n) throws IOException {\n\t\t\tfinal int[] ret = new int[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tret[i] = this.nextInt();\n\t\t\t}\n\t\t\treturn ret;\n\t\t}\n \n\t\tpublic long[] nextLongArray(int n) throws IOException {\n\t\t\tfinal long[] ret = new long[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tret[i] = this.nextLong();\n\t\t\t}\n\t\t\treturn ret;\n\t\t}\n \n\t\tpublic void close() throws IOException {\n\t\t\tbr.close();\n\t\t}\n\t}\n}", "language": "Java", "metadata": {"date": 1515380093, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03472.html", "problem_id": "p03472", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03472/input.txt", "sample_output_relpath": "derived/input_output/data/p03472/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03472/Java/s842760714.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s842760714", "user_id": "u790372061"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.Closeable;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.LinkedList;\nimport java.util.ListIterator;\nimport java.util.Map.Entry;\nimport java.util.PriorityQueue;\nimport java.util.Scanner;\nimport java.util.StringTokenizer;\nimport java.util.TreeMap;\nimport java.util.TreeSet;\n \npublic class Main {\n\t\n\tpublic static class Katana implements Comparable {\n\t\tlong a, b;\n\t\t\n\t\tpublic Katana(long a, long b){\n\t\t\tthis.a = a;\n\t\t\tthis.b = b;\n\t\t}\n\n\t\t@Override\n\t\tpublic int compareTo(Katana o) {\n\t\t\treturn -Long.compare(this.b, o.b);\n\t\t}\n\t}\n\t\n\tpublic static void main(String[] args) throws IOException {\n\t\ttry (Scanner sc = new Scanner(System.in)) {\n\t\t\tfinal int N = sc.nextInt();\n\t\t\tfinal long H = sc.nextLong();\n\t\t\t\n\t\t\tKatana[] ks = new Katana[N];\n\t\t\t\n\t\t\tlong[] bs= new long[N];\n\t\t\t\n\t\t\tfor(int i = 0; i < N; i++){\n\t\t\t\tfinal long a = sc.nextLong();\n\t\t\t\tfinal long b = sc.nextLong();\n\t\t\t\t\n\t\t\t\tks[i] = new Katana(a, b);\n\t\t\t\tbs[i] = b;\n\t\t\t}\n\t\t\t\n\t\t\tArrays.sort(bs);\n\t\t\tlong[] b_post_sum = new long[bs.length + 1];\n\t\t\tfor(int i = 1; i < b_post_sum.length; i++){\n\t\t\t\tb_post_sum[i] += b_post_sum[i - 1];\n\t\t\t\tb_post_sum[i] += bs[i - 1];\n\t\t\t}\n\t\t\t//System.out.println(Arrays.toString(bs));\n\t\t\t//System.out.println(Arrays.toString(b_post_sum));\n\t\t\t\n\t\t\tlong min = Long.MAX_VALUE;\n\t\t\tfor(final Katana katana : ks){\n\t\t\t\tfinal long curr_a = katana.a;\n\t\t\t\t\n\t\t\t\tint range_lower = -1, range_upper = N - 1;\n\t\t\t\twhile(range_lower + 1 < range_upper){\n\t\t\t\t\tfinal int middle = (range_lower + range_upper) / 2;\n\t\t\t\t\t//System.out.println(\"> \" + bs[middle] + \" \" + middle);\n\t\t\t\t\t\n\t\t\t\t\tif(bs[middle] < curr_a){\n\t\t\t\t\t\trange_lower = middle;\n\t\t\t\t\t}else{\n\t\t\t\t\t\trange_upper = middle;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//System.out.println(range_lower + \" \" + range_upper);\n\t\t\t\t\n\t\t\t\tint p_sum_lower = range_lower, p_sum_upper = N;\n\t\t\t\twhile(p_sum_lower + 1 < p_sum_upper){\n\t\t\t\t\tfinal int middle = (p_sum_lower + p_sum_upper) / 2;\n\t\t\t\t\t\n\t\t\t\t\tfinal long sum = b_post_sum[middle] - b_post_sum[range_upper];\n\t\t\t\t\tif(sum < H){\n\t\t\t\t\t\tp_sum_lower = middle;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tp_sum_upper = middle;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//System.out.println(p_sum_lower + \" \" + p_sum_upper);\n\t\t\t\t\n\t\t\t\tfinal int full_b_use_time = p_sum_upper - range_upper;\n\t\t\t\tfinal long full_b_use_sum = b_post_sum[p_sum_upper] - b_post_sum[range_upper];\n\t\t\t\t//System.out.println(full_b_use_time + \" \" + full_b_use_sum + \" \" + curr_a);\n\t\t\t\t\n\t\t\t\tif(full_b_use_sum < H){\n\t\t\t\t\tfinal long full_a_use_time = ((H - full_b_use_sum) + (curr_a - 1)) / (curr_a);\n\t\t\t\t\t//System.out.println(full_b_use_time + full_a_use_time);\n\t\t\t\t\tmin = Math.min(min, full_b_use_time + full_a_use_time);\n\t\t\t\t}else{\n\t\t\t\t\tmin = Math.min(min, full_b_use_time);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tSystem.out.println(min);\n\t\t}\n\t}\n \n\tpublic static class Scanner implements Closeable {\n\t\tprivate BufferedReader br;\n\t\tprivate StringTokenizer tok;\n \n\t\tpublic Scanner(InputStream is) throws IOException {\n\t\t\tbr = new BufferedReader(new InputStreamReader(is));\n\t\t}\n \n\t\tprivate void getLine() throws IOException {\n\t\t\twhile (!hasNext()) {\n\t\t\t\ttok = new StringTokenizer(br.readLine());\n\t\t\t}\n\t\t}\n \n\t\tprivate boolean hasNext() {\n\t\t\treturn tok != null && tok.hasMoreTokens();\n\t\t}\n \n\t\tpublic String next() throws IOException {\n\t\t\tgetLine();\n\t\t\treturn tok.nextToken();\n\t\t}\n \n\t\tpublic int nextInt() throws IOException {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n \n\t\tpublic long nextLong() throws IOException {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n \n\t\tpublic double nextDouble() throws IOException {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n \n\t\tpublic int[] nextIntArray(int n) throws IOException {\n\t\t\tfinal int[] ret = new int[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tret[i] = this.nextInt();\n\t\t\t}\n\t\t\treturn ret;\n\t\t}\n \n\t\tpublic long[] nextLongArray(int n) throws IOException {\n\t\t\tfinal long[] ret = new long[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tret[i] = this.nextLong();\n\t\t\t}\n\t\t\treturn ret;\n\t\t}\n \n\t\tpublic void close() throws IOException {\n\t\t\tbr.close();\n\t\t}\n\t}\n}", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are going out for a walk, when you suddenly encounter a monster. Fortunately, you have N katana (swords), Katana 1, Katana 2, …, Katana N, and can perform the following two kinds of attacks in any order:\n\nWield one of the katana you have. When you wield Katana i (1 ≤ i ≤ N), the monster receives a_i points of damage. The same katana can be wielded any number of times.\n\nThrow one of the katana you have. When you throw Katana i (1 ≤ i ≤ N) at the monster, it receives b_i points of damage, and you lose the katana. That is, you can no longer wield or throw that katana.\n\nThe monster will vanish when the total damage it has received is H points or more. At least how many attacks do you need in order to vanish it in total?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ H ≤ 10^9\n\n1 ≤ a_i ≤ b_i ≤ 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN H\na_1 b_1\n:\na_N b_N\n\nOutput\n\nPrint the minimum total number of attacks required to vanish the monster.\n\nSample Input 1\n\n1 10\n3 5\n\nSample Output 1\n\n3\n\nYou have one katana. Wielding it deals 3 points of damage, and throwing it deals 5 points of damage. By wielding it twice and then throwing it, you will deal 3 + 3 + 5 = 11 points of damage in a total of three attacks, vanishing the monster.\n\nSample Input 2\n\n2 10\n3 5\n2 6\n\nSample Output 2\n\n2\n\nIn addition to the katana above, you also have another katana. Wielding it deals 2 points of damage, and throwing it deals 6 points of damage. By throwing both katana, you will deal 5 + 6 = 11 points of damage in two attacks, vanishing the monster.\n\nSample Input 3\n\n4 1000000000\n1 1\n1 10000000\n1 30000000\n1 99999999\n\nSample Output 3\n\n860000004\n\nSample Input 4\n\n5 500\n35 44\n28 83\n46 62\n31 79\n40 43\n\nSample Output 4\n\n9", "sample_input": "1 10\n3 5\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03472", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are going out for a walk, when you suddenly encounter a monster. Fortunately, you have N katana (swords), Katana 1, Katana 2, …, Katana N, and can perform the following two kinds of attacks in any order:\n\nWield one of the katana you have. When you wield Katana i (1 ≤ i ≤ N), the monster receives a_i points of damage. The same katana can be wielded any number of times.\n\nThrow one of the katana you have. When you throw Katana i (1 ≤ i ≤ N) at the monster, it receives b_i points of damage, and you lose the katana. That is, you can no longer wield or throw that katana.\n\nThe monster will vanish when the total damage it has received is H points or more. At least how many attacks do you need in order to vanish it in total?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ H ≤ 10^9\n\n1 ≤ a_i ≤ b_i ≤ 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN H\na_1 b_1\n:\na_N b_N\n\nOutput\n\nPrint the minimum total number of attacks required to vanish the monster.\n\nSample Input 1\n\n1 10\n3 5\n\nSample Output 1\n\n3\n\nYou have one katana. Wielding it deals 3 points of damage, and throwing it deals 5 points of damage. By wielding it twice and then throwing it, you will deal 3 + 3 + 5 = 11 points of damage in a total of three attacks, vanishing the monster.\n\nSample Input 2\n\n2 10\n3 5\n2 6\n\nSample Output 2\n\n2\n\nIn addition to the katana above, you also have another katana. Wielding it deals 2 points of damage, and throwing it deals 6 points of damage. By throwing both katana, you will deal 5 + 6 = 11 points of damage in two attacks, vanishing the monster.\n\nSample Input 3\n\n4 1000000000\n1 1\n1 10000000\n1 30000000\n1 99999999\n\nSample Output 3\n\n860000004\n\nSample Input 4\n\n5 500\n35 44\n28 83\n46 62\n31 79\n40 43\n\nSample Output 4\n\n9", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 4202, "cpu_time_ms": 326, "memory_kb": 49828}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s364699118", "group_id": "codeNet:p03478", "input_text": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int a = sc.nextInt();\n int b = sc.nextInt();\n\n int sum = 0;\n for (int i = 1; i <= n; ++i) {\n int digitSum = 0;\n int tmp = i;\n while (tmp > 0) {\n digitSum += tmp % 10;\n tmp /= 10;\n }\n if (a <= digitSum && digitSum <= b)\n sum += i;\n }\n\n System.out.println(sum);\n }\n}", "language": "Java", "metadata": {"date": 1590119209, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03478.html", "problem_id": "p03478", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03478/input.txt", "sample_output_relpath": "derived/input_output/data/p03478/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03478/Java/s364699118.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s364699118", "user_id": "u333573372"}, "prompt_components": {"gold_output": "84\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int a = sc.nextInt();\n int b = sc.nextInt();\n\n int sum = 0;\n for (int i = 1; i <= n; ++i) {\n int digitSum = 0;\n int tmp = i;\n while (tmp > 0) {\n digitSum += tmp % 10;\n tmp /= 10;\n }\n if (a <= digitSum && digitSum <= b)\n sum += i;\n }\n\n System.out.println(sum);\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nFind the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).\n\nConstraints\n\n1 \\leq N \\leq 10^4\n\n1 \\leq A \\leq B \\leq 36\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).\n\nSample Input 1\n\n20 2 5\n\nSample Output 1\n\n84\n\nAmong the integers not greater than 20, the ones whose sums of digits are between 2 and 5, are: 2,3,4,5,11,12,13,14 and 20. We should print the sum of these, 84.\n\nSample Input 2\n\n10 1 2\n\nSample Output 2\n\n13\n\nSample Input 3\n\n100 4 16\n\nSample Output 3\n\n4554", "sample_input": "20 2 5\n"}, "reference_outputs": ["84\n"], "source_document_id": "p03478", "source_text": "Score : 200 points\n\nProblem Statement\n\nFind the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).\n\nConstraints\n\n1 \\leq N \\leq 10^4\n\n1 \\leq A \\leq B \\leq 36\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).\n\nSample Input 1\n\n20 2 5\n\nSample Output 1\n\n84\n\nAmong the integers not greater than 20, the ones whose sums of digits are between 2 and 5, are: 2,3,4,5,11,12,13,14 and 20. We should print the sum of these, 84.\n\nSample Input 2\n\n10 1 2\n\nSample Output 2\n\n13\n\nSample Input 3\n\n100 4 16\n\nSample Output 3\n\n4554", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 571, "cpu_time_ms": 98, "memory_kb": 23636}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s007578091", "group_id": "codeNet:p03478", "input_text": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int end = sc.nextInt();\n int min = sc.nextInt();\n int max = sc.nextInt();\n sc.close();\n\n long sum = 0;\n\n for (int i = 1; i <= end; i++) {\n int x = getXxx(i);\n\n if (min <= x && x <= max) {\n sum += i;\n }\n }\n\n System.out.println(sum);\n \n }\n\n private static int getXxx(int num) {\n\n int result = 0;\n\n while(num > 0) {\n result += num % 10;\n num /= 10;\n }\n\n return result;\n\n }\n}\t", "language": "Java", "metadata": {"date": 1587760040, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03478.html", "problem_id": "p03478", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03478/input.txt", "sample_output_relpath": "derived/input_output/data/p03478/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03478/Java/s007578091.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s007578091", "user_id": "u731451808"}, "prompt_components": {"gold_output": "84\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int end = sc.nextInt();\n int min = sc.nextInt();\n int max = sc.nextInt();\n sc.close();\n\n long sum = 0;\n\n for (int i = 1; i <= end; i++) {\n int x = getXxx(i);\n\n if (min <= x && x <= max) {\n sum += i;\n }\n }\n\n System.out.println(sum);\n \n }\n\n private static int getXxx(int num) {\n\n int result = 0;\n\n while(num > 0) {\n result += num % 10;\n num /= 10;\n }\n\n return result;\n\n }\n}\t", "problem_context": "Score : 200 points\n\nProblem Statement\n\nFind the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).\n\nConstraints\n\n1 \\leq N \\leq 10^4\n\n1 \\leq A \\leq B \\leq 36\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).\n\nSample Input 1\n\n20 2 5\n\nSample Output 1\n\n84\n\nAmong the integers not greater than 20, the ones whose sums of digits are between 2 and 5, are: 2,3,4,5,11,12,13,14 and 20. We should print the sum of these, 84.\n\nSample Input 2\n\n10 1 2\n\nSample Output 2\n\n13\n\nSample Input 3\n\n100 4 16\n\nSample Output 3\n\n4554", "sample_input": "20 2 5\n"}, "reference_outputs": ["84\n"], "source_document_id": "p03478", "source_text": "Score : 200 points\n\nProblem Statement\n\nFind the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).\n\nConstraints\n\n1 \\leq N \\leq 10^4\n\n1 \\leq A \\leq B \\leq 36\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).\n\nSample Input 1\n\n20 2 5\n\nSample Output 1\n\n84\n\nAmong the integers not greater than 20, the ones whose sums of digits are between 2 and 5, are: 2,3,4,5,11,12,13,14 and 20. We should print the sum of these, 84.\n\nSample Input 2\n\n10 1 2\n\nSample Output 2\n\n13\n\nSample Input 3\n\n100 4 16\n\nSample Output 3\n\n4554", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 578, "cpu_time_ms": 104, "memory_kb": 21716}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s022976052", "group_id": "codeNet:p03478", "input_text": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n \n int result = 0;\n \n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int a = sc.nextInt();\n int b = sc.nextInt();\n \n for (int i=1; i<=n; i++){\n int sum = 0;\n String str = Integer.toString(i);\n String []resultArray = str.split(\"\");\n \n for(int j = 0; j < resultArray.length; j++){\n int num=Integer.parseInt(resultArray[j]);\n sum += num;\n }\n \n if(a <= sum && sum <= b){\n result += i;\n }\n \n }\n\n System.out.println(result);\n sc.close();\n }\n}\n", "language": "Java", "metadata": {"date": 1577077170, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03478.html", "problem_id": "p03478", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03478/input.txt", "sample_output_relpath": "derived/input_output/data/p03478/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03478/Java/s022976052.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s022976052", "user_id": "u375531706"}, "prompt_components": {"gold_output": "84\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n \n int result = 0;\n \n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int a = sc.nextInt();\n int b = sc.nextInt();\n \n for (int i=1; i<=n; i++){\n int sum = 0;\n String str = Integer.toString(i);\n String []resultArray = str.split(\"\");\n \n for(int j = 0; j < resultArray.length; j++){\n int num=Integer.parseInt(resultArray[j]);\n sum += num;\n }\n \n if(a <= sum && sum <= b){\n result += i;\n }\n \n }\n\n System.out.println(result);\n sc.close();\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nFind the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).\n\nConstraints\n\n1 \\leq N \\leq 10^4\n\n1 \\leq A \\leq B \\leq 36\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).\n\nSample Input 1\n\n20 2 5\n\nSample Output 1\n\n84\n\nAmong the integers not greater than 20, the ones whose sums of digits are between 2 and 5, are: 2,3,4,5,11,12,13,14 and 20. We should print the sum of these, 84.\n\nSample Input 2\n\n10 1 2\n\nSample Output 2\n\n13\n\nSample Input 3\n\n100 4 16\n\nSample Output 3\n\n4554", "sample_input": "20 2 5\n"}, "reference_outputs": ["84\n"], "source_document_id": "p03478", "source_text": "Score : 200 points\n\nProblem Statement\n\nFind the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).\n\nConstraints\n\n1 \\leq N \\leq 10^4\n\n1 \\leq A \\leq B \\leq 36\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).\n\nSample Input 1\n\n20 2 5\n\nSample Output 1\n\n84\n\nAmong the integers not greater than 20, the ones whose sums of digits are between 2 and 5, are: 2,3,4,5,11,12,13,14 and 20. We should print the sum of these, 84.\n\nSample Input 2\n\n10 1 2\n\nSample Output 2\n\n13\n\nSample Input 3\n\n100 4 16\n\nSample Output 3\n\n4554", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 796, "cpu_time_ms": 178, "memory_kb": 34516}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s520690245", "group_id": "codeNet:p03478", "input_text": "import java.util.*;\n\nclass Main {\n public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n \n int n = sc.nextInt();\n int a = sc.nextInt();\n int b = sc.nextInt();\n\n int sumAll = 0;\n\n for(int i=1;i <= n; i++) {\n String t = String.valueOf(i);\n int sum = 0;\n for(int j = 0; j < t.length(); j++) {\n sum += Integer.parseInt(t.substring(j, j+1));\n }\n\n if(sum >=a && sum <=b) {\n sumAll += i;\n }\n\n }\n System.out.println(sumAll);\n }\n}", "language": "Java", "metadata": {"date": 1559245001, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03478.html", "problem_id": "p03478", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03478/input.txt", "sample_output_relpath": "derived/input_output/data/p03478/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03478/Java/s520690245.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s520690245", "user_id": "u892010121"}, "prompt_components": {"gold_output": "84\n", "input_to_evaluate": "import java.util.*;\n\nclass Main {\n public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n \n int n = sc.nextInt();\n int a = sc.nextInt();\n int b = sc.nextInt();\n\n int sumAll = 0;\n\n for(int i=1;i <= n; i++) {\n String t = String.valueOf(i);\n int sum = 0;\n for(int j = 0; j < t.length(); j++) {\n sum += Integer.parseInt(t.substring(j, j+1));\n }\n\n if(sum >=a && sum <=b) {\n sumAll += i;\n }\n\n }\n System.out.println(sumAll);\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nFind the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).\n\nConstraints\n\n1 \\leq N \\leq 10^4\n\n1 \\leq A \\leq B \\leq 36\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).\n\nSample Input 1\n\n20 2 5\n\nSample Output 1\n\n84\n\nAmong the integers not greater than 20, the ones whose sums of digits are between 2 and 5, are: 2,3,4,5,11,12,13,14 and 20. We should print the sum of these, 84.\n\nSample Input 2\n\n10 1 2\n\nSample Output 2\n\n13\n\nSample Input 3\n\n100 4 16\n\nSample Output 3\n\n4554", "sample_input": "20 2 5\n"}, "reference_outputs": ["84\n"], "source_document_id": "p03478", "source_text": "Score : 200 points\n\nProblem Statement\n\nFind the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).\n\nConstraints\n\n1 \\leq N \\leq 10^4\n\n1 \\leq A \\leq B \\leq 36\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).\n\nSample Input 1\n\n20 2 5\n\nSample Output 1\n\n84\n\nAmong the integers not greater than 20, the ones whose sums of digits are between 2 and 5, are: 2,3,4,5,11,12,13,14 and 20. We should print the sum of these, 84.\n\nSample Input 2\n\n10 1 2\n\nSample Output 2\n\n13\n\nSample Input 3\n\n100 4 16\n\nSample Output 3\n\n4554", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 610, "cpu_time_ms": 121, "memory_kb": 24020}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s386153764", "group_id": "codeNet:p03478", "input_text": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint a = sc.nextInt();\n\t\tint b = sc.nextInt();\n\t\tint sum = 0;\n\t\tfor(int i = 1; i <= n; i++) {\n\t\t\tint c = 0, d = i;\n\t\t\tfor(int j = 1; j < 5; j++) {\n\t\t\t\tc += d % 10;\n\t\t\t\td /= 10;\n\t\t\t}\n\t\t\tif(a <= c && c <= b) {\n\t\t\t\tsum += i;\n\t\t\t}\n\t\t}\n\t\tSystem.out.print(sum);\n\t}\n}", "language": "Java", "metadata": {"date": 1522295734, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03478.html", "problem_id": "p03478", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03478/input.txt", "sample_output_relpath": "derived/input_output/data/p03478/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03478/Java/s386153764.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s386153764", "user_id": "u065974537"}, "prompt_components": {"gold_output": "84\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint a = sc.nextInt();\n\t\tint b = sc.nextInt();\n\t\tint sum = 0;\n\t\tfor(int i = 1; i <= n; i++) {\n\t\t\tint c = 0, d = i;\n\t\t\tfor(int j = 1; j < 5; j++) {\n\t\t\t\tc += d % 10;\n\t\t\t\td /= 10;\n\t\t\t}\n\t\t\tif(a <= c && c <= b) {\n\t\t\t\tsum += i;\n\t\t\t}\n\t\t}\n\t\tSystem.out.print(sum);\n\t}\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nFind the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).\n\nConstraints\n\n1 \\leq N \\leq 10^4\n\n1 \\leq A \\leq B \\leq 36\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).\n\nSample Input 1\n\n20 2 5\n\nSample Output 1\n\n84\n\nAmong the integers not greater than 20, the ones whose sums of digits are between 2 and 5, are: 2,3,4,5,11,12,13,14 and 20. We should print the sum of these, 84.\n\nSample Input 2\n\n10 1 2\n\nSample Output 2\n\n13\n\nSample Input 3\n\n100 4 16\n\nSample Output 3\n\n4554", "sample_input": "20 2 5\n"}, "reference_outputs": ["84\n"], "source_document_id": "p03478", "source_text": "Score : 200 points\n\nProblem Statement\n\nFind the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).\n\nConstraints\n\n1 \\leq N \\leq 10^4\n\n1 \\leq A \\leq B \\leq 36\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).\n\nSample Input 1\n\n20 2 5\n\nSample Output 1\n\n84\n\nAmong the integers not greater than 20, the ones whose sums of digits are between 2 and 5, are: 2,3,4,5,11,12,13,14 and 20. We should print the sum of these, 84.\n\nSample Input 2\n\n10 1 2\n\nSample Output 2\n\n13\n\nSample Input 3\n\n100 4 16\n\nSample Output 3\n\n4554", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 95, "memory_kb": 23764}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s389436268", "group_id": "codeNet:p03478", "input_text": "import java.util.Scanner;\n\nclass Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint a = sc.nextInt();\n\t\tint b = sc.nextInt();\n\t\tint nlen = String.valueOf(n).length();\n\t\tint tmp1 = 0;\n\t\tint tmp2 = 0;\n\t\tint sum = 0;\n\n\t\tfor (int i = 1; i <= nlen; i++) {\n\t\t\tfor (int j = (int) Math.pow(10, i-1); j < Math.pow(10, i); j++) {\n\t\t\t\tif (j > n) {\n\t\t\t\t\tSystem.out.println(sum); return;\n\t\t\t\t} else if (i == 1) {\n\t\t\t\t\ttmp1 = j;\n\t\t\t\t\tif (tmp1 >= a && tmp1 <= b) {\n\t\t\t\t\t\tsum += j;\n\t\t\t\t\t}\n\t\t\t\t} else if (i == 2) {\n\t\t\t\t\ttmp1 = j/10;\n\t\t\t\t\ttmp2 = j%10;\n\t\t\t\t\ttmp1 += tmp2;\n\t\t\t\t\tif (tmp1 >= a && tmp1 <= b) {\n\t\t\t\t\t\tsum += j;\n\t\t\t\t\t}\n\t\t\t\t} else if (i == 3) {\n\t\t\t\t\ttmp1 = j/100;\n\t\t\t\t\ttmp2 = j%100;\n\t\t\t\t\ttmp1 += tmp2/10;\n\t\t\t\t\ttmp2 = tmp2%10;\n\t\t\t\t\ttmp1 += tmp2;\n\t\t\t\t\tif (tmp1 >= a && tmp1 <= b) {\n\t\t\t\t\t\tsum += j;\n\t\t\t\t\t}\n\t\t\t\t}else if (i == 4) {\n\t\t\t\t\tif (1 >= a && 1 <= b) {\n\t\t\t\t\t\tsum += j;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ttmp1 = 0;\n\t\t\t\ttmp2 = 0;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sum);\n\t}\n}", "language": "Java", "metadata": {"date": 1517784159, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03478.html", "problem_id": "p03478", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03478/input.txt", "sample_output_relpath": "derived/input_output/data/p03478/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03478/Java/s389436268.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s389436268", "user_id": "u322331631"}, "prompt_components": {"gold_output": "84\n", "input_to_evaluate": "import java.util.Scanner;\n\nclass Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint a = sc.nextInt();\n\t\tint b = sc.nextInt();\n\t\tint nlen = String.valueOf(n).length();\n\t\tint tmp1 = 0;\n\t\tint tmp2 = 0;\n\t\tint sum = 0;\n\n\t\tfor (int i = 1; i <= nlen; i++) {\n\t\t\tfor (int j = (int) Math.pow(10, i-1); j < Math.pow(10, i); j++) {\n\t\t\t\tif (j > n) {\n\t\t\t\t\tSystem.out.println(sum); return;\n\t\t\t\t} else if (i == 1) {\n\t\t\t\t\ttmp1 = j;\n\t\t\t\t\tif (tmp1 >= a && tmp1 <= b) {\n\t\t\t\t\t\tsum += j;\n\t\t\t\t\t}\n\t\t\t\t} else if (i == 2) {\n\t\t\t\t\ttmp1 = j/10;\n\t\t\t\t\ttmp2 = j%10;\n\t\t\t\t\ttmp1 += tmp2;\n\t\t\t\t\tif (tmp1 >= a && tmp1 <= b) {\n\t\t\t\t\t\tsum += j;\n\t\t\t\t\t}\n\t\t\t\t} else if (i == 3) {\n\t\t\t\t\ttmp1 = j/100;\n\t\t\t\t\ttmp2 = j%100;\n\t\t\t\t\ttmp1 += tmp2/10;\n\t\t\t\t\ttmp2 = tmp2%10;\n\t\t\t\t\ttmp1 += tmp2;\n\t\t\t\t\tif (tmp1 >= a && tmp1 <= b) {\n\t\t\t\t\t\tsum += j;\n\t\t\t\t\t}\n\t\t\t\t}else if (i == 4) {\n\t\t\t\t\tif (1 >= a && 1 <= b) {\n\t\t\t\t\t\tsum += j;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ttmp1 = 0;\n\t\t\t\ttmp2 = 0;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sum);\n\t}\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nFind the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).\n\nConstraints\n\n1 \\leq N \\leq 10^4\n\n1 \\leq A \\leq B \\leq 36\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).\n\nSample Input 1\n\n20 2 5\n\nSample Output 1\n\n84\n\nAmong the integers not greater than 20, the ones whose sums of digits are between 2 and 5, are: 2,3,4,5,11,12,13,14 and 20. We should print the sum of these, 84.\n\nSample Input 2\n\n10 1 2\n\nSample Output 2\n\n13\n\nSample Input 3\n\n100 4 16\n\nSample Output 3\n\n4554", "sample_input": "20 2 5\n"}, "reference_outputs": ["84\n"], "source_document_id": "p03478", "source_text": "Score : 200 points\n\nProblem Statement\n\nFind the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).\n\nConstraints\n\n1 \\leq N \\leq 10^4\n\n1 \\leq A \\leq B \\leq 36\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).\n\nSample Input 1\n\n20 2 5\n\nSample Output 1\n\n84\n\nAmong the integers not greater than 20, the ones whose sums of digits are between 2 and 5, are: 2,3,4,5,11,12,13,14 and 20. We should print the sum of these, 84.\n\nSample Input 2\n\n10 1 2\n\nSample Output 2\n\n13\n\nSample Input 3\n\n100 4 16\n\nSample Output 3\n\n4554", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 116, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s628370478", "group_id": "codeNet:p03478", "input_text": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int N = sc.nextInt();\n int A = sc.nextInt();\n int B = sc.nextInt();\n int result = 0;\n\n for (int i = 1; i <= N; i++) {\n String imput = String.valueOf(i);\n String[] strings;\n strings = imput.split(\"\");\n\n int sum = 0;\n for (int j = 0; j <= imput.length() - 1; j++) {\n sum += Integer.valueOf(strings[j]);\n }\n\n if(A <= sum && sum <= B) {\n result += i;\n }\n }\n System.out.println(result);\n }\n}", "language": "Java", "metadata": {"date": 1514083177, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03478.html", "problem_id": "p03478", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03478/input.txt", "sample_output_relpath": "derived/input_output/data/p03478/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03478/Java/s628370478.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s628370478", "user_id": "u598902504"}, "prompt_components": {"gold_output": "84\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int N = sc.nextInt();\n int A = sc.nextInt();\n int B = sc.nextInt();\n int result = 0;\n\n for (int i = 1; i <= N; i++) {\n String imput = String.valueOf(i);\n String[] strings;\n strings = imput.split(\"\");\n\n int sum = 0;\n for (int j = 0; j <= imput.length() - 1; j++) {\n sum += Integer.valueOf(strings[j]);\n }\n\n if(A <= sum && sum <= B) {\n result += i;\n }\n }\n System.out.println(result);\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nFind the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).\n\nConstraints\n\n1 \\leq N \\leq 10^4\n\n1 \\leq A \\leq B \\leq 36\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).\n\nSample Input 1\n\n20 2 5\n\nSample Output 1\n\n84\n\nAmong the integers not greater than 20, the ones whose sums of digits are between 2 and 5, are: 2,3,4,5,11,12,13,14 and 20. We should print the sum of these, 84.\n\nSample Input 2\n\n10 1 2\n\nSample Output 2\n\n13\n\nSample Input 3\n\n100 4 16\n\nSample Output 3\n\n4554", "sample_input": "20 2 5\n"}, "reference_outputs": ["84\n"], "source_document_id": "p03478", "source_text": "Score : 200 points\n\nProblem Statement\n\nFind the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).\n\nConstraints\n\n1 \\leq N \\leq 10^4\n\n1 \\leq A \\leq B \\leq 36\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).\n\nSample Input 1\n\n20 2 5\n\nSample Output 1\n\n84\n\nAmong the integers not greater than 20, the ones whose sums of digits are between 2 and 5, are: 2,3,4,5,11,12,13,14 and 20. We should print the sum of these, 84.\n\nSample Input 2\n\n10 1 2\n\nSample Output 2\n\n13\n\nSample Input 3\n\n100 4 16\n\nSample Output 3\n\n4554", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 689, "cpu_time_ms": 207, "memory_kb": 36436}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s759895970", "group_id": "codeNet:p03493", "input_text": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String s = sc.skip(\"0\").next();\n System.out.println(s.length());\n }\n}\n", "language": "Java", "metadata": {"date": 1596163809, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p03493.html", "problem_id": "p03493", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03493/input.txt", "sample_output_relpath": "derived/input_output/data/p03493/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03493/Java/s759895970.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s759895970", "user_id": "u190395363"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String s = sc.skip(\"0\").next();\n System.out.println(s.length());\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nSnuke has a grid consisting of three squares numbered 1, 2 and 3.\nIn each square, either 0 or 1 is written. The number written in Square i is s_i.\n\nSnuke will place a marble on each square that says 1.\nFind the number of squares on which Snuke will place a marble.\n\nConstraints\n\nEach of s_1, s_2 and s_3 is either 1 or 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns_{1}s_{2}s_{3}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n101\n\nSample Output 1\n\n2\n\nA marble will be placed on Square 1 and 3.\n\nSample Input 2\n\n000\n\nSample Output 2\n\n0\n\nNo marble will be placed on any square.", "sample_input": "101\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03493", "source_text": "Score : 100 points\n\nProblem Statement\n\nSnuke has a grid consisting of three squares numbered 1, 2 and 3.\nIn each square, either 0 or 1 is written. The number written in Square i is s_i.\n\nSnuke will place a marble on each square that says 1.\nFind the number of squares on which Snuke will place a marble.\n\nConstraints\n\nEach of s_1, s_2 and s_3 is either 1 or 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns_{1}s_{2}s_{3}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n101\n\nSample Output 1\n\n2\n\nA marble will be placed on Square 1 and 3.\n\nSample Input 2\n\n000\n\nSample Output 2\n\n0\n\nNo marble will be placed on any square.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 225, "cpu_time_ms": 121, "memory_kb": 35640}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s057320744", "group_id": "codeNet:p03493", "input_text": "import java.util.Scanner;\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int che = 30;\n for(int i = 1 ; i <= n ; i++){\n int a = sc.nextInt();\n int zyo = 0;\n int cou = 0;\n while(zyo == 0){\n if(a % 2 == 1){\n zyo = 1;\n }else{\n cou = cou + 1;\n a = a / 2;\n }\n }\n if(cou < che){\n che = cou;\n }\n }\n System.out.println(che);\n }\n}\n", "language": "Java", "metadata": {"date": 1593664254, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p03493.html", "problem_id": "p03493", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03493/input.txt", "sample_output_relpath": "derived/input_output/data/p03493/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03493/Java/s057320744.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s057320744", "user_id": "u073879055"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.Scanner;\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int che = 30;\n for(int i = 1 ; i <= n ; i++){\n int a = sc.nextInt();\n int zyo = 0;\n int cou = 0;\n while(zyo == 0){\n if(a % 2 == 1){\n zyo = 1;\n }else{\n cou = cou + 1;\n a = a / 2;\n }\n }\n if(cou < che){\n che = cou;\n }\n }\n System.out.println(che);\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nSnuke has a grid consisting of three squares numbered 1, 2 and 3.\nIn each square, either 0 or 1 is written. The number written in Square i is s_i.\n\nSnuke will place a marble on each square that says 1.\nFind the number of squares on which Snuke will place a marble.\n\nConstraints\n\nEach of s_1, s_2 and s_3 is either 1 or 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns_{1}s_{2}s_{3}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n101\n\nSample Output 1\n\n2\n\nA marble will be placed on Square 1 and 3.\n\nSample Input 2\n\n000\n\nSample Output 2\n\n0\n\nNo marble will be placed on any square.", "sample_input": "101\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03493", "source_text": "Score : 100 points\n\nProblem Statement\n\nSnuke has a grid consisting of three squares numbered 1, 2 and 3.\nIn each square, either 0 or 1 is written. The number written in Square i is s_i.\n\nSnuke will place a marble on each square that says 1.\nFind the number of squares on which Snuke will place a marble.\n\nConstraints\n\nEach of s_1, s_2 and s_3 is either 1 or 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns_{1}s_{2}s_{3}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n101\n\nSample Output 1\n\n2\n\nA marble will be placed on Square 1 and 3.\n\nSample Input 2\n\n000\n\nSample Output 2\n\n0\n\nNo marble will be placed on any square.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 508, "cpu_time_ms": 126, "memory_kb": 35980}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s699535049", "group_id": "codeNet:p03493", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n s = s.replace(\"0\", \"\");\n System.out.println(s.length());\n\n }\n}\n", "language": "Java", "metadata": {"date": 1591999609, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03493.html", "problem_id": "p03493", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03493/input.txt", "sample_output_relpath": "derived/input_output/data/p03493/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03493/Java/s699535049.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s699535049", "user_id": "u479371430"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n s = s.replace(\"0\", \"\");\n System.out.println(s.length());\n\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nSnuke has a grid consisting of three squares numbered 1, 2 and 3.\nIn each square, either 0 or 1 is written. The number written in Square i is s_i.\n\nSnuke will place a marble on each square that says 1.\nFind the number of squares on which Snuke will place a marble.\n\nConstraints\n\nEach of s_1, s_2 and s_3 is either 1 or 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns_{1}s_{2}s_{3}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n101\n\nSample Output 1\n\n2\n\nA marble will be placed on Square 1 and 3.\n\nSample Input 2\n\n000\n\nSample Output 2\n\n0\n\nNo marble will be placed on any square.", "sample_input": "101\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03493", "source_text": "Score : 100 points\n\nProblem Statement\n\nSnuke has a grid consisting of three squares numbered 1, 2 and 3.\nIn each square, either 0 or 1 is written. The number written in Square i is s_i.\n\nSnuke will place a marble on each square that says 1.\nFind the number of squares on which Snuke will place a marble.\n\nConstraints\n\nEach of s_1, s_2 and s_3 is either 1 or 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns_{1}s_{2}s_{3}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n101\n\nSample Output 1\n\n2\n\nA marble will be placed on Square 1 and 3.\n\nSample Input 2\n\n000\n\nSample Output 2\n\n0\n\nNo marble will be placed on any square.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 249, "cpu_time_ms": 110, "memory_kb": 23508}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s857842259", "group_id": "codeNet:p03493", "input_text": "import java.util.ArrayList;\nimport java.util.Scanner;\nimport java.util.stream.Collectors;\n\n/**\n * すぬけ君は1,2,3の番号がついた3つのマスからなるマス目を持っています。\n * 各マスには 0 か 1 が書かれており、マスiにはs iが書かれています。\n *\n * すぬけ君は 1 が書かれたマスにビー玉を置きます。\n * ビー玉が置かれるマスがいくつあるか求めてください。\n *\n * # restrict\n * s1, s2, s3 は、'0', '1'\n *\n * # input\n * 入力は以下の形式で標準入力から与えられる。\n * s1s2s3\n *\n * #\n */\npublic class Main {\n public static void main(String[] args) {\n final Scanner s = new Scanner(System.in);\n\n String s1 = s.next();\n String s2 = s.next();\n String s3 = s.next();\n\n ArrayList list = new ArrayList();\n list.add(s1);\n list.add(s2);\n list.add(s3);\n\n int count = list.stream()\n .filter( str -> str.equals(\"1\"))\n .collect(Collectors.toList())\n .size();\n\n System.out.print(count);\n }\n}\n", "language": "Java", "metadata": {"date": 1591473627, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03493.html", "problem_id": "p03493", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03493/input.txt", "sample_output_relpath": "derived/input_output/data/p03493/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03493/Java/s857842259.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s857842259", "user_id": "u219048480"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.ArrayList;\nimport java.util.Scanner;\nimport java.util.stream.Collectors;\n\n/**\n * すぬけ君は1,2,3の番号がついた3つのマスからなるマス目を持っています。\n * 各マスには 0 か 1 が書かれており、マスiにはs iが書かれています。\n *\n * すぬけ君は 1 が書かれたマスにビー玉を置きます。\n * ビー玉が置かれるマスがいくつあるか求めてください。\n *\n * # restrict\n * s1, s2, s3 は、'0', '1'\n *\n * # input\n * 入力は以下の形式で標準入力から与えられる。\n * s1s2s3\n *\n * #\n */\npublic class Main {\n public static void main(String[] args) {\n final Scanner s = new Scanner(System.in);\n\n String s1 = s.next();\n String s2 = s.next();\n String s3 = s.next();\n\n ArrayList list = new ArrayList();\n list.add(s1);\n list.add(s2);\n list.add(s3);\n\n int count = list.stream()\n .filter( str -> str.equals(\"1\"))\n .collect(Collectors.toList())\n .size();\n\n System.out.print(count);\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nSnuke has a grid consisting of three squares numbered 1, 2 and 3.\nIn each square, either 0 or 1 is written. The number written in Square i is s_i.\n\nSnuke will place a marble on each square that says 1.\nFind the number of squares on which Snuke will place a marble.\n\nConstraints\n\nEach of s_1, s_2 and s_3 is either 1 or 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns_{1}s_{2}s_{3}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n101\n\nSample Output 1\n\n2\n\nA marble will be placed on Square 1 and 3.\n\nSample Input 2\n\n000\n\nSample Output 2\n\n0\n\nNo marble will be placed on any square.", "sample_input": "101\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03493", "source_text": "Score : 100 points\n\nProblem Statement\n\nSnuke has a grid consisting of three squares numbered 1, 2 and 3.\nIn each square, either 0 or 1 is written. The number written in Square i is s_i.\n\nSnuke will place a marble on each square that says 1.\nFind the number of squares on which Snuke will place a marble.\n\nConstraints\n\nEach of s_1, s_2 and s_3 is either 1 or 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns_{1}s_{2}s_{3}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n101\n\nSample Output 1\n\n2\n\nA marble will be placed on Square 1 and 3.\n\nSample Input 2\n\n000\n\nSample Output 2\n\n0\n\nNo marble will be placed on any square.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1125, "cpu_time_ms": 93, "memory_kb": 21332}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s881468821", "group_id": "codeNet:p03493", "input_text": "\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\t//宣言文\n\t\t//標準入力オブジェクトを生成\n\t\tScanner sc = new Scanner(System.in);\n\t\t//標準入力で以下の変数を初期化\n\t\tint[] numArray = new int[3];\n\t\tnumArray[0] = sc.nextInt();\n\t\tnumArray[1] = sc.nextInt();\n\t\tnumArray[2] = sc.nextInt();\n\t\t//フラグ変数\n\t\tboolean numFlag = true;\n\t\tint countNum = 0;\n\n\t\t//処理文\n\t\tfor (int i = 0; i < numArray.length; i++) {\n\t\t\tif (!(numArray[i] == 0 || numArray[i] == 1)) {\n\t\t\t\t//制約 配列の中身が0か1なのか判定\n\t\t\t\tnumFlag = false;\n\t\t\t\tbreak;\n\t\t\t}else if(numArray[i] == 1){\n\t\t\t\t//1をカウントする。\n\t\t\t\tcountNum++;\n\t\t\t}\n\n\t\t}\n\n\t\tif(numFlag) {\n\t\t\t//標準出力\n\t\t\tSystem.out.print(countNum);\n\t\t}\n\t}\n}\n", "language": "Java", "metadata": {"date": 1588711002, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03493.html", "problem_id": "p03493", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03493/input.txt", "sample_output_relpath": "derived/input_output/data/p03493/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03493/Java/s881468821.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s881468821", "user_id": "u230865957"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\t//宣言文\n\t\t//標準入力オブジェクトを生成\n\t\tScanner sc = new Scanner(System.in);\n\t\t//標準入力で以下の変数を初期化\n\t\tint[] numArray = new int[3];\n\t\tnumArray[0] = sc.nextInt();\n\t\tnumArray[1] = sc.nextInt();\n\t\tnumArray[2] = sc.nextInt();\n\t\t//フラグ変数\n\t\tboolean numFlag = true;\n\t\tint countNum = 0;\n\n\t\t//処理文\n\t\tfor (int i = 0; i < numArray.length; i++) {\n\t\t\tif (!(numArray[i] == 0 || numArray[i] == 1)) {\n\t\t\t\t//制約 配列の中身が0か1なのか判定\n\t\t\t\tnumFlag = false;\n\t\t\t\tbreak;\n\t\t\t}else if(numArray[i] == 1){\n\t\t\t\t//1をカウントする。\n\t\t\t\tcountNum++;\n\t\t\t}\n\n\t\t}\n\n\t\tif(numFlag) {\n\t\t\t//標準出力\n\t\t\tSystem.out.print(countNum);\n\t\t}\n\t}\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nSnuke has a grid consisting of three squares numbered 1, 2 and 3.\nIn each square, either 0 or 1 is written. The number written in Square i is s_i.\n\nSnuke will place a marble on each square that says 1.\nFind the number of squares on which Snuke will place a marble.\n\nConstraints\n\nEach of s_1, s_2 and s_3 is either 1 or 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns_{1}s_{2}s_{3}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n101\n\nSample Output 1\n\n2\n\nA marble will be placed on Square 1 and 3.\n\nSample Input 2\n\n000\n\nSample Output 2\n\n0\n\nNo marble will be placed on any square.", "sample_input": "101\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03493", "source_text": "Score : 100 points\n\nProblem Statement\n\nSnuke has a grid consisting of three squares numbered 1, 2 and 3.\nIn each square, either 0 or 1 is written. The number written in Square i is s_i.\n\nSnuke will place a marble on each square that says 1.\nFind the number of squares on which Snuke will place a marble.\n\nConstraints\n\nEach of s_1, s_2 and s_3 is either 1 or 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns_{1}s_{2}s_{3}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n101\n\nSample Output 1\n\n2\n\nA marble will be placed on Square 1 and 3.\n\nSample Input 2\n\n000\n\nSample Output 2\n\n0\n\nNo marble will be placed on any square.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 784, "cpu_time_ms": 96, "memory_kb": 21460}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s238988896", "group_id": "codeNet:p03493", "input_text": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tchar[] s = sc.next().toCharArray();\n\t\tint count = 0;\n\t\tfor(int i = 0;i < 3;i++) {\n\t\t if(s[i] - '0' == 1) count++; \n\t\t}\n\n\t\tSystem.out.println(count);\n }\n\n}", "language": "Java", "metadata": {"date": 1588297307, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03493.html", "problem_id": "p03493", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03493/input.txt", "sample_output_relpath": "derived/input_output/data/p03493/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03493/Java/s238988896.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s238988896", "user_id": "u861445290"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tchar[] s = sc.next().toCharArray();\n\t\tint count = 0;\n\t\tfor(int i = 0;i < 3;i++) {\n\t\t if(s[i] - '0' == 1) count++; \n\t\t}\n\n\t\tSystem.out.println(count);\n }\n\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nSnuke has a grid consisting of three squares numbered 1, 2 and 3.\nIn each square, either 0 or 1 is written. The number written in Square i is s_i.\n\nSnuke will place a marble on each square that says 1.\nFind the number of squares on which Snuke will place a marble.\n\nConstraints\n\nEach of s_1, s_2 and s_3 is either 1 or 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns_{1}s_{2}s_{3}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n101\n\nSample Output 1\n\n2\n\nA marble will be placed on Square 1 and 3.\n\nSample Input 2\n\n000\n\nSample Output 2\n\n0\n\nNo marble will be placed on any square.", "sample_input": "101\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03493", "source_text": "Score : 100 points\n\nProblem Statement\n\nSnuke has a grid consisting of three squares numbered 1, 2 and 3.\nIn each square, either 0 or 1 is written. The number written in Square i is s_i.\n\nSnuke will place a marble on each square that says 1.\nFind the number of squares on which Snuke will place a marble.\n\nConstraints\n\nEach of s_1, s_2 and s_3 is either 1 or 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns_{1}s_{2}s_{3}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n101\n\nSample Output 1\n\n2\n\nA marble will be placed on Square 1 and 3.\n\nSample Input 2\n\n000\n\nSample Output 2\n\n0\n\nNo marble will be placed on any square.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 293, "cpu_time_ms": 91, "memory_kb": 23380}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s749812983", "group_id": "codeNet:p03493", "input_text": "import java.util.*;\n\nclass Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n s = s.replaceAll(\"0\",\"\");\n System.out.println(s.length());\n }\n}", "language": "Java", "metadata": {"date": 1586964075, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03493.html", "problem_id": "p03493", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03493/input.txt", "sample_output_relpath": "derived/input_output/data/p03493/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03493/Java/s749812983.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s749812983", "user_id": "u572345088"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.*;\n\nclass Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n s = s.replaceAll(\"0\",\"\");\n System.out.println(s.length());\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nSnuke has a grid consisting of three squares numbered 1, 2 and 3.\nIn each square, either 0 or 1 is written. The number written in Square i is s_i.\n\nSnuke will place a marble on each square that says 1.\nFind the number of squares on which Snuke will place a marble.\n\nConstraints\n\nEach of s_1, s_2 and s_3 is either 1 or 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns_{1}s_{2}s_{3}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n101\n\nSample Output 1\n\n2\n\nA marble will be placed on Square 1 and 3.\n\nSample Input 2\n\n000\n\nSample Output 2\n\n0\n\nNo marble will be placed on any square.", "sample_input": "101\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03493", "source_text": "Score : 100 points\n\nProblem Statement\n\nSnuke has a grid consisting of three squares numbered 1, 2 and 3.\nIn each square, either 0 or 1 is written. The number written in Square i is s_i.\n\nSnuke will place a marble on each square that says 1.\nFind the number of squares on which Snuke will place a marble.\n\nConstraints\n\nEach of s_1, s_2 and s_3 is either 1 or 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns_{1}s_{2}s_{3}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n101\n\nSample Output 1\n\n2\n\nA marble will be placed on Square 1 and 3.\n\nSample Input 2\n\n000\n\nSample Output 2\n\n0\n\nNo marble will be placed on any square.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 95, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s555789422", "group_id": "codeNet:p03493", "input_text": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n \n String s = sc.next();\n\n System.out.println(s.replace(\"0\",\"\").length());\n \n \n\t}\n}", "language": "Java", "metadata": {"date": 1579361480, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03493.html", "problem_id": "p03493", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03493/input.txt", "sample_output_relpath": "derived/input_output/data/p03493/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03493/Java/s555789422.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s555789422", "user_id": "u152058714"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n \n String s = sc.next();\n\n System.out.println(s.replace(\"0\",\"\").length());\n \n \n\t}\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nSnuke has a grid consisting of three squares numbered 1, 2 and 3.\nIn each square, either 0 or 1 is written. The number written in Square i is s_i.\n\nSnuke will place a marble on each square that says 1.\nFind the number of squares on which Snuke will place a marble.\n\nConstraints\n\nEach of s_1, s_2 and s_3 is either 1 or 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns_{1}s_{2}s_{3}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n101\n\nSample Output 1\n\n2\n\nA marble will be placed on Square 1 and 3.\n\nSample Input 2\n\n000\n\nSample Output 2\n\n0\n\nNo marble will be placed on any square.", "sample_input": "101\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03493", "source_text": "Score : 100 points\n\nProblem Statement\n\nSnuke has a grid consisting of three squares numbered 1, 2 and 3.\nIn each square, either 0 or 1 is written. The number written in Square i is s_i.\n\nSnuke will place a marble on each square that says 1.\nFind the number of squares on which Snuke will place a marble.\n\nConstraints\n\nEach of s_1, s_2 and s_3 is either 1 or 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns_{1}s_{2}s_{3}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n101\n\nSample Output 1\n\n2\n\nA marble will be placed on Square 1 and 3.\n\nSample Input 2\n\n000\n\nSample Output 2\n\n0\n\nNo marble will be placed on any square.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 107, "memory_kb": 21716}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s732158090", "group_id": "codeNet:p03493", "input_text": "import java.util.*;\n\npublic class Main{\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n \tString s = sc.next();\n s = s.replaceAll(\"0\",\"\");\n System.out.println(s.length());\n }\n}\n", "language": "Java", "metadata": {"date": 1562092088, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03493.html", "problem_id": "p03493", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03493/input.txt", "sample_output_relpath": "derived/input_output/data/p03493/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03493/Java/s732158090.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s732158090", "user_id": "u489585760"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main{\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n \tString s = sc.next();\n s = s.replaceAll(\"0\",\"\");\n System.out.println(s.length());\n }\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nSnuke has a grid consisting of three squares numbered 1, 2 and 3.\nIn each square, either 0 or 1 is written. The number written in Square i is s_i.\n\nSnuke will place a marble on each square that says 1.\nFind the number of squares on which Snuke will place a marble.\n\nConstraints\n\nEach of s_1, s_2 and s_3 is either 1 or 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns_{1}s_{2}s_{3}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n101\n\nSample Output 1\n\n2\n\nA marble will be placed on Square 1 and 3.\n\nSample Input 2\n\n000\n\nSample Output 2\n\n0\n\nNo marble will be placed on any square.", "sample_input": "101\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03493", "source_text": "Score : 100 points\n\nProblem Statement\n\nSnuke has a grid consisting of three squares numbered 1, 2 and 3.\nIn each square, either 0 or 1 is written. The number written in Square i is s_i.\n\nSnuke will place a marble on each square that says 1.\nFind the number of squares on which Snuke will place a marble.\n\nConstraints\n\nEach of s_1, s_2 and s_3 is either 1 or 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns_{1}s_{2}s_{3}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n101\n\nSample Output 1\n\n2\n\nA marble will be placed on Square 1 and 3.\n\nSample Input 2\n\n000\n\nSample Output 2\n\n0\n\nNo marble will be placed on any square.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 93, "memory_kb": 23252}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s488782907", "group_id": "codeNet:p03493", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tstatic Scanner sc = new Scanner(System.in);\n\n\tpublic static void main(String[] args) {\n\t\tint count = 0;\n\t\tString str = sc.next();\n\n\t\tfor (int i = 0; i < str.length(); i++) {\n\n\t\t\tif (str.charAt(i) == '1') {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}\n", "language": "Java", "metadata": {"date": 1556823764, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03493.html", "problem_id": "p03493", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03493/input.txt", "sample_output_relpath": "derived/input_output/data/p03493/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03493/Java/s488782907.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s488782907", "user_id": "u620269708"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tstatic Scanner sc = new Scanner(System.in);\n\n\tpublic static void main(String[] args) {\n\t\tint count = 0;\n\t\tString str = sc.next();\n\n\t\tfor (int i = 0; i < str.length(); i++) {\n\n\t\t\tif (str.charAt(i) == '1') {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nSnuke has a grid consisting of three squares numbered 1, 2 and 3.\nIn each square, either 0 or 1 is written. The number written in Square i is s_i.\n\nSnuke will place a marble on each square that says 1.\nFind the number of squares on which Snuke will place a marble.\n\nConstraints\n\nEach of s_1, s_2 and s_3 is either 1 or 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns_{1}s_{2}s_{3}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n101\n\nSample Output 1\n\n2\n\nA marble will be placed on Square 1 and 3.\n\nSample Input 2\n\n000\n\nSample Output 2\n\n0\n\nNo marble will be placed on any square.", "sample_input": "101\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03493", "source_text": "Score : 100 points\n\nProblem Statement\n\nSnuke has a grid consisting of three squares numbered 1, 2 and 3.\nIn each square, either 0 or 1 is written. The number written in Square i is s_i.\n\nSnuke will place a marble on each square that says 1.\nFind the number of squares on which Snuke will place a marble.\n\nConstraints\n\nEach of s_1, s_2 and s_3 is either 1 or 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns_{1}s_{2}s_{3}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n101\n\nSample Output 1\n\n2\n\nA marble will be placed on Square 1 and 3.\n\nSample Input 2\n\n000\n\nSample Output 2\n\n0\n\nNo marble will be placed on any square.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 90, "memory_kb": 21460}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s232990217", "group_id": "codeNet:p03493", "input_text": "import java.util.*;\npublic class Main{\n\tpublic static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n s = s.replaceAll(\"0\",\"\");\n System.out.println(s.length());\n }\n \n}", "language": "Java", "metadata": {"date": 1556378117, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03493.html", "problem_id": "p03493", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03493/input.txt", "sample_output_relpath": "derived/input_output/data/p03493/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03493/Java/s232990217.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s232990217", "user_id": "u024824950"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.*;\npublic class Main{\n\tpublic static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n s = s.replaceAll(\"0\",\"\");\n System.out.println(s.length());\n }\n \n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nSnuke has a grid consisting of three squares numbered 1, 2 and 3.\nIn each square, either 0 or 1 is written. The number written in Square i is s_i.\n\nSnuke will place a marble on each square that says 1.\nFind the number of squares on which Snuke will place a marble.\n\nConstraints\n\nEach of s_1, s_2 and s_3 is either 1 or 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns_{1}s_{2}s_{3}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n101\n\nSample Output 1\n\n2\n\nA marble will be placed on Square 1 and 3.\n\nSample Input 2\n\n000\n\nSample Output 2\n\n0\n\nNo marble will be placed on any square.", "sample_input": "101\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03493", "source_text": "Score : 100 points\n\nProblem Statement\n\nSnuke has a grid consisting of three squares numbered 1, 2 and 3.\nIn each square, either 0 or 1 is written. The number written in Square i is s_i.\n\nSnuke will place a marble on each square that says 1.\nFind the number of squares on which Snuke will place a marble.\n\nConstraints\n\nEach of s_1, s_2 and s_3 is either 1 or 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns_{1}s_{2}s_{3}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n101\n\nSample Output 1\n\n2\n\nA marble will be placed on Square 1 and 3.\n\nSample Input 2\n\n000\n\nSample Output 2\n\n0\n\nNo marble will be placed on any square.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 241, "cpu_time_ms": 92, "memory_kb": 23764}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s705394881", "group_id": "codeNet:p03493", "input_text": "import java.util.Scanner;\npublic class Main{\n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n String s = scan.next();\n String [] strArray = s.split(\"\");\n int sum = 0;\n\n for (int i = 0; i < strArray.length; i++) {\n sum = sum + Integer.parseInt(strArray[i]);\n }\n \n System.out.println(sum);\n\n }\n}", "language": "Java", "metadata": {"date": 1553697014, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03493.html", "problem_id": "p03493", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03493/input.txt", "sample_output_relpath": "derived/input_output/data/p03493/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03493/Java/s705394881.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s705394881", "user_id": "u035712734"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.Scanner;\npublic class Main{\n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n String s = scan.next();\n String [] strArray = s.split(\"\");\n int sum = 0;\n\n for (int i = 0; i < strArray.length; i++) {\n sum = sum + Integer.parseInt(strArray[i]);\n }\n \n System.out.println(sum);\n\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nSnuke has a grid consisting of three squares numbered 1, 2 and 3.\nIn each square, either 0 or 1 is written. The number written in Square i is s_i.\n\nSnuke will place a marble on each square that says 1.\nFind the number of squares on which Snuke will place a marble.\n\nConstraints\n\nEach of s_1, s_2 and s_3 is either 1 or 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns_{1}s_{2}s_{3}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n101\n\nSample Output 1\n\n2\n\nA marble will be placed on Square 1 and 3.\n\nSample Input 2\n\n000\n\nSample Output 2\n\n0\n\nNo marble will be placed on any square.", "sample_input": "101\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03493", "source_text": "Score : 100 points\n\nProblem Statement\n\nSnuke has a grid consisting of three squares numbered 1, 2 and 3.\nIn each square, either 0 or 1 is written. The number written in Square i is s_i.\n\nSnuke will place a marble on each square that says 1.\nFind the number of squares on which Snuke will place a marble.\n\nConstraints\n\nEach of s_1, s_2 and s_3 is either 1 or 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns_{1}s_{2}s_{3}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n101\n\nSample Output 1\n\n2\n\nA marble will be placed on Square 1 and 3.\n\nSample Input 2\n\n000\n\nSample Output 2\n\n0\n\nNo marble will be placed on any square.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 400, "cpu_time_ms": 91, "memory_kb": 22740}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s086201430", "group_id": "codeNet:p03493", "input_text": "import java.util.*;\n\npublic class Main{\n \n public static void main (String[] args){\n \n \tScanner scanner = new Scanner (System.in);\n \n \tString number = scanner.nextLine();\n \n \tint count = 0;\n \n \tfor (int i=0; i<3; i++){\n \t\tchar temp = number.charAt(i);\n \t\t\n \tif (temp == '1'){\n count++;\n }\n }\n System.out.println(count);\n }\n}", "language": "Java", "metadata": {"date": 1549493150, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03493.html", "problem_id": "p03493", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03493/input.txt", "sample_output_relpath": "derived/input_output/data/p03493/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03493/Java/s086201430.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s086201430", "user_id": "u505115437"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main{\n \n public static void main (String[] args){\n \n \tScanner scanner = new Scanner (System.in);\n \n \tString number = scanner.nextLine();\n \n \tint count = 0;\n \n \tfor (int i=0; i<3; i++){\n \t\tchar temp = number.charAt(i);\n \t\t\n \tif (temp == '1'){\n count++;\n }\n }\n System.out.println(count);\n }\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nSnuke has a grid consisting of three squares numbered 1, 2 and 3.\nIn each square, either 0 or 1 is written. The number written in Square i is s_i.\n\nSnuke will place a marble on each square that says 1.\nFind the number of squares on which Snuke will place a marble.\n\nConstraints\n\nEach of s_1, s_2 and s_3 is either 1 or 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns_{1}s_{2}s_{3}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n101\n\nSample Output 1\n\n2\n\nA marble will be placed on Square 1 and 3.\n\nSample Input 2\n\n000\n\nSample Output 2\n\n0\n\nNo marble will be placed on any square.", "sample_input": "101\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03493", "source_text": "Score : 100 points\n\nProblem Statement\n\nSnuke has a grid consisting of three squares numbered 1, 2 and 3.\nIn each square, either 0 or 1 is written. The number written in Square i is s_i.\n\nSnuke will place a marble on each square that says 1.\nFind the number of squares on which Snuke will place a marble.\n\nConstraints\n\nEach of s_1, s_2 and s_3 is either 1 or 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns_{1}s_{2}s_{3}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n101\n\nSample Output 1\n\n2\n\nA marble will be placed on Square 1 and 3.\n\nSample Input 2\n\n000\n\nSample Output 2\n\n0\n\nNo marble will be placed on any square.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 367, "cpu_time_ms": 112, "memory_kb": 22100}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s764870351", "group_id": "codeNet:p03493", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString str = sc.next();\n\t\tint n = 0;\n\n\t\tfor(int i = 0;i < 3; i++) {\n\t\t\tif(str.charAt(i) == '1') {\n\t\t\t\tn += 1;\n\t\t\t}else {\n\t\t\t\tn += 0;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(n);\n\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1524848654, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03493.html", "problem_id": "p03493", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03493/input.txt", "sample_output_relpath": "derived/input_output/data/p03493/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03493/Java/s764870351.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s764870351", "user_id": "u725133562"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString str = sc.next();\n\t\tint n = 0;\n\n\t\tfor(int i = 0;i < 3; i++) {\n\t\t\tif(str.charAt(i) == '1') {\n\t\t\t\tn += 1;\n\t\t\t}else {\n\t\t\t\tn += 0;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(n);\n\n\t}\n\n}\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nSnuke has a grid consisting of three squares numbered 1, 2 and 3.\nIn each square, either 0 or 1 is written. The number written in Square i is s_i.\n\nSnuke will place a marble on each square that says 1.\nFind the number of squares on which Snuke will place a marble.\n\nConstraints\n\nEach of s_1, s_2 and s_3 is either 1 or 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns_{1}s_{2}s_{3}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n101\n\nSample Output 1\n\n2\n\nA marble will be placed on Square 1 and 3.\n\nSample Input 2\n\n000\n\nSample Output 2\n\n0\n\nNo marble will be placed on any square.", "sample_input": "101\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03493", "source_text": "Score : 100 points\n\nProblem Statement\n\nSnuke has a grid consisting of three squares numbered 1, 2 and 3.\nIn each square, either 0 or 1 is written. The number written in Square i is s_i.\n\nSnuke will place a marble on each square that says 1.\nFind the number of squares on which Snuke will place a marble.\n\nConstraints\n\nEach of s_1, s_2 and s_3 is either 1 or 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns_{1}s_{2}s_{3}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n101\n\nSample Output 1\n\n2\n\nA marble will be placed on Square 1 and 3.\n\nSample Input 2\n\n000\n\nSample Output 2\n\n0\n\nNo marble will be placed on any square.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 94, "memory_kb": 21332}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s286967926", "group_id": "codeNet:p03493", "input_text": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\t// // 整数の入力\n\t\t// int a = sc.nextInt();\n\t\t// // スペース区切りの整数の入力\n\t\t// int b = sc.nextInt();\n\t\t// int c = sc.nextInt();\n\t\t// // 文字列の入力\n\t\t// String s = sc.next();\n\t\t// // 出力\n // System.out.println((a+b+c) + \" \" + s);\n String s = sc.next();\n int ans = 0;\n for (char c : s.toCharArray()) {\n if (c == '1') ans++;\n }\n System.out.println(ans);\n\t}\n}", "language": "Java", "metadata": {"date": 1520268820, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03493.html", "problem_id": "p03493", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03493/input.txt", "sample_output_relpath": "derived/input_output/data/p03493/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03493/Java/s286967926.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s286967926", "user_id": "u903215911"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\t// // 整数の入力\n\t\t// int a = sc.nextInt();\n\t\t// // スペース区切りの整数の入力\n\t\t// int b = sc.nextInt();\n\t\t// int c = sc.nextInt();\n\t\t// // 文字列の入力\n\t\t// String s = sc.next();\n\t\t// // 出力\n // System.out.println((a+b+c) + \" \" + s);\n String s = sc.next();\n int ans = 0;\n for (char c : s.toCharArray()) {\n if (c == '1') ans++;\n }\n System.out.println(ans);\n\t}\n}", "problem_context": "Score : 100 points\n\nProblem Statement\n\nSnuke has a grid consisting of three squares numbered 1, 2 and 3.\nIn each square, either 0 or 1 is written. The number written in Square i is s_i.\n\nSnuke will place a marble on each square that says 1.\nFind the number of squares on which Snuke will place a marble.\n\nConstraints\n\nEach of s_1, s_2 and s_3 is either 1 or 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns_{1}s_{2}s_{3}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n101\n\nSample Output 1\n\n2\n\nA marble will be placed on Square 1 and 3.\n\nSample Input 2\n\n000\n\nSample Output 2\n\n0\n\nNo marble will be placed on any square.", "sample_input": "101\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03493", "source_text": "Score : 100 points\n\nProblem Statement\n\nSnuke has a grid consisting of three squares numbered 1, 2 and 3.\nIn each square, either 0 or 1 is written. The number written in Square i is s_i.\n\nSnuke will place a marble on each square that says 1.\nFind the number of squares on which Snuke will place a marble.\n\nConstraints\n\nEach of s_1, s_2 and s_3 is either 1 or 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns_{1}s_{2}s_{3}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n101\n\nSample Output 1\n\n2\n\nA marble will be placed on Square 1 and 3.\n\nSample Input 2\n\n000\n\nSample Output 2\n\n0\n\nNo marble will be placed on any square.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 534, "cpu_time_ms": 93, "memory_kb": 21588}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s093015668", "group_id": "codeNet:p03493", "input_text": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.Arrays;\npublic class Main {\n\n\tpublic static void main(String[] args)throws IOException {\n\t\t// TODO Auto-generated method stub\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tString line = br.readLine();\n\t\tint count=0;\n\t\tfor(int i=0;i map = new HashMap(N);\n\t\t/*for ( キーのデータ型 key : マップの名前.keySet() ) {\n\t\t\tデータのデータ型 data = マップの名前.get( key );\n\n\t\t\t// keyやdataを使った処理;\n\t\t}*/\n\t\t//int i = Integer.parseInt(s);\n\t\t//Queue qq=new ArrayDeque<>(); //add,poll,peek BFSは前から実行される\n\t\t//Deque dd=new ArrayDeque<>();//push後ろに入れる,poll(pop)後ろからとる,peek addは先頭に入るからバグ注意\n\t\t//stackdfsは後ろから実行される\n\t\t//ArrayList cc = new ArrayList<>(N);\n\t\t//cc.contains(tmp)\n\t\t//Arrays.asList(c).contains(\"a\")\n\t\t//list.set(1,\"walk\");//1 1 2 3 5\n\t\t//PriorityQueue r=new PriorityQueue();//add poll\n\n\t\tprivate static int INF =1000000007;\n\n\n\n\t\tprivate static class D{\n\t\t\n\t\t\tArrayList X=new ArrayList<>();\n\t\t\tArrayList Y=new ArrayList<>();\n\t\t\tint t=0;\n\t\t\tint index=0;\n\t\t\tD(ArrayList X,ArrayList Y,int t,int index){\n\t\t\t\tthis.X=X;;\n\t\t\t\tthis.Y=Y;\n\t\t\t\tthis.t=t;\n\t\t\t\tthis.index=index;\n\t\t\t}\n\n\t\t}\n\n\n\n\t//Set a=new HashSet();\n\t\n\t\n\t\n\t//Integer.toBinaryString(i);\n\t//Integer.toString(i, 2);\n//\t//Integer.parseInt(bin, 2);\n\t//bitset\n\tprivate static int mod=1000000007;\n\tprivate static int slover() {\n\t\tStringBuffer S = new StringBuffer(sc.next());\n\t\tStringBuffer T = new StringBuffer(sc.next());\n\t\t\n\t\tint v=S.length()-1;\n\t\t\n\t\t\n\t\ta:for(int i=v;i>=T.length()-1;i--) {\n\t\t\t\n\t\t\t\n\t\t\tfor(int t=0;t divisors2(long t) {\n\t\tArrayList c=new ArrayList<>();\n\t\tfor(long i=2;i*i<=t;i++) {\n\t\t\t\n\t\t\t\n\t\t\tif(t%i==0) {\n\t\t\t\tp(t+\" \"+i);\n\t\t\t\tc.add((long)i);\n\t\t\t\tt/=i;\n\t\t\t\ti--;\n\t\t\t}\n\t\t}\n\t\tif(t!=1)c.add(t);\n\t\tCollections.sort(c);\n\t\t\n\t\treturn c;\n\t}\n\t\n\t\n\tprivate static long modPow(int i,int t,long mod) {\n\t\t//iのt乗をO(log t)で返す\n\t\tlong a=i;\n\t\tlong res=1;\n\t\twhile(t!=0) {\n\t\t\t//p(t);\n\t\t\tif((1&t)==1) {\n\t\t\t\tres=res*a%mod;\n\t\t\t}\n\t\t\ta=a*a%mod;\n\t\t\tt=t>>1;\n\t\t}\n\t\treturn res;\n\t}\n\n\tpublic static long gcd(long num1,long num2) {\n if(num2==0) return num1;\n else return gcd(num2,num1%num2);\n }\n\tpublic static long lcm(long num1,long num2) {\n\t\treturn num1*num2/gcd(num1,num2);\n\t}\n\t//O(N^0.5)\n\tprivate static boolean isPrime(long t) {\n\t\tif(t<2)return false;\n\t\tfor(int i=2;i*i<=t;i++) {\n\t\t\tif(t%i==0)return false;\n\t\t}\n\t\treturn true;\n\t}\n\tprivate static ArrayList divisors(long t) {\n\t\tArrayList c=new ArrayList<>();\n\t\tfor(int i=1;i*i<=t;i++) {\n\t\t\tif(t%i==0) {\n\t\t\t\tif(i*i!=t) {\n\t\t\t\t\tc.add(t/i);\n\t\t\t\t}\n\t\t\t\tc.add((long)i);\n\t\t\t}\n\t\t}\n\t\treturn c;\n\t}\n\tprivate static void bubunwa() {\n\t\tint N=sc.nextInt();\n\t\tint K=sc.nextInt();\n\t\tint a[]=sc.nextIntArray(N, false);\n\n\t\tboolean dp[] =new boolean[K+1];\n\n\t\tArrays.fill(dp, false);\n\t\tdp[0]=true;\n\t\tfor(int i=0;i=0;x--) {\n\t\t\t\tif(dp[x])dp[x+a[i]]=true;\n\t\t\t}\n\t\t}\n\n\t\tp(dp[K] ? \"Yes\":\"No\");\n\t}\n\t\n\tprivate static String bitToString(int i) {\n\t\t\n\t\t\tString T=\"\";\n\t\t\tfor(int j=0;j<2;j++) {\n\t\t\t\t//if(i>>j==0)break;\n\t\t\t\tif((1&i>>j)==1) {\n\t\t\t\t\tT+=\"1\";\n\t\t\t\t}else T+=\"0\";\n\t\t\t}\n\t\t\treturn (i+\" \"+T);\n\n\t\t\n\n\t}\n/*********************************************************************/\n\t//target以下までの値のindexを返す\n\t//target以上が欲しいときは返り値+1すればいい\n\t//0-indexで個数を求めるときはさらにindex+1する必要あり\n\tprivate static int lower_bound(long a[],long target) {\n\t//p(target+ \" \"+Arrays.toString(a));\n\tif(a[0]>target)return -1;\n\t//最後の値がtarget以下であるときは最後のindexを返す。\n\t//target以上が欲しいときは注意する必要あり\n\tif(a[a.length-1]<=target) return a.length-1;\n\n\tint S=-1;\n\tint E=a.length;\n\n\twhile(Starget) {\n\t\t\treturn G;\n\n\t\t}else if(a[G]<=target){\n\t\t\tS=G;\n\t\t}else if(a[G]>target) {\n\t\t\tE=G;\n\t\t}\n\n\t}\n\n\n\treturn -1;\n\t}\n\tstatic String nextPermutation(String s) {\n\t\tArrayList list=new ArrayList<>();\n\t\tfor(int i=0;i=0;i--) {\n\t\t\tif(list.get(i)=L;i--) {\n\t\t\tif(pivot map = new HashMap(N);\n\t\t/*for ( キーのデータ型 key : マップの名前.keySet() ) {\n\t\t\tデータのデータ型 data = マップの名前.get( key );\n\n\t\t\t// keyやdataを使った処理;\n\t\t}*/\n\t\t//int i = Integer.parseInt(s);\n\t\t//Queue qq=new ArrayDeque<>(); //add,poll,peek BFSは前から実行される\n\t\t//Deque dd=new ArrayDeque<>();//push後ろに入れる,poll(pop)後ろからとる,peek addは先頭に入るからバグ注意\n\t\t//stackdfsは後ろから実行される\n\t\t//ArrayList cc = new ArrayList<>(N);\n\t\t//cc.contains(tmp)\n\t\t//Arrays.asList(c).contains(\"a\")\n\t\t//list.set(1,\"walk\");//1 1 2 3 5\n\t\t//PriorityQueue r=new PriorityQueue();//add poll\n\n\t\tprivate static int INF =1000000007;\n\n\n\n\t\tprivate static class D{\n\t\t\n\t\t\tArrayList X=new ArrayList<>();\n\t\t\tArrayList Y=new ArrayList<>();\n\t\t\tint t=0;\n\t\t\tint index=0;\n\t\t\tD(ArrayList X,ArrayList Y,int t,int index){\n\t\t\t\tthis.X=X;;\n\t\t\t\tthis.Y=Y;\n\t\t\t\tthis.t=t;\n\t\t\t\tthis.index=index;\n\t\t\t}\n\n\t\t}\n\n\n\n\t//Set a=new HashSet();\n\t\n\t\n\t\n\t//Integer.toBinaryString(i);\n\t//Integer.toString(i, 2);\n//\t//Integer.parseInt(bin, 2);\n\t//bitset\n\tprivate static int mod=1000000007;\n\tprivate static int slover() {\n\t\tStringBuffer S = new StringBuffer(sc.next());\n\t\tStringBuffer T = new StringBuffer(sc.next());\n\t\t\n\t\tint v=S.length()-1;\n\t\t\n\t\t\n\t\ta:for(int i=v;i>=T.length()-1;i--) {\n\t\t\t\n\t\t\t\n\t\t\tfor(int t=0;t divisors2(long t) {\n\t\tArrayList c=new ArrayList<>();\n\t\tfor(long i=2;i*i<=t;i++) {\n\t\t\t\n\t\t\t\n\t\t\tif(t%i==0) {\n\t\t\t\tp(t+\" \"+i);\n\t\t\t\tc.add((long)i);\n\t\t\t\tt/=i;\n\t\t\t\ti--;\n\t\t\t}\n\t\t}\n\t\tif(t!=1)c.add(t);\n\t\tCollections.sort(c);\n\t\t\n\t\treturn c;\n\t}\n\t\n\t\n\tprivate static long modPow(int i,int t,long mod) {\n\t\t//iのt乗をO(log t)で返す\n\t\tlong a=i;\n\t\tlong res=1;\n\t\twhile(t!=0) {\n\t\t\t//p(t);\n\t\t\tif((1&t)==1) {\n\t\t\t\tres=res*a%mod;\n\t\t\t}\n\t\t\ta=a*a%mod;\n\t\t\tt=t>>1;\n\t\t}\n\t\treturn res;\n\t}\n\n\tpublic static long gcd(long num1,long num2) {\n if(num2==0) return num1;\n else return gcd(num2,num1%num2);\n }\n\tpublic static long lcm(long num1,long num2) {\n\t\treturn num1*num2/gcd(num1,num2);\n\t}\n\t//O(N^0.5)\n\tprivate static boolean isPrime(long t) {\n\t\tif(t<2)return false;\n\t\tfor(int i=2;i*i<=t;i++) {\n\t\t\tif(t%i==0)return false;\n\t\t}\n\t\treturn true;\n\t}\n\tprivate static ArrayList divisors(long t) {\n\t\tArrayList c=new ArrayList<>();\n\t\tfor(int i=1;i*i<=t;i++) {\n\t\t\tif(t%i==0) {\n\t\t\t\tif(i*i!=t) {\n\t\t\t\t\tc.add(t/i);\n\t\t\t\t}\n\t\t\t\tc.add((long)i);\n\t\t\t}\n\t\t}\n\t\treturn c;\n\t}\n\tprivate static void bubunwa() {\n\t\tint N=sc.nextInt();\n\t\tint K=sc.nextInt();\n\t\tint a[]=sc.nextIntArray(N, false);\n\n\t\tboolean dp[] =new boolean[K+1];\n\n\t\tArrays.fill(dp, false);\n\t\tdp[0]=true;\n\t\tfor(int i=0;i=0;x--) {\n\t\t\t\tif(dp[x])dp[x+a[i]]=true;\n\t\t\t}\n\t\t}\n\n\t\tp(dp[K] ? \"Yes\":\"No\");\n\t}\n\t\n\tprivate static String bitToString(int i) {\n\t\t\n\t\t\tString T=\"\";\n\t\t\tfor(int j=0;j<2;j++) {\n\t\t\t\t//if(i>>j==0)break;\n\t\t\t\tif((1&i>>j)==1) {\n\t\t\t\t\tT+=\"1\";\n\t\t\t\t}else T+=\"0\";\n\t\t\t}\n\t\t\treturn (i+\" \"+T);\n\n\t\t\n\n\t}\n/*********************************************************************/\n\t//target以下までの値のindexを返す\n\t//target以上が欲しいときは返り値+1すればいい\n\t//0-indexで個数を求めるときはさらにindex+1する必要あり\n\tprivate static int lower_bound(long a[],long target) {\n\t//p(target+ \" \"+Arrays.toString(a));\n\tif(a[0]>target)return -1;\n\t//最後の値がtarget以下であるときは最後のindexを返す。\n\t//target以上が欲しいときは注意する必要あり\n\tif(a[a.length-1]<=target) return a.length-1;\n\n\tint S=-1;\n\tint E=a.length;\n\n\twhile(Starget) {\n\t\t\treturn G;\n\n\t\t}else if(a[G]<=target){\n\t\t\tS=G;\n\t\t}else if(a[G]>target) {\n\t\t\tE=G;\n\t\t}\n\n\t}\n\n\n\treturn -1;\n\t}\n\tstatic String nextPermutation(String s) {\n\t\tArrayList list=new ArrayList<>();\n\t\tfor(int i=0;i=0;i--) {\n\t\t\tif(list.get(i)=L;i--) {\n\t\t\tif(pivot= 0; i--) {\n\t\t boolean flag = true;\n\t\t for (int j = 0; j < test.length; j++) {\n\t\t if (base[i + j] != test[j] && base[i + j] != '?') {\n\t\t flag = false;\n\t\t break;\n\t\t }\n\t\t }\n\t\t if (flag) {\n\t\t for (int j = 0; j < test.length; j++) {\n\t\t base[i + j] = test[j];\n\t\t }\n \t\t for (int j = 0; j < base.length; j++) {\n \t\t if (base[j] == '?') {\n \t\t base[j] = 'a';\n \t\t }\n \t\t }\n \t\t System.out.println(base);\n \t\t return;\n\t\t }\n\t\t}\n\t\tSystem.out.println(\"UNRESTORABLE\");\n }\n}\n\n", "language": "Java", "metadata": {"date": 1587061811, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03565.html", "problem_id": "p03565", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03565/input.txt", "sample_output_relpath": "derived/input_output/data/p03565/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03565/Java/s171214807.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s171214807", "user_id": "u575909439"}, "prompt_components": {"gold_output": "atcoder\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n\tpublic static void main (String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tchar[] base = sc.next().toCharArray();\n\t\tchar[] test = sc.next().toCharArray();\n\t\tfor (int i = base.length - test.length; i >= 0; i--) {\n\t\t boolean flag = true;\n\t\t for (int j = 0; j < test.length; j++) {\n\t\t if (base[i + j] != test[j] && base[i + j] != '?') {\n\t\t flag = false;\n\t\t break;\n\t\t }\n\t\t }\n\t\t if (flag) {\n\t\t for (int j = 0; j < test.length; j++) {\n\t\t base[i + j] = test[j];\n\t\t }\n \t\t for (int j = 0; j < base.length; j++) {\n \t\t if (base[j] == '?') {\n \t\t base[j] = 'a';\n \t\t }\n \t\t }\n \t\t System.out.println(base);\n \t\t return;\n\t\t }\n\t\t}\n\t\tSystem.out.println(\"UNRESTORABLE\");\n }\n}\n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nE869120 found a chest which is likely to contain treasure.\n\nHowever, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters.\n\nHe also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with ?.\n\nOne more thing he found is a sheet of paper with the following facts written on it:\n\nCondition 1: The string S contains a string T as a contiguous substring.\n\nCondition 2: S is the lexicographically smallest string among the ones that satisfy Condition 1.\n\nPrint the string S.\n\nIf such a string does not exist, print UNRESTORABLE.\n\nConstraints\n\n1 \\leq |S'|, |T| \\leq 50\n\nS' consists of lowercase English letters and ?.\n\nT consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT'\n\nOutput\n\nPrint the string S.\n\nIf such a string does not exist, print UNRESTORABLE instead.\n\nSample Input 1\n\n?tc????\ncoder\n\nSample Output 1\n\natcoder\n\nThere are 26 strings that satisfy Condition 1: atcoder, btcoder, ctcoder,..., ztcoder.\nAmong them, the lexicographically smallest is atcoder, so we can say S = atcoder.\n\nSample Input 2\n\n??p??d??\nabc\n\nSample Output 2\n\nUNRESTORABLE\n\nThere is no string that satisfies Condition 1, so the string S does not exist.", "sample_input": "?tc????\ncoder\n"}, "reference_outputs": ["atcoder\n"], "source_document_id": "p03565", "source_text": "Score : 300 points\n\nProblem Statement\n\nE869120 found a chest which is likely to contain treasure.\n\nHowever, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters.\n\nHe also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with ?.\n\nOne more thing he found is a sheet of paper with the following facts written on it:\n\nCondition 1: The string S contains a string T as a contiguous substring.\n\nCondition 2: S is the lexicographically smallest string among the ones that satisfy Condition 1.\n\nPrint the string S.\n\nIf such a string does not exist, print UNRESTORABLE.\n\nConstraints\n\n1 \\leq |S'|, |T| \\leq 50\n\nS' consists of lowercase English letters and ?.\n\nT consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT'\n\nOutput\n\nPrint the string S.\n\nIf such a string does not exist, print UNRESTORABLE instead.\n\nSample Input 1\n\n?tc????\ncoder\n\nSample Output 1\n\natcoder\n\nThere are 26 strings that satisfy Condition 1: atcoder, btcoder, ctcoder,..., ztcoder.\nAmong them, the lexicographically smallest is atcoder, so we can say S = atcoder.\n\nSample Input 2\n\n??p??d??\nabc\n\nSample Output 2\n\nUNRESTORABLE\n\nThere is no string that satisfies Condition 1, so the string S does not exist.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 843, "cpu_time_ms": 93, "memory_kb": 23124}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s984154227", "group_id": "codeNet:p03565", "input_text": "\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.math.BigInteger;\nimport java.util.*;\nimport java.util.stream.Collectors;\nimport java.util.stream.IntStream;\nimport java.util.stream.Stream;\n\npublic class Main {\n\n public static void main(String[] args) throws IOException {\n new Main().solve();\n }\n\n private void solve() throws IOException {\n try {\n// solveA();\n// solveB();\n// solveC();\n solveD();\n// solveE();\n// solveF();\n } finally {\n if (in != null) {\n in.close();\n }\n if (out != null) {\n out.flush();\n out.close();\n }\n }\n\n }\n\n // mods\n long MOD = (long) Math.pow(10, 9) + 7;\n\n private void solveA() {\n long a = nextLong();\n long b = nextLong();\n int k = nextInt();\n for (int i = 0; i < k; i++) {\n if (i % 2 == 0) {\n if (a % 2 == 1) {\n a -= 1;\n }\n b += (a / 2);\n a /= 2;\n } else {\n if (b % 2 == 1) {\n b -= 1;\n }\n a += (b / 2);\n b /= 2;\n }\n }\n out.println(a + \" \" + b);\n }\n\n private void solveB() {\n String s = next();\n if (s.length() == 2) {\n out.println(0);\n return;\n }\n s = s.substring(0, s.length() - 1);\n int res = 0;\n int length = s.length() / 2;\n for (int i = 0; i < length; i++) {\n int m = i + 1;\n String fr = s.substring(0, m);\n String bk = s.substring(m, m + m);\n if (fr.equals(bk)) {\n res = Math.max(res, fr.length() + bk.length());\n }\n }\n out.println(res);\n }\n\n private void solveC() {\n int n = nextInt();\n Integer[] a = IntStream.range(0, n).mapToObj(i -> nextInt()).sorted().toArray(Integer[]::new);\n Map am = Arrays.stream(a).collect(Collectors.groupingBy(i -> i, Collectors.counting()));\n long h = 0;\n long w = 0;\n for (int i = a.length - 1; i >= 0; i--) {\n int val = a[i];\n if (am.getOrDefault(val, 0L) < 2)\n continue;\n\n if (h == 0) {\n h = val;\n } else if (w == 0) {\n w = val;\n }\n am.put(val, am.get(val) - 2);\n }\n out.print(h * w);\n }\n\n private void solveD() {\n String s = next();\n String t = next();\n if (s.length() < t.length()) {\n out.println(\"UNRESTORABLE\");\n return;\n }\n List res = new ArrayList();\n for (int i = 0; i < s.length(); i++) {\n\n boolean isMatch = true;\n for (int j = 0, idx = i; j < t.length() && idx < s.length(); j++, idx++) {\n if (s.charAt(idx) != '?' && s.charAt(idx) != t.charAt(j)) {\n isMatch = false;\n break;\n }\n }\n if (isMatch) {\n StringBuilder builder = new StringBuilder();\n\n for (int j = 0; j < s.length(); j++) {\n if (j >= i && j < i + t.length()) {\n builder.append(t.charAt(j - i));\n } else {\n builder.append(s.charAt(j) == '?' ? \"a\" : s.charAt(j));\n }\n }\n res.add(builder.toString());\n }\n }\n Collections.sort(res);\n if (res.size() == 0)\n out.println(\"UNRESTORABLE\");\n else\n out.println(res.get(0));\n }\n\n private void solveE() {\n int n = nextInt();\n int m = nextInt();\n int[] p = IntStream.range(0, n).map(i -> nextInt()).toArray();\n\n int[][] xy = Stream.generate(() -> new int[]{nextInt(), nextInt()}).limit(m).toArray(int[][]::new);\n UnionFind unionFind = new UnionFind(n);\n for (int[] l : xy) {\n unionFind.unite(p[l[0] - 1], p[l[1] - 1]);\n }\n int res = 0;\n for (int i = 1; i <= n; i++) {\n if (unionFind.isSame(i, p[i - 1]))\n res++;\n }\n out.println(res);\n }\n\n private void solveF() {\n\n }\n\n private static class GraphNode {\n private int n;\n private List childs;\n\n public GraphNode(int n) {\n this.n = n;\n childs = new ArrayList();\n }\n\n public void addChild(int child) {\n this.childs.add(child);\n }\n }\n\n private static class Graph {\n\n private Map graph;\n\n public Graph(int[][] list) {\n graph = new HashMap();\n Arrays.stream(list).forEach(l -> {\n int a = l[0];\n int b = l[1];\n graph.put(a, graph.getOrDefault(a, new GraphNode(a)));\n graph.get(a).addChild(b);\n graph.put(b, graph.getOrDefault(b, new GraphNode(b)));\n graph.get(b).addChild(a);\n });\n }\n\n }\n\n private static class SegTree {\n long e = 0;\n\n long calcFunc(long a, long b) {\n return a + b;\n }\n\n int n;\n long nodes[];\n\n public SegTree(long[] a) {\n init(a);\n }\n\n public SegTree(int len, long x) {\n long a[] = new long[len];\n Arrays.fill(a, x);\n init(a);\n }\n\n public SegTree(int len) {\n init(len);\n }\n\n void init(long[] a) {\n init(a.length);\n for (int i = 0; i < a.length; i++) {\n nodes[i + n - 1] = a[i];\n }\n for (int i = n - 2; i >= 0; i--) {\n nodes[i] = calcFunc(nodes[i * 2 + 1], nodes[i * 2 + 2]);\n }\n }\n\n void init(int len) {\n n = 1;\n while (n < len) {\n n *= 2;\n }\n nodes = new long[n * 2 - 1];\n Arrays.fill(nodes, e);\n for (int i = n - 2; i >= 0; i--) {\n nodes[i] = calcFunc(nodes[i * 2 + 1], nodes[i * 2 + 2]);\n }\n }\n\n void set(final int i, long val) {\n int wkI = i + n - 1;\n nodes[wkI] = val;\n while (wkI > 0) {\n wkI = (wkI - 1) / 2;\n nodes[wkI] = calcFunc(nodes[wkI * 2 + 1], nodes[wkI * 2 + 2]);\n }\n }\n\n long get(int i) {\n return find(i, i + 1);\n }\n\n /*\n 要求区間 [a, b) 中の要素の最小値を答える\n k := 自分がいるノードのインデックス\n 対象区間は [l, r) にあたる\n */\n long find(int a, int b) {\n return find(a, b, 0, 0, n);\n }\n\n long find(int a, int b, int k, int l, int r) {\n if (r < 0)\n r = n;\n\n if (b <= l || r <= a)\n return e;\n\n if (a <= l && r <= b)\n return nodes[k];\n\n long val1 = find(a, b, k * 2 + 1, l, (l + r) / 2);\n long val2 = find(a, b, k * 2 + 2, (l + r) / 2, r);\n //Math.min()\n //今回は区間内の個数なのでSUM\n return val1 + val2;\n }\n }\n\n private static class UnionFind {\n int[] pars;\n\n public UnionFind(int n) {\n pars = new int[n + 1];\n Arrays.fill(pars, -1);\n }\n\n public int getChilds(int n) {\n int wk = getRoot(n);\n return pars[wk];\n }\n\n public int getRoot(int n) {\n if (pars[n] < 0)\n return n;\n return pars[n] = getRoot(pars[n]);\n }\n\n public boolean isSame(int a, int b) {\n return getRoot(a) == getRoot(b);\n }\n\n private int getSize(int a) {\n return -pars[getRoot(a)];\n }\n\n public void unite(int a, int b) {\n int wkA = getRoot(a);\n int wkB = getRoot(b);\n if (wkA == wkB)\n return;\n\n if (getSize(wkA) < getSize(wkB)) {\n int tmp = wkA;\n wkA = wkB;\n wkB = tmp;\n }\n pars[wkA] = pars[wkA] + pars[wkB];\n pars[wkB] = wkA;\n }\n }\n\n public long calcSimpleCombination(long n, long m, long CONST_MOD) {\n long mole = 1;\n for (long i = 1; i <= n + m; i++) {\n mole *= i;\n mole %= CONST_MOD;\n }\n long deno = 1;\n for (long i = 1; i <= n; i++) {\n deno *= i;\n deno %= CONST_MOD;\n }\n for (int i = 1; i <= m; i++) {\n deno *= i;\n deno %= CONST_MOD;\n }\n deno = modInverse(deno, CONST_MOD);\n return (mole * deno) % CONST_MOD;\n }\n\n long abs(double x) {\n return (long) Math.abs(x);\n }\n\n long round(double x) {\n return Math.round(x);\n }\n\n long floor(double x) {\n return (long) Math.floor(x);\n }\n\n long ceil(double x) {\n return (long) Math.ceil(x);\n }\n\n double sqrt(double x) {\n return Math.sqrt(x);\n }\n\n double pow(double x, double y) {\n return Math.pow(x, y);\n }\n\n long pow(long x, long y) {\n return (long) Math.pow(x, y);\n }\n\n int gcd(int a, int b) {\n return b == 0 ? a : gcd(b, a % b);\n }\n\n long gcd(long a, long b) {\n return b == 0 ? a : gcd(b, a % b);\n }\n\n long lcm(long a, long b) {\n return a * b / gcd(a, b);\n }\n\n int upperToInt(char a) {\n return a - 'A';\n }\n\n int lowerToInt(char a) {\n return a - 'a';\n }\n\n int numToInt(char a) {\n return a - '0';\n }\n\n int charToInt(char a) {\n return a >= 'a' ? lowerToInt(a) : a >= 'A' ? upperToInt(a) : numToInt(a);\n }\n\n char intToUpper(int a) {\n return (char) (a + 'A');\n }\n\n char intToLower(int a) {\n return (char) (a + 'a');\n }\n\n char intToNum(int a) {\n return (char) (a + '0');\n }\n\n void reverse(String array[]) {\n String reversed[] = new String[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void reverse(int array[]) {\n int reversed[] = new int[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void reverse(long array[]) {\n long reversed[] = new long[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void reverse(double array[]) {\n double reversed[] = new double[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void reverse(boolean array[]) {\n boolean reversed[] = new boolean[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void fill(int array[], int x) {\n Arrays.fill(array, x);\n }\n\n void fill(long array[], long x) {\n Arrays.fill(array, x);\n }\n\n void fill(double array[], double x) {\n Arrays.fill(array, x);\n }\n\n void fill(boolean array[], boolean x) {\n Arrays.fill(array, x);\n }\n\n void fill(int array[][], int x) {\n for (int a[] : array) {\n fill(a, x);\n }\n }\n\n void fill(long array[][], long x) {\n for (long a[] : array) {\n fill(a, x);\n }\n }\n\n void fill(double array[][], double x) {\n for (double a[] : array) {\n fill(a, x);\n }\n }\n\n void fill(boolean array[][], boolean x) {\n for (boolean a[] : array) {\n fill(a, x);\n }\n }\n\n void fill(int array[][][], int x) {\n for (int a[][] : array) {\n fill(a, x);\n }\n }\n\n void fill(long array[][][], long x) {\n for (long a[][] : array) {\n fill(a, x);\n }\n }\n\n void fill(double array[][][], double x) {\n for (double a[][] : array) {\n fill(a, x);\n }\n }\n\n void fill(boolean array[][][], boolean x) {\n for (boolean a[][] : array) {\n fill(a, x);\n }\n }\n\n long INF = (long) 1e18 + 7;\n\n boolean isINF(long a) {\n return abs(a) > INF / 1000;\n }\n\n boolean isPlusINF(long a) {\n return a > 0 && isINF(a);\n }\n\n boolean isMinusINF(long a) {\n return isPlusINF(-a);\n }\n\n int I_INF = (int) 1e9 + 7;\n\n boolean isINF(int a) {\n return abs(a) > I_INF / 1000;\n }\n\n boolean isPlusINF(int a) {\n return a > 0 && isINF(a);\n }\n\n boolean isMinusINF(int a) {\n return isPlusINF(-a);\n }\n\n public long mod(long i) {\n return i % MOD + ((i % MOD) < 0 ? MOD : 0);\n }\n\n long powMod(long x, long y) {\n if (y == 0) {\n return 1;\n } else {\n long tmp = powMod(x, y / 2);\n return mod(mod(tmp * tmp) * (y % 2 == 0 ? 1 : x));\n }\n }\n\n long[] powsMod(long x, int max) {\n long pow[] = new long[max + 1];\n pow[0] = 1;\n for (int i = 0; i < max; i++) {\n pow[i + 1] = mod(pow[i] * x);\n }\n return pow;\n }\n\n long inv(long x) {\n return powMod(x, MOD - 2);\n }\n\n int MAX_FACT = 5_000_100;\n long fact[];\n long invFact[];\n\n /**\n * Combination簡易版\n * 5 C 2\n * 異なる n個のものから r個を選ぶ組み合わせの総数 nCr を求めます。\n * 5!(5*4*3*2*1)\n * /\n * 2!(2*1) * (5-2)!(3*2*1)\n *\n * @param n\n * @param r\n * @return\n */\n private long getComb(int n, int r) {\n long tmp = 1;\n for (int i = 1; i <= r; i++) {\n tmp *= n - i + 1;\n tmp = mod(tmp);\n tmp *= inv(i);\n tmp = mod(tmp);\n }\n return tmp;\n }\n\n /**\n * 階乗計算の事前累積和\n * [1, 1, 2, 3, 4, 5, … FACTORIAL_NUM]\n * mod済\n */\n void prepareFact() {\n fact = new long[MAX_FACT];\n Arrays.fill(fact, 0);\n invFact = new long[MAX_FACT];\n Arrays.fill(invFact, 0);\n fact[0] = 1;\n int maxIndex = (int) min(MAX_FACT, (int) MOD);\n for (int i = 1; i < maxIndex; i++) {\n fact[i] = mod(fact[i - 1] * i);\n }\n invFact[maxIndex - 1] = inv(fact[maxIndex - 1]);\n for (int i = maxIndex - 1; i > 0; i--) {\n invFact[i - 1] = mod(invFact[i] * i);\n }\n }\n\n /**\n * 順列\n * nPk -> n! / (n-k)!\n *\n * @param n\n * @param r\n * @return\n */\n long permutation(int n, int r) {\n if (n < 0 || r < 0 || n < r) {\n return 0;\n }\n return mod(fact[n] * invFact[n - r]);\n }\n\n /**\n * 組み合わせ\n * nCk -> n! / k!・(n-k)!\n *\n * @param n\n * @param r\n * @return\n */\n long combination(int n, int r) {\n if (n < 0 || r < 0 || n < r) {\n return 0;\n }\n return mod(permutation(n, r) * invFact[r]);\n }\n\n /**\n * 重複組合せ nHr (同次積)\n * nHr = (n+r-1)Cr\n * 異なるn個のものから重複を許してr個取る組合せの総数\n * 例:\n * リンゴ,ミカン,牛肉の3種類の果物があります.これらの中から6個の食材を買って帰ります.\n * このとき,何通りの買い方がありますか?ただし,含まれない食材があってもよいものとします\n *\n * @param n\n * @param r\n * @return\n */\n long homogeneousProduct(int n, int r) {\n return combination((n - 1) + r, r);\n }\n\n /**\n * 多項係数\n * 文字aをp個,bをq個,cをr個, dをs個 あわせてn個を1列に並べるときの並べ方\n * n! / p!・q!・r!・s!\n *\n * @param n\n * @param strNum\n * @param mod\n * @return\n */\n\n /**\n * フェルマーの小定理を用いて逆元を求める。\n * ある数xのmod p(pは素数)の逆数x'はx' = x^(p-2)\n * 繰り返し二乗法を用いて計算する。\n * http://satanic0258.hatenablog.com/entry/2016/04/29/004730\n * {@link BigInteger#modInverse(BigInteger)}とどちらが速いか?\n *\n * @param x\n * @return\n */\n private long modInverse(long x, long mod) {\n long res = 1L;\n long k = mod - 2L;\n long y = x;\n while (k != 0) {\n if (k % 2 != 0) {\n res = (res * y) % mod;\n }\n y = (y * y) % mod;\n k /= 2;\n }\n return res;\n }\n\n\n private final PrintWriter out = new PrintWriter(System.out);\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte())\n return buffer[ptr++];\n else\n return -1;\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n private void skipUnprintable() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr]))\n ptr++;\n }\n\n public boolean hasNext() {\n skipUnprintable();\n return hasNextByte();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public String next() {\n if (!hasNext())\n throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext())\n throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public long min(long... v) {\n long min = Long.MAX_VALUE;\n for (long i : v) min = Math.min(min, i);\n return min;\n }\n\n public long max(long... v) {\n long max = Long.MIN_VALUE;\n for (long i : v) max = Math.max(max, i);\n return max;\n }\n}\n", "language": "Java", "metadata": {"date": 1584564009, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03565.html", "problem_id": "p03565", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03565/input.txt", "sample_output_relpath": "derived/input_output/data/p03565/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03565/Java/s984154227.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s984154227", "user_id": "u345932819"}, "prompt_components": {"gold_output": "atcoder\n", "input_to_evaluate": "\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.math.BigInteger;\nimport java.util.*;\nimport java.util.stream.Collectors;\nimport java.util.stream.IntStream;\nimport java.util.stream.Stream;\n\npublic class Main {\n\n public static void main(String[] args) throws IOException {\n new Main().solve();\n }\n\n private void solve() throws IOException {\n try {\n// solveA();\n// solveB();\n// solveC();\n solveD();\n// solveE();\n// solveF();\n } finally {\n if (in != null) {\n in.close();\n }\n if (out != null) {\n out.flush();\n out.close();\n }\n }\n\n }\n\n // mods\n long MOD = (long) Math.pow(10, 9) + 7;\n\n private void solveA() {\n long a = nextLong();\n long b = nextLong();\n int k = nextInt();\n for (int i = 0; i < k; i++) {\n if (i % 2 == 0) {\n if (a % 2 == 1) {\n a -= 1;\n }\n b += (a / 2);\n a /= 2;\n } else {\n if (b % 2 == 1) {\n b -= 1;\n }\n a += (b / 2);\n b /= 2;\n }\n }\n out.println(a + \" \" + b);\n }\n\n private void solveB() {\n String s = next();\n if (s.length() == 2) {\n out.println(0);\n return;\n }\n s = s.substring(0, s.length() - 1);\n int res = 0;\n int length = s.length() / 2;\n for (int i = 0; i < length; i++) {\n int m = i + 1;\n String fr = s.substring(0, m);\n String bk = s.substring(m, m + m);\n if (fr.equals(bk)) {\n res = Math.max(res, fr.length() + bk.length());\n }\n }\n out.println(res);\n }\n\n private void solveC() {\n int n = nextInt();\n Integer[] a = IntStream.range(0, n).mapToObj(i -> nextInt()).sorted().toArray(Integer[]::new);\n Map am = Arrays.stream(a).collect(Collectors.groupingBy(i -> i, Collectors.counting()));\n long h = 0;\n long w = 0;\n for (int i = a.length - 1; i >= 0; i--) {\n int val = a[i];\n if (am.getOrDefault(val, 0L) < 2)\n continue;\n\n if (h == 0) {\n h = val;\n } else if (w == 0) {\n w = val;\n }\n am.put(val, am.get(val) - 2);\n }\n out.print(h * w);\n }\n\n private void solveD() {\n String s = next();\n String t = next();\n if (s.length() < t.length()) {\n out.println(\"UNRESTORABLE\");\n return;\n }\n List res = new ArrayList();\n for (int i = 0; i < s.length(); i++) {\n\n boolean isMatch = true;\n for (int j = 0, idx = i; j < t.length() && idx < s.length(); j++, idx++) {\n if (s.charAt(idx) != '?' && s.charAt(idx) != t.charAt(j)) {\n isMatch = false;\n break;\n }\n }\n if (isMatch) {\n StringBuilder builder = new StringBuilder();\n\n for (int j = 0; j < s.length(); j++) {\n if (j >= i && j < i + t.length()) {\n builder.append(t.charAt(j - i));\n } else {\n builder.append(s.charAt(j) == '?' ? \"a\" : s.charAt(j));\n }\n }\n res.add(builder.toString());\n }\n }\n Collections.sort(res);\n if (res.size() == 0)\n out.println(\"UNRESTORABLE\");\n else\n out.println(res.get(0));\n }\n\n private void solveE() {\n int n = nextInt();\n int m = nextInt();\n int[] p = IntStream.range(0, n).map(i -> nextInt()).toArray();\n\n int[][] xy = Stream.generate(() -> new int[]{nextInt(), nextInt()}).limit(m).toArray(int[][]::new);\n UnionFind unionFind = new UnionFind(n);\n for (int[] l : xy) {\n unionFind.unite(p[l[0] - 1], p[l[1] - 1]);\n }\n int res = 0;\n for (int i = 1; i <= n; i++) {\n if (unionFind.isSame(i, p[i - 1]))\n res++;\n }\n out.println(res);\n }\n\n private void solveF() {\n\n }\n\n private static class GraphNode {\n private int n;\n private List childs;\n\n public GraphNode(int n) {\n this.n = n;\n childs = new ArrayList();\n }\n\n public void addChild(int child) {\n this.childs.add(child);\n }\n }\n\n private static class Graph {\n\n private Map graph;\n\n public Graph(int[][] list) {\n graph = new HashMap();\n Arrays.stream(list).forEach(l -> {\n int a = l[0];\n int b = l[1];\n graph.put(a, graph.getOrDefault(a, new GraphNode(a)));\n graph.get(a).addChild(b);\n graph.put(b, graph.getOrDefault(b, new GraphNode(b)));\n graph.get(b).addChild(a);\n });\n }\n\n }\n\n private static class SegTree {\n long e = 0;\n\n long calcFunc(long a, long b) {\n return a + b;\n }\n\n int n;\n long nodes[];\n\n public SegTree(long[] a) {\n init(a);\n }\n\n public SegTree(int len, long x) {\n long a[] = new long[len];\n Arrays.fill(a, x);\n init(a);\n }\n\n public SegTree(int len) {\n init(len);\n }\n\n void init(long[] a) {\n init(a.length);\n for (int i = 0; i < a.length; i++) {\n nodes[i + n - 1] = a[i];\n }\n for (int i = n - 2; i >= 0; i--) {\n nodes[i] = calcFunc(nodes[i * 2 + 1], nodes[i * 2 + 2]);\n }\n }\n\n void init(int len) {\n n = 1;\n while (n < len) {\n n *= 2;\n }\n nodes = new long[n * 2 - 1];\n Arrays.fill(nodes, e);\n for (int i = n - 2; i >= 0; i--) {\n nodes[i] = calcFunc(nodes[i * 2 + 1], nodes[i * 2 + 2]);\n }\n }\n\n void set(final int i, long val) {\n int wkI = i + n - 1;\n nodes[wkI] = val;\n while (wkI > 0) {\n wkI = (wkI - 1) / 2;\n nodes[wkI] = calcFunc(nodes[wkI * 2 + 1], nodes[wkI * 2 + 2]);\n }\n }\n\n long get(int i) {\n return find(i, i + 1);\n }\n\n /*\n 要求区間 [a, b) 中の要素の最小値を答える\n k := 自分がいるノードのインデックス\n 対象区間は [l, r) にあたる\n */\n long find(int a, int b) {\n return find(a, b, 0, 0, n);\n }\n\n long find(int a, int b, int k, int l, int r) {\n if (r < 0)\n r = n;\n\n if (b <= l || r <= a)\n return e;\n\n if (a <= l && r <= b)\n return nodes[k];\n\n long val1 = find(a, b, k * 2 + 1, l, (l + r) / 2);\n long val2 = find(a, b, k * 2 + 2, (l + r) / 2, r);\n //Math.min()\n //今回は区間内の個数なのでSUM\n return val1 + val2;\n }\n }\n\n private static class UnionFind {\n int[] pars;\n\n public UnionFind(int n) {\n pars = new int[n + 1];\n Arrays.fill(pars, -1);\n }\n\n public int getChilds(int n) {\n int wk = getRoot(n);\n return pars[wk];\n }\n\n public int getRoot(int n) {\n if (pars[n] < 0)\n return n;\n return pars[n] = getRoot(pars[n]);\n }\n\n public boolean isSame(int a, int b) {\n return getRoot(a) == getRoot(b);\n }\n\n private int getSize(int a) {\n return -pars[getRoot(a)];\n }\n\n public void unite(int a, int b) {\n int wkA = getRoot(a);\n int wkB = getRoot(b);\n if (wkA == wkB)\n return;\n\n if (getSize(wkA) < getSize(wkB)) {\n int tmp = wkA;\n wkA = wkB;\n wkB = tmp;\n }\n pars[wkA] = pars[wkA] + pars[wkB];\n pars[wkB] = wkA;\n }\n }\n\n public long calcSimpleCombination(long n, long m, long CONST_MOD) {\n long mole = 1;\n for (long i = 1; i <= n + m; i++) {\n mole *= i;\n mole %= CONST_MOD;\n }\n long deno = 1;\n for (long i = 1; i <= n; i++) {\n deno *= i;\n deno %= CONST_MOD;\n }\n for (int i = 1; i <= m; i++) {\n deno *= i;\n deno %= CONST_MOD;\n }\n deno = modInverse(deno, CONST_MOD);\n return (mole * deno) % CONST_MOD;\n }\n\n long abs(double x) {\n return (long) Math.abs(x);\n }\n\n long round(double x) {\n return Math.round(x);\n }\n\n long floor(double x) {\n return (long) Math.floor(x);\n }\n\n long ceil(double x) {\n return (long) Math.ceil(x);\n }\n\n double sqrt(double x) {\n return Math.sqrt(x);\n }\n\n double pow(double x, double y) {\n return Math.pow(x, y);\n }\n\n long pow(long x, long y) {\n return (long) Math.pow(x, y);\n }\n\n int gcd(int a, int b) {\n return b == 0 ? a : gcd(b, a % b);\n }\n\n long gcd(long a, long b) {\n return b == 0 ? a : gcd(b, a % b);\n }\n\n long lcm(long a, long b) {\n return a * b / gcd(a, b);\n }\n\n int upperToInt(char a) {\n return a - 'A';\n }\n\n int lowerToInt(char a) {\n return a - 'a';\n }\n\n int numToInt(char a) {\n return a - '0';\n }\n\n int charToInt(char a) {\n return a >= 'a' ? lowerToInt(a) : a >= 'A' ? upperToInt(a) : numToInt(a);\n }\n\n char intToUpper(int a) {\n return (char) (a + 'A');\n }\n\n char intToLower(int a) {\n return (char) (a + 'a');\n }\n\n char intToNum(int a) {\n return (char) (a + '0');\n }\n\n void reverse(String array[]) {\n String reversed[] = new String[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void reverse(int array[]) {\n int reversed[] = new int[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void reverse(long array[]) {\n long reversed[] = new long[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void reverse(double array[]) {\n double reversed[] = new double[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void reverse(boolean array[]) {\n boolean reversed[] = new boolean[array.length];\n for (int i = 0; i < array.length; i++) {\n reversed[array.length - i - 1] = array[i];\n }\n for (int i = 0; i < array.length; i++) {\n array[i] = reversed[i];\n }\n }\n\n void fill(int array[], int x) {\n Arrays.fill(array, x);\n }\n\n void fill(long array[], long x) {\n Arrays.fill(array, x);\n }\n\n void fill(double array[], double x) {\n Arrays.fill(array, x);\n }\n\n void fill(boolean array[], boolean x) {\n Arrays.fill(array, x);\n }\n\n void fill(int array[][], int x) {\n for (int a[] : array) {\n fill(a, x);\n }\n }\n\n void fill(long array[][], long x) {\n for (long a[] : array) {\n fill(a, x);\n }\n }\n\n void fill(double array[][], double x) {\n for (double a[] : array) {\n fill(a, x);\n }\n }\n\n void fill(boolean array[][], boolean x) {\n for (boolean a[] : array) {\n fill(a, x);\n }\n }\n\n void fill(int array[][][], int x) {\n for (int a[][] : array) {\n fill(a, x);\n }\n }\n\n void fill(long array[][][], long x) {\n for (long a[][] : array) {\n fill(a, x);\n }\n }\n\n void fill(double array[][][], double x) {\n for (double a[][] : array) {\n fill(a, x);\n }\n }\n\n void fill(boolean array[][][], boolean x) {\n for (boolean a[][] : array) {\n fill(a, x);\n }\n }\n\n long INF = (long) 1e18 + 7;\n\n boolean isINF(long a) {\n return abs(a) > INF / 1000;\n }\n\n boolean isPlusINF(long a) {\n return a > 0 && isINF(a);\n }\n\n boolean isMinusINF(long a) {\n return isPlusINF(-a);\n }\n\n int I_INF = (int) 1e9 + 7;\n\n boolean isINF(int a) {\n return abs(a) > I_INF / 1000;\n }\n\n boolean isPlusINF(int a) {\n return a > 0 && isINF(a);\n }\n\n boolean isMinusINF(int a) {\n return isPlusINF(-a);\n }\n\n public long mod(long i) {\n return i % MOD + ((i % MOD) < 0 ? MOD : 0);\n }\n\n long powMod(long x, long y) {\n if (y == 0) {\n return 1;\n } else {\n long tmp = powMod(x, y / 2);\n return mod(mod(tmp * tmp) * (y % 2 == 0 ? 1 : x));\n }\n }\n\n long[] powsMod(long x, int max) {\n long pow[] = new long[max + 1];\n pow[0] = 1;\n for (int i = 0; i < max; i++) {\n pow[i + 1] = mod(pow[i] * x);\n }\n return pow;\n }\n\n long inv(long x) {\n return powMod(x, MOD - 2);\n }\n\n int MAX_FACT = 5_000_100;\n long fact[];\n long invFact[];\n\n /**\n * Combination簡易版\n * 5 C 2\n * 異なる n個のものから r個を選ぶ組み合わせの総数 nCr を求めます。\n * 5!(5*4*3*2*1)\n * /\n * 2!(2*1) * (5-2)!(3*2*1)\n *\n * @param n\n * @param r\n * @return\n */\n private long getComb(int n, int r) {\n long tmp = 1;\n for (int i = 1; i <= r; i++) {\n tmp *= n - i + 1;\n tmp = mod(tmp);\n tmp *= inv(i);\n tmp = mod(tmp);\n }\n return tmp;\n }\n\n /**\n * 階乗計算の事前累積和\n * [1, 1, 2, 3, 4, 5, … FACTORIAL_NUM]\n * mod済\n */\n void prepareFact() {\n fact = new long[MAX_FACT];\n Arrays.fill(fact, 0);\n invFact = new long[MAX_FACT];\n Arrays.fill(invFact, 0);\n fact[0] = 1;\n int maxIndex = (int) min(MAX_FACT, (int) MOD);\n for (int i = 1; i < maxIndex; i++) {\n fact[i] = mod(fact[i - 1] * i);\n }\n invFact[maxIndex - 1] = inv(fact[maxIndex - 1]);\n for (int i = maxIndex - 1; i > 0; i--) {\n invFact[i - 1] = mod(invFact[i] * i);\n }\n }\n\n /**\n * 順列\n * nPk -> n! / (n-k)!\n *\n * @param n\n * @param r\n * @return\n */\n long permutation(int n, int r) {\n if (n < 0 || r < 0 || n < r) {\n return 0;\n }\n return mod(fact[n] * invFact[n - r]);\n }\n\n /**\n * 組み合わせ\n * nCk -> n! / k!・(n-k)!\n *\n * @param n\n * @param r\n * @return\n */\n long combination(int n, int r) {\n if (n < 0 || r < 0 || n < r) {\n return 0;\n }\n return mod(permutation(n, r) * invFact[r]);\n }\n\n /**\n * 重複組合せ nHr (同次積)\n * nHr = (n+r-1)Cr\n * 異なるn個のものから重複を許してr個取る組合せの総数\n * 例:\n * リンゴ,ミカン,牛肉の3種類の果物があります.これらの中から6個の食材を買って帰ります.\n * このとき,何通りの買い方がありますか?ただし,含まれない食材があってもよいものとします\n *\n * @param n\n * @param r\n * @return\n */\n long homogeneousProduct(int n, int r) {\n return combination((n - 1) + r, r);\n }\n\n /**\n * 多項係数\n * 文字aをp個,bをq個,cをr個, dをs個 あわせてn個を1列に並べるときの並べ方\n * n! / p!・q!・r!・s!\n *\n * @param n\n * @param strNum\n * @param mod\n * @return\n */\n\n /**\n * フェルマーの小定理を用いて逆元を求める。\n * ある数xのmod p(pは素数)の逆数x'はx' = x^(p-2)\n * 繰り返し二乗法を用いて計算する。\n * http://satanic0258.hatenablog.com/entry/2016/04/29/004730\n * {@link BigInteger#modInverse(BigInteger)}とどちらが速いか?\n *\n * @param x\n * @return\n */\n private long modInverse(long x, long mod) {\n long res = 1L;\n long k = mod - 2L;\n long y = x;\n while (k != 0) {\n if (k % 2 != 0) {\n res = (res * y) % mod;\n }\n y = (y * y) % mod;\n k /= 2;\n }\n return res;\n }\n\n\n private final PrintWriter out = new PrintWriter(System.out);\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte())\n return buffer[ptr++];\n else\n return -1;\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n private void skipUnprintable() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr]))\n ptr++;\n }\n\n public boolean hasNext() {\n skipUnprintable();\n return hasNextByte();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public String next() {\n if (!hasNext())\n throw new NoSuchElementException();\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext())\n throw new NoSuchElementException();\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public long min(long... v) {\n long min = Long.MAX_VALUE;\n for (long i : v) min = Math.min(min, i);\n return min;\n }\n\n public long max(long... v) {\n long max = Long.MIN_VALUE;\n for (long i : v) max = Math.max(max, i);\n return max;\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nE869120 found a chest which is likely to contain treasure.\n\nHowever, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters.\n\nHe also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with ?.\n\nOne more thing he found is a sheet of paper with the following facts written on it:\n\nCondition 1: The string S contains a string T as a contiguous substring.\n\nCondition 2: S is the lexicographically smallest string among the ones that satisfy Condition 1.\n\nPrint the string S.\n\nIf such a string does not exist, print UNRESTORABLE.\n\nConstraints\n\n1 \\leq |S'|, |T| \\leq 50\n\nS' consists of lowercase English letters and ?.\n\nT consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT'\n\nOutput\n\nPrint the string S.\n\nIf such a string does not exist, print UNRESTORABLE instead.\n\nSample Input 1\n\n?tc????\ncoder\n\nSample Output 1\n\natcoder\n\nThere are 26 strings that satisfy Condition 1: atcoder, btcoder, ctcoder,..., ztcoder.\nAmong them, the lexicographically smallest is atcoder, so we can say S = atcoder.\n\nSample Input 2\n\n??p??d??\nabc\n\nSample Output 2\n\nUNRESTORABLE\n\nThere is no string that satisfies Condition 1, so the string S does not exist.", "sample_input": "?tc????\ncoder\n"}, "reference_outputs": ["atcoder\n"], "source_document_id": "p03565", "source_text": "Score : 300 points\n\nProblem Statement\n\nE869120 found a chest which is likely to contain treasure.\n\nHowever, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters.\n\nHe also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with ?.\n\nOne more thing he found is a sheet of paper with the following facts written on it:\n\nCondition 1: The string S contains a string T as a contiguous substring.\n\nCondition 2: S is the lexicographically smallest string among the ones that satisfy Condition 1.\n\nPrint the string S.\n\nIf such a string does not exist, print UNRESTORABLE.\n\nConstraints\n\n1 \\leq |S'|, |T| \\leq 50\n\nS' consists of lowercase English letters and ?.\n\nT consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT'\n\nOutput\n\nPrint the string S.\n\nIf such a string does not exist, print UNRESTORABLE instead.\n\nSample Input 1\n\n?tc????\ncoder\n\nSample Output 1\n\natcoder\n\nThere are 26 strings that satisfy Condition 1: atcoder, btcoder, ctcoder,..., ztcoder.\nAmong them, the lexicographically smallest is atcoder, so we can say S = atcoder.\n\nSample Input 2\n\n??p??d??\nabc\n\nSample Output 2\n\nUNRESTORABLE\n\nThere is no string that satisfies Condition 1, so the string S does not exist.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 19865, "cpu_time_ms": 78, "memory_kb": 23252}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s416803832", "group_id": "codeNet:p03565", "input_text": "\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tchar []s = sc.next().toCharArray();\n\t\tString t = sc.next();\n\t\t\n\t\tint n = s.length;\n\t\tint m = t.length();\n\t\t\n\t\tif(n < m) {\n\t\t\tSystem.out.println(\"UNRESTORABLE\");\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tint cnt = m-1;\n\t\tint num = -1;\n\t\t\n\t\tfor(int i = n-1 ;i >= 0 ;i--) {\n\t\t\tif(s[i] =='?' || s[i] == t.charAt(cnt)) {\n\t\t\t\tcnt--;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tcnt = m-1;\n\t\t\t}\n\t\t\tif(cnt == -1) {\n\t\t\t\tnum = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tcnt = 0;\n\t\t\n\t\tfor(int i = 0 ;i < n ;i++) {\n\t\t\tif(num > i || cnt == m) {\n\t\t\t\tif(s[i] == '?') {\n\t\t\t\t\ts[i] = 'a';\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\ts[i] = t.charAt(cnt);\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tString ans = String.valueOf(s);\n\t\tif(cnt != -1) {\n\t\t\tSystem.out.println(\"UNRESTORABLE\");\n\t\t\treturn;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}\n", "language": "Java", "metadata": {"date": 1584399451, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03565.html", "problem_id": "p03565", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03565/input.txt", "sample_output_relpath": "derived/input_output/data/p03565/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03565/Java/s416803832.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s416803832", "user_id": "u920212194"}, "prompt_components": {"gold_output": "atcoder\n", "input_to_evaluate": "\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tchar []s = sc.next().toCharArray();\n\t\tString t = sc.next();\n\t\t\n\t\tint n = s.length;\n\t\tint m = t.length();\n\t\t\n\t\tif(n < m) {\n\t\t\tSystem.out.println(\"UNRESTORABLE\");\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tint cnt = m-1;\n\t\tint num = -1;\n\t\t\n\t\tfor(int i = n-1 ;i >= 0 ;i--) {\n\t\t\tif(s[i] =='?' || s[i] == t.charAt(cnt)) {\n\t\t\t\tcnt--;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tcnt = m-1;\n\t\t\t}\n\t\t\tif(cnt == -1) {\n\t\t\t\tnum = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tcnt = 0;\n\t\t\n\t\tfor(int i = 0 ;i < n ;i++) {\n\t\t\tif(num > i || cnt == m) {\n\t\t\t\tif(s[i] == '?') {\n\t\t\t\t\ts[i] = 'a';\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\ts[i] = t.charAt(cnt);\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tString ans = String.valueOf(s);\n\t\tif(cnt != -1) {\n\t\t\tSystem.out.println(\"UNRESTORABLE\");\n\t\t\treturn;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nE869120 found a chest which is likely to contain treasure.\n\nHowever, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters.\n\nHe also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with ?.\n\nOne more thing he found is a sheet of paper with the following facts written on it:\n\nCondition 1: The string S contains a string T as a contiguous substring.\n\nCondition 2: S is the lexicographically smallest string among the ones that satisfy Condition 1.\n\nPrint the string S.\n\nIf such a string does not exist, print UNRESTORABLE.\n\nConstraints\n\n1 \\leq |S'|, |T| \\leq 50\n\nS' consists of lowercase English letters and ?.\n\nT consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT'\n\nOutput\n\nPrint the string S.\n\nIf such a string does not exist, print UNRESTORABLE instead.\n\nSample Input 1\n\n?tc????\ncoder\n\nSample Output 1\n\natcoder\n\nThere are 26 strings that satisfy Condition 1: atcoder, btcoder, ctcoder,..., ztcoder.\nAmong them, the lexicographically smallest is atcoder, so we can say S = atcoder.\n\nSample Input 2\n\n??p??d??\nabc\n\nSample Output 2\n\nUNRESTORABLE\n\nThere is no string that satisfies Condition 1, so the string S does not exist.", "sample_input": "?tc????\ncoder\n"}, "reference_outputs": ["atcoder\n"], "source_document_id": "p03565", "source_text": "Score : 300 points\n\nProblem Statement\n\nE869120 found a chest which is likely to contain treasure.\n\nHowever, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters.\n\nHe also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with ?.\n\nOne more thing he found is a sheet of paper with the following facts written on it:\n\nCondition 1: The string S contains a string T as a contiguous substring.\n\nCondition 2: S is the lexicographically smallest string among the ones that satisfy Condition 1.\n\nPrint the string S.\n\nIf such a string does not exist, print UNRESTORABLE.\n\nConstraints\n\n1 \\leq |S'|, |T| \\leq 50\n\nS' consists of lowercase English letters and ?.\n\nT consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT'\n\nOutput\n\nPrint the string S.\n\nIf such a string does not exist, print UNRESTORABLE instead.\n\nSample Input 1\n\n?tc????\ncoder\n\nSample Output 1\n\natcoder\n\nThere are 26 strings that satisfy Condition 1: atcoder, btcoder, ctcoder,..., ztcoder.\nAmong them, the lexicographically smallest is atcoder, so we can say S = atcoder.\n\nSample Input 2\n\n??p??d??\nabc\n\nSample Output 2\n\nUNRESTORABLE\n\nThere is no string that satisfies Condition 1, so the string S does not exist.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 855, "cpu_time_ms": 111, "memory_kb": 22996}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s330330593", "group_id": "codeNet:p03565", "input_text": "import java.util.*;\nimport static java.lang.Math.*;\nimport java.math.BigInteger;\n\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\t// 入力\n\t\tString s = sc.next();\n\t\tString t = sc.next();\n\t\t\n\t\t// 計算\n\t\tString result = \"UNRESTORABLE\";\n\t\tfor(int i = s.length()-t.length(); i >= 0; i--){\n\t\t boolean flg = true;\n\t\t for(int j = 0; j < t.length(); j++){\n\t\t if(i+j >= s.length()){\n\t\t flg = false;\n\t\t break;\n\t\t }\n\t\t if(s.charAt(i+j) != t.charAt(j) && s.charAt(i+j) != '?'){\n\t\t flg = false;\n\t\t }\n\t\t }\n\t\t if(flg){\n\t\t String newS = s.replace('?', 'a');\n\t\t result = newS.substring(0, i) + t + newS.substring(i+t.length());\n\t\t break;\n\t\t }\n\t\t}\n\t\t\n\t\t// 出力\n\t\tSystem.out.println(result);\n\t}\n}\n\n", "language": "Java", "metadata": {"date": 1582606391, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03565.html", "problem_id": "p03565", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03565/input.txt", "sample_output_relpath": "derived/input_output/data/p03565/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03565/Java/s330330593.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s330330593", "user_id": "u513960802"}, "prompt_components": {"gold_output": "atcoder\n", "input_to_evaluate": "import java.util.*;\nimport static java.lang.Math.*;\nimport java.math.BigInteger;\n\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\t// 入力\n\t\tString s = sc.next();\n\t\tString t = sc.next();\n\t\t\n\t\t// 計算\n\t\tString result = \"UNRESTORABLE\";\n\t\tfor(int i = s.length()-t.length(); i >= 0; i--){\n\t\t boolean flg = true;\n\t\t for(int j = 0; j < t.length(); j++){\n\t\t if(i+j >= s.length()){\n\t\t flg = false;\n\t\t break;\n\t\t }\n\t\t if(s.charAt(i+j) != t.charAt(j) && s.charAt(i+j) != '?'){\n\t\t flg = false;\n\t\t }\n\t\t }\n\t\t if(flg){\n\t\t String newS = s.replace('?', 'a');\n\t\t result = newS.substring(0, i) + t + newS.substring(i+t.length());\n\t\t break;\n\t\t }\n\t\t}\n\t\t\n\t\t// 出力\n\t\tSystem.out.println(result);\n\t}\n}\n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nE869120 found a chest which is likely to contain treasure.\n\nHowever, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters.\n\nHe also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with ?.\n\nOne more thing he found is a sheet of paper with the following facts written on it:\n\nCondition 1: The string S contains a string T as a contiguous substring.\n\nCondition 2: S is the lexicographically smallest string among the ones that satisfy Condition 1.\n\nPrint the string S.\n\nIf such a string does not exist, print UNRESTORABLE.\n\nConstraints\n\n1 \\leq |S'|, |T| \\leq 50\n\nS' consists of lowercase English letters and ?.\n\nT consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT'\n\nOutput\n\nPrint the string S.\n\nIf such a string does not exist, print UNRESTORABLE instead.\n\nSample Input 1\n\n?tc????\ncoder\n\nSample Output 1\n\natcoder\n\nThere are 26 strings that satisfy Condition 1: atcoder, btcoder, ctcoder,..., ztcoder.\nAmong them, the lexicographically smallest is atcoder, so we can say S = atcoder.\n\nSample Input 2\n\n??p??d??\nabc\n\nSample Output 2\n\nUNRESTORABLE\n\nThere is no string that satisfies Condition 1, so the string S does not exist.", "sample_input": "?tc????\ncoder\n"}, "reference_outputs": ["atcoder\n"], "source_document_id": "p03565", "source_text": "Score : 300 points\n\nProblem Statement\n\nE869120 found a chest which is likely to contain treasure.\n\nHowever, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters.\n\nHe also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with ?.\n\nOne more thing he found is a sheet of paper with the following facts written on it:\n\nCondition 1: The string S contains a string T as a contiguous substring.\n\nCondition 2: S is the lexicographically smallest string among the ones that satisfy Condition 1.\n\nPrint the string S.\n\nIf such a string does not exist, print UNRESTORABLE.\n\nConstraints\n\n1 \\leq |S'|, |T| \\leq 50\n\nS' consists of lowercase English letters and ?.\n\nT consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT'\n\nOutput\n\nPrint the string S.\n\nIf such a string does not exist, print UNRESTORABLE instead.\n\nSample Input 1\n\n?tc????\ncoder\n\nSample Output 1\n\natcoder\n\nThere are 26 strings that satisfy Condition 1: atcoder, btcoder, ctcoder,..., ztcoder.\nAmong them, the lexicographically smallest is atcoder, so we can say S = atcoder.\n\nSample Input 2\n\n??p??d??\nabc\n\nSample Output 2\n\nUNRESTORABLE\n\nThere is no string that satisfies Condition 1, so the string S does not exist.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 838, "cpu_time_ms": 90, "memory_kb": 21716}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s540027590", "group_id": "codeNet:p03565", "input_text": "import java.util.PriorityQueue;\nimport java.util.Scanner;\n\nclass Main {\n public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n String S = sc.nextLine();\n String T = sc.nextLine();\n PriorityQueue q = new PriorityQueue();\n\n for (int i = S.length() - T.length(); i >= 0; i--) {\n String sub = S.substring(i, i + T.length());\n int k;\n int cnt = 0;\n for (k = 0; k < T.length(); k++) {\n if (sub.charAt(k) == '?') {\n cnt++;\n continue;\n }\n if (sub.charAt(k) != T.charAt(k))\n break;\n }\n if (k == T.length()) {\n String ans = S.substring(0, i).replace('?', 'a');\n ans += T;\n ans += S.substring(i + T.length()).replace('?', 'a');;\n q.add(ans);\n }\n }\n if (q.peek() != null) {\n System.out.println(q.peek());\n } else {\n System.out.println(\"UNRESTORABLE\");\n }\n }\n}", "language": "Java", "metadata": {"date": 1566330223, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03565.html", "problem_id": "p03565", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03565/input.txt", "sample_output_relpath": "derived/input_output/data/p03565/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03565/Java/s540027590.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s540027590", "user_id": "u572483595"}, "prompt_components": {"gold_output": "atcoder\n", "input_to_evaluate": "import java.util.PriorityQueue;\nimport java.util.Scanner;\n\nclass Main {\n public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n String S = sc.nextLine();\n String T = sc.nextLine();\n PriorityQueue q = new PriorityQueue();\n\n for (int i = S.length() - T.length(); i >= 0; i--) {\n String sub = S.substring(i, i + T.length());\n int k;\n int cnt = 0;\n for (k = 0; k < T.length(); k++) {\n if (sub.charAt(k) == '?') {\n cnt++;\n continue;\n }\n if (sub.charAt(k) != T.charAt(k))\n break;\n }\n if (k == T.length()) {\n String ans = S.substring(0, i).replace('?', 'a');\n ans += T;\n ans += S.substring(i + T.length()).replace('?', 'a');;\n q.add(ans);\n }\n }\n if (q.peek() != null) {\n System.out.println(q.peek());\n } else {\n System.out.println(\"UNRESTORABLE\");\n }\n }\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nE869120 found a chest which is likely to contain treasure.\n\nHowever, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters.\n\nHe also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with ?.\n\nOne more thing he found is a sheet of paper with the following facts written on it:\n\nCondition 1: The string S contains a string T as a contiguous substring.\n\nCondition 2: S is the lexicographically smallest string among the ones that satisfy Condition 1.\n\nPrint the string S.\n\nIf such a string does not exist, print UNRESTORABLE.\n\nConstraints\n\n1 \\leq |S'|, |T| \\leq 50\n\nS' consists of lowercase English letters and ?.\n\nT consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT'\n\nOutput\n\nPrint the string S.\n\nIf such a string does not exist, print UNRESTORABLE instead.\n\nSample Input 1\n\n?tc????\ncoder\n\nSample Output 1\n\natcoder\n\nThere are 26 strings that satisfy Condition 1: atcoder, btcoder, ctcoder,..., ztcoder.\nAmong them, the lexicographically smallest is atcoder, so we can say S = atcoder.\n\nSample Input 2\n\n??p??d??\nabc\n\nSample Output 2\n\nUNRESTORABLE\n\nThere is no string that satisfies Condition 1, so the string S does not exist.", "sample_input": "?tc????\ncoder\n"}, "reference_outputs": ["atcoder\n"], "source_document_id": "p03565", "source_text": "Score : 300 points\n\nProblem Statement\n\nE869120 found a chest which is likely to contain treasure.\n\nHowever, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters.\n\nHe also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with ?.\n\nOne more thing he found is a sheet of paper with the following facts written on it:\n\nCondition 1: The string S contains a string T as a contiguous substring.\n\nCondition 2: S is the lexicographically smallest string among the ones that satisfy Condition 1.\n\nPrint the string S.\n\nIf such a string does not exist, print UNRESTORABLE.\n\nConstraints\n\n1 \\leq |S'|, |T| \\leq 50\n\nS' consists of lowercase English letters and ?.\n\nT consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT'\n\nOutput\n\nPrint the string S.\n\nIf such a string does not exist, print UNRESTORABLE instead.\n\nSample Input 1\n\n?tc????\ncoder\n\nSample Output 1\n\natcoder\n\nThere are 26 strings that satisfy Condition 1: atcoder, btcoder, ctcoder,..., ztcoder.\nAmong them, the lexicographically smallest is atcoder, so we can say S = atcoder.\n\nSample Input 2\n\n??p??d??\nabc\n\nSample Output 2\n\nUNRESTORABLE\n\nThere is no string that satisfies Condition 1, so the string S does not exist.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1119, "cpu_time_ms": 92, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s883556393", "group_id": "codeNet:p03565", "input_text": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n // Your code here!\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n String t = sc.next();\n char[] S = s.toCharArray();\n char[] T = t.toCharArray();\n int slen = S.length;\n int tlen = T.length;\n char[] ans = null;\n boolean flg = false;\n if(s.indexOf(t)>=0) flg = true;\n for(int i=slen-tlen;i>=0;i--){\n if(diffCheck(S, T, i)){\n char[] tans = S.clone();\n for(int j=i;j0){\n ans = tans;\n }\n }\n }\n for(int i=0;ic2) return 1;\n }\n return 0;\n }\n private static boolean diffCheck(char[] a, char[] b, int as){\n for(int i=0;i=0) flg = true;\n for(int i=slen-tlen;i>=0;i--){\n if(diffCheck(S, T, i)){\n char[] tans = S.clone();\n for(int j=i;j0){\n ans = tans;\n }\n }\n }\n for(int i=0;ic2) return 1;\n }\n return 0;\n }\n private static boolean diffCheck(char[] a, char[] b, int as){\n for(int i=0;i ts=new TreeSet<>();\n int sizeS=s.length;\n int sizeT=t.length;\n for (int i = 0; i <= sizeS-sizeT; i++) {\n int count=0,temp=0;\n for (int j = i; j < sizeT+i; j++) {\n if(s[j]=='?'||s[j]==t[j-i]){\n count++;\n temp=i;\n }\n }\n if(count==sizeT){\n String ans=\"\";\n out.println(\"temp=\"+temp);\n for (int j = 0; j < sizeS; j++) {\n out.println(\"j=\"+j);\n out.println(\"ans=\"+ans);\n if(j ts=new TreeSet<>();\n int sizeS=s.length;\n int sizeT=t.length;\n for (int i = 0; i <= sizeS-sizeT; i++) {\n int count=0,temp=0;\n for (int j = i; j < sizeT+i; j++) {\n if(s[j]=='?'||s[j]==t[j-i]){\n count++;\n temp=i;\n }\n }\n if(count==sizeT){\n String ans=\"\";\n out.println(\"temp=\"+temp);\n for (int j = 0; j < sizeS; j++) {\n out.println(\"j=\"+j);\n out.println(\"ans=\"+ans);\n if(j= 0; --i) {\n String sub = s.substring(i, i + t.length());\n boolean flag = true;\n for (int j = 0; j < t.length(); ++j) {\n if (t.charAt(j) != sub.charAt(j) && sub.charAt(j) != '?') {\n flag = false;\n break;\n }\n }\n if (flag) {\n StringBuilder ans = new StringBuilder();\n for (int j = 0; j < i; ++j) {\n ans.append((s.charAt(j) == '?') ? 'a' : s.charAt(j));\n }\n ans.append(t);\n for (int j = i + t.length(); j < s.length(); ++j) {\n ans.append((s.charAt(j) == '?') ? 'a' : s.charAt(j));\n }\n out.println(ans);\n return;\n }\n }\n\n out.println(\"UNRESTORABLE\");\n\n }//end\n\n }\n\n}", "language": "Java", "metadata": {"date": 1509358374, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03565.html", "problem_id": "p03565", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03565/input.txt", "sample_output_relpath": "derived/input_output/data/p03565/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03565/Java/s810076665.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s810076665", "user_id": "u381253095"}, "prompt_components": {"gold_output": "atcoder\n", "input_to_evaluate": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n\n private static class InputReader {\n private BufferedReader reader;\n private StringTokenizer tokenizer;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException exp) {\n throw new RuntimeException(exp);\n }\n }\n return tokenizer.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n }\n\n public static void main(String[] args) { //throws FileNotFoundException {\n InputStream inputStream = System.in; //new FileInputStream(\"input.txt\");\n OutputStream outputStream = System.out; //new FileOutputStream(\"output.txt\");\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n\n Task newTask = new Task();\n newTask.solve(in, out);\n\n out.close();\n }\n\n private static class Task {\n //.constant\n private final int INF = Integer.MAX_VALUE;\n private final int MOD = (int)1e9 + 7;\n\n //.data\n\n //.code\n public void solve(InputReader in, PrintWriter out) {\n String s = in.next();\n String t = in.next();\n\n for (int i = s.length() - t.length(); i >= 0; --i) {\n String sub = s.substring(i, i + t.length());\n boolean flag = true;\n for (int j = 0; j < t.length(); ++j) {\n if (t.charAt(j) != sub.charAt(j) && sub.charAt(j) != '?') {\n flag = false;\n break;\n }\n }\n if (flag) {\n StringBuilder ans = new StringBuilder();\n for (int j = 0; j < i; ++j) {\n ans.append((s.charAt(j) == '?') ? 'a' : s.charAt(j));\n }\n ans.append(t);\n for (int j = i + t.length(); j < s.length(); ++j) {\n ans.append((s.charAt(j) == '?') ? 'a' : s.charAt(j));\n }\n out.println(ans);\n return;\n }\n }\n\n out.println(\"UNRESTORABLE\");\n\n }//end\n\n }\n\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nE869120 found a chest which is likely to contain treasure.\n\nHowever, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters.\n\nHe also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with ?.\n\nOne more thing he found is a sheet of paper with the following facts written on it:\n\nCondition 1: The string S contains a string T as a contiguous substring.\n\nCondition 2: S is the lexicographically smallest string among the ones that satisfy Condition 1.\n\nPrint the string S.\n\nIf such a string does not exist, print UNRESTORABLE.\n\nConstraints\n\n1 \\leq |S'|, |T| \\leq 50\n\nS' consists of lowercase English letters and ?.\n\nT consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT'\n\nOutput\n\nPrint the string S.\n\nIf such a string does not exist, print UNRESTORABLE instead.\n\nSample Input 1\n\n?tc????\ncoder\n\nSample Output 1\n\natcoder\n\nThere are 26 strings that satisfy Condition 1: atcoder, btcoder, ctcoder,..., ztcoder.\nAmong them, the lexicographically smallest is atcoder, so we can say S = atcoder.\n\nSample Input 2\n\n??p??d??\nabc\n\nSample Output 2\n\nUNRESTORABLE\n\nThere is no string that satisfies Condition 1, so the string S does not exist.", "sample_input": "?tc????\ncoder\n"}, "reference_outputs": ["atcoder\n"], "source_document_id": "p03565", "source_text": "Score : 300 points\n\nProblem Statement\n\nE869120 found a chest which is likely to contain treasure.\n\nHowever, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters.\n\nHe also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with ?.\n\nOne more thing he found is a sheet of paper with the following facts written on it:\n\nCondition 1: The string S contains a string T as a contiguous substring.\n\nCondition 2: S is the lexicographically smallest string among the ones that satisfy Condition 1.\n\nPrint the string S.\n\nIf such a string does not exist, print UNRESTORABLE.\n\nConstraints\n\n1 \\leq |S'|, |T| \\leq 50\n\nS' consists of lowercase English letters and ?.\n\nT consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT'\n\nOutput\n\nPrint the string S.\n\nIf such a string does not exist, print UNRESTORABLE instead.\n\nSample Input 1\n\n?tc????\ncoder\n\nSample Output 1\n\natcoder\n\nThere are 26 strings that satisfy Condition 1: atcoder, btcoder, ctcoder,..., ztcoder.\nAmong them, the lexicographically smallest is atcoder, so we can say S = atcoder.\n\nSample Input 2\n\n??p??d??\nabc\n\nSample Output 2\n\nUNRESTORABLE\n\nThere is no string that satisfies Condition 1, so the string S does not exist.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2699, "cpu_time_ms": 75, "memory_kb": 22740}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s922452503", "group_id": "codeNet:p03565", "input_text": "import java.util.*;\npublic class Main {\n\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n String ss,t;\n ss = sc.next();\n t = sc.next();\n boolean f = true;\n int head = 0;\n for(int i=0;i=ss.length()){\n f = false;\n break;\n }\n if(ss.charAt(i+j)==t.charAt(j) || ss.charAt(i+j)=='?'){\n\n f = true;\n } else {\n f = false;\n break;\n }\n }\n if(f==true) break;\n }else{\n f = false;\n }\n\n }\n if(f==false){\n System.out.println(\"UNRESTORABLE\");\n } else {\n String s = \"\";\n for(int i=0;i=ss.length()){\n f = false;\n break;\n }\n if(ss.charAt(i+j)==t.charAt(j) || ss.charAt(i+j)=='?'){\n\n f = true;\n } else {\n f = false;\n break;\n }\n }\n if(f==true) break;\n }else{\n f = false;\n }\n\n }\n if(f==false){\n System.out.println(\"UNRESTORABLE\");\n } else {\n String s = \"\";\n for(int i=0;i= (T.length - (i + 1))\n\t\t\t\t\t\t&& indexS >= i) {\n\t\t\t\t\tboolean isTarget = true;\n\t\t\t\t\tint count = indexS;\n\t\t\t\t\tfor (int j = i; j < T.length; j++) {\n\t\t\t\t\t\tif (S.charAt(count) != T[j] && S.charAt(count) != '?') {\n\t\t\t\t\t\t\tisTarget = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t}\n\t\t\t\t\tif (isTarget) {\n\t\t\t\t\t\tcount = indexS - i;\n\t\t\t\t\t\tfor (int j = 0; j < i; j++) {\n\t\t\t\t\t\t\tif (S.charAt(count) != T[j] && S.charAt(count) != '?') {\n\t\t\t\t\t\t\t\tisTarget = false;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif (isTarget) {\n\t\t\t\t\t\tfor (int k = 0; k < S.length(); k++) {\n\t\t\t\t\t\t\tif (k == indexS) {\n\t\t\t\t\t\t\t\tsb.append(T);\n\t\t\t\t\t\t\t\tk += T.length - 1;\n\t\t\t\t\t\t\t} else if (S.charAt(k) == '?') {\n\t\t\t\t\t\t\t\tsb.append('a');\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tsb.append(S.charAt(k));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tresult = sb.toString();\n\t\t\t\t\t\tisTargetMain = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!isTargetMain) {\n\t\t\t\tStringBuilder sb1 = new StringBuilder();\n\t\t\t\tfor (int i = 0; i < T.length; i++) {\n\t\t\t\t\tsb1.append('?');\n\t\t\t\t}\n\t\t\t\tindexS = S.indexOf(sb1.toString());\n\t\t\t\tif (indexS >= 0) {\n\t\t\t\t\tfor (int k = 0; k < S.length(); k++) {\n\t\t\t\t\t\tif (k == indexS) {\n\t\t\t\t\t\t\tsb.append(T);\n\t\t\t\t\t\t\tk += T.length - 1;\n\t\t\t\t\t\t} else if (S.charAt(k) == '?') {\n\t\t\t\t\t\t\tsb.append('a');\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tsb.append(S.charAt(k));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tresult = sb.toString();\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t\tSystem.out.println(result);\n\t}\n}", "language": "Java", "metadata": {"date": 1509244558, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03565.html", "problem_id": "p03565", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03565/input.txt", "sample_output_relpath": "derived/input_output/data/p03565/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03565/Java/s893662993.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s893662993", "user_id": "u207626397"}, "prompt_components": {"gold_output": "atcoder\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString S = sc.nextLine();\n\t\tchar[] T = sc.nextLine().toCharArray();\n\t\tsc.close();\n\t\tString result = \"UNRESTORABLE\";\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint indexS = 0;\n\t\tif (T.length <= S.length()) {\n\t\t\tboolean isTargetMain = false;\n\t\t\tfor (int i = 0; i < T.length; i++) {\n\t\t\t\tindexS = S.indexOf(T[i]);\n\t\t\t\tif (S.length() - (indexS + 1) >= (T.length - (i + 1))\n\t\t\t\t\t\t&& indexS >= i) {\n\t\t\t\t\tboolean isTarget = true;\n\t\t\t\t\tint count = indexS;\n\t\t\t\t\tfor (int j = i; j < T.length; j++) {\n\t\t\t\t\t\tif (S.charAt(count) != T[j] && S.charAt(count) != '?') {\n\t\t\t\t\t\t\tisTarget = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t}\n\t\t\t\t\tif (isTarget) {\n\t\t\t\t\t\tcount = indexS - i;\n\t\t\t\t\t\tfor (int j = 0; j < i; j++) {\n\t\t\t\t\t\t\tif (S.charAt(count) != T[j] && S.charAt(count) != '?') {\n\t\t\t\t\t\t\t\tisTarget = false;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif (isTarget) {\n\t\t\t\t\t\tfor (int k = 0; k < S.length(); k++) {\n\t\t\t\t\t\t\tif (k == indexS) {\n\t\t\t\t\t\t\t\tsb.append(T);\n\t\t\t\t\t\t\t\tk += T.length - 1;\n\t\t\t\t\t\t\t} else if (S.charAt(k) == '?') {\n\t\t\t\t\t\t\t\tsb.append('a');\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tsb.append(S.charAt(k));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tresult = sb.toString();\n\t\t\t\t\t\tisTargetMain = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!isTargetMain) {\n\t\t\t\tStringBuilder sb1 = new StringBuilder();\n\t\t\t\tfor (int i = 0; i < T.length; i++) {\n\t\t\t\t\tsb1.append('?');\n\t\t\t\t}\n\t\t\t\tindexS = S.indexOf(sb1.toString());\n\t\t\t\tif (indexS >= 0) {\n\t\t\t\t\tfor (int k = 0; k < S.length(); k++) {\n\t\t\t\t\t\tif (k == indexS) {\n\t\t\t\t\t\t\tsb.append(T);\n\t\t\t\t\t\t\tk += T.length - 1;\n\t\t\t\t\t\t} else if (S.charAt(k) == '?') {\n\t\t\t\t\t\t\tsb.append('a');\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tsb.append(S.charAt(k));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tresult = sb.toString();\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t\tSystem.out.println(result);\n\t}\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nE869120 found a chest which is likely to contain treasure.\n\nHowever, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters.\n\nHe also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with ?.\n\nOne more thing he found is a sheet of paper with the following facts written on it:\n\nCondition 1: The string S contains a string T as a contiguous substring.\n\nCondition 2: S is the lexicographically smallest string among the ones that satisfy Condition 1.\n\nPrint the string S.\n\nIf such a string does not exist, print UNRESTORABLE.\n\nConstraints\n\n1 \\leq |S'|, |T| \\leq 50\n\nS' consists of lowercase English letters and ?.\n\nT consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT'\n\nOutput\n\nPrint the string S.\n\nIf such a string does not exist, print UNRESTORABLE instead.\n\nSample Input 1\n\n?tc????\ncoder\n\nSample Output 1\n\natcoder\n\nThere are 26 strings that satisfy Condition 1: atcoder, btcoder, ctcoder,..., ztcoder.\nAmong them, the lexicographically smallest is atcoder, so we can say S = atcoder.\n\nSample Input 2\n\n??p??d??\nabc\n\nSample Output 2\n\nUNRESTORABLE\n\nThere is no string that satisfies Condition 1, so the string S does not exist.", "sample_input": "?tc????\ncoder\n"}, "reference_outputs": ["atcoder\n"], "source_document_id": "p03565", "source_text": "Score : 300 points\n\nProblem Statement\n\nE869120 found a chest which is likely to contain treasure.\n\nHowever, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters.\n\nHe also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with ?.\n\nOne more thing he found is a sheet of paper with the following facts written on it:\n\nCondition 1: The string S contains a string T as a contiguous substring.\n\nCondition 2: S is the lexicographically smallest string among the ones that satisfy Condition 1.\n\nPrint the string S.\n\nIf such a string does not exist, print UNRESTORABLE.\n\nConstraints\n\n1 \\leq |S'|, |T| \\leq 50\n\nS' consists of lowercase English letters and ?.\n\nT consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT'\n\nOutput\n\nPrint the string S.\n\nIf such a string does not exist, print UNRESTORABLE instead.\n\nSample Input 1\n\n?tc????\ncoder\n\nSample Output 1\n\natcoder\n\nThere are 26 strings that satisfy Condition 1: atcoder, btcoder, ctcoder,..., ztcoder.\nAmong them, the lexicographically smallest is atcoder, so we can say S = atcoder.\n\nSample Input 2\n\n??p??d??\nabc\n\nSample Output 2\n\nUNRESTORABLE\n\nThere is no string that satisfies Condition 1, so the string S does not exist.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1896, "cpu_time_ms": 91, "memory_kb": 21972}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s990797599", "group_id": "codeNet:p03574", "input_text": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n int H = sc.nextInt();\n int W = sc.nextInt();\n char[][] S = new char[H][W];\n for(int i=0; i0){\n if(S[i-1][j]=='#'){\n count++;\n } \n if(j>0 && S[i-1][j-1]=='#'){\n count++;\n }\n if(j0 && S[i][j-1]=='#'){\n count++;\n }\n if(j0 && S[i+1][j-1]=='#'){\n count++;\n }\n if(j0){\n if(S[i-1][j]=='#'){\n count++;\n } \n if(j>0 && S[i-1][j-1]=='#'){\n count++;\n }\n if(j0 && S[i][j-1]=='#'){\n count++;\n }\n if(j0 && S[i+1][j-1]=='#'){\n count++;\n }\n if(j=0) {\n if(i-1>=0&&S[i-1][j-1].equals(\"#\")) \n count++;\n if(S[i][j-1].equals(\"#\")) \n count++;\n if(i+1=0&&S[i-1][j].equals(\"#\")) \n count++;\n if(i+1=0&&S[i-1][j+1].equals(\"#\")) \n count++;\n if(S[i][j+1].equals(\"#\")) \n count++;\n if(i+1=0) {\n if(i-1>=0&&S[i-1][j-1].equals(\"#\")) \n count++;\n if(S[i][j-1].equals(\"#\")) \n count++;\n if(i+1=0&&S[i-1][j].equals(\"#\")) \n count++;\n if(i+1=0&&S[i-1][j+1].equals(\"#\")) \n count++;\n if(S[i][j+1].equals(\"#\")) \n count++;\n if(i+1 Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }\n public double nextDouble() { return Double.parseDouble(next());}\n}", "language": "Java", "metadata": {"date": 1533174304, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03574.html", "problem_id": "p03574", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03574/input.txt", "sample_output_relpath": "derived/input_output/data/p03574/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03574/Java/s425484771.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s425484771", "user_id": "u687766076"}, "prompt_components": {"gold_output": "11211\n1#2#1\n11211\n", "input_to_evaluate": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.util.NoSuchElementException;\n\npublic class Main {\n\t private static String[][] map;\n\n\tpublic static void main(String[] args){\n//\t\tFastScanner sc = new FastScanner();\n//\t\tint x = sc.nextInt();\n//\t\tint y = sc.nextInt();\n//\t\tmap = new String[x][y];\n\t\tint x =3;\n\t\tint y =3;\n\t\tfor(int i=0; i Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }\n public double nextDouble() { return Double.parseDouble(next());}\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given an H × W grid.\n\nThe squares in the grid are described by H strings, S_1,...,S_H.\n\nThe j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \\leq i \\leq H,1 \\leq j \\leq W).\n\n. stands for an empty square, and # stands for a square containing a bomb.\n\nDolphin is interested in how many bomb squares are horizontally, vertically or diagonally adjacent to each empty square.\n\n(Below, we will simply say \"adjacent\" for this meaning. For each square, there are at most eight adjacent squares.)\n\nHe decides to replace each . in our H strings with a digit that represents the number of bomb squares adjacent to the corresponding empty square.\n\nPrint the strings after the process.\n\nConstraints\n\n1 \\leq H,W \\leq 50\n\nS_i is a string of length W consisting of # and ..\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 H strings after the process.\n\nThe i-th line should contain a string T_i of length W, where the j-th character in T_i corresponds to the square at the i-th row from the top and j-th row from the left in the grid (1 \\leq i \\leq H, 1 \\leq j \\leq W).\n\nSample Input 1\n\n3 5\n.....\n.#.#.\n.....\n\nSample Output 1\n\n11211\n1#2#1\n11211\n\nFor example, let us observe the empty square at the first row from the top and first column from the left.\n\nThere is one bomb square adjacent to this empty square: the square at the second row and second column.\n\nThus, the . corresponding to this empty square is replaced with 1.\n\nSample Input 2\n\n3 5\n#####\n#####\n#####\n\nSample Output 2\n\n#####\n#####\n#####\n\nIt is possible that there is no empty square.\n\nSample Input 3\n\n6 6\n#####.\n#.#.##\n####.#\n.#..#.\n#.##..\n#.#...\n\nSample Output 3\n\n#####3\n#8#7##\n####5#\n4#65#2\n#5##21\n#4#310", "sample_input": "3 5\n.....\n.#.#.\n.....\n"}, "reference_outputs": ["11211\n1#2#1\n11211\n"], "source_document_id": "p03574", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given an H × W grid.\n\nThe squares in the grid are described by H strings, S_1,...,S_H.\n\nThe j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \\leq i \\leq H,1 \\leq j \\leq W).\n\n. stands for an empty square, and # stands for a square containing a bomb.\n\nDolphin is interested in how many bomb squares are horizontally, vertically or diagonally adjacent to each empty square.\n\n(Below, we will simply say \"adjacent\" for this meaning. For each square, there are at most eight adjacent squares.)\n\nHe decides to replace each . in our H strings with a digit that represents the number of bomb squares adjacent to the corresponding empty square.\n\nPrint the strings after the process.\n\nConstraints\n\n1 \\leq H,W \\leq 50\n\nS_i is a string of length W consisting of # and ..\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 H strings after the process.\n\nThe i-th line should contain a string T_i of length W, where the j-th character in T_i corresponds to the square at the i-th row from the top and j-th row from the left in the grid (1 \\leq i \\leq H, 1 \\leq j \\leq W).\n\nSample Input 1\n\n3 5\n.....\n.#.#.\n.....\n\nSample Output 1\n\n11211\n1#2#1\n11211\n\nFor example, let us observe the empty square at the first row from the top and first column from the left.\n\nThere is one bomb square adjacent to this empty square: the square at the second row and second column.\n\nThus, the . corresponding to this empty square is replaced with 1.\n\nSample Input 2\n\n3 5\n#####\n#####\n#####\n\nSample Output 2\n\n#####\n#####\n#####\n\nIt is possible that there is no empty square.\n\nSample Input 3\n\n6 6\n#####.\n#.#.##\n####.#\n.#..#.\n#.##..\n#.#...\n\nSample Output 3\n\n#####3\n#8#7##\n####5#\n4#65#2\n#5##21\n#4#310", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3096, "cpu_time_ms": 69, "memory_kb": 21204}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s882289957", "group_id": "codeNet:p03574", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint h = scan.nextInt();\n\t\tint w = scan.nextInt();\n\t\tint[][] count = new int[h][w];\n\t\tint[] dx = {0, 0, 1, -1, 1, -1, 1, -1};\n\t\tint[] dy = {1, -1, 0, 0, -1, 1, 1, -1};\n\t\tString S = \"\";\n\t\tchar[][] a = new char[h][w];\n\t\tfor (int i = 0; i < h; i++) {\n\t\t\tS = scan.next();\n\t\t\tfor (int j = 0; j < w; j++) {\n\t\t\t\ta[i][j] = S.charAt(j);\n\t\t\t}\n\t\t}\n\t\tint ny = 0;\n\t\tint nx = 0;\n\n\t\tfor (int i = 0; i < h; i++) {\n\t\t\tfor (int j = 0; j < w; j++) {\n\t\t\t\tif (a[i][j] == '.') {\n\t\t\t\t\tfor (int k = 0; k < 8; k++) {\n\t\t\t\t\t\tny = i + dy[k];\n\t\t\t\t\t\tnx = j + dx[k];\n\t\t\t\t\t\tif (ny < 0 || nx < 0 || ny >= h || nx >= w) continue;\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tif (a[ny][nx] == '#') {\n\t\t\t\t\t\t\t\tcount[i][j]++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (int i = 0; i < h; i++) {\n\t\t\tfor (int j = 0; j < w; j++) {\n\t\t\t\tif (a[i][j] == '.') {\n\t\t\t\t\ta[i][j] = encode(count[i][j]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tString str[] = new String[h];\n\t\tfor (int i = 0; i < h; i++) {\n\t\t\tfor (int j = 0; j < w; j++) {\n\t\t\t\tif (j == 0) {\n\t\t\t\t\tstr[i] = String.valueOf(a[i][j]);\n\t\t\t\t} else {\n\t\t\t\t\tstr[i] = str[i] + String.valueOf(a[i][j]);\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (int i = 0; i < h; i++) {\n\t\t\tSystem.out.println(str[i]);\n\t\t}\n\t}\n\n\tstatic private char encode(int num) {\n\t\tswitch (num) {\n\t\tcase 1:\n\t\t\treturn '1';\n\t\tcase 2:\n\t\t\treturn '2';\n\t\tcase 3:\n\t\t\treturn '3';\n\t\tcase 4:\n\t\t\treturn '4';\n\t\tcase 5:\n\t\t\treturn '5';\n\t\tcase 6:\n\t\t\treturn '6';\n\t\tcase 7:\n\t\t\treturn '7';\n\t\tcase 8:\n\t\t\treturn '8';\n\t\tcase 0:\n\t\treturn '0';\n\t\t}\n\t\treturn '0';\n\t}\n}", "language": "Java", "metadata": {"date": 1532230007, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03574.html", "problem_id": "p03574", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03574/input.txt", "sample_output_relpath": "derived/input_output/data/p03574/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03574/Java/s882289957.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s882289957", "user_id": "u102602414"}, "prompt_components": {"gold_output": "11211\n1#2#1\n11211\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint h = scan.nextInt();\n\t\tint w = scan.nextInt();\n\t\tint[][] count = new int[h][w];\n\t\tint[] dx = {0, 0, 1, -1, 1, -1, 1, -1};\n\t\tint[] dy = {1, -1, 0, 0, -1, 1, 1, -1};\n\t\tString S = \"\";\n\t\tchar[][] a = new char[h][w];\n\t\tfor (int i = 0; i < h; i++) {\n\t\t\tS = scan.next();\n\t\t\tfor (int j = 0; j < w; j++) {\n\t\t\t\ta[i][j] = S.charAt(j);\n\t\t\t}\n\t\t}\n\t\tint ny = 0;\n\t\tint nx = 0;\n\n\t\tfor (int i = 0; i < h; i++) {\n\t\t\tfor (int j = 0; j < w; j++) {\n\t\t\t\tif (a[i][j] == '.') {\n\t\t\t\t\tfor (int k = 0; k < 8; k++) {\n\t\t\t\t\t\tny = i + dy[k];\n\t\t\t\t\t\tnx = j + dx[k];\n\t\t\t\t\t\tif (ny < 0 || nx < 0 || ny >= h || nx >= w) continue;\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tif (a[ny][nx] == '#') {\n\t\t\t\t\t\t\t\tcount[i][j]++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (int i = 0; i < h; i++) {\n\t\t\tfor (int j = 0; j < w; j++) {\n\t\t\t\tif (a[i][j] == '.') {\n\t\t\t\t\ta[i][j] = encode(count[i][j]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tString str[] = new String[h];\n\t\tfor (int i = 0; i < h; i++) {\n\t\t\tfor (int j = 0; j < w; j++) {\n\t\t\t\tif (j == 0) {\n\t\t\t\t\tstr[i] = String.valueOf(a[i][j]);\n\t\t\t\t} else {\n\t\t\t\t\tstr[i] = str[i] + String.valueOf(a[i][j]);\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (int i = 0; i < h; i++) {\n\t\t\tSystem.out.println(str[i]);\n\t\t}\n\t}\n\n\tstatic private char encode(int num) {\n\t\tswitch (num) {\n\t\tcase 1:\n\t\t\treturn '1';\n\t\tcase 2:\n\t\t\treturn '2';\n\t\tcase 3:\n\t\t\treturn '3';\n\t\tcase 4:\n\t\t\treturn '4';\n\t\tcase 5:\n\t\t\treturn '5';\n\t\tcase 6:\n\t\t\treturn '6';\n\t\tcase 7:\n\t\t\treturn '7';\n\t\tcase 8:\n\t\t\treturn '8';\n\t\tcase 0:\n\t\treturn '0';\n\t\t}\n\t\treturn '0';\n\t}\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given an H × W grid.\n\nThe squares in the grid are described by H strings, S_1,...,S_H.\n\nThe j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \\leq i \\leq H,1 \\leq j \\leq W).\n\n. stands for an empty square, and # stands for a square containing a bomb.\n\nDolphin is interested in how many bomb squares are horizontally, vertically or diagonally adjacent to each empty square.\n\n(Below, we will simply say \"adjacent\" for this meaning. For each square, there are at most eight adjacent squares.)\n\nHe decides to replace each . in our H strings with a digit that represents the number of bomb squares adjacent to the corresponding empty square.\n\nPrint the strings after the process.\n\nConstraints\n\n1 \\leq H,W \\leq 50\n\nS_i is a string of length W consisting of # and ..\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 H strings after the process.\n\nThe i-th line should contain a string T_i of length W, where the j-th character in T_i corresponds to the square at the i-th row from the top and j-th row from the left in the grid (1 \\leq i \\leq H, 1 \\leq j \\leq W).\n\nSample Input 1\n\n3 5\n.....\n.#.#.\n.....\n\nSample Output 1\n\n11211\n1#2#1\n11211\n\nFor example, let us observe the empty square at the first row from the top and first column from the left.\n\nThere is one bomb square adjacent to this empty square: the square at the second row and second column.\n\nThus, the . corresponding to this empty square is replaced with 1.\n\nSample Input 2\n\n3 5\n#####\n#####\n#####\n\nSample Output 2\n\n#####\n#####\n#####\n\nIt is possible that there is no empty square.\n\nSample Input 3\n\n6 6\n#####.\n#.#.##\n####.#\n.#..#.\n#.##..\n#.#...\n\nSample Output 3\n\n#####3\n#8#7##\n####5#\n4#65#2\n#5##21\n#4#310", "sample_input": "3 5\n.....\n.#.#.\n.....\n"}, "reference_outputs": ["11211\n1#2#1\n11211\n"], "source_document_id": "p03574", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given an H × W grid.\n\nThe squares in the grid are described by H strings, S_1,...,S_H.\n\nThe j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \\leq i \\leq H,1 \\leq j \\leq W).\n\n. stands for an empty square, and # stands for a square containing a bomb.\n\nDolphin is interested in how many bomb squares are horizontally, vertically or diagonally adjacent to each empty square.\n\n(Below, we will simply say \"adjacent\" for this meaning. For each square, there are at most eight adjacent squares.)\n\nHe decides to replace each . in our H strings with a digit that represents the number of bomb squares adjacent to the corresponding empty square.\n\nPrint the strings after the process.\n\nConstraints\n\n1 \\leq H,W \\leq 50\n\nS_i is a string of length W consisting of # and ..\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 H strings after the process.\n\nThe i-th line should contain a string T_i of length W, where the j-th character in T_i corresponds to the square at the i-th row from the top and j-th row from the left in the grid (1 \\leq i \\leq H, 1 \\leq j \\leq W).\n\nSample Input 1\n\n3 5\n.....\n.#.#.\n.....\n\nSample Output 1\n\n11211\n1#2#1\n11211\n\nFor example, let us observe the empty square at the first row from the top and first column from the left.\n\nThere is one bomb square adjacent to this empty square: the square at the second row and second column.\n\nThus, the . corresponding to this empty square is replaced with 1.\n\nSample Input 2\n\n3 5\n#####\n#####\n#####\n\nSample Output 2\n\n#####\n#####\n#####\n\nIt is possible that there is no empty square.\n\nSample Input 3\n\n6 6\n#####.\n#.#.##\n####.#\n.#..#.\n#.##..\n#.#...\n\nSample Output 3\n\n#####3\n#8#7##\n####5#\n4#65#2\n#5##21\n#4#310", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1583, "cpu_time_ms": 105, "memory_kb": 22100}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s918783083", "group_id": "codeNet:p03574", "input_text": "import java.io.*;\nimport java.util.*;\nimport static java.lang.Math.*;\n\npublic class Main {\n public static void main(String[] args) {\n Main main = new Main();\n main.solve(args);\n }\n\n public void solve(String[] args) {\n MyScanner scanner = new MyScanner();\n int H = scanner.nextInt();\n int W = scanner.nextInt();\n List list = new ArrayList<>();\n for (int i = 0; i < H; i++) {\n list.add(scanner.next());\n }\n for (int i = 0; i < H; i++) {\n for (int j = 0; j < W; j++) {\n if (list.get(i).charAt(j) == '#') {\n System.out.print(\"#\");\n continue;\n }\n int c = 0;\n if (i > 0 && j > 0 && list.get(i-1).charAt(j-1) == '#') {\n c++;\n }\n if (i > 0 && list.get(i-1).charAt(j) == '#') {\n c++;\n }\n if (i > 0 && j < W -1 && list.get(i-1).charAt(j+1) == '#') {\n c++;\n }\n\n if (j > 0 && list.get(i).charAt(j-1) == '#') {\n c++;\n }\n if (j < W -1 && list.get(i).charAt(j+1) == '#') {\n c++;\n }\n\n if (i < H -1 && j > 0 && list.get(i+1).charAt(j-1) == '#') {\n c++;\n }\n if (i < H -1 && list.get(i+1).charAt(j) == '#') {\n c++;\n }\n if (i < H -1 && j < W -1 && list.get(i+1).charAt(j+1) == '#') {\n c++;\n }\n System.out.print(c);\n }\n System.out.println(\"\");\n }\n }\n\n private class MyScanner {\n String[] s;\n int i;\n BufferedReader br;\n String reg = \" \";\n\n MyScanner () {\n s = new String[0];\n i = 0;\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n public String next() {\n try {\n if (i < s.length) return s[i++];\n String line = br.readLine();\n while (line.equals(\"\")) {\n line = br.readLine();\n }\n s = line.split(reg, 0);\n i = 0;\n return s[i++];\n } catch (Exception e) {\n e.printStackTrace();\n }\n return null;\n }\n\n public int nextInt() {\n try {\n return Integer.parseInt(next());\n } catch (Exception e) {\n e.printStackTrace();\n }\n return -1;\n }\n\n public double nextDouble() {\n try {\n return Double.parseDouble(next());\n } catch (Exception e) {\n e.printStackTrace();\n }\n return -1;\n }\n\n public long nextLong() {\n try {\n return Long.parseLong(next());\n } catch (Exception e) {\n e.printStackTrace();\n }\n return -1;\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1508030027, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03574.html", "problem_id": "p03574", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03574/input.txt", "sample_output_relpath": "derived/input_output/data/p03574/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03574/Java/s918783083.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s918783083", "user_id": "u796228844"}, "prompt_components": {"gold_output": "11211\n1#2#1\n11211\n", "input_to_evaluate": "import java.io.*;\nimport java.util.*;\nimport static java.lang.Math.*;\n\npublic class Main {\n public static void main(String[] args) {\n Main main = new Main();\n main.solve(args);\n }\n\n public void solve(String[] args) {\n MyScanner scanner = new MyScanner();\n int H = scanner.nextInt();\n int W = scanner.nextInt();\n List list = new ArrayList<>();\n for (int i = 0; i < H; i++) {\n list.add(scanner.next());\n }\n for (int i = 0; i < H; i++) {\n for (int j = 0; j < W; j++) {\n if (list.get(i).charAt(j) == '#') {\n System.out.print(\"#\");\n continue;\n }\n int c = 0;\n if (i > 0 && j > 0 && list.get(i-1).charAt(j-1) == '#') {\n c++;\n }\n if (i > 0 && list.get(i-1).charAt(j) == '#') {\n c++;\n }\n if (i > 0 && j < W -1 && list.get(i-1).charAt(j+1) == '#') {\n c++;\n }\n\n if (j > 0 && list.get(i).charAt(j-1) == '#') {\n c++;\n }\n if (j < W -1 && list.get(i).charAt(j+1) == '#') {\n c++;\n }\n\n if (i < H -1 && j > 0 && list.get(i+1).charAt(j-1) == '#') {\n c++;\n }\n if (i < H -1 && list.get(i+1).charAt(j) == '#') {\n c++;\n }\n if (i < H -1 && j < W -1 && list.get(i+1).charAt(j+1) == '#') {\n c++;\n }\n System.out.print(c);\n }\n System.out.println(\"\");\n }\n }\n\n private class MyScanner {\n String[] s;\n int i;\n BufferedReader br;\n String reg = \" \";\n\n MyScanner () {\n s = new String[0];\n i = 0;\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n public String next() {\n try {\n if (i < s.length) return s[i++];\n String line = br.readLine();\n while (line.equals(\"\")) {\n line = br.readLine();\n }\n s = line.split(reg, 0);\n i = 0;\n return s[i++];\n } catch (Exception e) {\n e.printStackTrace();\n }\n return null;\n }\n\n public int nextInt() {\n try {\n return Integer.parseInt(next());\n } catch (Exception e) {\n e.printStackTrace();\n }\n return -1;\n }\n\n public double nextDouble() {\n try {\n return Double.parseDouble(next());\n } catch (Exception e) {\n e.printStackTrace();\n }\n return -1;\n }\n\n public long nextLong() {\n try {\n return Long.parseLong(next());\n } catch (Exception e) {\n e.printStackTrace();\n }\n return -1;\n }\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given an H × W grid.\n\nThe squares in the grid are described by H strings, S_1,...,S_H.\n\nThe j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \\leq i \\leq H,1 \\leq j \\leq W).\n\n. stands for an empty square, and # stands for a square containing a bomb.\n\nDolphin is interested in how many bomb squares are horizontally, vertically or diagonally adjacent to each empty square.\n\n(Below, we will simply say \"adjacent\" for this meaning. For each square, there are at most eight adjacent squares.)\n\nHe decides to replace each . in our H strings with a digit that represents the number of bomb squares adjacent to the corresponding empty square.\n\nPrint the strings after the process.\n\nConstraints\n\n1 \\leq H,W \\leq 50\n\nS_i is a string of length W consisting of # and ..\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 H strings after the process.\n\nThe i-th line should contain a string T_i of length W, where the j-th character in T_i corresponds to the square at the i-th row from the top and j-th row from the left in the grid (1 \\leq i \\leq H, 1 \\leq j \\leq W).\n\nSample Input 1\n\n3 5\n.....\n.#.#.\n.....\n\nSample Output 1\n\n11211\n1#2#1\n11211\n\nFor example, let us observe the empty square at the first row from the top and first column from the left.\n\nThere is one bomb square adjacent to this empty square: the square at the second row and second column.\n\nThus, the . corresponding to this empty square is replaced with 1.\n\nSample Input 2\n\n3 5\n#####\n#####\n#####\n\nSample Output 2\n\n#####\n#####\n#####\n\nIt is possible that there is no empty square.\n\nSample Input 3\n\n6 6\n#####.\n#.#.##\n####.#\n.#..#.\n#.##..\n#.#...\n\nSample Output 3\n\n#####3\n#8#7##\n####5#\n4#65#2\n#5##21\n#4#310", "sample_input": "3 5\n.....\n.#.#.\n.....\n"}, "reference_outputs": ["11211\n1#2#1\n11211\n"], "source_document_id": "p03574", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given an H × W grid.\n\nThe squares in the grid are described by H strings, S_1,...,S_H.\n\nThe j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \\leq i \\leq H,1 \\leq j \\leq W).\n\n. stands for an empty square, and # stands for a square containing a bomb.\n\nDolphin is interested in how many bomb squares are horizontally, vertically or diagonally adjacent to each empty square.\n\n(Below, we will simply say \"adjacent\" for this meaning. For each square, there are at most eight adjacent squares.)\n\nHe decides to replace each . in our H strings with a digit that represents the number of bomb squares adjacent to the corresponding empty square.\n\nPrint the strings after the process.\n\nConstraints\n\n1 \\leq H,W \\leq 50\n\nS_i is a string of length W consisting of # and ..\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 H strings after the process.\n\nThe i-th line should contain a string T_i of length W, where the j-th character in T_i corresponds to the square at the i-th row from the top and j-th row from the left in the grid (1 \\leq i \\leq H, 1 \\leq j \\leq W).\n\nSample Input 1\n\n3 5\n.....\n.#.#.\n.....\n\nSample Output 1\n\n11211\n1#2#1\n11211\n\nFor example, let us observe the empty square at the first row from the top and first column from the left.\n\nThere is one bomb square adjacent to this empty square: the square at the second row and second column.\n\nThus, the . corresponding to this empty square is replaced with 1.\n\nSample Input 2\n\n3 5\n#####\n#####\n#####\n\nSample Output 2\n\n#####\n#####\n#####\n\nIt is possible that there is no empty square.\n\nSample Input 3\n\n6 6\n#####.\n#.#.##\n####.#\n.#..#.\n#.##..\n#.#...\n\nSample Output 3\n\n#####3\n#8#7##\n####5#\n4#65#2\n#5##21\n#4#310", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3163, "cpu_time_ms": 100, "memory_kb": 21204}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s996386183", "group_id": "codeNet:p03574", "input_text": "import java.util.Scanner;\n\npublic class Main {\n int h, w;\n char[][] cs;\n public static void main(String[] args) {\n Main m = new Main();\n m.read();\n m.solve();\n }\n\n private void read() {\n Scanner sc = new Scanner(System.in);\n h = sc.nextInt();\n w = sc.nextInt();\n cs = new char[h][];\n sc.nextLine();\n for (int i = 0; i < h; i++) {\n cs[i] = sc.nextLine().toCharArray();\n }\n }\n\n private void solve() {\n int[][] ans = new int[h][w];\n for (int i = 0; i < h; i++) {\n for (int j = 0; j < w; j++) {\n int cnt = 0;\n for (int dx = -1; dx <= 1; dx++) {\n for (int dy = -1; dy <= 1; dy++) {\n if (dx == dy && dx == 0)\n continue;\n int x = dx + j;\n int y = dy + i;\n if (x >= 0 && x < w && y >= 0 && y < h) {\n if (cs[y][x] == '#')\n cnt++;\n }\n }\n }\n ans[i][j] = cnt;\n }\n }\n\n for (int i = 0; i < h; i++) {\n for (int j = 0; j < w; j++) {\n if (cs[i][j] == '#')\n System.out.print('#');\n else\n System.out.printf(\"%d\", ans[i][j]);\n }\n System.out.println();\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1508029645, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03574.html", "problem_id": "p03574", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03574/input.txt", "sample_output_relpath": "derived/input_output/data/p03574/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03574/Java/s996386183.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s996386183", "user_id": "u067614599"}, "prompt_components": {"gold_output": "11211\n1#2#1\n11211\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n int h, w;\n char[][] cs;\n public static void main(String[] args) {\n Main m = new Main();\n m.read();\n m.solve();\n }\n\n private void read() {\n Scanner sc = new Scanner(System.in);\n h = sc.nextInt();\n w = sc.nextInt();\n cs = new char[h][];\n sc.nextLine();\n for (int i = 0; i < h; i++) {\n cs[i] = sc.nextLine().toCharArray();\n }\n }\n\n private void solve() {\n int[][] ans = new int[h][w];\n for (int i = 0; i < h; i++) {\n for (int j = 0; j < w; j++) {\n int cnt = 0;\n for (int dx = -1; dx <= 1; dx++) {\n for (int dy = -1; dy <= 1; dy++) {\n if (dx == dy && dx == 0)\n continue;\n int x = dx + j;\n int y = dy + i;\n if (x >= 0 && x < w && y >= 0 && y < h) {\n if (cs[y][x] == '#')\n cnt++;\n }\n }\n }\n ans[i][j] = cnt;\n }\n }\n\n for (int i = 0; i < h; i++) {\n for (int j = 0; j < w; j++) {\n if (cs[i][j] == '#')\n System.out.print('#');\n else\n System.out.printf(\"%d\", ans[i][j]);\n }\n System.out.println();\n }\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given an H × W grid.\n\nThe squares in the grid are described by H strings, S_1,...,S_H.\n\nThe j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \\leq i \\leq H,1 \\leq j \\leq W).\n\n. stands for an empty square, and # stands for a square containing a bomb.\n\nDolphin is interested in how many bomb squares are horizontally, vertically or diagonally adjacent to each empty square.\n\n(Below, we will simply say \"adjacent\" for this meaning. For each square, there are at most eight adjacent squares.)\n\nHe decides to replace each . in our H strings with a digit that represents the number of bomb squares adjacent to the corresponding empty square.\n\nPrint the strings after the process.\n\nConstraints\n\n1 \\leq H,W \\leq 50\n\nS_i is a string of length W consisting of # and ..\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 H strings after the process.\n\nThe i-th line should contain a string T_i of length W, where the j-th character in T_i corresponds to the square at the i-th row from the top and j-th row from the left in the grid (1 \\leq i \\leq H, 1 \\leq j \\leq W).\n\nSample Input 1\n\n3 5\n.....\n.#.#.\n.....\n\nSample Output 1\n\n11211\n1#2#1\n11211\n\nFor example, let us observe the empty square at the first row from the top and first column from the left.\n\nThere is one bomb square adjacent to this empty square: the square at the second row and second column.\n\nThus, the . corresponding to this empty square is replaced with 1.\n\nSample Input 2\n\n3 5\n#####\n#####\n#####\n\nSample Output 2\n\n#####\n#####\n#####\n\nIt is possible that there is no empty square.\n\nSample Input 3\n\n6 6\n#####.\n#.#.##\n####.#\n.#..#.\n#.##..\n#.#...\n\nSample Output 3\n\n#####3\n#8#7##\n####5#\n4#65#2\n#5##21\n#4#310", "sample_input": "3 5\n.....\n.#.#.\n.....\n"}, "reference_outputs": ["11211\n1#2#1\n11211\n"], "source_document_id": "p03574", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given an H × W grid.\n\nThe squares in the grid are described by H strings, S_1,...,S_H.\n\nThe j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \\leq i \\leq H,1 \\leq j \\leq W).\n\n. stands for an empty square, and # stands for a square containing a bomb.\n\nDolphin is interested in how many bomb squares are horizontally, vertically or diagonally adjacent to each empty square.\n\n(Below, we will simply say \"adjacent\" for this meaning. For each square, there are at most eight adjacent squares.)\n\nHe decides to replace each . in our H strings with a digit that represents the number of bomb squares adjacent to the corresponding empty square.\n\nPrint the strings after the process.\n\nConstraints\n\n1 \\leq H,W \\leq 50\n\nS_i is a string of length W consisting of # and ..\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 H strings after the process.\n\nThe i-th line should contain a string T_i of length W, where the j-th character in T_i corresponds to the square at the i-th row from the top and j-th row from the left in the grid (1 \\leq i \\leq H, 1 \\leq j \\leq W).\n\nSample Input 1\n\n3 5\n.....\n.#.#.\n.....\n\nSample Output 1\n\n11211\n1#2#1\n11211\n\nFor example, let us observe the empty square at the first row from the top and first column from the left.\n\nThere is one bomb square adjacent to this empty square: the square at the second row and second column.\n\nThus, the . corresponding to this empty square is replaced with 1.\n\nSample Input 2\n\n3 5\n#####\n#####\n#####\n\nSample Output 2\n\n#####\n#####\n#####\n\nIt is possible that there is no empty square.\n\nSample Input 3\n\n6 6\n#####.\n#.#.##\n####.#\n.#..#.\n#.##..\n#.#...\n\nSample Output 3\n\n#####3\n#8#7##\n####5#\n4#65#2\n#5##21\n#4#310", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1501, "cpu_time_ms": 208, "memory_kb": 23692}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s002455333", "group_id": "codeNet:p03606", "input_text": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n \n\t\t// 整数の入力\n\t\tint n = sc.nextInt();\n int ans = 0;\n for (int i = 0; i < n; i++) {\n ans -= sc.nextInt() - sc.nextInt() - 1; \n }\n \n\t\t// 出力\n\t\tSystem.out.println(ans);\n\t}\n}", "language": "Java", "metadata": {"date": 1568681382, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03606.html", "problem_id": "p03606", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03606/input.txt", "sample_output_relpath": "derived/input_output/data/p03606/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03606/Java/s002455333.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s002455333", "user_id": "u711620077"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n \n\t\t// 整数の入力\n\t\tint n = sc.nextInt();\n int ans = 0;\n for (int i = 0; i < n; i++) {\n ans -= sc.nextInt() - sc.nextInt() - 1; \n }\n \n\t\t// 出力\n\t\tSystem.out.println(ans);\n\t}\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nJoisino is working as a receptionist at a theater.\n\nThe theater has 100000 seats, numbered from 1 to 100000.\n\nAccording to her memo, N groups of audiences have come so far, and the i-th group occupies the consecutive seats from Seat l_i to Seat r_i (inclusive).\n\nHow many people are sitting at the theater now?\n\nConstraints\n\n1≤N≤1000\n\n1≤l_i≤r_i≤100000\n\nNo seat is occupied by more than one person.\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nl_1 r_1\n:\nl_N r_N\n\nOutput\n\nPrint the number of people sitting at the theater.\n\nSample Input 1\n\n1\n24 30\n\nSample Output 1\n\n7\n\nThere are 7 people, sitting at Seat 24,25,26,27,28,29 and 30.\n\nSample Input 2\n\n2\n6 8\n3 3\n\nSample Output 2\n\n4", "sample_input": "1\n24 30\n"}, "reference_outputs": ["7\n"], "source_document_id": "p03606", "source_text": "Score : 200 points\n\nProblem Statement\n\nJoisino is working as a receptionist at a theater.\n\nThe theater has 100000 seats, numbered from 1 to 100000.\n\nAccording to her memo, N groups of audiences have come so far, and the i-th group occupies the consecutive seats from Seat l_i to Seat r_i (inclusive).\n\nHow many people are sitting at the theater now?\n\nConstraints\n\n1≤N≤1000\n\n1≤l_i≤r_i≤100000\n\nNo seat is occupied by more than one person.\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nl_1 r_1\n:\nl_N r_N\n\nOutput\n\nPrint the number of people sitting at the theater.\n\nSample Input 1\n\n1\n24 30\n\nSample Output 1\n\n7\n\nThere are 7 people, sitting at Seat 24,25,26,27,28,29 and 30.\n\nSample Input 2\n\n2\n6 8\n3 3\n\nSample Output 2\n\n4", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 338, "cpu_time_ms": 144, "memory_kb": 24084}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s453233972", "group_id": "codeNet:p03606", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = Integer.parseInt(sc.nextLine());\n\n\t\tint totalVisitor = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint l = sc.nextInt();\n\t\t\tint r = sc.nextInt();\n\t\t\ttotalVisitor += r - l + 1;\n\t\t}\n\n\t\tSystem.out.println(totalVisitor);\n\n\t\tsc.close();\n\t}\n}", "language": "Java", "metadata": {"date": 1544090167, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03606.html", "problem_id": "p03606", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03606/input.txt", "sample_output_relpath": "derived/input_output/data/p03606/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03606/Java/s453233972.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s453233972", "user_id": "u694845319"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = Integer.parseInt(sc.nextLine());\n\n\t\tint totalVisitor = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint l = sc.nextInt();\n\t\t\tint r = sc.nextInt();\n\t\t\ttotalVisitor += r - l + 1;\n\t\t}\n\n\t\tSystem.out.println(totalVisitor);\n\n\t\tsc.close();\n\t}\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nJoisino is working as a receptionist at a theater.\n\nThe theater has 100000 seats, numbered from 1 to 100000.\n\nAccording to her memo, N groups of audiences have come so far, and the i-th group occupies the consecutive seats from Seat l_i to Seat r_i (inclusive).\n\nHow many people are sitting at the theater now?\n\nConstraints\n\n1≤N≤1000\n\n1≤l_i≤r_i≤100000\n\nNo seat is occupied by more than one person.\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nl_1 r_1\n:\nl_N r_N\n\nOutput\n\nPrint the number of people sitting at the theater.\n\nSample Input 1\n\n1\n24 30\n\nSample Output 1\n\n7\n\nThere are 7 people, sitting at Seat 24,25,26,27,28,29 and 30.\n\nSample Input 2\n\n2\n6 8\n3 3\n\nSample Output 2\n\n4", "sample_input": "1\n24 30\n"}, "reference_outputs": ["7\n"], "source_document_id": "p03606", "source_text": "Score : 200 points\n\nProblem Statement\n\nJoisino is working as a receptionist at a theater.\n\nThe theater has 100000 seats, numbered from 1 to 100000.\n\nAccording to her memo, N groups of audiences have come so far, and the i-th group occupies the consecutive seats from Seat l_i to Seat r_i (inclusive).\n\nHow many people are sitting at the theater now?\n\nConstraints\n\n1≤N≤1000\n\n1≤l_i≤r_i≤100000\n\nNo seat is occupied by more than one person.\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nl_1 r_1\n:\nl_N r_N\n\nOutput\n\nPrint the number of people sitting at the theater.\n\nSample Input 1\n\n1\n24 30\n\nSample Output 1\n\n7\n\nThere are 7 people, sitting at Seat 24,25,26,27,28,29 and 30.\n\nSample Input 2\n\n2\n6 8\n3 3\n\nSample Output 2\n\n4", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 149, "memory_kb": 25836}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s883271902", "group_id": "codeNet:p03606", "input_text": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.util.InputMismatchException;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tFastScannerB sc = new FastScannerB(System.in);\n\t\t\n\t\tint N = sc.nextInt();\n\t\tint total = 0;\n\t\tfor(int i = 0; i= numChars)\n {\n curChar = 0;\n try\n {\n numChars = stream.read(buf);\n } catch (IOException e)\n {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public int nextInt()\n {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-')\n {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do\n {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public String next()\n {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do\n {\n res.appendCodePoint(c);\n c = read();\n } while (!isSpaceChar(c));\n return res.toString();\n } \n \n public double nextDouble() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n double res = 0;\n while (!isSpaceChar(c) && c != '.') {\n if (c == 'e' || c == 'E')\n return res * Math.pow(10, nextInt());\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n }\n if (c == '.') {\n c = read();\n double m = 1;\n while (!isSpaceChar(c)) {\n if (c == 'e' || c == 'E')\n return res * Math.pow(10, nextInt());\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n m /= 10;\n res += (c - '0') * m;\n c = read();\n }\n }\n return res * sgn;\n }\n \n public long nextLong() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n \n public boolean isSpaceChar(int c)\n {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n \n public boolean isLineEndChar(int c)\n {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == '\\n' || c == '\\r' || c == -1;\n }\n\n public interface SpaceCharFilter\n {\n public boolean isSpaceChar(int ch);\n }\n}", "language": "Java", "metadata": {"date": 1505005407, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03606.html", "problem_id": "p03606", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03606/input.txt", "sample_output_relpath": "derived/input_output/data/p03606/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03606/Java/s883271902.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s883271902", "user_id": "u174093453"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.util.InputMismatchException;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tFastScannerB sc = new FastScannerB(System.in);\n\t\t\n\t\tint N = sc.nextInt();\n\t\tint total = 0;\n\t\tfor(int i = 0; i= numChars)\n {\n curChar = 0;\n try\n {\n numChars = stream.read(buf);\n } catch (IOException e)\n {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public int nextInt()\n {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-')\n {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do\n {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public String next()\n {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do\n {\n res.appendCodePoint(c);\n c = read();\n } while (!isSpaceChar(c));\n return res.toString();\n } \n \n public double nextDouble() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n double res = 0;\n while (!isSpaceChar(c) && c != '.') {\n if (c == 'e' || c == 'E')\n return res * Math.pow(10, nextInt());\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n }\n if (c == '.') {\n c = read();\n double m = 1;\n while (!isSpaceChar(c)) {\n if (c == 'e' || c == 'E')\n return res * Math.pow(10, nextInt());\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n m /= 10;\n res += (c - '0') * m;\n c = read();\n }\n }\n return res * sgn;\n }\n \n public long nextLong() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n long res = 0;\n do {\n if (c < '0' || c > '9')\n throw new InputMismatchException();\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n \n public boolean isSpaceChar(int c)\n {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n \n public boolean isLineEndChar(int c)\n {\n if (filter != null)\n return filter.isSpaceChar(c);\n return c == '\\n' || c == '\\r' || c == -1;\n }\n\n public interface SpaceCharFilter\n {\n public boolean isSpaceChar(int ch);\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nJoisino is working as a receptionist at a theater.\n\nThe theater has 100000 seats, numbered from 1 to 100000.\n\nAccording to her memo, N groups of audiences have come so far, and the i-th group occupies the consecutive seats from Seat l_i to Seat r_i (inclusive).\n\nHow many people are sitting at the theater now?\n\nConstraints\n\n1≤N≤1000\n\n1≤l_i≤r_i≤100000\n\nNo seat is occupied by more than one person.\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nl_1 r_1\n:\nl_N r_N\n\nOutput\n\nPrint the number of people sitting at the theater.\n\nSample Input 1\n\n1\n24 30\n\nSample Output 1\n\n7\n\nThere are 7 people, sitting at Seat 24,25,26,27,28,29 and 30.\n\nSample Input 2\n\n2\n6 8\n3 3\n\nSample Output 2\n\n4", "sample_input": "1\n24 30\n"}, "reference_outputs": ["7\n"], "source_document_id": "p03606", "source_text": "Score : 200 points\n\nProblem Statement\n\nJoisino is working as a receptionist at a theater.\n\nThe theater has 100000 seats, numbered from 1 to 100000.\n\nAccording to her memo, N groups of audiences have come so far, and the i-th group occupies the consecutive seats from Seat l_i to Seat r_i (inclusive).\n\nHow many people are sitting at the theater now?\n\nConstraints\n\n1≤N≤1000\n\n1≤l_i≤r_i≤100000\n\nNo seat is occupied by more than one person.\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nl_1 r_1\n:\nl_N r_N\n\nOutput\n\nPrint the number of people sitting at the theater.\n\nSample Input 1\n\n1\n24 30\n\nSample Output 1\n\n7\n\nThere are 7 people, sitting at Seat 24,25,26,27,28,29 and 30.\n\nSample Input 2\n\n2\n6 8\n3 3\n\nSample Output 2\n\n4", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3894, "cpu_time_ms": 118, "memory_kb": 21204}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s900169181", "group_id": "codeNet:p03624", "input_text": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n char[] array = sc.nextLine().toCharArray();\n\n Set list = new HashSet();\n for(Character c: array) {\n list.add(c);\n }\n\n for(char ch = 'a'; ch<='z'; ch++) {\n if(!list.contains(ch)) {\n System.out.println(ch);\n System.exit(0);\n }\n }\n System.out.println(\"None\");\n }\n}\n", "language": "Java", "metadata": {"date": 1589779577, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03624.html", "problem_id": "p03624", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03624/input.txt", "sample_output_relpath": "derived/input_output/data/p03624/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03624/Java/s900169181.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s900169181", "user_id": "u604773739"}, "prompt_components": {"gold_output": "b\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n char[] array = sc.nextLine().toCharArray();\n\n Set list = new HashSet();\n for(Character c: array) {\n list.add(c);\n }\n\n for(char ch = 'a'; ch<='z'; ch++) {\n if(!list.contains(ch)) {\n System.out.println(ch);\n System.exit(0);\n }\n }\n System.out.println(\"None\");\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nFind the lexicographically (alphabetically) smallest lowercase English letter that does not occur in S.\nIf every lowercase English letter occurs in S, print None instead.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5 (|S| is the length of string S.)\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 lexicographically smallest lowercase English letter that does not occur in S.\nIf every lowercase English letter occurs in S, print None instead.\n\nSample Input 1\n\natcoderregularcontest\n\nSample Output 1\n\nb\n\nThe string atcoderregularcontest contains a, but does not contain b.\n\nSample Input 2\n\nabcdefghijklmnopqrstuvwxyz\n\nSample Output 2\n\nNone\n\nThis string contains every lowercase English letter.\n\nSample Input 3\n\nfajsonlslfepbjtsaayxbymeskptcumtwrmkkinjxnnucagfrg\n\nSample Output 3\n\nd", "sample_input": "atcoderregularcontest\n"}, "reference_outputs": ["b\n"], "source_document_id": "p03624", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nFind the lexicographically (alphabetically) smallest lowercase English letter that does not occur in S.\nIf every lowercase English letter occurs in S, print None instead.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5 (|S| is the length of string S.)\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 lexicographically smallest lowercase English letter that does not occur in S.\nIf every lowercase English letter occurs in S, print None instead.\n\nSample Input 1\n\natcoderregularcontest\n\nSample Output 1\n\nb\n\nThe string atcoderregularcontest contains a, but does not contain b.\n\nSample Input 2\n\nabcdefghijklmnopqrstuvwxyz\n\nSample Output 2\n\nNone\n\nThis string contains every lowercase English letter.\n\nSample Input 3\n\nfajsonlslfepbjtsaayxbymeskptcumtwrmkkinjxnnucagfrg\n\nSample Output 3\n\nd", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 531, "cpu_time_ms": 167, "memory_kb": 26372}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s747901203", "group_id": "codeNet:p03624", "input_text": "import java.util.*;\nimport java.util.TreeMap;\nimport java.util.List;\nimport java.util.stream.Collectors;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n char[] s = sc.next().toCharArray();\n for (char c = 'a'; c <= 'z'; c++) {\n int flag = 1;\n for (int i = 0; i < s.length; i++) {\n if (s[i] == c) {\n flag = -1;\n }\n }\n if (flag == 1) {\n System.out.println(c);\n return;\n }\n }\n System.out.println(\"None\");\n }\n}\n", "language": "Java", "metadata": {"date": 1586921762, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03624.html", "problem_id": "p03624", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03624/input.txt", "sample_output_relpath": "derived/input_output/data/p03624/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03624/Java/s747901203.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s747901203", "user_id": "u010415482"}, "prompt_components": {"gold_output": "b\n", "input_to_evaluate": "import java.util.*;\nimport java.util.TreeMap;\nimport java.util.List;\nimport java.util.stream.Collectors;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n char[] s = sc.next().toCharArray();\n for (char c = 'a'; c <= 'z'; c++) {\n int flag = 1;\n for (int i = 0; i < s.length; i++) {\n if (s[i] == c) {\n flag = -1;\n }\n }\n if (flag == 1) {\n System.out.println(c);\n return;\n }\n }\n System.out.println(\"None\");\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nFind the lexicographically (alphabetically) smallest lowercase English letter that does not occur in S.\nIf every lowercase English letter occurs in S, print None instead.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5 (|S| is the length of string S.)\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 lexicographically smallest lowercase English letter that does not occur in S.\nIf every lowercase English letter occurs in S, print None instead.\n\nSample Input 1\n\natcoderregularcontest\n\nSample Output 1\n\nb\n\nThe string atcoderregularcontest contains a, but does not contain b.\n\nSample Input 2\n\nabcdefghijklmnopqrstuvwxyz\n\nSample Output 2\n\nNone\n\nThis string contains every lowercase English letter.\n\nSample Input 3\n\nfajsonlslfepbjtsaayxbymeskptcumtwrmkkinjxnnucagfrg\n\nSample Output 3\n\nd", "sample_input": "atcoderregularcontest\n"}, "reference_outputs": ["b\n"], "source_document_id": "p03624", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nFind the lexicographically (alphabetically) smallest lowercase English letter that does not occur in S.\nIf every lowercase English letter occurs in S, print None instead.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5 (|S| is the length of string S.)\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 lexicographically smallest lowercase English letter that does not occur in S.\nIf every lowercase English letter occurs in S, print None instead.\n\nSample Input 1\n\natcoderregularcontest\n\nSample Output 1\n\nb\n\nThe string atcoderregularcontest contains a, but does not contain b.\n\nSample Input 2\n\nabcdefghijklmnopqrstuvwxyz\n\nSample Output 2\n\nNone\n\nThis string contains every lowercase English letter.\n\nSample Input 3\n\nfajsonlslfepbjtsaayxbymeskptcumtwrmkkinjxnnucagfrg\n\nSample Output 3\n\nd", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 539, "cpu_time_ms": 152, "memory_kb": 26712}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s519571972", "group_id": "codeNet:p03624", "input_text": "import java.util.*;\n\npublic class Main {\n\tpublic static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n String s=sc.next();\n String t=\"None\";\n for(int i=97;i<123;i++){\n if(!s.contains(String.valueOf((char)i))){\n t=String.valueOf((char)i);\n break;\n }\n }\n System.out.println(t);\n }\n}\n", "language": "Java", "metadata": {"date": 1572095808, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03624.html", "problem_id": "p03624", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03624/input.txt", "sample_output_relpath": "derived/input_output/data/p03624/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03624/Java/s519571972.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s519571972", "user_id": "u251779460"}, "prompt_components": {"gold_output": "b\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n\tpublic static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n String s=sc.next();\n String t=\"None\";\n for(int i=97;i<123;i++){\n if(!s.contains(String.valueOf((char)i))){\n t=String.valueOf((char)i);\n break;\n }\n }\n System.out.println(t);\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nFind the lexicographically (alphabetically) smallest lowercase English letter that does not occur in S.\nIf every lowercase English letter occurs in S, print None instead.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5 (|S| is the length of string S.)\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 lexicographically smallest lowercase English letter that does not occur in S.\nIf every lowercase English letter occurs in S, print None instead.\n\nSample Input 1\n\natcoderregularcontest\n\nSample Output 1\n\nb\n\nThe string atcoderregularcontest contains a, but does not contain b.\n\nSample Input 2\n\nabcdefghijklmnopqrstuvwxyz\n\nSample Output 2\n\nNone\n\nThis string contains every lowercase English letter.\n\nSample Input 3\n\nfajsonlslfepbjtsaayxbymeskptcumtwrmkkinjxnnucagfrg\n\nSample Output 3\n\nd", "sample_input": "atcoderregularcontest\n"}, "reference_outputs": ["b\n"], "source_document_id": "p03624", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nFind the lexicographically (alphabetically) smallest lowercase English letter that does not occur in S.\nIf every lowercase English letter occurs in S, print None instead.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5 (|S| is the length of string S.)\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 lexicographically smallest lowercase English letter that does not occur in S.\nIf every lowercase English letter occurs in S, print None instead.\n\nSample Input 1\n\natcoderregularcontest\n\nSample Output 1\n\nb\n\nThe string atcoderregularcontest contains a, but does not contain b.\n\nSample Input 2\n\nabcdefghijklmnopqrstuvwxyz\n\nSample Output 2\n\nNone\n\nThis string contains every lowercase English letter.\n\nSample Input 3\n\nfajsonlslfepbjtsaayxbymeskptcumtwrmkkinjxnnucagfrg\n\nSample Output 3\n\nd", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 146, "memory_kb": 23892}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s603980384", "group_id": "codeNet:p03624", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[]args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString s = sc.next();\n\t\tfor(char c = 'a'; c <= 'z'; c++) {\n\t\t\tif(s.indexOf(c) == -1) {\n\t\t\t\tSystem.out.println(c);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"None\");\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1565797095, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03624.html", "problem_id": "p03624", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03624/input.txt", "sample_output_relpath": "derived/input_output/data/p03624/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03624/Java/s603980384.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s603980384", "user_id": "u412290310"}, "prompt_components": {"gold_output": "b\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[]args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString s = sc.next();\n\t\tfor(char c = 'a'; c <= 'z'; c++) {\n\t\t\tif(s.indexOf(c) == -1) {\n\t\t\t\tSystem.out.println(c);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"None\");\n\t}\n\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nFind the lexicographically (alphabetically) smallest lowercase English letter that does not occur in S.\nIf every lowercase English letter occurs in S, print None instead.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5 (|S| is the length of string S.)\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 lexicographically smallest lowercase English letter that does not occur in S.\nIf every lowercase English letter occurs in S, print None instead.\n\nSample Input 1\n\natcoderregularcontest\n\nSample Output 1\n\nb\n\nThe string atcoderregularcontest contains a, but does not contain b.\n\nSample Input 2\n\nabcdefghijklmnopqrstuvwxyz\n\nSample Output 2\n\nNone\n\nThis string contains every lowercase English letter.\n\nSample Input 3\n\nfajsonlslfepbjtsaayxbymeskptcumtwrmkkinjxnnucagfrg\n\nSample Output 3\n\nd", "sample_input": "atcoderregularcontest\n"}, "reference_outputs": ["b\n"], "source_document_id": "p03624", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nFind the lexicographically (alphabetically) smallest lowercase English letter that does not occur in S.\nIf every lowercase English letter occurs in S, print None instead.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5 (|S| is the length of string S.)\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 lexicographically smallest lowercase English letter that does not occur in S.\nIf every lowercase English letter occurs in S, print None instead.\n\nSample Input 1\n\natcoderregularcontest\n\nSample Output 1\n\nb\n\nThe string atcoderregularcontest contains a, but does not contain b.\n\nSample Input 2\n\nabcdefghijklmnopqrstuvwxyz\n\nSample Output 2\n\nNone\n\nThis string contains every lowercase English letter.\n\nSample Input 3\n\nfajsonlslfepbjtsaayxbymeskptcumtwrmkkinjxnnucagfrg\n\nSample Output 3\n\nd", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 147, "memory_kb": 24220}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s581913999", "group_id": "codeNet:p03624", "input_text": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n String s = scanner.next();\n String ans = \"\";\n\n char[] alphabet = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};\n StringBuilder elem = new StringBuilder();\n\n for (int i = 0; i < alphabet.length; i++) {\n if (!s.contains(String.valueOf(alphabet[i]))) {\n elem.append(alphabet[i]);\n break;\n }\n }\n\n if (elem.length() == 0) {\n ans = \"None\";\n } else {\n ans = elem.toString();\n }\n\n\n System.out.println(ans);\n }\n}", "language": "Java", "metadata": {"date": 1519391168, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03624.html", "problem_id": "p03624", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03624/input.txt", "sample_output_relpath": "derived/input_output/data/p03624/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03624/Java/s581913999.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s581913999", "user_id": "u184005844"}, "prompt_components": {"gold_output": "b\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n String s = scanner.next();\n String ans = \"\";\n\n char[] alphabet = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};\n StringBuilder elem = new StringBuilder();\n\n for (int i = 0; i < alphabet.length; i++) {\n if (!s.contains(String.valueOf(alphabet[i]))) {\n elem.append(alphabet[i]);\n break;\n }\n }\n\n if (elem.length() == 0) {\n ans = \"None\";\n } else {\n ans = elem.toString();\n }\n\n\n System.out.println(ans);\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nFind the lexicographically (alphabetically) smallest lowercase English letter that does not occur in S.\nIf every lowercase English letter occurs in S, print None instead.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5 (|S| is the length of string S.)\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 lexicographically smallest lowercase English letter that does not occur in S.\nIf every lowercase English letter occurs in S, print None instead.\n\nSample Input 1\n\natcoderregularcontest\n\nSample Output 1\n\nb\n\nThe string atcoderregularcontest contains a, but does not contain b.\n\nSample Input 2\n\nabcdefghijklmnopqrstuvwxyz\n\nSample Output 2\n\nNone\n\nThis string contains every lowercase English letter.\n\nSample Input 3\n\nfajsonlslfepbjtsaayxbymeskptcumtwrmkkinjxnnucagfrg\n\nSample Output 3\n\nd", "sample_input": "atcoderregularcontest\n"}, "reference_outputs": ["b\n"], "source_document_id": "p03624", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nFind the lexicographically (alphabetically) smallest lowercase English letter that does not occur in S.\nIf every lowercase English letter occurs in S, print None instead.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5 (|S| is the length of string S.)\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 lexicographically smallest lowercase English letter that does not occur in S.\nIf every lowercase English letter occurs in S, print None instead.\n\nSample Input 1\n\natcoderregularcontest\n\nSample Output 1\n\nb\n\nThe string atcoderregularcontest contains a, but does not contain b.\n\nSample Input 2\n\nabcdefghijklmnopqrstuvwxyz\n\nSample Output 2\n\nNone\n\nThis string contains every lowercase English letter.\n\nSample Input 3\n\nfajsonlslfepbjtsaayxbymeskptcumtwrmkkinjxnnucagfrg\n\nSample Output 3\n\nd", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 143, "memory_kb": 22632}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s696594116", "group_id": "codeNet:p03624", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString s = sc.nextLine();\n\t\tsc.close();\n\t\tfor (int i = 97; i < 123; i++) {\n\t\t\tchar c = (char) i;\n\t\t\tfor (int j = 0; j < s.length(); j++) {\n\t\t\t\tchar c2 = s.charAt(j);\n\t\t\t\tif (c == c2) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (j + 1 == s.length() && c != c2) {\n\t\t\t\t\tSystem.out.println(c);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"None\");\n\t}\n}\n", "language": "Java", "metadata": {"date": 1504636491, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03624.html", "problem_id": "p03624", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03624/input.txt", "sample_output_relpath": "derived/input_output/data/p03624/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03624/Java/s696594116.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s696594116", "user_id": "u502053317"}, "prompt_components": {"gold_output": "b\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString s = sc.nextLine();\n\t\tsc.close();\n\t\tfor (int i = 97; i < 123; i++) {\n\t\t\tchar c = (char) i;\n\t\t\tfor (int j = 0; j < s.length(); j++) {\n\t\t\t\tchar c2 = s.charAt(j);\n\t\t\t\tif (c == c2) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (j + 1 == s.length() && c != c2) {\n\t\t\t\t\tSystem.out.println(c);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"None\");\n\t}\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nFind the lexicographically (alphabetically) smallest lowercase English letter that does not occur in S.\nIf every lowercase English letter occurs in S, print None instead.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5 (|S| is the length of string S.)\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 lexicographically smallest lowercase English letter that does not occur in S.\nIf every lowercase English letter occurs in S, print None instead.\n\nSample Input 1\n\natcoderregularcontest\n\nSample Output 1\n\nb\n\nThe string atcoderregularcontest contains a, but does not contain b.\n\nSample Input 2\n\nabcdefghijklmnopqrstuvwxyz\n\nSample Output 2\n\nNone\n\nThis string contains every lowercase English letter.\n\nSample Input 3\n\nfajsonlslfepbjtsaayxbymeskptcumtwrmkkinjxnnucagfrg\n\nSample Output 3\n\nd", "sample_input": "atcoderregularcontest\n"}, "reference_outputs": ["b\n"], "source_document_id": "p03624", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nFind the lexicographically (alphabetically) smallest lowercase English letter that does not occur in S.\nIf every lowercase English letter occurs in S, print None instead.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5 (|S| is the length of string S.)\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 lexicographically smallest lowercase English letter that does not occur in S.\nIf every lowercase English letter occurs in S, print None instead.\n\nSample Input 1\n\natcoderregularcontest\n\nSample Output 1\n\nb\n\nThe string atcoderregularcontest contains a, but does not contain b.\n\nSample Input 2\n\nabcdefghijklmnopqrstuvwxyz\n\nSample Output 2\n\nNone\n\nThis string contains every lowercase English letter.\n\nSample Input 3\n\nfajsonlslfepbjtsaayxbymeskptcumtwrmkkinjxnnucagfrg\n\nSample Output 3\n\nd", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 467, "cpu_time_ms": 166, "memory_kb": 26308}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s378149246", "group_id": "codeNet:p03624", "input_text": "import java.util.*;\npublic class Main{\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n String s = scan.next();\n char[] arr = s.toCharArray();\n int len = s.length();\n if(len == 0){\n System.out.println(\"a\");\n return;\n }\n HashSet set = new HashSet<>();\n for(int i=0;i set = new HashSet<>();\n for(int i=0;i= cnt3) yon = false; \n\n if(yon) System.out.println(\"Yes\");\n else System.out.println(\"No\");\n\n }\n}\n", "language": "Java", "metadata": {"date": 1598373270, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p03639.html", "problem_id": "p03639", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03639/input.txt", "sample_output_relpath": "derived/input_output/data/p03639/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03639/Java/s251803435.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s251803435", "user_id": "u591547748"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.*;\nimport java.lang.Math;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n \n\tint n = sc.nextInt();\n int istack;\n int cnt = 0;\n int cnt2 = 0;\n int cnt3 = 0;\n int ef;\n boolean yon =true;\n \n for(int i = 0; i < n;i++) {\n istack = sc.nextInt();\n if(istack % 4 == 0) cnt++;\n else if(istack % 2 == 0) cnt2++;\n else cnt3++;\n }\n \tcnt3++;\n \n if(cnt*2+1 >= cnt3) yon = false; \n\n if(yon) System.out.println(\"Yes\");\n else System.out.println(\"No\");\n\n }\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a sequence of length N, a = (a_1, a_2, ..., a_N).\nEach a_i is a positive integer.\n\nSnuke's objective is to permute the element in a so that the following condition is satisfied:\n\nFor each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a multiple of 4.\n\nDetermine whether Snuke can achieve his objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\na_i is an integer.\n\n1 ≤ a_i ≤ 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\nIf Snuke can achieve his objective, print Yes; otherwise, print No.\n\nSample Input 1\n\n3\n1 10 100\n\nSample Output 1\n\nYes\n\nOne solution is (1, 100, 10).\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\nNo\n\nIt is impossible to permute a so that the condition is satisfied.\n\nSample Input 3\n\n3\n1 4 1\n\nSample Output 3\n\nYes\n\nThe condition is already satisfied initially.\n\nSample Input 4\n\n2\n1 1\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n6\n2 7 1 8 2 8\n\nSample Output 5\n\nYes", "sample_input": "3\n1 10 100\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03639", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a sequence of length N, a = (a_1, a_2, ..., a_N).\nEach a_i is a positive integer.\n\nSnuke's objective is to permute the element in a so that the following condition is satisfied:\n\nFor each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a multiple of 4.\n\nDetermine whether Snuke can achieve his objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\na_i is an integer.\n\n1 ≤ a_i ≤ 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\nIf Snuke can achieve his objective, print Yes; otherwise, print No.\n\nSample Input 1\n\n3\n1 10 100\n\nSample Output 1\n\nYes\n\nOne solution is (1, 100, 10).\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\nNo\n\nIt is impossible to permute a so that the condition is satisfied.\n\nSample Input 3\n\n3\n1 4 1\n\nSample Output 3\n\nYes\n\nThe condition is already satisfied initially.\n\nSample Input 4\n\n2\n1 1\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n6\n2 7 1 8 2 8\n\nSample Output 5\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 580, "cpu_time_ms": 460, "memory_kb": 58852}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s243487493", "group_id": "codeNet:p03639", "input_text": "import java.io.*;\nimport java.math.*;\nimport java.util.*;\npublic class Main {\n \n\tpublic static void main(String[] args) { \n\t\tScanner input = new Scanner(System.in);\n\t\tint N = input.nextInt();\n\t\tint T = 0;\n\t\tint F = 0; //Two and four\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tint x = input.nextInt();\n\t\t\tif (x%4==0) F++;\n\t\t\telse if (x%2==0) T++;\n\t\t}\n\t\tif (T>1) N-=T; //multiples of two can be joined as one contiguous sub-array since 2^2 = 4\n\t\tN-=3;\n\t\tF--;\n\t\tN-=F*2;\n\t\tSystem.out.println(N<=0?\"Yes\":\"No\");\n\t}\n}", "language": "Java", "metadata": {"date": 1592666211, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03639.html", "problem_id": "p03639", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03639/input.txt", "sample_output_relpath": "derived/input_output/data/p03639/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03639/Java/s243487493.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s243487493", "user_id": "u263333739"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.io.*;\nimport java.math.*;\nimport java.util.*;\npublic class Main {\n \n\tpublic static void main(String[] args) { \n\t\tScanner input = new Scanner(System.in);\n\t\tint N = input.nextInt();\n\t\tint T = 0;\n\t\tint F = 0; //Two and four\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tint x = input.nextInt();\n\t\t\tif (x%4==0) F++;\n\t\t\telse if (x%2==0) T++;\n\t\t}\n\t\tif (T>1) N-=T; //multiples of two can be joined as one contiguous sub-array since 2^2 = 4\n\t\tN-=3;\n\t\tF--;\n\t\tN-=F*2;\n\t\tSystem.out.println(N<=0?\"Yes\":\"No\");\n\t}\n}", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a sequence of length N, a = (a_1, a_2, ..., a_N).\nEach a_i is a positive integer.\n\nSnuke's objective is to permute the element in a so that the following condition is satisfied:\n\nFor each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a multiple of 4.\n\nDetermine whether Snuke can achieve his objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\na_i is an integer.\n\n1 ≤ a_i ≤ 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\nIf Snuke can achieve his objective, print Yes; otherwise, print No.\n\nSample Input 1\n\n3\n1 10 100\n\nSample Output 1\n\nYes\n\nOne solution is (1, 100, 10).\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\nNo\n\nIt is impossible to permute a so that the condition is satisfied.\n\nSample Input 3\n\n3\n1 4 1\n\nSample Output 3\n\nYes\n\nThe condition is already satisfied initially.\n\nSample Input 4\n\n2\n1 1\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n6\n2 7 1 8 2 8\n\nSample Output 5\n\nYes", "sample_input": "3\n1 10 100\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03639", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a sequence of length N, a = (a_1, a_2, ..., a_N).\nEach a_i is a positive integer.\n\nSnuke's objective is to permute the element in a so that the following condition is satisfied:\n\nFor each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a multiple of 4.\n\nDetermine whether Snuke can achieve his objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\na_i is an integer.\n\n1 ≤ a_i ≤ 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\nIf Snuke can achieve his objective, print Yes; otherwise, print No.\n\nSample Input 1\n\n3\n1 10 100\n\nSample Output 1\n\nYes\n\nOne solution is (1, 100, 10).\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\nNo\n\nIt is impossible to permute a so that the condition is satisfied.\n\nSample Input 3\n\n3\n1 4 1\n\nSample Output 3\n\nYes\n\nThe condition is already satisfied initially.\n\nSample Input 4\n\n2\n1 1\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n6\n2 7 1 8 2 8\n\nSample Output 5\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 503, "cpu_time_ms": 388, "memory_kb": 48420}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s133480057", "group_id": "codeNet:p03639", "input_text": "import java.util.Scanner;\n\n\n\tpublic class Main {\n\n\t\tpublic static void main(String[] args) {\n\n\t\t\tScanner sc = new Scanner(System.in);\n\n\t\t\tint n = sc.nextInt();\n\t\t\tint[] a = new int[n];\n\t\t\tint o = 0;\n\t\t\tint f = 0;\n\t\t\t\n\t\t\tfor(int i=0;i= 2 && four >= others) ||\n\t\t\t(two == 0 && four >= others - 1) ||\n\t\t\t(four >= others + two - 1)) {\n\t\t\tSystem.out.println(\"Yes\");\n\t\t} else {\n\t\t\tSystem.out.println(\"No\");\n\t\t}\n\t}\n}\n", "language": "Java", "metadata": {"date": 1569629508, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03639.html", "problem_id": "p03639", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03639/input.txt", "sample_output_relpath": "derived/input_output/data/p03639/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03639/Java/s591351485.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s591351485", "user_id": "u575909439"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n\tpublic static void main (String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint four = 0;\n\t\tint two = 0;\n\t\tint others = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint a = sc.nextInt();\n\t\t\tif (a % 4 == 0) {\n\t\t\t\tfour++;\n\t\t\t} else if (a % 2 == 0) {\n\t\t\t\ttwo++;\n\t\t\t} else {\n\t\t\t\tothers++;\n\t\t\t}\n\t\t}\n\t\tif ((two >= 2 && four >= others) ||\n\t\t\t(two == 0 && four >= others - 1) ||\n\t\t\t(four >= others + two - 1)) {\n\t\t\tSystem.out.println(\"Yes\");\n\t\t} else {\n\t\t\tSystem.out.println(\"No\");\n\t\t}\n\t}\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a sequence of length N, a = (a_1, a_2, ..., a_N).\nEach a_i is a positive integer.\n\nSnuke's objective is to permute the element in a so that the following condition is satisfied:\n\nFor each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a multiple of 4.\n\nDetermine whether Snuke can achieve his objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\na_i is an integer.\n\n1 ≤ a_i ≤ 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\nIf Snuke can achieve his objective, print Yes; otherwise, print No.\n\nSample Input 1\n\n3\n1 10 100\n\nSample Output 1\n\nYes\n\nOne solution is (1, 100, 10).\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\nNo\n\nIt is impossible to permute a so that the condition is satisfied.\n\nSample Input 3\n\n3\n1 4 1\n\nSample Output 3\n\nYes\n\nThe condition is already satisfied initially.\n\nSample Input 4\n\n2\n1 1\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n6\n2 7 1 8 2 8\n\nSample Output 5\n\nYes", "sample_input": "3\n1 10 100\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03639", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a sequence of length N, a = (a_1, a_2, ..., a_N).\nEach a_i is a positive integer.\n\nSnuke's objective is to permute the element in a so that the following condition is satisfied:\n\nFor each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a multiple of 4.\n\nDetermine whether Snuke can achieve his objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\na_i is an integer.\n\n1 ≤ a_i ≤ 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\nIf Snuke can achieve his objective, print Yes; otherwise, print No.\n\nSample Input 1\n\n3\n1 10 100\n\nSample Output 1\n\nYes\n\nOne solution is (1, 100, 10).\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\nNo\n\nIt is impossible to permute a so that the condition is satisfied.\n\nSample Input 3\n\n3\n1 4 1\n\nSample Output 3\n\nYes\n\nThe condition is already satisfied initially.\n\nSample Input 4\n\n2\n1 1\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n6\n2 7 1 8 2 8\n\nSample Output 5\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 549, "cpu_time_ms": 480, "memory_kb": 49756}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s561262044", "group_id": "codeNet:p03639", "input_text": "\nimport java.util.Scanner;\n\npublic class Main{\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t int N = sc.nextInt();\n\t \n\t \n\t long m = 1;\n\t \n\t int count_4 =0;\n\t int count_2=0;\n\t int count_odd=0;\n\t for (int i = 0; i=count_odd)\n\t \t\tSystem.out.println(\"Yes\");\n\t \telse\n\t \t\tSystem.out.println(\"No\");\n\t }\n\t else if (count_2!=0){\n\t \tif (count_4>=count_odd)\n\t \t\tSystem.out.println(\"Yes\");\n\t \telse\n\t \t\tSystem.out.println(\"No\");\n\t }\n\n\t else\n\t \tSystem.out.println(\"No\");\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1559559209, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03639.html", "problem_id": "p03639", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03639/input.txt", "sample_output_relpath": "derived/input_output/data/p03639/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03639/Java/s561262044.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s561262044", "user_id": "u645304546"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "\nimport java.util.Scanner;\n\npublic class Main{\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t int N = sc.nextInt();\n\t \n\t \n\t long m = 1;\n\t \n\t int count_4 =0;\n\t int count_2=0;\n\t int count_odd=0;\n\t for (int i = 0; i=count_odd)\n\t \t\tSystem.out.println(\"Yes\");\n\t \telse\n\t \t\tSystem.out.println(\"No\");\n\t }\n\t else if (count_2!=0){\n\t \tif (count_4>=count_odd)\n\t \t\tSystem.out.println(\"Yes\");\n\t \telse\n\t \t\tSystem.out.println(\"No\");\n\t }\n\n\t else\n\t \tSystem.out.println(\"No\");\n\t}\n\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a sequence of length N, a = (a_1, a_2, ..., a_N).\nEach a_i is a positive integer.\n\nSnuke's objective is to permute the element in a so that the following condition is satisfied:\n\nFor each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a multiple of 4.\n\nDetermine whether Snuke can achieve his objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\na_i is an integer.\n\n1 ≤ a_i ≤ 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\nIf Snuke can achieve his objective, print Yes; otherwise, print No.\n\nSample Input 1\n\n3\n1 10 100\n\nSample Output 1\n\nYes\n\nOne solution is (1, 100, 10).\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\nNo\n\nIt is impossible to permute a so that the condition is satisfied.\n\nSample Input 3\n\n3\n1 4 1\n\nSample Output 3\n\nYes\n\nThe condition is already satisfied initially.\n\nSample Input 4\n\n2\n1 1\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n6\n2 7 1 8 2 8\n\nSample Output 5\n\nYes", "sample_input": "3\n1 10 100\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03639", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a sequence of length N, a = (a_1, a_2, ..., a_N).\nEach a_i is a positive integer.\n\nSnuke's objective is to permute the element in a so that the following condition is satisfied:\n\nFor each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a multiple of 4.\n\nDetermine whether Snuke can achieve his objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\na_i is an integer.\n\n1 ≤ a_i ≤ 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\nIf Snuke can achieve his objective, print Yes; otherwise, print No.\n\nSample Input 1\n\n3\n1 10 100\n\nSample Output 1\n\nYes\n\nOne solution is (1, 100, 10).\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\nNo\n\nIt is impossible to permute a so that the condition is satisfied.\n\nSample Input 3\n\n3\n1 4 1\n\nSample Output 3\n\nYes\n\nThe condition is already satisfied initially.\n\nSample Input 4\n\n2\n1 1\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n6\n2 7 1 8 2 8\n\nSample Output 5\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 472, "memory_kb": 45492}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s498835183", "group_id": "codeNet:p03639", "input_text": "\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t int N = sc.nextInt();\n\t \n\t long m = 1;\n\t \n\t int count_4 =0;\n\t int count_2=0;\n\t int count_odd=0;\n\t for (int i = 0; i=count_odd)\n\t \tSystem.out.println(\"Yes\");\n\t \n\t else\n\t \tSystem.out.println(\"No\");\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1559558340, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03639.html", "problem_id": "p03639", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03639/input.txt", "sample_output_relpath": "derived/input_output/data/p03639/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03639/Java/s498835183.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s498835183", "user_id": "u645304546"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t int N = sc.nextInt();\n\t \n\t long m = 1;\n\t \n\t int count_4 =0;\n\t int count_2=0;\n\t int count_odd=0;\n\t for (int i = 0; i=count_odd)\n\t \tSystem.out.println(\"Yes\");\n\t \n\t else\n\t \tSystem.out.println(\"No\");\n\t}\n\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a sequence of length N, a = (a_1, a_2, ..., a_N).\nEach a_i is a positive integer.\n\nSnuke's objective is to permute the element in a so that the following condition is satisfied:\n\nFor each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a multiple of 4.\n\nDetermine whether Snuke can achieve his objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\na_i is an integer.\n\n1 ≤ a_i ≤ 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\nIf Snuke can achieve his objective, print Yes; otherwise, print No.\n\nSample Input 1\n\n3\n1 10 100\n\nSample Output 1\n\nYes\n\nOne solution is (1, 100, 10).\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\nNo\n\nIt is impossible to permute a so that the condition is satisfied.\n\nSample Input 3\n\n3\n1 4 1\n\nSample Output 3\n\nYes\n\nThe condition is already satisfied initially.\n\nSample Input 4\n\n2\n1 1\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n6\n2 7 1 8 2 8\n\nSample Output 5\n\nYes", "sample_input": "3\n1 10 100\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03639", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a sequence of length N, a = (a_1, a_2, ..., a_N).\nEach a_i is a positive integer.\n\nSnuke's objective is to permute the element in a so that the following condition is satisfied:\n\nFor each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a multiple of 4.\n\nDetermine whether Snuke can achieve his objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\na_i is an integer.\n\n1 ≤ a_i ≤ 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\nIf Snuke can achieve his objective, print Yes; otherwise, print No.\n\nSample Input 1\n\n3\n1 10 100\n\nSample Output 1\n\nYes\n\nOne solution is (1, 100, 10).\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\nNo\n\nIt is impossible to permute a so that the condition is satisfied.\n\nSample Input 3\n\n3\n1 4 1\n\nSample Output 3\n\nYes\n\nThe condition is already satisfied initially.\n\nSample Input 4\n\n2\n1 1\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n6\n2 7 1 8 2 8\n\nSample Output 5\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 474, "memory_kb": 50472}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s711806411", "group_id": "codeNet:p03639", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner reader = new Scanner(System.in);\n\t\tint N = reader.nextInt();\n\t\tString ans = \"No\";\n\t\tint[] all = new int[3];\n\t\tint[] arr = new int[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tarr[i] = reader.nextInt();\n\t\t\tint tmp = arr[i];\n\t\t\tfor (int j = 1; j < 4; j++) {\n\t\t\t\tif (tmp % (2*j) != 0 || j == 3) {\n\t\t\t\t\tall[j-1]++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (all[2] > (all[0] + all[1] - 1)) {\n\t\t\tans = \"Yes\";\n\t\t}\n\t\tif ((all[2] + all[1]/2) >= (all[0] + all[1]%2)) {\n\t\t\tans = \"Yes\";\n\t\t}\n\n\t\tSystem.out.println(ans);\n\t\treader.close();\n\n\t}\n}\n\n\n\n", "language": "Java", "metadata": {"date": 1556479579, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03639.html", "problem_id": "p03639", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03639/input.txt", "sample_output_relpath": "derived/input_output/data/p03639/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03639/Java/s711806411.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s711806411", "user_id": "u431954591"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner reader = new Scanner(System.in);\n\t\tint N = reader.nextInt();\n\t\tString ans = \"No\";\n\t\tint[] all = new int[3];\n\t\tint[] arr = new int[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tarr[i] = reader.nextInt();\n\t\t\tint tmp = arr[i];\n\t\t\tfor (int j = 1; j < 4; j++) {\n\t\t\t\tif (tmp % (2*j) != 0 || j == 3) {\n\t\t\t\t\tall[j-1]++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (all[2] > (all[0] + all[1] - 1)) {\n\t\t\tans = \"Yes\";\n\t\t}\n\t\tif ((all[2] + all[1]/2) >= (all[0] + all[1]%2)) {\n\t\t\tans = \"Yes\";\n\t\t}\n\n\t\tSystem.out.println(ans);\n\t\treader.close();\n\n\t}\n}\n\n\n\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a sequence of length N, a = (a_1, a_2, ..., a_N).\nEach a_i is a positive integer.\n\nSnuke's objective is to permute the element in a so that the following condition is satisfied:\n\nFor each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a multiple of 4.\n\nDetermine whether Snuke can achieve his objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\na_i is an integer.\n\n1 ≤ a_i ≤ 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\nIf Snuke can achieve his objective, print Yes; otherwise, print No.\n\nSample Input 1\n\n3\n1 10 100\n\nSample Output 1\n\nYes\n\nOne solution is (1, 100, 10).\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\nNo\n\nIt is impossible to permute a so that the condition is satisfied.\n\nSample Input 3\n\n3\n1 4 1\n\nSample Output 3\n\nYes\n\nThe condition is already satisfied initially.\n\nSample Input 4\n\n2\n1 1\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n6\n2 7 1 8 2 8\n\nSample Output 5\n\nYes", "sample_input": "3\n1 10 100\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03639", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a sequence of length N, a = (a_1, a_2, ..., a_N).\nEach a_i is a positive integer.\n\nSnuke's objective is to permute the element in a so that the following condition is satisfied:\n\nFor each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a multiple of 4.\n\nDetermine whether Snuke can achieve his objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\na_i is an integer.\n\n1 ≤ a_i ≤ 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\nIf Snuke can achieve his objective, print Yes; otherwise, print No.\n\nSample Input 1\n\n3\n1 10 100\n\nSample Output 1\n\nYes\n\nOne solution is (1, 100, 10).\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\nNo\n\nIt is impossible to permute a so that the condition is satisfied.\n\nSample Input 3\n\n3\n1 4 1\n\nSample Output 3\n\nYes\n\nThe condition is already satisfied initially.\n\nSample Input 4\n\n2\n1 1\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n6\n2 7 1 8 2 8\n\nSample Output 5\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 493, "memory_kb": 50276}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s267587263", "group_id": "codeNet:p03639", "input_text": "import java.util.*;\nimport java.lang.*;\n\n// class Pair implements Comparable{\n// long a;\n// int cnt;\n// public Pair(long i, int j){\n// this.a = i;\n// this.cnt = j;\n// }\n// public int compareTo(Pair p){\n// if(this.cnt>=2 && p.cnt >=2 && this.a=2) return -1;\n// return 1;\n// }\n// }\n\nclass Main{\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int cnt4 = 0;\n int cnt2 = 0;\n int odd = 0;\n int N = Integer.parseInt(sc.next());\n for(int i = 0; i0 && odd<=cnt4) System.out.println(\"Yes\");\n else System.out.println(\"No\");\n\n }\n}", "language": "Java", "metadata": {"date": 1534533846, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03639.html", "problem_id": "p03639", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03639/input.txt", "sample_output_relpath": "derived/input_output/data/p03639/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03639/Java/s267587263.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s267587263", "user_id": "u432614080"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.util.*;\nimport java.lang.*;\n\n// class Pair implements Comparable{\n// long a;\n// int cnt;\n// public Pair(long i, int j){\n// this.a = i;\n// this.cnt = j;\n// }\n// public int compareTo(Pair p){\n// if(this.cnt>=2 && p.cnt >=2 && this.a=2) return -1;\n// return 1;\n// }\n// }\n\nclass Main{\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int cnt4 = 0;\n int cnt2 = 0;\n int odd = 0;\n int N = Integer.parseInt(sc.next());\n for(int i = 0; i0 && odd<=cnt4) System.out.println(\"Yes\");\n else System.out.println(\"No\");\n\n }\n}", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a sequence of length N, a = (a_1, a_2, ..., a_N).\nEach a_i is a positive integer.\n\nSnuke's objective is to permute the element in a so that the following condition is satisfied:\n\nFor each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a multiple of 4.\n\nDetermine whether Snuke can achieve his objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\na_i is an integer.\n\n1 ≤ a_i ≤ 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\nIf Snuke can achieve his objective, print Yes; otherwise, print No.\n\nSample Input 1\n\n3\n1 10 100\n\nSample Output 1\n\nYes\n\nOne solution is (1, 100, 10).\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\nNo\n\nIt is impossible to permute a so that the condition is satisfied.\n\nSample Input 3\n\n3\n1 4 1\n\nSample Output 3\n\nYes\n\nThe condition is already satisfied initially.\n\nSample Input 4\n\n2\n1 1\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n6\n2 7 1 8 2 8\n\nSample Output 5\n\nYes", "sample_input": "3\n1 10 100\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03639", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a sequence of length N, a = (a_1, a_2, ..., a_N).\nEach a_i is a positive integer.\n\nSnuke's objective is to permute the element in a so that the following condition is satisfied:\n\nFor each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a multiple of 4.\n\nDetermine whether Snuke can achieve his objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\na_i is an integer.\n\n1 ≤ a_i ≤ 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\nIf Snuke can achieve his objective, print Yes; otherwise, print No.\n\nSample Input 1\n\n3\n1 10 100\n\nSample Output 1\n\nYes\n\nOne solution is (1, 100, 10).\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\nNo\n\nIt is impossible to permute a so that the condition is satisfied.\n\nSample Input 3\n\n3\n1 4 1\n\nSample Output 3\n\nYes\n\nThe condition is already satisfied initially.\n\nSample Input 4\n\n2\n1 1\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n6\n2 7 1 8 2 8\n\nSample Output 5\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 936, "cpu_time_ms": 392, "memory_kb": 42484}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s588124370", "group_id": "codeNet:p03639", "input_text": "import java.io.*;\nimport java.util.*;\n\n/**\n * @author baito\n */\n\npublic class Main\n{\n static StringBuilder sb = new StringBuilder();\n static FastScanner sc = new FastScanner(System.in);\n static int INF = 12345678;\n static long LINF = 123456789123456789L;\n static long MINF = -123456789123456789L;\n static long MOD = 1000000007;\n static int[] y4 = {0, 1, 0, -1};\n static int[] x4 = {1, 0, -1, 0};\n static int[] y8 = {0, 1, 0, -1, -1, 1, 1, -1};\n static int[] x8 = {1, 0, -1, 0, 1, -1, 1, -1};\n static long[] F;//factorial\n static boolean[] isPrime;\n static int[] primes;\n static char[][] map;\n\n static int N, K;\n static int[] A;\n\n\n public static void main(String[] args)\n {\n N = sc.nextInt();\n A = sc.nextIntArray(N);\n int c4=0,c2 =0;\n for (int i = 0; i < N; i++)\n {\n if(A[i] %4==0)c4++;\n else if (A[i] %2==0)c2++;\n }\n int res = c4 * 3 + c2;\n if(res >= N){\n System.out.println(\"Yes\");\n }else{\n System.out.println(\"No\");\n }\n\n }\n\n public static long getHashKey(int a, int b)\n {\n return (long) a << 32 | b;\n }\n\n public static boolean isOutofIndex(int x, int y)\n {\n if (x < 0 || y < 0) return true;\n if (map[0].length <= x || map.length <= y) return true;\n return false;\n }\n\n public static void setPrimes()\n {\n int n = 100001;\n isPrime = new boolean[n];\n List prs = new ArrayList<>();\n Arrays.fill(isPrime, true);\n isPrime[0] = isPrime[1] = false;\n for (int i = 2; i * i <= n; i++)\n {\n if (!isPrime[i]) continue;\n prs.add(i);\n for (int j = i * 2; j < n; j += i)\n {\n isPrime[j] = false;\n }\n }\n primes = new int[prs.size()];\n for (int i = 0; i < prs.size(); i++)\n primes[i] = prs.get(i);\n }\n\n public static void revSort(int[] a)\n {\n Arrays.sort(a);\n reverse(a);\n }\n\n public static void revSort(long[] a)\n {\n Arrays.sort(a);\n reverse(a);\n }\n\n public static int[][] copy(int[][] ar)\n {\n int[][] nr = new int[ar.length][ar[0].length];\n for (int i = 0; i < ar.length; i++)\n for (int j = 0; j < ar[0].length; j++)\n nr[i][j] = ar[i][j];\n return nr;\n }\n\n\n /**\n *

指定した値以上の先頭のインデクスを返す

\n *

配列要素が0のときは、0が返る。

\n *\n * @returnint : 探索した値以上で、先頭になるインデクス\n */\n public static int lowerBound(final int[] arr, final int value)\n {\n int low = 0;\n int high = arr.length;\n int mid;\n while (low < high)\n {\n mid = ((high - low) >>> 1) + low; //(low + high) / 2 (オーバーフロー対策)\n if (arr[mid] < value)\n {\n low = mid + 1;\n }\n else\n {\n high = mid;\n }\n }\n return low;\n }\n\n /**\n *

指定した値より大きい先頭のインデクスを返す

\n *

配列要素が0のときは、0が返る。

\n *\n * @returnint : 探索した値より上で、先頭になるインデクス\n */\n public static int upperBound(final int[] arr, final int value)\n {\n int low = 0;\n int high = arr.length;\n int mid;\n while (low < high)\n {\n mid = ((high - low) >>> 1) + low; //(low + high) / 2 (オーバーフロー対策)\n if (arr[mid] <= value)\n {\n low = mid + 1;\n }\n else\n {\n high = mid;\n }\n }\n return low;\n }\n\n //次の順列に書き換える、最大値ならfalseを返す\n public static boolean nextPermutation(int A[])\n {\n int len = A.length;\n int pos = len - 2;\n for (; pos >= 0; pos--)\n {\n if (A[pos] < A[pos + 1]) break;\n }\n if (pos == -1) return false;\n\n //posより大きい最小の数を二分探索\n int ok = pos + 1;\n int ng = len;\n while (Math.abs(ng - ok) > 1)\n {\n int mid = (ok + ng) / 2;\n if (A[mid] > A[pos]) ok = mid;\n else ng = mid;\n\n }\n\n swap(A, pos, ok);\n reverse(A, pos + 1, len - 1);\n\n\n return true;\n }\n\n //次の順列に書き換える、最小値ならfalseを返す\n public static boolean prevPermutation(int A[])\n {\n int len = A.length;\n int pos = len - 2;\n for (; pos >= 0; pos--)\n {\n if (A[pos] > A[pos + 1]) break;\n }\n if (pos == -1) return false;\n\n //posより小さい最大の数を二分探索\n int ok = pos + 1;\n int ng = len;\n while (Math.abs(ng - ok) > 1)\n {\n int mid = (ok + ng) / 2;\n if (A[mid] < A[pos]) ok = mid;\n else ng = mid;\n\n }\n\n swap(A, pos, ok);\n reverse(A, pos + 1, len - 1);\n\n\n return true;\n }\n\n //↓nCrをmod計算するために必要。 ***factorial(N)を呼ぶ必要がある***\n static long ncr(int n, int r)\n {\n if (n < r) return 0;\n else if (r == 0) return 1;\n\n factorial(n);\n return F[n] / (F[n - r] * F[r]);\n }\n\n static long ncr2(int a, int b)\n {\n if (b == 0) return 1;\n else if (a < b) return 0;\n long res = 1;\n for (int i = 0; i < b; i++)\n {\n res *= a - i;\n res /= i + 1;\n }\n return res;\n }\n\n static long ncrdp(int n, int r)\n {\n if (n < r) return 0;\n long[][] dp = new long[n + 1][r + 1];\n for (int ni = 0; ni < n + 1; ni++)\n {\n dp[ni][0] = dp[ni][ni] = 1;\n for (int ri = 1; ri < ni; ri++)\n {\n dp[ni][ri] = dp[ni - 1][ri - 1] + dp[ni - 1][ri];\n }\n }\n return dp[n][r];\n }\n\n static long modNcr(int n, int r)\n {\n if (n < r) return 0;\n long result = F[n];\n result = result * modInv(F[n - r]) % MOD;\n result = result * modInv(F[r]) % MOD;\n return result;\n }\n\n public static long modSum(long... lar)\n {\n long res = 0;\n for (long l : lar)\n res = (res + l % MOD) % MOD;\n return res;\n }\n\n public static long modDiff(long a, long b)\n {\n long res = a - b;\n if (res < 0) res += MOD;\n res %= MOD;\n return res;\n }\n\n public static long modMul(long... lar)\n {\n long res = 1;\n for (long l : lar)\n res = (res * l) % MOD;\n if (res < 0) res += MOD;\n res %= MOD;\n return res;\n }\n\n public static long modDiv(long a, long b)\n {\n long x = a % MOD;\n long y = b % MOD;\n long res = (x * modInv(y)) % MOD;\n return res;\n }\n\n static long modInv(long n)\n {\n return modPow(n, MOD - 2);\n }\n\n static void factorial(int n)\n {\n F = new long[n + 1];\n F[0] = F[1] = 1;\n// for (int i = 2; i <= n; i++)\n// {\n// F[i] = (F[i - 1] * i) % MOD;\n// }\n //\n for (int i = 2; i <= 100000; i++)\n {\n F[i] = (F[i - 1] * i) % MOD;\n }\n for (int i = 100001; i <= n; i++)\n {\n F[i] = (F[i - 1] * i) % MOD;\n }\n }\n\n static long modPow(long x, long n)\n {\n long res = 1L;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n res = res * x % MOD;\n }\n x = x * x % MOD;\n n >>= 1;\n }\n return res;\n }\n\n //↑nCrをmod計算するために必要\n\n static int gcd(int n, int r)\n {\n return r == 0 ? n : gcd(r, n % r);\n }\n\n static long gcd(long n, long r)\n {\n return r == 0 ? n : gcd(r, n % r);\n }\n\n static void swap(T[] x, int i, int j)\n {\n T t = x[i];\n x[i] = x[j];\n x[j] = t;\n }\n\n static void swap(int[] x, int i, int j)\n {\n int t = x[i];\n x[i] = x[j];\n x[j] = t;\n }\n\n public static void reverse(int[] x)\n {\n int l = 0;\n int r = x.length - 1;\n while (l < r)\n {\n int temp = x[l];\n x[l] = x[r];\n x[r] = temp;\n l++;\n r--;\n }\n }\n\n public static void reverse(long[] x)\n {\n int l = 0;\n int r = x.length - 1;\n while (l < r)\n {\n long temp = x[l];\n x[l] = x[r];\n x[r] = temp;\n l++;\n r--;\n }\n }\n\n public static void reverse(int[] x, int s, int e)\n {\n int l = s;\n int r = e;\n while (l < r)\n {\n int temp = x[l];\n x[l] = x[r];\n x[r] = temp;\n l++;\n r--;\n }\n }\n\n static int length(int a)\n {\n int cou = 0;\n while (a != 0)\n {\n a /= 10;\n cou++;\n }\n return cou;\n }\n\n static int length(long a)\n {\n int cou = 0;\n while (a != 0)\n {\n a /= 10;\n cou++;\n }\n return cou;\n }\n\n static int countC2(char[][] a, char c)\n {\n int co = 0;\n for (int i = 0; i < a.length; i++)\n for (int j = 0; j < a[0].length; j++)\n if (a[i][j] == c) co++;\n return co;\n }\n\n static int countI(int[] a, int key)\n {\n int co = 0;\n for (int i = 0; i < a.length; i++)\n if (a[i] == key) co++;\n return co;\n }\n\n static int countI(int[][] a, int key)\n {\n int co = 0;\n for (int i = 0; i < a.length; i++)\n for (int j = 0; j < a[0].length; j++)\n if (a[i][j] == key) co++;\n return co;\n }\n\n static void fill(int[][] a, int v)\n {\n for (int i = 0; i < a.length; i++)\n for (int j = 0; j < a[0].length; j++)\n a[i][j] = v;\n }\n\n\n static void fill(long[][] a, long v)\n {\n for (int i = 0; i < a.length; i++)\n for (int j = 0; j < a[0].length; j++)\n a[i][j] = v;\n }\n\n static void fill(int[][][] a, int v)\n {\n for (int i = 0; i < a.length; i++)\n for (int j = 0; j < a[0].length; j++)\n for (int k = 0; k < a[0][0].length; k++)\n a[i][j][k] = v;\n }\n\n static int max(int... a)\n {\n int res = Integer.MIN_VALUE;\n for (int i : a)\n {\n res = Math.max(res, i);\n }\n return res;\n }\n\n\n static int max(int[][] ar)\n {\n int res = Integer.MIN_VALUE;\n for (int i[] : ar)\n res = Math.max(res, max(i));\n return res;\n }\n\n static int min(int... a)\n {\n int res = Integer.MAX_VALUE;\n for (int i : a)\n {\n res = Math.min(res, i);\n }\n return res;\n }\n\n\n static int min(int[][] ar)\n {\n int res = Integer.MAX_VALUE;\n for (int i[] : ar)\n res = Math.min(res, min(i));\n return res;\n }\n\n static int sum(int[] a)\n {\n int cou = 0;\n for (int i : a)\n cou += i;\n return cou;\n }\n\n static int abs(int a)\n {\n return Math.abs(a);\n }\n\n static class FastScanner\n {\n\n private BufferedReader reader = null;\n private StringTokenizer tokenizer = null;\n\n public FastScanner(InputStream in)\n {\n reader = new BufferedReader(new InputStreamReader(in));\n tokenizer = null;\n }\n\n public String next()\n {\n if (tokenizer == null || !tokenizer.hasMoreTokens())\n {\n try\n {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e)\n {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n /*public String nextChar(){\n return (char)next()[0];\n }*/\n public String nextLine()\n {\n if (tokenizer == null || !tokenizer.hasMoreTokens())\n {\n try\n {\n return reader.readLine();\n } catch (IOException e)\n {\n throw new RuntimeException(e);\n }\n }\n\n return tokenizer.nextToken(\"\\n\");\n }\n\n public long nextLong()\n {\n return Long.parseLong(next());\n }\n\n public int nextInt()\n {\n return Integer.parseInt(next());\n }\n\n public double nextDouble()\n {\n return Double.parseDouble(next());\n }\n\n public int[] nextIntArray(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = nextInt();\n }\n return a;\n }\n\n public int[] nextIntArrayDec(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = nextInt() - 1;\n }\n return a;\n }\n\n public int[][] nextIntArray2(int h, int w)\n {\n int[][] a = new int[h][w];\n for (int hi = 0; hi < h; hi++)\n {\n for (int wi = 0; wi < w; wi++)\n {\n a[hi][wi] = nextInt();\n }\n }\n return a;\n }\n\n public int[][] nextIntArray2Dec(int h, int w)\n {\n int[][] a = new int[h][w];\n for (int hi = 0; hi < h; hi++)\n {\n for (int wi = 0; wi < w; wi++)\n {\n a[hi][wi] = nextInt() - 1;\n }\n }\n return a;\n }\n\n //複数の配列を受け取る\n public void nextIntArrays2ar(int[] a, int[] b)\n {\n for (int i = 0; i < a.length; i++)\n {\n a[i] = sc.nextInt();\n b[i] = sc.nextInt();\n }\n }\n\n public void nextIntArrays2arDec(int[] a, int[] b)\n {\n for (int i = 0; i < a.length; i++)\n {\n a[i] = sc.nextInt() - 1;\n b[i] = sc.nextInt() - 1;\n }\n }\n\n //複数の配列を受け取る\n public void nextIntArrays3ar(int[] a, int[] b, int[] c)\n {\n for (int i = 0; i < a.length; i++)\n {\n a[i] = sc.nextInt();\n b[i] = sc.nextInt();\n c[i] = sc.nextInt();\n }\n }\n\n //複数の配列を受け取る\n public void nextIntArrays3arDecLeft2(int[] a, int[] b, int[] c)\n {\n for (int i = 0; i < a.length; i++)\n {\n a[i] = sc.nextInt() - 1;\n b[i] = sc.nextInt() - 1;\n c[i] = sc.nextInt();\n }\n }\n\n public Integer[] nextIntegerArray(int n)\n {\n Integer[] a = new Integer[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = nextInt();\n }\n return a;\n }\n\n public char[] nextCharArray(int n)\n {\n char[] a = next().toCharArray();\n\n return a;\n }\n\n public char[][] nextCharArray2(int h, int w)\n {\n char[][] a = new char[h][w];\n for (int i = 0; i < h; i++)\n {\n a[i] = next().toCharArray();\n }\n return a;\n }\n\n //スペースが入っている場合\n public char[][] nextCharArray2s(int h, int w)\n {\n char[][] a = new char[h][w];\n for (int i = 0; i < h; i++)\n {\n a[i] = nextLine().replace(\" \", \"\").toCharArray();\n }\n return a;\n }\n\n public char[][] nextWrapCharArray2(int h, int w, char c)\n {\n char[][] a = new char[h + 2][w + 2];\n //char c = '*';\n int i;\n for (i = 0; i < w + 2; i++)\n a[0][i] = c;\n for (i = 1; i < h + 1; i++)\n {\n a[i] = (c + next() + c).toCharArray();\n }\n for (i = 0; i < w + 2; i++)\n a[h + 1][i] = c;\n return a;\n }\n\n //スペースが入ってる時用\n public char[][] nextWrapCharArray2s(int h, int w, char c)\n {\n char[][] a = new char[h + 2][w + 2];\n //char c = '*';\n int i;\n for (i = 0; i < w + 2; i++)\n a[0][i] = c;\n for (i = 1; i < h + 1; i++)\n {\n a[i] = (c + nextLine().replace(\" \", \"\") + c).toCharArray();\n }\n for (i = 0; i < w + 2; i++)\n a[h + 1][i] = c;\n return a;\n }\n\n public long[] nextLongArray(int n)\n {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = nextLong();\n }\n return a;\n }\n\n public long[][] nextLongArray2(int h, int w)\n {\n long[][] a = new long[h][w];\n for (int hi = 0; hi < h; hi++)\n {\n for (int wi = 0; wi < h; wi++)\n {\n a[h][w] = nextLong();\n }\n }\n return a;\n }\n }\n}\n", "language": "Java", "metadata": {"date": 1530072740, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03639.html", "problem_id": "p03639", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03639/input.txt", "sample_output_relpath": "derived/input_output/data/p03639/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03639/Java/s588124370.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s588124370", "user_id": "u986437843"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.io.*;\nimport java.util.*;\n\n/**\n * @author baito\n */\n\npublic class Main\n{\n static StringBuilder sb = new StringBuilder();\n static FastScanner sc = new FastScanner(System.in);\n static int INF = 12345678;\n static long LINF = 123456789123456789L;\n static long MINF = -123456789123456789L;\n static long MOD = 1000000007;\n static int[] y4 = {0, 1, 0, -1};\n static int[] x4 = {1, 0, -1, 0};\n static int[] y8 = {0, 1, 0, -1, -1, 1, 1, -1};\n static int[] x8 = {1, 0, -1, 0, 1, -1, 1, -1};\n static long[] F;//factorial\n static boolean[] isPrime;\n static int[] primes;\n static char[][] map;\n\n static int N, K;\n static int[] A;\n\n\n public static void main(String[] args)\n {\n N = sc.nextInt();\n A = sc.nextIntArray(N);\n int c4=0,c2 =0;\n for (int i = 0; i < N; i++)\n {\n if(A[i] %4==0)c4++;\n else if (A[i] %2==0)c2++;\n }\n int res = c4 * 3 + c2;\n if(res >= N){\n System.out.println(\"Yes\");\n }else{\n System.out.println(\"No\");\n }\n\n }\n\n public static long getHashKey(int a, int b)\n {\n return (long) a << 32 | b;\n }\n\n public static boolean isOutofIndex(int x, int y)\n {\n if (x < 0 || y < 0) return true;\n if (map[0].length <= x || map.length <= y) return true;\n return false;\n }\n\n public static void setPrimes()\n {\n int n = 100001;\n isPrime = new boolean[n];\n List prs = new ArrayList<>();\n Arrays.fill(isPrime, true);\n isPrime[0] = isPrime[1] = false;\n for (int i = 2; i * i <= n; i++)\n {\n if (!isPrime[i]) continue;\n prs.add(i);\n for (int j = i * 2; j < n; j += i)\n {\n isPrime[j] = false;\n }\n }\n primes = new int[prs.size()];\n for (int i = 0; i < prs.size(); i++)\n primes[i] = prs.get(i);\n }\n\n public static void revSort(int[] a)\n {\n Arrays.sort(a);\n reverse(a);\n }\n\n public static void revSort(long[] a)\n {\n Arrays.sort(a);\n reverse(a);\n }\n\n public static int[][] copy(int[][] ar)\n {\n int[][] nr = new int[ar.length][ar[0].length];\n for (int i = 0; i < ar.length; i++)\n for (int j = 0; j < ar[0].length; j++)\n nr[i][j] = ar[i][j];\n return nr;\n }\n\n\n /**\n *

指定した値以上の先頭のインデクスを返す

\n *

配列要素が0のときは、0が返る。

\n *\n * @returnint : 探索した値以上で、先頭になるインデクス\n */\n public static int lowerBound(final int[] arr, final int value)\n {\n int low = 0;\n int high = arr.length;\n int mid;\n while (low < high)\n {\n mid = ((high - low) >>> 1) + low; //(low + high) / 2 (オーバーフロー対策)\n if (arr[mid] < value)\n {\n low = mid + 1;\n }\n else\n {\n high = mid;\n }\n }\n return low;\n }\n\n /**\n *

指定した値より大きい先頭のインデクスを返す

\n *

配列要素が0のときは、0が返る。

\n *\n * @returnint : 探索した値より上で、先頭になるインデクス\n */\n public static int upperBound(final int[] arr, final int value)\n {\n int low = 0;\n int high = arr.length;\n int mid;\n while (low < high)\n {\n mid = ((high - low) >>> 1) + low; //(low + high) / 2 (オーバーフロー対策)\n if (arr[mid] <= value)\n {\n low = mid + 1;\n }\n else\n {\n high = mid;\n }\n }\n return low;\n }\n\n //次の順列に書き換える、最大値ならfalseを返す\n public static boolean nextPermutation(int A[])\n {\n int len = A.length;\n int pos = len - 2;\n for (; pos >= 0; pos--)\n {\n if (A[pos] < A[pos + 1]) break;\n }\n if (pos == -1) return false;\n\n //posより大きい最小の数を二分探索\n int ok = pos + 1;\n int ng = len;\n while (Math.abs(ng - ok) > 1)\n {\n int mid = (ok + ng) / 2;\n if (A[mid] > A[pos]) ok = mid;\n else ng = mid;\n\n }\n\n swap(A, pos, ok);\n reverse(A, pos + 1, len - 1);\n\n\n return true;\n }\n\n //次の順列に書き換える、最小値ならfalseを返す\n public static boolean prevPermutation(int A[])\n {\n int len = A.length;\n int pos = len - 2;\n for (; pos >= 0; pos--)\n {\n if (A[pos] > A[pos + 1]) break;\n }\n if (pos == -1) return false;\n\n //posより小さい最大の数を二分探索\n int ok = pos + 1;\n int ng = len;\n while (Math.abs(ng - ok) > 1)\n {\n int mid = (ok + ng) / 2;\n if (A[mid] < A[pos]) ok = mid;\n else ng = mid;\n\n }\n\n swap(A, pos, ok);\n reverse(A, pos + 1, len - 1);\n\n\n return true;\n }\n\n //↓nCrをmod計算するために必要。 ***factorial(N)を呼ぶ必要がある***\n static long ncr(int n, int r)\n {\n if (n < r) return 0;\n else if (r == 0) return 1;\n\n factorial(n);\n return F[n] / (F[n - r] * F[r]);\n }\n\n static long ncr2(int a, int b)\n {\n if (b == 0) return 1;\n else if (a < b) return 0;\n long res = 1;\n for (int i = 0; i < b; i++)\n {\n res *= a - i;\n res /= i + 1;\n }\n return res;\n }\n\n static long ncrdp(int n, int r)\n {\n if (n < r) return 0;\n long[][] dp = new long[n + 1][r + 1];\n for (int ni = 0; ni < n + 1; ni++)\n {\n dp[ni][0] = dp[ni][ni] = 1;\n for (int ri = 1; ri < ni; ri++)\n {\n dp[ni][ri] = dp[ni - 1][ri - 1] + dp[ni - 1][ri];\n }\n }\n return dp[n][r];\n }\n\n static long modNcr(int n, int r)\n {\n if (n < r) return 0;\n long result = F[n];\n result = result * modInv(F[n - r]) % MOD;\n result = result * modInv(F[r]) % MOD;\n return result;\n }\n\n public static long modSum(long... lar)\n {\n long res = 0;\n for (long l : lar)\n res = (res + l % MOD) % MOD;\n return res;\n }\n\n public static long modDiff(long a, long b)\n {\n long res = a - b;\n if (res < 0) res += MOD;\n res %= MOD;\n return res;\n }\n\n public static long modMul(long... lar)\n {\n long res = 1;\n for (long l : lar)\n res = (res * l) % MOD;\n if (res < 0) res += MOD;\n res %= MOD;\n return res;\n }\n\n public static long modDiv(long a, long b)\n {\n long x = a % MOD;\n long y = b % MOD;\n long res = (x * modInv(y)) % MOD;\n return res;\n }\n\n static long modInv(long n)\n {\n return modPow(n, MOD - 2);\n }\n\n static void factorial(int n)\n {\n F = new long[n + 1];\n F[0] = F[1] = 1;\n// for (int i = 2; i <= n; i++)\n// {\n// F[i] = (F[i - 1] * i) % MOD;\n// }\n //\n for (int i = 2; i <= 100000; i++)\n {\n F[i] = (F[i - 1] * i) % MOD;\n }\n for (int i = 100001; i <= n; i++)\n {\n F[i] = (F[i - 1] * i) % MOD;\n }\n }\n\n static long modPow(long x, long n)\n {\n long res = 1L;\n while (n > 0)\n {\n if ((n & 1) == 1)\n {\n res = res * x % MOD;\n }\n x = x * x % MOD;\n n >>= 1;\n }\n return res;\n }\n\n //↑nCrをmod計算するために必要\n\n static int gcd(int n, int r)\n {\n return r == 0 ? n : gcd(r, n % r);\n }\n\n static long gcd(long n, long r)\n {\n return r == 0 ? n : gcd(r, n % r);\n }\n\n static void swap(T[] x, int i, int j)\n {\n T t = x[i];\n x[i] = x[j];\n x[j] = t;\n }\n\n static void swap(int[] x, int i, int j)\n {\n int t = x[i];\n x[i] = x[j];\n x[j] = t;\n }\n\n public static void reverse(int[] x)\n {\n int l = 0;\n int r = x.length - 1;\n while (l < r)\n {\n int temp = x[l];\n x[l] = x[r];\n x[r] = temp;\n l++;\n r--;\n }\n }\n\n public static void reverse(long[] x)\n {\n int l = 0;\n int r = x.length - 1;\n while (l < r)\n {\n long temp = x[l];\n x[l] = x[r];\n x[r] = temp;\n l++;\n r--;\n }\n }\n\n public static void reverse(int[] x, int s, int e)\n {\n int l = s;\n int r = e;\n while (l < r)\n {\n int temp = x[l];\n x[l] = x[r];\n x[r] = temp;\n l++;\n r--;\n }\n }\n\n static int length(int a)\n {\n int cou = 0;\n while (a != 0)\n {\n a /= 10;\n cou++;\n }\n return cou;\n }\n\n static int length(long a)\n {\n int cou = 0;\n while (a != 0)\n {\n a /= 10;\n cou++;\n }\n return cou;\n }\n\n static int countC2(char[][] a, char c)\n {\n int co = 0;\n for (int i = 0; i < a.length; i++)\n for (int j = 0; j < a[0].length; j++)\n if (a[i][j] == c) co++;\n return co;\n }\n\n static int countI(int[] a, int key)\n {\n int co = 0;\n for (int i = 0; i < a.length; i++)\n if (a[i] == key) co++;\n return co;\n }\n\n static int countI(int[][] a, int key)\n {\n int co = 0;\n for (int i = 0; i < a.length; i++)\n for (int j = 0; j < a[0].length; j++)\n if (a[i][j] == key) co++;\n return co;\n }\n\n static void fill(int[][] a, int v)\n {\n for (int i = 0; i < a.length; i++)\n for (int j = 0; j < a[0].length; j++)\n a[i][j] = v;\n }\n\n\n static void fill(long[][] a, long v)\n {\n for (int i = 0; i < a.length; i++)\n for (int j = 0; j < a[0].length; j++)\n a[i][j] = v;\n }\n\n static void fill(int[][][] a, int v)\n {\n for (int i = 0; i < a.length; i++)\n for (int j = 0; j < a[0].length; j++)\n for (int k = 0; k < a[0][0].length; k++)\n a[i][j][k] = v;\n }\n\n static int max(int... a)\n {\n int res = Integer.MIN_VALUE;\n for (int i : a)\n {\n res = Math.max(res, i);\n }\n return res;\n }\n\n\n static int max(int[][] ar)\n {\n int res = Integer.MIN_VALUE;\n for (int i[] : ar)\n res = Math.max(res, max(i));\n return res;\n }\n\n static int min(int... a)\n {\n int res = Integer.MAX_VALUE;\n for (int i : a)\n {\n res = Math.min(res, i);\n }\n return res;\n }\n\n\n static int min(int[][] ar)\n {\n int res = Integer.MAX_VALUE;\n for (int i[] : ar)\n res = Math.min(res, min(i));\n return res;\n }\n\n static int sum(int[] a)\n {\n int cou = 0;\n for (int i : a)\n cou += i;\n return cou;\n }\n\n static int abs(int a)\n {\n return Math.abs(a);\n }\n\n static class FastScanner\n {\n\n private BufferedReader reader = null;\n private StringTokenizer tokenizer = null;\n\n public FastScanner(InputStream in)\n {\n reader = new BufferedReader(new InputStreamReader(in));\n tokenizer = null;\n }\n\n public String next()\n {\n if (tokenizer == null || !tokenizer.hasMoreTokens())\n {\n try\n {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e)\n {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n /*public String nextChar(){\n return (char)next()[0];\n }*/\n public String nextLine()\n {\n if (tokenizer == null || !tokenizer.hasMoreTokens())\n {\n try\n {\n return reader.readLine();\n } catch (IOException e)\n {\n throw new RuntimeException(e);\n }\n }\n\n return tokenizer.nextToken(\"\\n\");\n }\n\n public long nextLong()\n {\n return Long.parseLong(next());\n }\n\n public int nextInt()\n {\n return Integer.parseInt(next());\n }\n\n public double nextDouble()\n {\n return Double.parseDouble(next());\n }\n\n public int[] nextIntArray(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = nextInt();\n }\n return a;\n }\n\n public int[] nextIntArrayDec(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = nextInt() - 1;\n }\n return a;\n }\n\n public int[][] nextIntArray2(int h, int w)\n {\n int[][] a = new int[h][w];\n for (int hi = 0; hi < h; hi++)\n {\n for (int wi = 0; wi < w; wi++)\n {\n a[hi][wi] = nextInt();\n }\n }\n return a;\n }\n\n public int[][] nextIntArray2Dec(int h, int w)\n {\n int[][] a = new int[h][w];\n for (int hi = 0; hi < h; hi++)\n {\n for (int wi = 0; wi < w; wi++)\n {\n a[hi][wi] = nextInt() - 1;\n }\n }\n return a;\n }\n\n //複数の配列を受け取る\n public void nextIntArrays2ar(int[] a, int[] b)\n {\n for (int i = 0; i < a.length; i++)\n {\n a[i] = sc.nextInt();\n b[i] = sc.nextInt();\n }\n }\n\n public void nextIntArrays2arDec(int[] a, int[] b)\n {\n for (int i = 0; i < a.length; i++)\n {\n a[i] = sc.nextInt() - 1;\n b[i] = sc.nextInt() - 1;\n }\n }\n\n //複数の配列を受け取る\n public void nextIntArrays3ar(int[] a, int[] b, int[] c)\n {\n for (int i = 0; i < a.length; i++)\n {\n a[i] = sc.nextInt();\n b[i] = sc.nextInt();\n c[i] = sc.nextInt();\n }\n }\n\n //複数の配列を受け取る\n public void nextIntArrays3arDecLeft2(int[] a, int[] b, int[] c)\n {\n for (int i = 0; i < a.length; i++)\n {\n a[i] = sc.nextInt() - 1;\n b[i] = sc.nextInt() - 1;\n c[i] = sc.nextInt();\n }\n }\n\n public Integer[] nextIntegerArray(int n)\n {\n Integer[] a = new Integer[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = nextInt();\n }\n return a;\n }\n\n public char[] nextCharArray(int n)\n {\n char[] a = next().toCharArray();\n\n return a;\n }\n\n public char[][] nextCharArray2(int h, int w)\n {\n char[][] a = new char[h][w];\n for (int i = 0; i < h; i++)\n {\n a[i] = next().toCharArray();\n }\n return a;\n }\n\n //スペースが入っている場合\n public char[][] nextCharArray2s(int h, int w)\n {\n char[][] a = new char[h][w];\n for (int i = 0; i < h; i++)\n {\n a[i] = nextLine().replace(\" \", \"\").toCharArray();\n }\n return a;\n }\n\n public char[][] nextWrapCharArray2(int h, int w, char c)\n {\n char[][] a = new char[h + 2][w + 2];\n //char c = '*';\n int i;\n for (i = 0; i < w + 2; i++)\n a[0][i] = c;\n for (i = 1; i < h + 1; i++)\n {\n a[i] = (c + next() + c).toCharArray();\n }\n for (i = 0; i < w + 2; i++)\n a[h + 1][i] = c;\n return a;\n }\n\n //スペースが入ってる時用\n public char[][] nextWrapCharArray2s(int h, int w, char c)\n {\n char[][] a = new char[h + 2][w + 2];\n //char c = '*';\n int i;\n for (i = 0; i < w + 2; i++)\n a[0][i] = c;\n for (i = 1; i < h + 1; i++)\n {\n a[i] = (c + nextLine().replace(\" \", \"\") + c).toCharArray();\n }\n for (i = 0; i < w + 2; i++)\n a[h + 1][i] = c;\n return a;\n }\n\n public long[] nextLongArray(int n)\n {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n {\n a[i] = nextLong();\n }\n return a;\n }\n\n public long[][] nextLongArray2(int h, int w)\n {\n long[][] a = new long[h][w];\n for (int hi = 0; hi < h; hi++)\n {\n for (int wi = 0; wi < h; wi++)\n {\n a[h][w] = nextLong();\n }\n }\n return a;\n }\n }\n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a sequence of length N, a = (a_1, a_2, ..., a_N).\nEach a_i is a positive integer.\n\nSnuke's objective is to permute the element in a so that the following condition is satisfied:\n\nFor each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a multiple of 4.\n\nDetermine whether Snuke can achieve his objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\na_i is an integer.\n\n1 ≤ a_i ≤ 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\nIf Snuke can achieve his objective, print Yes; otherwise, print No.\n\nSample Input 1\n\n3\n1 10 100\n\nSample Output 1\n\nYes\n\nOne solution is (1, 100, 10).\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\nNo\n\nIt is impossible to permute a so that the condition is satisfied.\n\nSample Input 3\n\n3\n1 4 1\n\nSample Output 3\n\nYes\n\nThe condition is already satisfied initially.\n\nSample Input 4\n\n2\n1 1\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n6\n2 7 1 8 2 8\n\nSample Output 5\n\nYes", "sample_input": "3\n1 10 100\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03639", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a sequence of length N, a = (a_1, a_2, ..., a_N).\nEach a_i is a positive integer.\n\nSnuke's objective is to permute the element in a so that the following condition is satisfied:\n\nFor each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a multiple of 4.\n\nDetermine whether Snuke can achieve his objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\na_i is an integer.\n\n1 ≤ a_i ≤ 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\nIf Snuke can achieve his objective, print Yes; otherwise, print No.\n\nSample Input 1\n\n3\n1 10 100\n\nSample Output 1\n\nYes\n\nOne solution is (1, 100, 10).\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\nNo\n\nIt is impossible to permute a so that the condition is satisfied.\n\nSample Input 3\n\n3\n1 4 1\n\nSample Output 3\n\nYes\n\nThe condition is already satisfied initially.\n\nSample Input 4\n\n2\n1 1\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n6\n2 7 1 8 2 8\n\nSample Output 5\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 17840, "cpu_time_ms": 194, "memory_kb": 36060}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s433088438", "group_id": "codeNet:p03639", "input_text": "\nimport java.io.*;\nimport java.util.*;\n\nclass Main{\n\tpublic static void main(String[] args){\n\t\tsolve();\n\t}\n\tpublic static void solve(){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] a = new int[n];\n\t\tfor(int i=0;inum[0] && num[1]!=0){\n\t\t\tSystem.out.println(\"No\");\n\t\t}\n\t\telse if(num[2]!=0 && num[0]==0){\n\t\t\tSystem.out.println(\"No\");\n\t\t}\n\t\telse{\n\t\t\tSystem.out.println(\"Yes\");\n\t\t}\n\t} \n}\n", "language": "Java", "metadata": {"date": 1527879771, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03639.html", "problem_id": "p03639", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03639/input.txt", "sample_output_relpath": "derived/input_output/data/p03639/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03639/Java/s433088438.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s433088438", "user_id": "u929167194"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "\nimport java.io.*;\nimport java.util.*;\n\nclass Main{\n\tpublic static void main(String[] args){\n\t\tsolve();\n\t}\n\tpublic static void solve(){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] a = new int[n];\n\t\tfor(int i=0;inum[0] && num[1]!=0){\n\t\t\tSystem.out.println(\"No\");\n\t\t}\n\t\telse if(num[2]!=0 && num[0]==0){\n\t\t\tSystem.out.println(\"No\");\n\t\t}\n\t\telse{\n\t\t\tSystem.out.println(\"Yes\");\n\t\t}\n\t} \n}\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a sequence of length N, a = (a_1, a_2, ..., a_N).\nEach a_i is a positive integer.\n\nSnuke's objective is to permute the element in a so that the following condition is satisfied:\n\nFor each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a multiple of 4.\n\nDetermine whether Snuke can achieve his objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\na_i is an integer.\n\n1 ≤ a_i ≤ 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\nIf Snuke can achieve his objective, print Yes; otherwise, print No.\n\nSample Input 1\n\n3\n1 10 100\n\nSample Output 1\n\nYes\n\nOne solution is (1, 100, 10).\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\nNo\n\nIt is impossible to permute a so that the condition is satisfied.\n\nSample Input 3\n\n3\n1 4 1\n\nSample Output 3\n\nYes\n\nThe condition is already satisfied initially.\n\nSample Input 4\n\n2\n1 1\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n6\n2 7 1 8 2 8\n\nSample Output 5\n\nYes", "sample_input": "3\n1 10 100\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03639", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a sequence of length N, a = (a_1, a_2, ..., a_N).\nEach a_i is a positive integer.\n\nSnuke's objective is to permute the element in a so that the following condition is satisfied:\n\nFor each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a multiple of 4.\n\nDetermine whether Snuke can achieve his objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\na_i is an integer.\n\n1 ≤ a_i ≤ 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\nIf Snuke can achieve his objective, print Yes; otherwise, print No.\n\nSample Input 1\n\n3\n1 10 100\n\nSample Output 1\n\nYes\n\nOne solution is (1, 100, 10).\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\nNo\n\nIt is impossible to permute a so that the condition is satisfied.\n\nSample Input 3\n\n3\n1 4 1\n\nSample Output 3\n\nYes\n\nThe condition is already satisfied initially.\n\nSample Input 4\n\n2\n1 1\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n6\n2 7 1 8 2 8\n\nSample Output 5\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 619, "cpu_time_ms": 472, "memory_kb": 50844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s169337369", "group_id": "codeNet:p03639", "input_text": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\nimport java.io.IOException;\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n TaskC solver = new TaskC();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class TaskC {\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.nextInt();\n int[] a = new int[3];\n for (int i = 0; i < n; ++i) {\n int x = in.nextInt();\n if (x % 4 == 0) {\n ++a[2];\n } else if (x % 2 == 0) {\n ++a[1];\n } else {\n ++a[0];\n }\n }\n if (a[1] > 0) {\n out.println(a[2] >= a[0] ? \"Yes\" : \"No\");\n } else {\n out.println(Math.abs(a[2] - a[0]) > 1 ? \"No\" : \"Yes\");\n }\n }\n\n }\n\n static class InputReader {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n }\n}\n\n", "language": "Java", "metadata": {"date": 1504906331, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03639.html", "problem_id": "p03639", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03639/input.txt", "sample_output_relpath": "derived/input_output/data/p03639/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03639/Java/s169337369.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s169337369", "user_id": "u396441153"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\nimport java.io.IOException;\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n TaskC solver = new TaskC();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class TaskC {\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.nextInt();\n int[] a = new int[3];\n for (int i = 0; i < n; ++i) {\n int x = in.nextInt();\n if (x % 4 == 0) {\n ++a[2];\n } else if (x % 2 == 0) {\n ++a[1];\n } else {\n ++a[0];\n }\n }\n if (a[1] > 0) {\n out.println(a[2] >= a[0] ? \"Yes\" : \"No\");\n } else {\n out.println(Math.abs(a[2] - a[0]) > 1 ? \"No\" : \"Yes\");\n }\n }\n\n }\n\n static class InputReader {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n }\n}\n\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a sequence of length N, a = (a_1, a_2, ..., a_N).\nEach a_i is a positive integer.\n\nSnuke's objective is to permute the element in a so that the following condition is satisfied:\n\nFor each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a multiple of 4.\n\nDetermine whether Snuke can achieve his objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\na_i is an integer.\n\n1 ≤ a_i ≤ 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\nIf Snuke can achieve his objective, print Yes; otherwise, print No.\n\nSample Input 1\n\n3\n1 10 100\n\nSample Output 1\n\nYes\n\nOne solution is (1, 100, 10).\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\nNo\n\nIt is impossible to permute a so that the condition is satisfied.\n\nSample Input 3\n\n3\n1 4 1\n\nSample Output 3\n\nYes\n\nThe condition is already satisfied initially.\n\nSample Input 4\n\n2\n1 1\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n6\n2 7 1 8 2 8\n\nSample Output 5\n\nYes", "sample_input": "3\n1 10 100\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03639", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a sequence of length N, a = (a_1, a_2, ..., a_N).\nEach a_i is a positive integer.\n\nSnuke's objective is to permute the element in a so that the following condition is satisfied:\n\nFor each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a multiple of 4.\n\nDetermine whether Snuke can achieve his objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\na_i is an integer.\n\n1 ≤ a_i ≤ 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\nIf Snuke can achieve his objective, print Yes; otherwise, print No.\n\nSample Input 1\n\n3\n1 10 100\n\nSample Output 1\n\nYes\n\nOne solution is (1, 100, 10).\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\nNo\n\nIt is impossible to permute a so that the condition is satisfied.\n\nSample Input 3\n\n3\n1 4 1\n\nSample Output 3\n\nYes\n\nThe condition is already satisfied initially.\n\nSample Input 4\n\n2\n1 1\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n6\n2 7 1 8 2 8\n\nSample Output 5\n\nYes", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2135, "cpu_time_ms": 179, "memory_kb": 37728}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s847429199", "group_id": "codeNet:p03705", "input_text": "import java.util.Scanner;\n\n\npublic class Main\n{\n\n\tpublic static void main(String[] args)\n\t{\n\t\t// TODO Auto-ge\n\t\tScanner sc=new Scanner(System.in);\n\t\twhile(sc.hasNext()){\n\t\t\tlong x=sc.nextLong(),y=sc.nextLong(),z=sc.nextLong();\n\t\t\tif(y>z||x==1)System.out.println(0);\n\t\t\telse if(y==z)System.out.println(1);\n\t\t\telse System.out.println((x-2)*(z-y)+1);\n\t\t}\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1601321503, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03705.html", "problem_id": "p03705", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03705/input.txt", "sample_output_relpath": "derived/input_output/data/p03705/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03705/Java/s847429199.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s847429199", "user_id": "u353919145"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.util.Scanner;\n\n\npublic class Main\n{\n\n\tpublic static void main(String[] args)\n\t{\n\t\t// TODO Auto-ge\n\t\tScanner sc=new Scanner(System.in);\n\t\twhile(sc.hasNext()){\n\t\t\tlong x=sc.nextLong(),y=sc.nextLong(),z=sc.nextLong();\n\t\t\tif(y>z||x==1)System.out.println(0);\n\t\t\telse if(y==z)System.out.println(1);\n\t\t\telse System.out.println((x-2)*(z-y)+1);\n\t\t}\n\t}\n\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSnuke has N integers. Among them, the smallest is A, and the largest is B.\nWe are interested in the sum of those N integers. How many different possible sums there are?\n\nConstraints\n\n1 ≤ N,A,B ≤ 10^9\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the number of the different possible sums.\n\nSample Input 1\n\n4 4 6\n\nSample Output 1\n\n5\n\nThere are five possible sums: 18=4+4+4+6, 19=4+4+5+6, 20=4+5+5+6, 21=4+5+6+6 and 22=4+6+6+6.\n\nSample Input 2\n\n5 4 3\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1 7 10\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 3 3\n\nSample Output 4\n\n1", "sample_input": "4 4 6\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03705", "source_text": "Score : 200 points\n\nProblem Statement\n\nSnuke has N integers. Among them, the smallest is A, and the largest is B.\nWe are interested in the sum of those N integers. How many different possible sums there are?\n\nConstraints\n\n1 ≤ N,A,B ≤ 10^9\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the number of the different possible sums.\n\nSample Input 1\n\n4 4 6\n\nSample Output 1\n\n5\n\nThere are five possible sums: 18=4+4+4+6, 19=4+4+5+6, 20=4+5+5+6, 21=4+5+6+6 and 22=4+6+6+6.\n\nSample Input 2\n\n5 4 3\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1 7 10\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 3 3\n\nSample Output 4\n\n1", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 358, "cpu_time_ms": 107, "memory_kb": 27016}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s914121121", "group_id": "codeNet:p03705", "input_text": "import java.util.*;\npublic class Main{\n\tpublic static void main(String[] args){\n \tScanner sc = new Scanner(System.in);\n long n = sc.nextLong();\n long a = sc.nextLong();\n long b = sc.nextLong();\n if(a>=b)System.out.println(0);\n else System.out.println(b*(n-2)-a*(n-2)+1);\n }\n}\n", "language": "Java", "metadata": {"date": 1569624605, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03705.html", "problem_id": "p03705", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03705/input.txt", "sample_output_relpath": "derived/input_output/data/p03705/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03705/Java/s914121121.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s914121121", "user_id": "u547167033"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.util.*;\npublic class Main{\n\tpublic static void main(String[] args){\n \tScanner sc = new Scanner(System.in);\n long n = sc.nextLong();\n long a = sc.nextLong();\n long b = sc.nextLong();\n if(a>=b)System.out.println(0);\n else System.out.println(b*(n-2)-a*(n-2)+1);\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSnuke has N integers. Among them, the smallest is A, and the largest is B.\nWe are interested in the sum of those N integers. How many different possible sums there are?\n\nConstraints\n\n1 ≤ N,A,B ≤ 10^9\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the number of the different possible sums.\n\nSample Input 1\n\n4 4 6\n\nSample Output 1\n\n5\n\nThere are five possible sums: 18=4+4+4+6, 19=4+4+5+6, 20=4+5+5+6, 21=4+5+6+6 and 22=4+6+6+6.\n\nSample Input 2\n\n5 4 3\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1 7 10\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 3 3\n\nSample Output 4\n\n1", "sample_input": "4 4 6\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03705", "source_text": "Score : 200 points\n\nProblem Statement\n\nSnuke has N integers. Among them, the smallest is A, and the largest is B.\nWe are interested in the sum of those N integers. How many different possible sums there are?\n\nConstraints\n\n1 ≤ N,A,B ≤ 10^9\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the number of the different possible sums.\n\nSample Input 1\n\n4 4 6\n\nSample Output 1\n\n5\n\nThere are five possible sums: 18=4+4+4+6, 19=4+4+5+6, 20=4+5+5+6, 21=4+5+6+6 and 22=4+6+6+6.\n\nSample Input 2\n\n5 4 3\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1 7 10\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 3 3\n\nSample Output 4\n\n1", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 22740}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s459638385", "group_id": "codeNet:p03705", "input_text": "import java.math.BigInteger;\nimport java.util.*;\npublic class Main {\n\t\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n \n long N = sc.nextLong();\n long A = sc.nextLong();\n long B = sc.nextLong();\n \n if (A > B || N < (A-B+1)) {\n \tSystem.out.println(0);\n \treturn;\n }\n \n \n //処理\n N -= 2;\n \n String ans = BigInteger.valueOf(B).multiply(BigInteger.valueOf(N)).subtract(BigInteger.valueOf(A).multiply(BigInteger.valueOf(N))).add(BigInteger.ONE).toString(10);\n \n System.out.println(ans);\n }\n}\n\n", "language": "Java", "metadata": {"date": 1548180798, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03705.html", "problem_id": "p03705", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03705/input.txt", "sample_output_relpath": "derived/input_output/data/p03705/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03705/Java/s459638385.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s459638385", "user_id": "u927651664"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.math.BigInteger;\nimport java.util.*;\npublic class Main {\n\t\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n \n long N = sc.nextLong();\n long A = sc.nextLong();\n long B = sc.nextLong();\n \n if (A > B || N < (A-B+1)) {\n \tSystem.out.println(0);\n \treturn;\n }\n \n \n //処理\n N -= 2;\n \n String ans = BigInteger.valueOf(B).multiply(BigInteger.valueOf(N)).subtract(BigInteger.valueOf(A).multiply(BigInteger.valueOf(N))).add(BigInteger.ONE).toString(10);\n \n System.out.println(ans);\n }\n}\n\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSnuke has N integers. Among them, the smallest is A, and the largest is B.\nWe are interested in the sum of those N integers. How many different possible sums there are?\n\nConstraints\n\n1 ≤ N,A,B ≤ 10^9\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the number of the different possible sums.\n\nSample Input 1\n\n4 4 6\n\nSample Output 1\n\n5\n\nThere are five possible sums: 18=4+4+4+6, 19=4+4+5+6, 20=4+5+5+6, 21=4+5+6+6 and 22=4+6+6+6.\n\nSample Input 2\n\n5 4 3\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1 7 10\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 3 3\n\nSample Output 4\n\n1", "sample_input": "4 4 6\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03705", "source_text": "Score : 200 points\n\nProblem Statement\n\nSnuke has N integers. Among them, the smallest is A, and the largest is B.\nWe are interested in the sum of those N integers. How many different possible sums there are?\n\nConstraints\n\n1 ≤ N,A,B ≤ 10^9\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the number of the different possible sums.\n\nSample Input 1\n\n4 4 6\n\nSample Output 1\n\n5\n\nThere are five possible sums: 18=4+4+4+6, 19=4+4+5+6, 20=4+5+5+6, 21=4+5+6+6 and 22=4+6+6+6.\n\nSample Input 2\n\n5 4 3\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1 7 10\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 3 3\n\nSample Output 4\n\n1", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 654, "cpu_time_ms": 101, "memory_kb": 22996}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s913077161", "group_id": "codeNet:p03705", "input_text": "import java.util.Scanner;\n\n\n\n\npublic class Main {\n\n public static void main(String[] args) {\n\n \tMain main=new Main();\n\n \tmain.run();\n\n }\n\n void run() {\n \tScanner sc=new Scanner(System.in);\n\n \tint N=sc.nextInt();\n \tint A=sc.nextInt();\n \tint B=sc.nextInt();\n\n \tif(A>B || (N==1 && A!=B)) {\n \t\tSystem.out.println(\"0\");\n \t\treturn;\n \t}\n\n \tint lowbound=(N-1)*A+B;\n \tint upeerbound=A+(N-1)*B;\n\n \tint result=upeerbound-lowbound+1;\n\n \tSystem.out.println(result);\n }\n\n\n}\n\n", "language": "Java", "metadata": {"date": 1528240748, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03705.html", "problem_id": "p03705", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03705/input.txt", "sample_output_relpath": "derived/input_output/data/p03705/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03705/Java/s913077161.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s913077161", "user_id": "u874996917"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.util.Scanner;\n\n\n\n\npublic class Main {\n\n public static void main(String[] args) {\n\n \tMain main=new Main();\n\n \tmain.run();\n\n }\n\n void run() {\n \tScanner sc=new Scanner(System.in);\n\n \tint N=sc.nextInt();\n \tint A=sc.nextInt();\n \tint B=sc.nextInt();\n\n \tif(A>B || (N==1 && A!=B)) {\n \t\tSystem.out.println(\"0\");\n \t\treturn;\n \t}\n\n \tint lowbound=(N-1)*A+B;\n \tint upeerbound=A+(N-1)*B;\n\n \tint result=upeerbound-lowbound+1;\n\n \tSystem.out.println(result);\n }\n\n\n}\n\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSnuke has N integers. Among them, the smallest is A, and the largest is B.\nWe are interested in the sum of those N integers. How many different possible sums there are?\n\nConstraints\n\n1 ≤ N,A,B ≤ 10^9\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the number of the different possible sums.\n\nSample Input 1\n\n4 4 6\n\nSample Output 1\n\n5\n\nThere are five possible sums: 18=4+4+4+6, 19=4+4+5+6, 20=4+5+5+6, 21=4+5+6+6 and 22=4+6+6+6.\n\nSample Input 2\n\n5 4 3\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1 7 10\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 3 3\n\nSample Output 4\n\n1", "sample_input": "4 4 6\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03705", "source_text": "Score : 200 points\n\nProblem Statement\n\nSnuke has N integers. Among them, the smallest is A, and the largest is B.\nWe are interested in the sum of those N integers. How many different possible sums there are?\n\nConstraints\n\n1 ≤ N,A,B ≤ 10^9\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the number of the different possible sums.\n\nSample Input 1\n\n4 4 6\n\nSample Output 1\n\n5\n\nThere are five possible sums: 18=4+4+4+6, 19=4+4+5+6, 20=4+5+5+6, 21=4+5+6+6 and 22=4+6+6+6.\n\nSample Input 2\n\n5 4 3\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1 7 10\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 3 3\n\nSample Output 4\n\n1", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 515, "cpu_time_ms": 93, "memory_kb": 23124}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s055165614", "group_id": "codeNet:p03705", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n\tstatic Scanner sc = new Scanner(System.in);\n public void run() throws Exception {\n \t//StringBuilder sb = new StringBuilder();\n\n \tint n1 = sc.nextInt();\n \tint n2 = sc.nextInt();\n \tint n3 = sc.nextInt();\n \tlong anw = 0;\n \tif(n1 == 1){\n \t\tif(n2 > n3){\n \t\t\tanw = 0;\n \t\t}else if (n2 == n3){\n \t\t\tlong min = n2*(n1-1) + n3;\n \tlong max = n3*(n1-1) + n2;\n \tanw = max - min + 1;\n \t\t}\n \t}else {\n \tlong min = n2*(n1-1) + n3;\n \tlong max = n3*(n1-1) + n2;\n \tanw = max - min + 1;\n \t}\n \tSystem.out.println(anw);\n }\n public static void main(String[] args) throws Exception {\n new Main().run();\n }\n}\n", "language": "Java", "metadata": {"date": 1497208015, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03705.html", "problem_id": "p03705", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03705/input.txt", "sample_output_relpath": "derived/input_output/data/p03705/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03705/Java/s055165614.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s055165614", "user_id": "u589207414"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n\tstatic Scanner sc = new Scanner(System.in);\n public void run() throws Exception {\n \t//StringBuilder sb = new StringBuilder();\n\n \tint n1 = sc.nextInt();\n \tint n2 = sc.nextInt();\n \tint n3 = sc.nextInt();\n \tlong anw = 0;\n \tif(n1 == 1){\n \t\tif(n2 > n3){\n \t\t\tanw = 0;\n \t\t}else if (n2 == n3){\n \t\t\tlong min = n2*(n1-1) + n3;\n \tlong max = n3*(n1-1) + n2;\n \tanw = max - min + 1;\n \t\t}\n \t}else {\n \tlong min = n2*(n1-1) + n3;\n \tlong max = n3*(n1-1) + n2;\n \tanw = max - min + 1;\n \t}\n \tSystem.out.println(anw);\n }\n public static void main(String[] args) throws Exception {\n new Main().run();\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSnuke has N integers. Among them, the smallest is A, and the largest is B.\nWe are interested in the sum of those N integers. How many different possible sums there are?\n\nConstraints\n\n1 ≤ N,A,B ≤ 10^9\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the number of the different possible sums.\n\nSample Input 1\n\n4 4 6\n\nSample Output 1\n\n5\n\nThere are five possible sums: 18=4+4+4+6, 19=4+4+5+6, 20=4+5+5+6, 21=4+5+6+6 and 22=4+6+6+6.\n\nSample Input 2\n\n5 4 3\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1 7 10\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 3 3\n\nSample Output 4\n\n1", "sample_input": "4 4 6\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03705", "source_text": "Score : 200 points\n\nProblem Statement\n\nSnuke has N integers. Among them, the smallest is A, and the largest is B.\nWe are interested in the sum of those N integers. How many different possible sums there are?\n\nConstraints\n\n1 ≤ N,A,B ≤ 10^9\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the number of the different possible sums.\n\nSample Input 1\n\n4 4 6\n\nSample Output 1\n\n5\n\nThere are five possible sums: 18=4+4+4+6, 19=4+4+5+6, 20=4+5+5+6, 21=4+5+6+6 and 22=4+6+6+6.\n\nSample Input 2\n\n5 4 3\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1 7 10\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 3 3\n\nSample Output 4\n\n1", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 103, "memory_kb": 21716}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s131287757", "group_id": "codeNet:p03705", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint a = sc.nextInt();\n\t\tint b = sc.nextInt();\n\t\tint min = 0;\n\t\tint max = 0;\n\t\tint cnt = 0;\n\n\t\tif(n == 1) {\n\t\t\tif(a == b) {\n\t\t\t\tcnt++;\n\t\t\t}else if(a != b) {\n\t\t\t\t//なにもしない\n\t\t\t}\n\t\t}else if(n > 1) {\n\t\t\tif(a > b) {\n\t\t\t\t//なにもしない\n\t\t\t}else if(a < b){\n\t\t\t\tfor(int i = 0 ; i < n ; i++) {\n\t\t\t\t\tmin += a;\n\t\t\t\t\tmax += b;\n\t\t\t\t}\n\t\t\t\tcnt = (max - b + a) - (min - a + b) + 1;\n\t\t\t}else if(a == b){\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}\n}\n", "language": "Java", "metadata": {"date": 1495937452, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03705.html", "problem_id": "p03705", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03705/input.txt", "sample_output_relpath": "derived/input_output/data/p03705/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03705/Java/s131287757.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s131287757", "user_id": "u764011970"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint a = sc.nextInt();\n\t\tint b = sc.nextInt();\n\t\tint min = 0;\n\t\tint max = 0;\n\t\tint cnt = 0;\n\n\t\tif(n == 1) {\n\t\t\tif(a == b) {\n\t\t\t\tcnt++;\n\t\t\t}else if(a != b) {\n\t\t\t\t//なにもしない\n\t\t\t}\n\t\t}else if(n > 1) {\n\t\t\tif(a > b) {\n\t\t\t\t//なにもしない\n\t\t\t}else if(a < b){\n\t\t\t\tfor(int i = 0 ; i < n ; i++) {\n\t\t\t\t\tmin += a;\n\t\t\t\t\tmax += b;\n\t\t\t\t}\n\t\t\t\tcnt = (max - b + a) - (min - a + b) + 1;\n\t\t\t}else if(a == b){\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSnuke has N integers. Among them, the smallest is A, and the largest is B.\nWe are interested in the sum of those N integers. How many different possible sums there are?\n\nConstraints\n\n1 ≤ N,A,B ≤ 10^9\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the number of the different possible sums.\n\nSample Input 1\n\n4 4 6\n\nSample Output 1\n\n5\n\nThere are five possible sums: 18=4+4+4+6, 19=4+4+5+6, 20=4+5+5+6, 21=4+5+6+6 and 22=4+6+6+6.\n\nSample Input 2\n\n5 4 3\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1 7 10\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 3 3\n\nSample Output 4\n\n1", "sample_input": "4 4 6\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03705", "source_text": "Score : 200 points\n\nProblem Statement\n\nSnuke has N integers. Among them, the smallest is A, and the largest is B.\nWe are interested in the sum of those N integers. How many different possible sums there are?\n\nConstraints\n\n1 ≤ N,A,B ≤ 10^9\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the number of the different possible sums.\n\nSample Input 1\n\n4 4 6\n\nSample Output 1\n\n5\n\nThere are five possible sums: 18=4+4+4+6, 19=4+4+5+6, 20=4+5+5+6, 21=4+5+6+6 and 22=4+6+6+6.\n\nSample Input 2\n\n5 4 3\n\nSample Output 2\n\n0\n\nSample Input 3\n\n1 7 10\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 3 3\n\nSample Output 4\n\n1", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 666, "cpu_time_ms": 137, "memory_kb": 22604}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s869214241", "group_id": "codeNet:p03714", "input_text": "\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.Comparator;\nimport java.util.InputMismatchException;\nimport java.util.PriorityQueue;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tInputReader in = new InputReader(inputStream);\n\t\tPrintWriter out = new PrintWriter(outputStream);\n\t\tTaskX solver = new TaskX();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n\n\tstatic int INF = 1 << 30;\n\tstatic long LINF = 1L << 55;\n\tstatic int MOD = 1000000007;\n\tstatic int[] mh4 = { 0, -1, 1, 0 };\n\tstatic int[] mw4 = { -1, 0, 0, 1 };\n\tstatic int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };\n\tstatic int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };\n\n\tstatic class TaskX {\n\n\t\tpublic void solve(int testNumber, InputReader in, PrintWriter out) {\n\n\t\t\tint n = in.nextInt();\n\t\t\tlong[] a = in.nextLongArray(3*n);\n\t\t\tPriorityQueue b = new PriorityQueue();\n\t\t\tPriorityQueue r = new PriorityQueue(Comparator.reverseOrder());\n\t\t\tlong b_sum = 0, r_sum = 0;\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tb_sum += a[i];\n\t\t\t\tb.add(a[i]);\n\n\t\t\t\tr_sum += a[3*n-i-1];\n\t\t\t\tr.add(a[3*n-i-1]);\n\t\t\t}\n\n\t\t\tlong[] b_max = new long[n+1];\n\t\t\tlong[] r_max = new long[n+1];\n\t\t\tb_max[0] = b_sum;\n\t\t\tr_max[0] = r_sum;\n\n\t\t\tfor (int i = 1; i <= n; i++) {\n\t\t\t\tb.add(a[n+i-1]);\n\t\t\t\tb_max[i] += b_max[i-1] + a[n+i-1] - b.remove();\n\t\t\t}\n\n\t\t\tfor (int i = 1; i <= n; i++) {\n\t\t\t\tr.add(a[2*n-i]);\n\t\t\t\tr_max[i] += r_max[i-1] + a[2*n-i] - r.remove();\n\t\t\t}\n\n\t\t\tlong ans = -LINF;\n\t\t\tfor (int i = 0; i <= n; i++) {\n\t\t\t\tans = Math.max(ans, b_max[i] - r_max[n-i]);\n\t\t\t}\n\n\t\t\tout.println(ans);\n\t\t}\n\t}\n\n\tstatic class InputReader {\n\t\tBufferedReader in;\n\t\tStringTokenizer tok;\n\n\t\tpublic String nextString() {\n\t\t\twhile (!tok.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\ttok = new StringTokenizer(in.readLine(), \" \");\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn tok.nextToken();\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\treturn Integer.parseInt(nextString());\n\t\t}\n\n\t\tpublic long nextLong() {\n\t\t\treturn Long.parseLong(nextString());\n\t\t}\n\n\t\tpublic double nextDouble() {\n\t\t\treturn Double.parseDouble(nextString());\n\t\t}\n\n\t\tpublic int[] nextIntArray(int n) {\n\t\t\tint[] res = new int[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tres[i] = nextInt();\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic int[] nextIntArrayDec(int n) {\n\t\t\tint[] res = new int[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tres[i] = nextInt() - 1;\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic int[] nextIntArray1Index(int n) {\n\t\t\tint[] res = new int[n + 1];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tres[i + 1] = nextInt();\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic long[] nextLongArray(int n) {\n\t\t\tlong[] res = new long[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tres[i] = nextLong();\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic long[] nextLongArrayDec(int n) {\n\t\t\tlong[] res = new long[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tres[i] = nextLong() - 1;\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic long[] nextLongArray1Index(int n) {\n\t\t\tlong[] res = new long[n + 1];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tres[i + 1] = nextLong();\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic double[] nextDoubleArray(int n) {\n\t\t\tdouble[] res = new double[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tres[i] = nextDouble();\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic InputReader(InputStream inputStream) {\n\t\t\tin = new BufferedReader(new InputStreamReader(inputStream));\n\t\t\ttok = new StringTokenizer(\"\");\n\t\t}\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1536943333, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03714.html", "problem_id": "p03714", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03714/input.txt", "sample_output_relpath": "derived/input_output/data/p03714/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03714/Java/s869214241.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s869214241", "user_id": "u266665184"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.Comparator;\nimport java.util.InputMismatchException;\nimport java.util.PriorityQueue;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tInputReader in = new InputReader(inputStream);\n\t\tPrintWriter out = new PrintWriter(outputStream);\n\t\tTaskX solver = new TaskX();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n\n\tstatic int INF = 1 << 30;\n\tstatic long LINF = 1L << 55;\n\tstatic int MOD = 1000000007;\n\tstatic int[] mh4 = { 0, -1, 1, 0 };\n\tstatic int[] mw4 = { -1, 0, 0, 1 };\n\tstatic int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };\n\tstatic int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };\n\n\tstatic class TaskX {\n\n\t\tpublic void solve(int testNumber, InputReader in, PrintWriter out) {\n\n\t\t\tint n = in.nextInt();\n\t\t\tlong[] a = in.nextLongArray(3*n);\n\t\t\tPriorityQueue b = new PriorityQueue();\n\t\t\tPriorityQueue r = new PriorityQueue(Comparator.reverseOrder());\n\t\t\tlong b_sum = 0, r_sum = 0;\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tb_sum += a[i];\n\t\t\t\tb.add(a[i]);\n\n\t\t\t\tr_sum += a[3*n-i-1];\n\t\t\t\tr.add(a[3*n-i-1]);\n\t\t\t}\n\n\t\t\tlong[] b_max = new long[n+1];\n\t\t\tlong[] r_max = new long[n+1];\n\t\t\tb_max[0] = b_sum;\n\t\t\tr_max[0] = r_sum;\n\n\t\t\tfor (int i = 1; i <= n; i++) {\n\t\t\t\tb.add(a[n+i-1]);\n\t\t\t\tb_max[i] += b_max[i-1] + a[n+i-1] - b.remove();\n\t\t\t}\n\n\t\t\tfor (int i = 1; i <= n; i++) {\n\t\t\t\tr.add(a[2*n-i]);\n\t\t\t\tr_max[i] += r_max[i-1] + a[2*n-i] - r.remove();\n\t\t\t}\n\n\t\t\tlong ans = -LINF;\n\t\t\tfor (int i = 0; i <= n; i++) {\n\t\t\t\tans = Math.max(ans, b_max[i] - r_max[n-i]);\n\t\t\t}\n\n\t\t\tout.println(ans);\n\t\t}\n\t}\n\n\tstatic class InputReader {\n\t\tBufferedReader in;\n\t\tStringTokenizer tok;\n\n\t\tpublic String nextString() {\n\t\t\twhile (!tok.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\ttok = new StringTokenizer(in.readLine(), \" \");\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn tok.nextToken();\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\treturn Integer.parseInt(nextString());\n\t\t}\n\n\t\tpublic long nextLong() {\n\t\t\treturn Long.parseLong(nextString());\n\t\t}\n\n\t\tpublic double nextDouble() {\n\t\t\treturn Double.parseDouble(nextString());\n\t\t}\n\n\t\tpublic int[] nextIntArray(int n) {\n\t\t\tint[] res = new int[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tres[i] = nextInt();\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic int[] nextIntArrayDec(int n) {\n\t\t\tint[] res = new int[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tres[i] = nextInt() - 1;\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic int[] nextIntArray1Index(int n) {\n\t\t\tint[] res = new int[n + 1];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tres[i + 1] = nextInt();\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic long[] nextLongArray(int n) {\n\t\t\tlong[] res = new long[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tres[i] = nextLong();\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic long[] nextLongArrayDec(int n) {\n\t\t\tlong[] res = new long[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tres[i] = nextLong() - 1;\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic long[] nextLongArray1Index(int n) {\n\t\t\tlong[] res = new long[n + 1];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tres[i + 1] = nextLong();\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic double[] nextDoubleArray(int n) {\n\t\t\tdouble[] res = new double[n];\n\t\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\tres[i] = nextDouble();\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\n\t\tpublic InputReader(InputStream inputStream) {\n\t\t\tin = new BufferedReader(new InputStreamReader(inputStream));\n\t\t\ttok = new StringTokenizer(\"\");\n\t\t}\n\t}\n\n}\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nLet N be a positive integer.\n\nThere is a numerical sequence of length 3N, a = (a_1, a_2, ..., a_{3N}).\nSnuke is constructing a new sequence of length 2N, a', by removing exactly N elements from a without changing the order of the remaining elements.\nHere, the score of a' is defined as follows: (the sum of the elements in the first half of a') - (the sum of the elements in the second half of a').\n\nFind the maximum possible score of a'.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\na_i is an integer.\n\n1 ≤ a_i ≤ 10^9\n\nPartial Score\n\nIn the test set worth 300 points, N ≤ 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_{3N}\n\nOutput\n\nPrint the maximum possible score of a'.\n\nSample Input 1\n\n2\n3 1 4 1 5 9\n\nSample Output 1\n\n1\n\nWhen a_2 and a_6 are removed, a' will be (3, 4, 1, 5), which has a score of (3 + 4) - (1 + 5) = 1.\n\nSample Input 2\n\n1\n1 2 3\n\nSample Output 2\n\n-1\n\nFor example, when a_1 are removed, a' will be (2, 3), which has a score of 2 - 3 = -1.\n\nSample Input 3\n\n3\n8 2 2 7 4 6 5 3 8\n\nSample Output 3\n\n5\n\nFor example, when a_2, a_3 and a_9 are removed, a' will be (8, 7, 4, 6, 5, 3), which has a score of (8 + 7 + 4) - (6 + 5 + 3) = 5.", "sample_input": "2\n3 1 4 1 5 9\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03714", "source_text": "Score : 500 points\n\nProblem Statement\n\nLet N be a positive integer.\n\nThere is a numerical sequence of length 3N, a = (a_1, a_2, ..., a_{3N}).\nSnuke is constructing a new sequence of length 2N, a', by removing exactly N elements from a without changing the order of the remaining elements.\nHere, the score of a' is defined as follows: (the sum of the elements in the first half of a') - (the sum of the elements in the second half of a').\n\nFind the maximum possible score of a'.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\na_i is an integer.\n\n1 ≤ a_i ≤ 10^9\n\nPartial Score\n\nIn the test set worth 300 points, N ≤ 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_{3N}\n\nOutput\n\nPrint the maximum possible score of a'.\n\nSample Input 1\n\n2\n3 1 4 1 5 9\n\nSample Output 1\n\n1\n\nWhen a_2 and a_6 are removed, a' will be (3, 4, 1, 5), which has a score of (3 + 4) - (1 + 5) = 1.\n\nSample Input 2\n\n1\n1 2 3\n\nSample Output 2\n\n-1\n\nFor example, when a_1 are removed, a' will be (2, 3), which has a score of 2 - 3 = -1.\n\nSample Input 3\n\n3\n8 2 2 7 4 6 5 3 8\n\nSample Output 3\n\n5\n\nFor example, when a_2, a_3 and a_9 are removed, a' will be (8, 7, 4, 6, 5, 3), which has a score of (8 + 7 + 4) - (6 + 5 + 3) = 5.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3625, "cpu_time_ms": 408, "memory_kb": 66188}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s492916772", "group_id": "codeNet:p03814", "input_text": "import java.util.Scanner;\nimport java.util.regex.Matcher;\nimport java.util.regex.Pattern;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n String s = scanner.next();\n\n scanner.close();\n\n Pattern p = Pattern.compile(\"[A][A-Z]*[Z]\");\n Matcher matcher = p.matcher(s);\n int max = 0;\n while (matcher.find()) {\n int length = matcher.group().length();\n if (max < length) {\n max = length;\n }\n }\n\n System.out.println(max);\n }\n}\n", "language": "Java", "metadata": {"date": 1572919670, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03814.html", "problem_id": "p03814", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03814/input.txt", "sample_output_relpath": "derived/input_output/data/p03814/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03814/Java/s492916772.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s492916772", "user_id": "u124992755"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.util.Scanner;\nimport java.util.regex.Matcher;\nimport java.util.regex.Pattern;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n String s = scanner.next();\n\n scanner.close();\n\n Pattern p = Pattern.compile(\"[A][A-Z]*[Z]\");\n Matcher matcher = p.matcher(s);\n int max = 0;\n while (matcher.find()) {\n int length = matcher.group().length();\n if (max < length) {\n max = length;\n }\n }\n\n System.out.println(max);\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSnuke has decided to construct a string that starts with A and ends with Z, by taking out a substring of a string s (that is, a consecutive part of s).\n\nFind the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with A and ends with Z.\n\nConstraints\n\n1 ≦ |s| ≦ 200{,}000\n\ns consists of uppercase English letters.\n\nThere exists a substring of s that starts with A and ends with Z.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\nQWERTYASDFZXCV\n\nSample Output 1\n\n5\n\nBy taking out the seventh through eleventh characters, it is possible to construct ASDFZ, which starts with A and ends with Z.\n\nSample Input 2\n\nZABCZ\n\nSample Output 2\n\n4\n\nSample Input 3\n\nHASFJGHOGAKZZFEGA\n\nSample Output 3\n\n12", "sample_input": "QWERTYASDFZXCV\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03814", "source_text": "Score : 200 points\n\nProblem Statement\n\nSnuke has decided to construct a string that starts with A and ends with Z, by taking out a substring of a string s (that is, a consecutive part of s).\n\nFind the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with A and ends with Z.\n\nConstraints\n\n1 ≦ |s| ≦ 200{,}000\n\ns consists of uppercase English letters.\n\nThere exists a substring of s that starts with A and ends with Z.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\nQWERTYASDFZXCV\n\nSample Output 1\n\n5\n\nBy taking out the seventh through eleventh characters, it is possible to construct ASDFZ, which starts with A and ends with Z.\n\nSample Input 2\n\nZABCZ\n\nSample Output 2\n\n4\n\nSample Input 3\n\nHASFJGHOGAKZZFEGA\n\nSample Output 3\n\n12", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 199, "memory_kb": 25664}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s770845918", "group_id": "codeNet:p03814", "input_text": "import java.util.Scanner;\n\npublic class Main{\n public static void main(String[] args){\n Scanner sc=new Scanner(System.in);\n String s=sc.next();\n int index1=s.indexOf(\"A\");\n int index2=s.indexOf(\"Z\");\n System.out.println(s.substring(index1,index2+1).length());\n }\n}", "language": "Java", "metadata": {"date": 1572356713, "filename_ext": "java", "original_language": "Java7 (OpenJDK 1.7.0)", "problem_description_relpath": "problem_descriptions/p03814.html", "problem_id": "p03814", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03814/input.txt", "sample_output_relpath": "derived/input_output/data/p03814/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03814/Java/s770845918.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s770845918", "user_id": "u431125128"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main{\n public static void main(String[] args){\n Scanner sc=new Scanner(System.in);\n String s=sc.next();\n int index1=s.indexOf(\"A\");\n int index2=s.indexOf(\"Z\");\n System.out.println(s.substring(index1,index2+1).length());\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSnuke has decided to construct a string that starts with A and ends with Z, by taking out a substring of a string s (that is, a consecutive part of s).\n\nFind the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with A and ends with Z.\n\nConstraints\n\n1 ≦ |s| ≦ 200{,}000\n\ns consists of uppercase English letters.\n\nThere exists a substring of s that starts with A and ends with Z.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\nQWERTYASDFZXCV\n\nSample Output 1\n\n5\n\nBy taking out the seventh through eleventh characters, it is possible to construct ASDFZ, which starts with A and ends with Z.\n\nSample Input 2\n\nZABCZ\n\nSample Output 2\n\n4\n\nSample Input 3\n\nHASFJGHOGAKZZFEGA\n\nSample Output 3\n\n12", "sample_input": "QWERTYASDFZXCV\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03814", "source_text": "Score : 200 points\n\nProblem Statement\n\nSnuke has decided to construct a string that starts with A and ends with Z, by taking out a substring of a string s (that is, a consecutive part of s).\n\nFind the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with A and ends with Z.\n\nConstraints\n\n1 ≦ |s| ≦ 200{,}000\n\ns consists of uppercase English letters.\n\nThere exists a substring of s that starts with A and ends with Z.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\nQWERTYASDFZXCV\n\nSample Output 1\n\n5\n\nBy taking out the seventh through eleventh characters, it is possible to construct ASDFZ, which starts with A and ends with Z.\n\nSample Input 2\n\nZABCZ\n\nSample Output 2\n\n4\n\nSample Input 3\n\nHASFJGHOGAKZZFEGA\n\nSample Output 3\n\n12", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 194, "memory_kb": 26132}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s942270201", "group_id": "codeNet:p03814", "input_text": "import java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n\n int positionA = Integer.MAX_VALUE;// Aは出来るだけ文字列の先頭で見つけたい\n int positionZ = 0;// Zは出来るだけ文字の後ろで見つけたい\n for (int i = 0; i < s.length(); i++) {\n if (s.charAt(i) == 'A') {\n if (positionA > i) positionA = i;\n } else if (s.charAt(i) == 'Z') {\n if (positionZ < i) positionZ = i;\n }\n }\n\n System.out.println(positionZ-positionA+1);\n }\n}\n", "language": "Java", "metadata": {"date": 1565753466, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03814.html", "problem_id": "p03814", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03814/input.txt", "sample_output_relpath": "derived/input_output/data/p03814/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03814/Java/s942270201.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s942270201", "user_id": "u847564582"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n\n int positionA = Integer.MAX_VALUE;// Aは出来るだけ文字列の先頭で見つけたい\n int positionZ = 0;// Zは出来るだけ文字の後ろで見つけたい\n for (int i = 0; i < s.length(); i++) {\n if (s.charAt(i) == 'A') {\n if (positionA > i) positionA = i;\n } else if (s.charAt(i) == 'Z') {\n if (positionZ < i) positionZ = i;\n }\n }\n\n System.out.println(positionZ-positionA+1);\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSnuke has decided to construct a string that starts with A and ends with Z, by taking out a substring of a string s (that is, a consecutive part of s).\n\nFind the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with A and ends with Z.\n\nConstraints\n\n1 ≦ |s| ≦ 200{,}000\n\ns consists of uppercase English letters.\n\nThere exists a substring of s that starts with A and ends with Z.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\nQWERTYASDFZXCV\n\nSample Output 1\n\n5\n\nBy taking out the seventh through eleventh characters, it is possible to construct ASDFZ, which starts with A and ends with Z.\n\nSample Input 2\n\nZABCZ\n\nSample Output 2\n\n4\n\nSample Input 3\n\nHASFJGHOGAKZZFEGA\n\nSample Output 3\n\n12", "sample_input": "QWERTYASDFZXCV\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03814", "source_text": "Score : 200 points\n\nProblem Statement\n\nSnuke has decided to construct a string that starts with A and ends with Z, by taking out a substring of a string s (that is, a consecutive part of s).\n\nFind the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with A and ends with Z.\n\nConstraints\n\n1 ≦ |s| ≦ 200{,}000\n\ns consists of uppercase English letters.\n\nThere exists a substring of s that starts with A and ends with Z.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\nQWERTYASDFZXCV\n\nSample Output 1\n\n5\n\nBy taking out the seventh through eleventh characters, it is possible to construct ASDFZ, which starts with A and ends with Z.\n\nSample Input 2\n\nZABCZ\n\nSample Output 2\n\n4\n\nSample Input 3\n\nHASFJGHOGAKZZFEGA\n\nSample Output 3\n\n12", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 660, "cpu_time_ms": 173, "memory_kb": 25044}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s981345221", "group_id": "codeNet:p03814", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[]args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString s = sc.next();\n\n\t\tint min = s.length();\n\t\tint max = 0;\n\n\t\tfor(int i = 0; i < s.length(); i++) {\n\t\t\tif('A'==s.charAt(i)) {\n\t\t\t\tmin = Math.min(min, i);\n\t\t\t}\n\t\t\tif('Z'==s.charAt(i)) {\n\t\t\t\tmax = Math.max(max, i);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println((max - min) + 1);\n\n\t}\n\n}", "language": "Java", "metadata": {"date": 1564165966, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03814.html", "problem_id": "p03814", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03814/input.txt", "sample_output_relpath": "derived/input_output/data/p03814/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03814/Java/s981345221.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s981345221", "user_id": "u412290310"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[]args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString s = sc.next();\n\n\t\tint min = s.length();\n\t\tint max = 0;\n\n\t\tfor(int i = 0; i < s.length(); i++) {\n\t\t\tif('A'==s.charAt(i)) {\n\t\t\t\tmin = Math.min(min, i);\n\t\t\t}\n\t\t\tif('Z'==s.charAt(i)) {\n\t\t\t\tmax = Math.max(max, i);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println((max - min) + 1);\n\n\t}\n\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSnuke has decided to construct a string that starts with A and ends with Z, by taking out a substring of a string s (that is, a consecutive part of s).\n\nFind the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with A and ends with Z.\n\nConstraints\n\n1 ≦ |s| ≦ 200{,}000\n\ns consists of uppercase English letters.\n\nThere exists a substring of s that starts with A and ends with Z.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\nQWERTYASDFZXCV\n\nSample Output 1\n\n5\n\nBy taking out the seventh through eleventh characters, it is possible to construct ASDFZ, which starts with A and ends with Z.\n\nSample Input 2\n\nZABCZ\n\nSample Output 2\n\n4\n\nSample Input 3\n\nHASFJGHOGAKZZFEGA\n\nSample Output 3\n\n12", "sample_input": "QWERTYASDFZXCV\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03814", "source_text": "Score : 200 points\n\nProblem Statement\n\nSnuke has decided to construct a string that starts with A and ends with Z, by taking out a substring of a string s (that is, a consecutive part of s).\n\nFind the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with A and ends with Z.\n\nConstraints\n\n1 ≦ |s| ≦ 200{,}000\n\ns consists of uppercase English letters.\n\nThere exists a substring of s that starts with A and ends with Z.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\nQWERTYASDFZXCV\n\nSample Output 1\n\n5\n\nBy taking out the seventh through eleventh characters, it is possible to construct ASDFZ, which starts with A and ends with Z.\n\nSample Input 2\n\nZABCZ\n\nSample Output 2\n\n4\n\nSample Input 3\n\nHASFJGHOGAKZZFEGA\n\nSample Output 3\n\n12", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 172, "memory_kb": 26184}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s703931700", "group_id": "codeNet:p03814", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tString s = sc.next();\n\n\t\tSystem.out.println(s.lastIndexOf('Z') - s.indexOf('A') + 1);\n\n \tsc.close();\n\t}\n}", "language": "Java", "metadata": {"date": 1549726814, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03814.html", "problem_id": "p03814", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03814/input.txt", "sample_output_relpath": "derived/input_output/data/p03814/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03814/Java/s703931700.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s703931700", "user_id": "u818498408"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tString s = sc.next();\n\n\t\tSystem.out.println(s.lastIndexOf('Z') - s.indexOf('A') + 1);\n\n \tsc.close();\n\t}\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSnuke has decided to construct a string that starts with A and ends with Z, by taking out a substring of a string s (that is, a consecutive part of s).\n\nFind the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with A and ends with Z.\n\nConstraints\n\n1 ≦ |s| ≦ 200{,}000\n\ns consists of uppercase English letters.\n\nThere exists a substring of s that starts with A and ends with Z.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\nQWERTYASDFZXCV\n\nSample Output 1\n\n5\n\nBy taking out the seventh through eleventh characters, it is possible to construct ASDFZ, which starts with A and ends with Z.\n\nSample Input 2\n\nZABCZ\n\nSample Output 2\n\n4\n\nSample Input 3\n\nHASFJGHOGAKZZFEGA\n\nSample Output 3\n\n12", "sample_input": "QWERTYASDFZXCV\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03814", "source_text": "Score : 200 points\n\nProblem Statement\n\nSnuke has decided to construct a string that starts with A and ends with Z, by taking out a substring of a string s (that is, a consecutive part of s).\n\nFind the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with A and ends with Z.\n\nConstraints\n\n1 ≦ |s| ≦ 200{,}000\n\ns consists of uppercase English letters.\n\nThere exists a substring of s that starts with A and ends with Z.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\nQWERTYASDFZXCV\n\nSample Output 1\n\n5\n\nBy taking out the seventh through eleventh characters, it is possible to construct ASDFZ, which starts with A and ends with Z.\n\nSample Input 2\n\nZABCZ\n\nSample Output 2\n\n4\n\nSample Input 3\n\nHASFJGHOGAKZZFEGA\n\nSample Output 3\n\n12", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 241, "cpu_time_ms": 166, "memory_kb": 28452}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s016498417", "group_id": "codeNet:p03814", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString S = sc.next();\n\t\tsc.close();\n\t\tint l = 0;\n\t\tfor(int i = 0; i < S.length(); i++) {\n\t\t\tif(S.charAt(i) == 'A') {\n\t\t\t\tl = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tint r = 0;\n\t\tfor(int i = S.length() - 1; i >= 0; i--) {\n\t\t\tif(S.charAt(i) == 'Z') {\n\t\t\t\tr = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(r- l + 1);\n\t}\n}", "language": "Java", "metadata": {"date": 1540087177, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03814.html", "problem_id": "p03814", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03814/input.txt", "sample_output_relpath": "derived/input_output/data/p03814/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03814/Java/s016498417.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s016498417", "user_id": "u634209474"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString S = sc.next();\n\t\tsc.close();\n\t\tint l = 0;\n\t\tfor(int i = 0; i < S.length(); i++) {\n\t\t\tif(S.charAt(i) == 'A') {\n\t\t\t\tl = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tint r = 0;\n\t\tfor(int i = S.length() - 1; i >= 0; i--) {\n\t\t\tif(S.charAt(i) == 'Z') {\n\t\t\t\tr = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(r- l + 1);\n\t}\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSnuke has decided to construct a string that starts with A and ends with Z, by taking out a substring of a string s (that is, a consecutive part of s).\n\nFind the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with A and ends with Z.\n\nConstraints\n\n1 ≦ |s| ≦ 200{,}000\n\ns consists of uppercase English letters.\n\nThere exists a substring of s that starts with A and ends with Z.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\nQWERTYASDFZXCV\n\nSample Output 1\n\n5\n\nBy taking out the seventh through eleventh characters, it is possible to construct ASDFZ, which starts with A and ends with Z.\n\nSample Input 2\n\nZABCZ\n\nSample Output 2\n\n4\n\nSample Input 3\n\nHASFJGHOGAKZZFEGA\n\nSample Output 3\n\n12", "sample_input": "QWERTYASDFZXCV\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03814", "source_text": "Score : 200 points\n\nProblem Statement\n\nSnuke has decided to construct a string that starts with A and ends with Z, by taking out a substring of a string s (that is, a consecutive part of s).\n\nFind the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with A and ends with Z.\n\nConstraints\n\n1 ≦ |s| ≦ 200{,}000\n\ns consists of uppercase English letters.\n\nThere exists a substring of s that starts with A and ends with Z.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\nQWERTYASDFZXCV\n\nSample Output 1\n\n5\n\nBy taking out the seventh through eleventh characters, it is possible to construct ASDFZ, which starts with A and ends with Z.\n\nSample Input 2\n\nZABCZ\n\nSample Output 2\n\n4\n\nSample Input 3\n\nHASFJGHOGAKZZFEGA\n\nSample Output 3\n\n12", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 431, "cpu_time_ms": 161, "memory_kb": 26040}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s757620055", "group_id": "codeNet:p03814", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tString s = scan.next();\n\t\tint a = s.indexOf(\"A\");\n\t\tint z = s.lastIndexOf(\"Z\");\n\t\tString r = s.substring(a, z+1);\n\t\tint ans = r.length();\n\t\tSystem.out.println(ans);\n\t}\n}\n", "language": "Java", "metadata": {"date": 1532036315, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03814.html", "problem_id": "p03814", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03814/input.txt", "sample_output_relpath": "derived/input_output/data/p03814/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03814/Java/s757620055.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s757620055", "user_id": "u102602414"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tString s = scan.next();\n\t\tint a = s.indexOf(\"A\");\n\t\tint z = s.lastIndexOf(\"Z\");\n\t\tString r = s.substring(a, z+1);\n\t\tint ans = r.length();\n\t\tSystem.out.println(ans);\n\t}\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSnuke has decided to construct a string that starts with A and ends with Z, by taking out a substring of a string s (that is, a consecutive part of s).\n\nFind the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with A and ends with Z.\n\nConstraints\n\n1 ≦ |s| ≦ 200{,}000\n\ns consists of uppercase English letters.\n\nThere exists a substring of s that starts with A and ends with Z.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\nQWERTYASDFZXCV\n\nSample Output 1\n\n5\n\nBy taking out the seventh through eleventh characters, it is possible to construct ASDFZ, which starts with A and ends with Z.\n\nSample Input 2\n\nZABCZ\n\nSample Output 2\n\n4\n\nSample Input 3\n\nHASFJGHOGAKZZFEGA\n\nSample Output 3\n\n12", "sample_input": "QWERTYASDFZXCV\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03814", "source_text": "Score : 200 points\n\nProblem Statement\n\nSnuke has decided to construct a string that starts with A and ends with Z, by taking out a substring of a string s (that is, a consecutive part of s).\n\nFind the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with A and ends with Z.\n\nConstraints\n\n1 ≦ |s| ≦ 200{,}000\n\ns consists of uppercase English letters.\n\nThere exists a substring of s that starts with A and ends with Z.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\nQWERTYASDFZXCV\n\nSample Output 1\n\n5\n\nBy taking out the seventh through eleventh characters, it is possible to construct ASDFZ, which starts with A and ends with Z.\n\nSample Input 2\n\nZABCZ\n\nSample Output 2\n\n4\n\nSample Input 3\n\nHASFJGHOGAKZZFEGA\n\nSample Output 3\n\n12", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 302, "cpu_time_ms": 155, "memory_kb": 28472}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s110616822", "group_id": "codeNet:p03814", "input_text": "import java.util.*;\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String line = sc.nextLine();\n int firstA = line.indexOf(\"A\");\n int lastZ = line.lastIndexOf(\"Z\");\n line = line.substring(firstA, lastZ + 1);\n System.out.println(line.length());\n \n }\n}", "language": "Java", "metadata": {"date": 1527341788, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03814.html", "problem_id": "p03814", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03814/input.txt", "sample_output_relpath": "derived/input_output/data/p03814/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03814/Java/s110616822.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s110616822", "user_id": "u133430200"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String line = sc.nextLine();\n int firstA = line.indexOf(\"A\");\n int lastZ = line.lastIndexOf(\"Z\");\n line = line.substring(firstA, lastZ + 1);\n System.out.println(line.length());\n \n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSnuke has decided to construct a string that starts with A and ends with Z, by taking out a substring of a string s (that is, a consecutive part of s).\n\nFind the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with A and ends with Z.\n\nConstraints\n\n1 ≦ |s| ≦ 200{,}000\n\ns consists of uppercase English letters.\n\nThere exists a substring of s that starts with A and ends with Z.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\nQWERTYASDFZXCV\n\nSample Output 1\n\n5\n\nBy taking out the seventh through eleventh characters, it is possible to construct ASDFZ, which starts with A and ends with Z.\n\nSample Input 2\n\nZABCZ\n\nSample Output 2\n\n4\n\nSample Input 3\n\nHASFJGHOGAKZZFEGA\n\nSample Output 3\n\n12", "sample_input": "QWERTYASDFZXCV\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03814", "source_text": "Score : 200 points\n\nProblem Statement\n\nSnuke has decided to construct a string that starts with A and ends with Z, by taking out a substring of a string s (that is, a consecutive part of s).\n\nFind the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with A and ends with Z.\n\nConstraints\n\n1 ≦ |s| ≦ 200{,}000\n\ns consists of uppercase English letters.\n\nThere exists a substring of s that starts with A and ends with Z.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\nQWERTYASDFZXCV\n\nSample Output 1\n\n5\n\nBy taking out the seventh through eleventh characters, it is possible to construct ASDFZ, which starts with A and ends with Z.\n\nSample Input 2\n\nZABCZ\n\nSample Output 2\n\n4\n\nSample Input 3\n\nHASFJGHOGAKZZFEGA\n\nSample Output 3\n\n12", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 172, "memory_kb": 26312}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s699852060", "group_id": "codeNet:p03814", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString s = sc.nextLine();\n\n\t\tint firstIndex = s.indexOf('A');\n\t\tint lastIndex = s.lastIndexOf('Z');\n\n\t\tint result = lastIndex - firstIndex +1;\n\t\tSystem.out.println(result);\n\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1526956325, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03814.html", "problem_id": "p03814", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03814/input.txt", "sample_output_relpath": "derived/input_output/data/p03814/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03814/Java/s699852060.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s699852060", "user_id": "u920340928"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString s = sc.nextLine();\n\n\t\tint firstIndex = s.indexOf('A');\n\t\tint lastIndex = s.lastIndexOf('Z');\n\n\t\tint result = lastIndex - firstIndex +1;\n\t\tSystem.out.println(result);\n\n\t}\n\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSnuke has decided to construct a string that starts with A and ends with Z, by taking out a substring of a string s (that is, a consecutive part of s).\n\nFind the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with A and ends with Z.\n\nConstraints\n\n1 ≦ |s| ≦ 200{,}000\n\ns consists of uppercase English letters.\n\nThere exists a substring of s that starts with A and ends with Z.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\nQWERTYASDFZXCV\n\nSample Output 1\n\n5\n\nBy taking out the seventh through eleventh characters, it is possible to construct ASDFZ, which starts with A and ends with Z.\n\nSample Input 2\n\nZABCZ\n\nSample Output 2\n\n4\n\nSample Input 3\n\nHASFJGHOGAKZZFEGA\n\nSample Output 3\n\n12", "sample_input": "QWERTYASDFZXCV\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03814", "source_text": "Score : 200 points\n\nProblem Statement\n\nSnuke has decided to construct a string that starts with A and ends with Z, by taking out a substring of a string s (that is, a consecutive part of s).\n\nFind the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with A and ends with Z.\n\nConstraints\n\n1 ≦ |s| ≦ 200{,}000\n\ns consists of uppercase English letters.\n\nThere exists a substring of s that starts with A and ends with Z.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\nQWERTYASDFZXCV\n\nSample Output 1\n\n5\n\nBy taking out the seventh through eleventh characters, it is possible to construct ASDFZ, which starts with A and ends with Z.\n\nSample Input 2\n\nZABCZ\n\nSample Output 2\n\n4\n\nSample Input 3\n\nHASFJGHOGAKZZFEGA\n\nSample Output 3\n\n12", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 178, "memory_kb": 28228}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s928218002", "group_id": "codeNet:p03814", "input_text": "\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.PrintStream;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n String input = in.nextLine();\n int size = input.codePointCount(0, input.length());\n\n boolean started = false;\n int count = 0;\n int result = 0;\n for(int i = 0; i < size; i++) {\n int c = input.codePointAt(i);\n\n\n count += 1;\n switch (c) {\n case 'A':\n if (!started) {\n count = 1;\n }\n started = true;\n break;\n case 'Z':\n result = count;\n break;\n }\n }\n out.print(result);\n }\n public static final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));\n public static final PrintStream out = System.out;\n}\n", "language": "Java", "metadata": {"date": 1485657709, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03814.html", "problem_id": "p03814", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03814/input.txt", "sample_output_relpath": "derived/input_output/data/p03814/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03814/Java/s928218002.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s928218002", "user_id": "u163613259"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.PrintStream;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n String input = in.nextLine();\n int size = input.codePointCount(0, input.length());\n\n boolean started = false;\n int count = 0;\n int result = 0;\n for(int i = 0; i < size; i++) {\n int c = input.codePointAt(i);\n\n\n count += 1;\n switch (c) {\n case 'A':\n if (!started) {\n count = 1;\n }\n started = true;\n break;\n case 'Z':\n result = count;\n break;\n }\n }\n out.print(result);\n }\n public static final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));\n public static final PrintStream out = System.out;\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSnuke has decided to construct a string that starts with A and ends with Z, by taking out a substring of a string s (that is, a consecutive part of s).\n\nFind the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with A and ends with Z.\n\nConstraints\n\n1 ≦ |s| ≦ 200{,}000\n\ns consists of uppercase English letters.\n\nThere exists a substring of s that starts with A and ends with Z.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\nQWERTYASDFZXCV\n\nSample Output 1\n\n5\n\nBy taking out the seventh through eleventh characters, it is possible to construct ASDFZ, which starts with A and ends with Z.\n\nSample Input 2\n\nZABCZ\n\nSample Output 2\n\n4\n\nSample Input 3\n\nHASFJGHOGAKZZFEGA\n\nSample Output 3\n\n12", "sample_input": "QWERTYASDFZXCV\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03814", "source_text": "Score : 200 points\n\nProblem Statement\n\nSnuke has decided to construct a string that starts with A and ends with Z, by taking out a substring of a string s (that is, a consecutive part of s).\n\nFind the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of s that starts with A and ends with Z.\n\nConstraints\n\n1 ≦ |s| ≦ 200{,}000\n\ns consists of uppercase English letters.\n\nThere exists a substring of s that starts with A and ends with Z.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\nQWERTYASDFZXCV\n\nSample Output 1\n\n5\n\nBy taking out the seventh through eleventh characters, it is possible to construct ASDFZ, which starts with A and ends with Z.\n\nSample Input 2\n\nZABCZ\n\nSample Output 2\n\n4\n\nSample Input 3\n\nHASFJGHOGAKZZFEGA\n\nSample Output 3\n\n12", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 986, "cpu_time_ms": 234, "memory_kb": 15612}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s803922407", "group_id": "codeNet:p03835", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint k = sc.nextInt();\n\t\tint s = sc.nextInt();\n\t\t\n\t\tint cnt = 0;\n\t\tfor (int x = 0; x <= k && x <= s; x++) {\n\t\t\tfor (int y = 0; y <= k && x + y <= s; y++) {\n\t\t\t\tif (s - x - y <= k) cnt++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(cnt);\n\t\t\n\t\tsc.close();\n\t}\n\t\n}\n\n\n", "language": "Java", "metadata": {"date": 1597429580, "filename_ext": "java", "original_language": "Java (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03835.html", "problem_id": "p03835", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03835/input.txt", "sample_output_relpath": "derived/input_output/data/p03835/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03835/Java/s803922407.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s803922407", "user_id": "u818498408"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint k = sc.nextInt();\n\t\tint s = sc.nextInt();\n\t\t\n\t\tint cnt = 0;\n\t\tfor (int x = 0; x <= k && x <= s; x++) {\n\t\t\tfor (int y = 0; y <= k && x + y <= s; y++) {\n\t\t\t\tif (s - x - y <= k) cnt++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(cnt);\n\t\t\n\t\tsc.close();\n\t}\n\t\n}\n\n\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given two integers K and S.\n\nThree variable X, Y and Z takes integer values satisfying 0≤X,Y,Z≤K.\n\nHow many different assignments of values to X, Y and Z are there such that X + Y + Z = S?\n\nConstraints\n\n2≤K≤2500\n\n0≤S≤3K\n\nK and S are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nK S\n\nOutput\n\nPrint the number of the triples of X, Y and Z that satisfy the condition.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n6\n\nThere are six triples of X, Y and Z that satisfy the condition:\n\nX = 0, Y = 0, Z = 2\n\nX = 0, Y = 2, Z = 0\n\nX = 2, Y = 0, Z = 0\n\nX = 0, Y = 1, Z = 1\n\nX = 1, Y = 0, Z = 1\n\nX = 1, Y = 1, Z = 0\n\nSample Input 2\n\n5 15\n\nSample Output 2\n\n1\n\nThe maximum value of X + Y + Z is 15, achieved by one triple of X, Y and Z.", "sample_input": "2 2\n"}, "reference_outputs": ["6\n"], "source_document_id": "p03835", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given two integers K and S.\n\nThree variable X, Y and Z takes integer values satisfying 0≤X,Y,Z≤K.\n\nHow many different assignments of values to X, Y and Z are there such that X + Y + Z = S?\n\nConstraints\n\n2≤K≤2500\n\n0≤S≤3K\n\nK and S are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nK S\n\nOutput\n\nPrint the number of the triples of X, Y and Z that satisfy the condition.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n6\n\nThere are six triples of X, Y and Z that satisfy the condition:\n\nX = 0, Y = 0, Z = 2\n\nX = 0, Y = 2, Z = 0\n\nX = 2, Y = 0, Z = 0\n\nX = 0, Y = 1, Z = 1\n\nX = 1, Y = 0, Z = 1\n\nX = 1, Y = 1, Z = 0\n\nSample Input 2\n\n5 15\n\nSample Output 2\n\n1\n\nThe maximum value of X + Y + Z is 15, achieved by one triple of X, Y and Z.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 100, "memory_kb": 27160}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s019931565", "group_id": "codeNet:p03835", "input_text": "import java.util.ArrayDeque;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.Queue;\nimport java.util.Random;\nimport java.util.Scanner;\n \n\n\npublic class Main {\n\tprivate static Scanner sc = new Scanner(System.in);\n\t//result = Math.pow(num1, num3)\n\t//StringBuffer str = new StringBuffer(hoge1);\n\t//String hoge2 = str.reverse().toString();\n\t//map.containsKey(A)\n\n\t//Map map = new HashMap(n);\n\t/*for ( キーのデータ型 key : マップの名前.keySet() ) {\n\t\tデータのデータ型 data = マップの名前.get( key );\n\t\t\n\t\t// keyやdataを使った処理;\n\t}*/\n\t//int i = Integer.parseInt(s);\n\t//Queue qq=new ArrayDeque<>(); //add,poll,peek\n\t//Deque qq=new ArrayDeque<>();//push,pop,peek\n\t//ArrayList cc = new ArrayList<>(N);\n\t//Collections.sort(list);\n\t//Array.sort(list); cc.contains(tmp)\n\t//Arrays.asList(c).contains(\"a\")\n\t//list.set(1,\"walk\");//1 1 2 3 5\n\tstatic long mod =1000000007;\n\t//static \tArrayList cc = new ArrayList<>(100);\n\tstatic int INF=1000000007;\n\t\n\tpublic static void main(String[] args) {\n\t\t//int N=sc.nextInt();for(int i=0;i=S&&a+b<=S)ans++;\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\tp(ans);\n\t}\n\t\n\t\t\n\t\n\t\n\t\t\n\t\n\tpublic static long modPow(long g,long N) {\n\t\tlong T=1;\n\t\tfor(int i=0;i list=new ArrayList<>();\n\t\tfor(int i=0;i=0;i--) {\n\t\t\tif(list.get(i)=L;i--) {\n\t\t\tif(pivot map = new HashMap(n);\n\t/*for ( キーのデータ型 key : マップの名前.keySet() ) {\n\t\tデータのデータ型 data = マップの名前.get( key );\n\t\t\n\t\t// keyやdataを使った処理;\n\t}*/\n\t//int i = Integer.parseInt(s);\n\t//Queue qq=new ArrayDeque<>(); //add,poll,peek\n\t//Deque qq=new ArrayDeque<>();//push,pop,peek\n\t//ArrayList cc = new ArrayList<>(N);\n\t//Collections.sort(list);\n\t//Array.sort(list); cc.contains(tmp)\n\t//Arrays.asList(c).contains(\"a\")\n\t//list.set(1,\"walk\");//1 1 2 3 5\n\tstatic long mod =1000000007;\n\t//static \tArrayList cc = new ArrayList<>(100);\n\tstatic int INF=1000000007;\n\t\n\tpublic static void main(String[] args) {\n\t\t//int N=sc.nextInt();for(int i=0;i=S&&a+b<=S)ans++;\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\tp(ans);\n\t}\n\t\n\t\t\n\t\n\t\n\t\t\n\t\n\tpublic static long modPow(long g,long N) {\n\t\tlong T=1;\n\t\tfor(int i=0;i list=new ArrayList<>();\n\t\tfor(int i=0;i=0;i--) {\n\t\t\tif(list.get(i)=L;i--) {\n\t\t\tif(pivot s)\n break;\n for(int j = 0; j <= k; ++j){\n int s_ = s-(i+j);\n if(s_ < 0)\n break;\n if(s_>=0 && s_<= k)\n ++res;\n }\n }\n System.out.println(res);\n }\n}\n\nclass Scan\n{\n private byte[] buf=new byte[1024];\n private int index;\n private InputStream in;\n private int total;\n public Scan()\n {\n in=System.in;\n }\n public int scan()throws IOException\n {\n if(total<0)\n throw new InputMismatchException();\n if(index>=total)\n {\n index=0;\n total=in.read(buf);\n if(total<=0)\n return -1;\n }\n return buf[index++];\n }\n public int scanInt()throws IOException\n {\n int integer=0;\n int n=scan();\n while(isWhiteSpace(n))\n n=scan();\n int neg=1;\n if(n=='-')\n {\n neg=-1;\n n=scan();\n }\n while(!isWhiteSpace(n))\n {\n if(n>='0'&&n<='9')\n {\n integer*=10;\n integer+=n-'0';\n n=scan();\n }\n else throw new InputMismatchException();\n }\n return neg*integer;\n }\n public long scanLong() throws IOException {\n long integer=0;\n int n=scan();\n while(isWhiteSpace(n))\n n=scan();\n int neg=1;\n if(n=='-')\n {\n neg=-1;\n n=scan();\n }\n while(!isWhiteSpace(n))\n {\n if(n>='0'&&n<='9')\n {\n integer*=10;\n integer+=n-'0';\n n=scan();\n }\n else throw new InputMismatchException();\n }\n return neg*integer;\n }\n public double scanDouble()throws IOException\n {\n double doub=0;\n int n=scan();\n while(isWhiteSpace(n))\n n=scan();\n int neg=1;\n if(n=='-')\n {\n neg=-1;\n n=scan();\n }\n while(!isWhiteSpace(n)&&n!='.')\n {\n if(n>='0'&&n<='9')\n {\n doub*=10;\n doub+=n-'0';\n n=scan();\n }\n else throw new InputMismatchException();\n }\n if(n=='.')\n {\n n=scan();\n double temp=1;\n while(!isWhiteSpace(n))\n {\n if(n>='0'&&n<='9')\n {\n temp/=10;\n doub+=(n-'0')*temp;\n n=scan();\n }\n else throw new InputMismatchException();\n }\n }\n return doub*neg;\n }\n public String scanString()throws IOException\n {\n StringBuilder sb=new StringBuilder();\n int n=scan();\n while(isWhiteSpace(n))\n n=scan();\n while(!isWhiteSpace(n))\n {\n sb.append((char)n);\n n=scan();\n }\n return sb.toString();\n }\n private boolean isWhiteSpace(int n)\n {\n if(n==' '||n=='\\n'||n=='\\r'||n=='\\t'||n==-1)\n return true;\n return false;\n }\n}\n", "language": "Java", "metadata": {"date": 1590348806, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03835.html", "problem_id": "p03835", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03835/input.txt", "sample_output_relpath": "derived/input_output/data/p03835/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03835/Java/s713676542.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s713676542", "user_id": "u111285482"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n public static void main(String args[]) throws IOException {\n Scan sc = new Scan();\n int k = sc.scanInt();\n int s = sc.scanInt();\n int res = 0;\n for(int i = 0; i <= k; ++i){\n if(i > s)\n break;\n for(int j = 0; j <= k; ++j){\n int s_ = s-(i+j);\n if(s_ < 0)\n break;\n if(s_>=0 && s_<= k)\n ++res;\n }\n }\n System.out.println(res);\n }\n}\n\nclass Scan\n{\n private byte[] buf=new byte[1024];\n private int index;\n private InputStream in;\n private int total;\n public Scan()\n {\n in=System.in;\n }\n public int scan()throws IOException\n {\n if(total<0)\n throw new InputMismatchException();\n if(index>=total)\n {\n index=0;\n total=in.read(buf);\n if(total<=0)\n return -1;\n }\n return buf[index++];\n }\n public int scanInt()throws IOException\n {\n int integer=0;\n int n=scan();\n while(isWhiteSpace(n))\n n=scan();\n int neg=1;\n if(n=='-')\n {\n neg=-1;\n n=scan();\n }\n while(!isWhiteSpace(n))\n {\n if(n>='0'&&n<='9')\n {\n integer*=10;\n integer+=n-'0';\n n=scan();\n }\n else throw new InputMismatchException();\n }\n return neg*integer;\n }\n public long scanLong() throws IOException {\n long integer=0;\n int n=scan();\n while(isWhiteSpace(n))\n n=scan();\n int neg=1;\n if(n=='-')\n {\n neg=-1;\n n=scan();\n }\n while(!isWhiteSpace(n))\n {\n if(n>='0'&&n<='9')\n {\n integer*=10;\n integer+=n-'0';\n n=scan();\n }\n else throw new InputMismatchException();\n }\n return neg*integer;\n }\n public double scanDouble()throws IOException\n {\n double doub=0;\n int n=scan();\n while(isWhiteSpace(n))\n n=scan();\n int neg=1;\n if(n=='-')\n {\n neg=-1;\n n=scan();\n }\n while(!isWhiteSpace(n)&&n!='.')\n {\n if(n>='0'&&n<='9')\n {\n doub*=10;\n doub+=n-'0';\n n=scan();\n }\n else throw new InputMismatchException();\n }\n if(n=='.')\n {\n n=scan();\n double temp=1;\n while(!isWhiteSpace(n))\n {\n if(n>='0'&&n<='9')\n {\n temp/=10;\n doub+=(n-'0')*temp;\n n=scan();\n }\n else throw new InputMismatchException();\n }\n }\n return doub*neg;\n }\n public String scanString()throws IOException\n {\n StringBuilder sb=new StringBuilder();\n int n=scan();\n while(isWhiteSpace(n))\n n=scan();\n while(!isWhiteSpace(n))\n {\n sb.append((char)n);\n n=scan();\n }\n return sb.toString();\n }\n private boolean isWhiteSpace(int n)\n {\n if(n==' '||n=='\\n'||n=='\\r'||n=='\\t'||n==-1)\n return true;\n return false;\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given two integers K and S.\n\nThree variable X, Y and Z takes integer values satisfying 0≤X,Y,Z≤K.\n\nHow many different assignments of values to X, Y and Z are there such that X + Y + Z = S?\n\nConstraints\n\n2≤K≤2500\n\n0≤S≤3K\n\nK and S are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nK S\n\nOutput\n\nPrint the number of the triples of X, Y and Z that satisfy the condition.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n6\n\nThere are six triples of X, Y and Z that satisfy the condition:\n\nX = 0, Y = 0, Z = 2\n\nX = 0, Y = 2, Z = 0\n\nX = 2, Y = 0, Z = 0\n\nX = 0, Y = 1, Z = 1\n\nX = 1, Y = 0, Z = 1\n\nX = 1, Y = 1, Z = 0\n\nSample Input 2\n\n5 15\n\nSample Output 2\n\n1\n\nThe maximum value of X + Y + Z is 15, achieved by one triple of X, Y and Z.", "sample_input": "2 2\n"}, "reference_outputs": ["6\n"], "source_document_id": "p03835", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given two integers K and S.\n\nThree variable X, Y and Z takes integer values satisfying 0≤X,Y,Z≤K.\n\nHow many different assignments of values to X, Y and Z are there such that X + Y + Z = S?\n\nConstraints\n\n2≤K≤2500\n\n0≤S≤3K\n\nK and S are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nK S\n\nOutput\n\nPrint the number of the triples of X, Y and Z that satisfy the condition.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n6\n\nThere are six triples of X, Y and Z that satisfy the condition:\n\nX = 0, Y = 0, Z = 2\n\nX = 0, Y = 2, Z = 0\n\nX = 2, Y = 0, Z = 0\n\nX = 0, Y = 1, Z = 1\n\nX = 1, Y = 0, Z = 1\n\nX = 1, Y = 1, Z = 0\n\nSample Input 2\n\n5 15\n\nSample Output 2\n\n1\n\nThe maximum value of X + Y + Z is 15, achieved by one triple of X, Y and Z.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3476, "cpu_time_ms": 85, "memory_kb": 21076}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s866654746", "group_id": "codeNet:p03835", "input_text": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n\n\tfinal static long MOD = 1000000007L;\n\tpublic static String[] Ws = null;\n\tpublic static int wsIndx = 0;\n\tpublic static BufferedReader in = null;\n\tpublic static ArrayList list = new ArrayList<>();\n\tpublic static void main(String[] args) throws Exception {\n\n\t\tint K=nextInt();\n\t\tint S=nextInt();\n\n\t\tlong ans = 0;\n\t\tfor(int x=0;x<=K;x++){\n\t\t\tfor(int y=0;y<=K;y++){\n\t\t\t\tint z=S-x-y;\n\t\t\t\tif(0<=z&&z<=K){\n\t\t\t\t\tans++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\n\t}\n\n\tpublic static long[] disassemblyAlph(String s) {\n\t\tlong[] alph = new long['z' - 'a' + 1];\n\t\tArrays.fill(alph, 0);\n\t\tfor (int i = 0; i < s.length(); i++) {\n\t\t\talph[s.charAt(i) - 'a']++;\n\t\t}\n\t\treturn alph;\n\t}\n\n\tpublic static String[] toStringArray(String s) {\n\t\tString[] tmp = new String[s.length()];\n\t\tchar[] c = s.toCharArray();\n\t\tfor (int i = 0; i < tmp.length; i++) {\n\t\t\ttmp[i] = String.valueOf(c[i]);\n\t\t}\n\t\treturn tmp;\n\t}\n\n\tpublic static String concatStringArray(String[] s){\n\t\tStringBuffer sb = new StringBuffer();\n\t\tfor(String x:s){\n\t\t\tsb.append(x);\n\t\t}\n\t\treturn sb.toString();\n\t}\n\n\tpublic static void check() throws Exception{\n\t\tif(in == null){\n\t\t\tin = new BufferedReader(new InputStreamReader(System.in));\n\t\t}\n\t\tif(Ws==null || Ws.length<=wsIndx){\n\t\t\tWs = in.readLine().split(\" \");\n\t\t\twsIndx=0;\n\t\t}\n\t}\n\tpublic static int nextInt()throws Exception{\n\t\tcheck();\n\t\treturn Integer.parseInt(Ws[wsIndx++]);\n\t}\n\n\tpublic static long nextLong()throws Exception{\n\t\tcheck();\n\t\treturn Long.parseLong(Ws[wsIndx++]);\n\t}\n\n\tpublic static String nextString()throws Exception{\n\t\tcheck();\n\t\treturn Ws[wsIndx++];\n\t}\n\n\tpublic static int[] nextInts()throws Exception{\n\t\tcheck();\n\t\tint[] tmp = new int[Ws.length];\n\t\tfor(int i=0;i list = new ArrayList<>();\n\tpublic static void main(String[] args) throws Exception {\n\n\t\tint K=nextInt();\n\t\tint S=nextInt();\n\n\t\tlong ans = 0;\n\t\tfor(int x=0;x<=K;x++){\n\t\t\tfor(int y=0;y<=K;y++){\n\t\t\t\tint z=S-x-y;\n\t\t\t\tif(0<=z&&z<=K){\n\t\t\t\t\tans++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\n\t}\n\n\tpublic static long[] disassemblyAlph(String s) {\n\t\tlong[] alph = new long['z' - 'a' + 1];\n\t\tArrays.fill(alph, 0);\n\t\tfor (int i = 0; i < s.length(); i++) {\n\t\t\talph[s.charAt(i) - 'a']++;\n\t\t}\n\t\treturn alph;\n\t}\n\n\tpublic static String[] toStringArray(String s) {\n\t\tString[] tmp = new String[s.length()];\n\t\tchar[] c = s.toCharArray();\n\t\tfor (int i = 0; i < tmp.length; i++) {\n\t\t\ttmp[i] = String.valueOf(c[i]);\n\t\t}\n\t\treturn tmp;\n\t}\n\n\tpublic static String concatStringArray(String[] s){\n\t\tStringBuffer sb = new StringBuffer();\n\t\tfor(String x:s){\n\t\t\tsb.append(x);\n\t\t}\n\t\treturn sb.toString();\n\t}\n\n\tpublic static void check() throws Exception{\n\t\tif(in == null){\n\t\t\tin = new BufferedReader(new InputStreamReader(System.in));\n\t\t}\n\t\tif(Ws==null || Ws.length<=wsIndx){\n\t\t\tWs = in.readLine().split(\" \");\n\t\t\twsIndx=0;\n\t\t}\n\t}\n\tpublic static int nextInt()throws Exception{\n\t\tcheck();\n\t\treturn Integer.parseInt(Ws[wsIndx++]);\n\t}\n\n\tpublic static long nextLong()throws Exception{\n\t\tcheck();\n\t\treturn Long.parseLong(Ws[wsIndx++]);\n\t}\n\n\tpublic static String nextString()throws Exception{\n\t\tcheck();\n\t\treturn Ws[wsIndx++];\n\t}\n\n\tpublic static int[] nextInts()throws Exception{\n\t\tcheck();\n\t\tint[] tmp = new int[Ws.length];\n\t\tfor(int i=0;i S) break;\n\t\t\t\t}\n\t\t\t\tif(x+y > S) break;\n\t\t\t}\n\t\t\tif(x > S) break;\n\t\t}\n\n\t\tSystem.out.println(count);\n\t}\n}", "language": "Java", "metadata": {"date": 1565728308, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03835.html", "problem_id": "p03835", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03835/input.txt", "sample_output_relpath": "derived/input_output/data/p03835/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03835/Java/s950283015.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s950283015", "user_id": "u526365587"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint K = sc.nextInt();\n\t\tint S = sc.nextInt();\n\n\t\tint count = 0;\n\t\tfor(int x=0; x<=K; x++) {\n\t\t\tfor(int y=0; y<=K; y++) {\n\t\t\t\tfor(int z=0; z<=K; z++) {\n\t\t\t\t\tif(x+y+z == S) count++;\n\t\t\t\t\tif(x+y+z > S) break;\n\t\t\t\t}\n\t\t\t\tif(x+y > S) break;\n\t\t\t}\n\t\t\tif(x > S) break;\n\t\t}\n\n\t\tSystem.out.println(count);\n\t}\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given two integers K and S.\n\nThree variable X, Y and Z takes integer values satisfying 0≤X,Y,Z≤K.\n\nHow many different assignments of values to X, Y and Z are there such that X + Y + Z = S?\n\nConstraints\n\n2≤K≤2500\n\n0≤S≤3K\n\nK and S are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nK S\n\nOutput\n\nPrint the number of the triples of X, Y and Z that satisfy the condition.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n6\n\nThere are six triples of X, Y and Z that satisfy the condition:\n\nX = 0, Y = 0, Z = 2\n\nX = 0, Y = 2, Z = 0\n\nX = 2, Y = 0, Z = 0\n\nX = 0, Y = 1, Z = 1\n\nX = 1, Y = 0, Z = 1\n\nX = 1, Y = 1, Z = 0\n\nSample Input 2\n\n5 15\n\nSample Output 2\n\n1\n\nThe maximum value of X + Y + Z is 15, achieved by one triple of X, Y and Z.", "sample_input": "2 2\n"}, "reference_outputs": ["6\n"], "source_document_id": "p03835", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given two integers K and S.\n\nThree variable X, Y and Z takes integer values satisfying 0≤X,Y,Z≤K.\n\nHow many different assignments of values to X, Y and Z are there such that X + Y + Z = S?\n\nConstraints\n\n2≤K≤2500\n\n0≤S≤3K\n\nK and S are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nK S\n\nOutput\n\nPrint the number of the triples of X, Y and Z that satisfy the condition.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n6\n\nThere are six triples of X, Y and Z that satisfy the condition:\n\nX = 0, Y = 0, Z = 2\n\nX = 0, Y = 2, Z = 0\n\nX = 2, Y = 0, Z = 0\n\nX = 0, Y = 1, Z = 1\n\nX = 1, Y = 0, Z = 1\n\nX = 1, Y = 1, Z = 0\n\nSample Input 2\n\n5 15\n\nSample Output 2\n\n1\n\nThe maximum value of X + Y + Z is 15, achieved by one triple of X, Y and Z.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2108, "memory_kb": 21716}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s941016391", "group_id": "codeNet:p03835", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int k = sc.nextInt();\n int s = sc.nextInt();\n\n int count = 0;\n for (int i = 0; i <= k; i++) {\n for (int j = 0; j <= k; j++) {\n int l = s - (i + j);\n if (l >= 0 && l <= k) {\n count++;\n }\n }\n }\n\n System.out.println(count);\n }\n}", "language": "Java", "metadata": {"date": 1563939625, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03835.html", "problem_id": "p03835", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03835/input.txt", "sample_output_relpath": "derived/input_output/data/p03835/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03835/Java/s941016391.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s941016391", "user_id": "u853262452"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int k = sc.nextInt();\n int s = sc.nextInt();\n\n int count = 0;\n for (int i = 0; i <= k; i++) {\n for (int j = 0; j <= k; j++) {\n int l = s - (i + j);\n if (l >= 0 && l <= k) {\n count++;\n }\n }\n }\n\n System.out.println(count);\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given two integers K and S.\n\nThree variable X, Y and Z takes integer values satisfying 0≤X,Y,Z≤K.\n\nHow many different assignments of values to X, Y and Z are there such that X + Y + Z = S?\n\nConstraints\n\n2≤K≤2500\n\n0≤S≤3K\n\nK and S are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nK S\n\nOutput\n\nPrint the number of the triples of X, Y and Z that satisfy the condition.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n6\n\nThere are six triples of X, Y and Z that satisfy the condition:\n\nX = 0, Y = 0, Z = 2\n\nX = 0, Y = 2, Z = 0\n\nX = 2, Y = 0, Z = 0\n\nX = 0, Y = 1, Z = 1\n\nX = 1, Y = 0, Z = 1\n\nX = 1, Y = 1, Z = 0\n\nSample Input 2\n\n5 15\n\nSample Output 2\n\n1\n\nThe maximum value of X + Y + Z is 15, achieved by one triple of X, Y and Z.", "sample_input": "2 2\n"}, "reference_outputs": ["6\n"], "source_document_id": "p03835", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given two integers K and S.\n\nThree variable X, Y and Z takes integer values satisfying 0≤X,Y,Z≤K.\n\nHow many different assignments of values to X, Y and Z are there such that X + Y + Z = S?\n\nConstraints\n\n2≤K≤2500\n\n0≤S≤3K\n\nK and S are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nK S\n\nOutput\n\nPrint the number of the triples of X, Y and Z that satisfy the condition.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n6\n\nThere are six triples of X, Y and Z that satisfy the condition:\n\nX = 0, Y = 0, Z = 2\n\nX = 0, Y = 2, Z = 0\n\nX = 2, Y = 0, Z = 0\n\nX = 0, Y = 1, Z = 1\n\nX = 1, Y = 0, Z = 1\n\nX = 1, Y = 1, Z = 0\n\nSample Input 2\n\n5 15\n\nSample Output 2\n\n1\n\nThe maximum value of X + Y + Z is 15, achieved by one triple of X, Y and Z.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 496, "cpu_time_ms": 108, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s520566900", "group_id": "codeNet:p03835", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner s = new Scanner(System.in);\n\n\t\tint K = s.nextInt();\n\t\tint S = s.nextInt();\n\n\t\tint answer = 0;\n\t\tfor (int x = 0; x <= K; x++) {\n\t\t\tif (x > S)\n\t\t\t\tbreak;\n\t\t\tfor (int y = 0; y <= K; y++) {\n\t\t\t\tif (x + y > S)\n\t\t\t\t\tbreak;\n\n\t\t\t\tint z = S - x - y;\n\t\t\t\tif(z<=K) {\n\t\t\t\t\tanswer ++;\n\t\t\t\t}\n\t\t\t\t/*\n\t\t\t\tfor (int z = 0; z <= K; z++) {\n\t\t\t\t\tif (x + y + z > S)\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tif(x+y+z == S) {\n\t\t\t\t\t\tanswer++;\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\t*/\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(answer);\n\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1561721494, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03835.html", "problem_id": "p03835", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03835/input.txt", "sample_output_relpath": "derived/input_output/data/p03835/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03835/Java/s520566900.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s520566900", "user_id": "u592109578"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner s = new Scanner(System.in);\n\n\t\tint K = s.nextInt();\n\t\tint S = s.nextInt();\n\n\t\tint answer = 0;\n\t\tfor (int x = 0; x <= K; x++) {\n\t\t\tif (x > S)\n\t\t\t\tbreak;\n\t\t\tfor (int y = 0; y <= K; y++) {\n\t\t\t\tif (x + y > S)\n\t\t\t\t\tbreak;\n\n\t\t\t\tint z = S - x - y;\n\t\t\t\tif(z<=K) {\n\t\t\t\t\tanswer ++;\n\t\t\t\t}\n\t\t\t\t/*\n\t\t\t\tfor (int z = 0; z <= K; z++) {\n\t\t\t\t\tif (x + y + z > S)\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tif(x+y+z == S) {\n\t\t\t\t\t\tanswer++;\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\t*/\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(answer);\n\n\t}\n\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given two integers K and S.\n\nThree variable X, Y and Z takes integer values satisfying 0≤X,Y,Z≤K.\n\nHow many different assignments of values to X, Y and Z are there such that X + Y + Z = S?\n\nConstraints\n\n2≤K≤2500\n\n0≤S≤3K\n\nK and S are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nK S\n\nOutput\n\nPrint the number of the triples of X, Y and Z that satisfy the condition.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n6\n\nThere are six triples of X, Y and Z that satisfy the condition:\n\nX = 0, Y = 0, Z = 2\n\nX = 0, Y = 2, Z = 0\n\nX = 2, Y = 0, Z = 0\n\nX = 0, Y = 1, Z = 1\n\nX = 1, Y = 0, Z = 1\n\nX = 1, Y = 1, Z = 0\n\nSample Input 2\n\n5 15\n\nSample Output 2\n\n1\n\nThe maximum value of X + Y + Z is 15, achieved by one triple of X, Y and Z.", "sample_input": "2 2\n"}, "reference_outputs": ["6\n"], "source_document_id": "p03835", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given two integers K and S.\n\nThree variable X, Y and Z takes integer values satisfying 0≤X,Y,Z≤K.\n\nHow many different assignments of values to X, Y and Z are there such that X + Y + Z = S?\n\nConstraints\n\n2≤K≤2500\n\n0≤S≤3K\n\nK and S are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nK S\n\nOutput\n\nPrint the number of the triples of X, Y and Z that satisfy the condition.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n6\n\nThere are six triples of X, Y and Z that satisfy the condition:\n\nX = 0, Y = 0, Z = 2\n\nX = 0, Y = 2, Z = 0\n\nX = 2, Y = 0, Z = 0\n\nX = 0, Y = 1, Z = 1\n\nX = 1, Y = 0, Z = 1\n\nX = 1, Y = 1, Z = 0\n\nSample Input 2\n\n5 15\n\nSample Output 2\n\n1\n\nThe maximum value of X + Y + Z is 15, achieved by one triple of X, Y and Z.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 107, "memory_kb": 23380}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s569295238", "group_id": "codeNet:p03835", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\ttry {\n\t\t\tint k = sc.nextInt();\n\t\t\tint s = sc.nextInt();\n\n\t\t\tint ans = 0;\n\t\t\tfor (int a = 0; a <= k; a++) {\n\t\t\t\tif (a == s) {\n\t\t\t\t\tans++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tint bc = (int) Math.ceil((double) (s - a) / 2);\n\t\t\t\tif (bc <= k) {\n\t\t\t\t\tfor (int b = 0; b <= k; b++) {\n\t\t\t\t\t\tif (s - a - b >= 0 && s - a - b <= k) {\n\t\t\t\t\t\t\tans++;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tSystem.out.println(ans);\n\n\t\t} finally {\n\t\t\tsc.close();\n\t\t}\n\t}\n}", "language": "Java", "metadata": {"date": 1547148756, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03835.html", "problem_id": "p03835", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03835/input.txt", "sample_output_relpath": "derived/input_output/data/p03835/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03835/Java/s569295238.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s569295238", "user_id": "u694845319"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\ttry {\n\t\t\tint k = sc.nextInt();\n\t\t\tint s = sc.nextInt();\n\n\t\t\tint ans = 0;\n\t\t\tfor (int a = 0; a <= k; a++) {\n\t\t\t\tif (a == s) {\n\t\t\t\t\tans++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tint bc = (int) Math.ceil((double) (s - a) / 2);\n\t\t\t\tif (bc <= k) {\n\t\t\t\t\tfor (int b = 0; b <= k; b++) {\n\t\t\t\t\t\tif (s - a - b >= 0 && s - a - b <= k) {\n\t\t\t\t\t\t\tans++;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tSystem.out.println(ans);\n\n\t\t} finally {\n\t\t\tsc.close();\n\t\t}\n\t}\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given two integers K and S.\n\nThree variable X, Y and Z takes integer values satisfying 0≤X,Y,Z≤K.\n\nHow many different assignments of values to X, Y and Z are there such that X + Y + Z = S?\n\nConstraints\n\n2≤K≤2500\n\n0≤S≤3K\n\nK and S are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nK S\n\nOutput\n\nPrint the number of the triples of X, Y and Z that satisfy the condition.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n6\n\nThere are six triples of X, Y and Z that satisfy the condition:\n\nX = 0, Y = 0, Z = 2\n\nX = 0, Y = 2, Z = 0\n\nX = 2, Y = 0, Z = 0\n\nX = 0, Y = 1, Z = 1\n\nX = 1, Y = 0, Z = 1\n\nX = 1, Y = 1, Z = 0\n\nSample Input 2\n\n5 15\n\nSample Output 2\n\n1\n\nThe maximum value of X + Y + Z is 15, achieved by one triple of X, Y and Z.", "sample_input": "2 2\n"}, "reference_outputs": ["6\n"], "source_document_id": "p03835", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given two integers K and S.\n\nThree variable X, Y and Z takes integer values satisfying 0≤X,Y,Z≤K.\n\nHow many different assignments of values to X, Y and Z are there such that X + Y + Z = S?\n\nConstraints\n\n2≤K≤2500\n\n0≤S≤3K\n\nK and S are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nK S\n\nOutput\n\nPrint the number of the triples of X, Y and Z that satisfy the condition.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n6\n\nThere are six triples of X, Y and Z that satisfy the condition:\n\nX = 0, Y = 0, Z = 2\n\nX = 0, Y = 2, Z = 0\n\nX = 2, Y = 0, Z = 0\n\nX = 0, Y = 1, Z = 1\n\nX = 1, Y = 0, Z = 1\n\nX = 1, Y = 1, Z = 0\n\nSample Input 2\n\n5 15\n\nSample Output 2\n\n1\n\nThe maximum value of X + Y + Z is 15, achieved by one triple of X, Y and Z.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 547, "cpu_time_ms": 122, "memory_kb": 21716}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s527545204", "group_id": "codeNet:p03835", "input_text": "import java.util.Scanner;\n\npublic class Main{\n public static void main(String[] args){\n\tScanner scan = new Scanner(System.in);\n\n\tint K = scan.nextInt();\n\tint S = scan.nextInt();\n\n\tint count = 0;\n\tfor(int i = 0; i <= K; i++){\n\t for(int j = 0; j <= K; j++){\n\t\tfor(int k = 0; k <= K; k++){\n\t\t if(i+j+k == S){\n\t\t\tcount++;\n\t\t }\n\t\t}\n\t }\n\t}\n\n\tSystem.out.println(count);\n }\n}\n", "language": "Java", "metadata": {"date": 1546274467, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03835.html", "problem_id": "p03835", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03835/input.txt", "sample_output_relpath": "derived/input_output/data/p03835/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03835/Java/s527545204.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s527545204", "user_id": "u769839099"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main{\n public static void main(String[] args){\n\tScanner scan = new Scanner(System.in);\n\n\tint K = scan.nextInt();\n\tint S = scan.nextInt();\n\n\tint count = 0;\n\tfor(int i = 0; i <= K; i++){\n\t for(int j = 0; j <= K; j++){\n\t\tfor(int k = 0; k <= K; k++){\n\t\t if(i+j+k == S){\n\t\t\tcount++;\n\t\t }\n\t\t}\n\t }\n\t}\n\n\tSystem.out.println(count);\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given two integers K and S.\n\nThree variable X, Y and Z takes integer values satisfying 0≤X,Y,Z≤K.\n\nHow many different assignments of values to X, Y and Z are there such that X + Y + Z = S?\n\nConstraints\n\n2≤K≤2500\n\n0≤S≤3K\n\nK and S are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nK S\n\nOutput\n\nPrint the number of the triples of X, Y and Z that satisfy the condition.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n6\n\nThere are six triples of X, Y and Z that satisfy the condition:\n\nX = 0, Y = 0, Z = 2\n\nX = 0, Y = 2, Z = 0\n\nX = 2, Y = 0, Z = 0\n\nX = 0, Y = 1, Z = 1\n\nX = 1, Y = 0, Z = 1\n\nX = 1, Y = 1, Z = 0\n\nSample Input 2\n\n5 15\n\nSample Output 2\n\n1\n\nThe maximum value of X + Y + Z is 15, achieved by one triple of X, Y and Z.", "sample_input": "2 2\n"}, "reference_outputs": ["6\n"], "source_document_id": "p03835", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given two integers K and S.\n\nThree variable X, Y and Z takes integer values satisfying 0≤X,Y,Z≤K.\n\nHow many different assignments of values to X, Y and Z are there such that X + Y + Z = S?\n\nConstraints\n\n2≤K≤2500\n\n0≤S≤3K\n\nK and S are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nK S\n\nOutput\n\nPrint the number of the triples of X, Y and Z that satisfy the condition.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n6\n\nThere are six triples of X, Y and Z that satisfy the condition:\n\nX = 0, Y = 0, Z = 2\n\nX = 0, Y = 2, Z = 0\n\nX = 2, Y = 0, Z = 0\n\nX = 0, Y = 1, Z = 1\n\nX = 1, Y = 0, Z = 1\n\nX = 1, Y = 1, Z = 0\n\nSample Input 2\n\n5 15\n\nSample Output 2\n\n1\n\nThe maximum value of X + Y + Z is 15, achieved by one triple of X, Y and Z.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2109, "memory_kb": 21844}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s130907430", "group_id": "codeNet:p03835", "input_text": "import java.util.Scanner;\npublic class Main {\n\n public static void main(String[] args){\n \tScanner sc = new Scanner(System.in);\n \t// 入力\n \tint k = sc.nextInt();\n \tint s = sc.nextInt();\n\n \tint cnt = 0;\n\n \tfor (int x = 0; x <= k; x++){\n \tfor (int y = 0; y <= k; y++){\n \t\tif((s - (x + y)) >= 0 && (s - (x + y)) <= k){\n \t\tcnt++;\n \t}\n \t}\n \t}\n\n \t// 出力\n \tSystem.out.println(cnt);\n }\n}", "language": "Java", "metadata": {"date": 1538695236, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03835.html", "problem_id": "p03835", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03835/input.txt", "sample_output_relpath": "derived/input_output/data/p03835/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03835/Java/s130907430.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s130907430", "user_id": "u931462782"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "import java.util.Scanner;\npublic class Main {\n\n public static void main(String[] args){\n \tScanner sc = new Scanner(System.in);\n \t// 入力\n \tint k = sc.nextInt();\n \tint s = sc.nextInt();\n\n \tint cnt = 0;\n\n \tfor (int x = 0; x <= k; x++){\n \tfor (int y = 0; y <= k; y++){\n \t\tif((s - (x + y)) >= 0 && (s - (x + y)) <= k){\n \t\tcnt++;\n \t}\n \t}\n \t}\n\n \t// 出力\n \tSystem.out.println(cnt);\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given two integers K and S.\n\nThree variable X, Y and Z takes integer values satisfying 0≤X,Y,Z≤K.\n\nHow many different assignments of values to X, Y and Z are there such that X + Y + Z = S?\n\nConstraints\n\n2≤K≤2500\n\n0≤S≤3K\n\nK and S are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nK S\n\nOutput\n\nPrint the number of the triples of X, Y and Z that satisfy the condition.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n6\n\nThere are six triples of X, Y and Z that satisfy the condition:\n\nX = 0, Y = 0, Z = 2\n\nX = 0, Y = 2, Z = 0\n\nX = 2, Y = 0, Z = 0\n\nX = 0, Y = 1, Z = 1\n\nX = 1, Y = 0, Z = 1\n\nX = 1, Y = 1, Z = 0\n\nSample Input 2\n\n5 15\n\nSample Output 2\n\n1\n\nThe maximum value of X + Y + Z is 15, achieved by one triple of X, Y and Z.", "sample_input": "2 2\n"}, "reference_outputs": ["6\n"], "source_document_id": "p03835", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given two integers K and S.\n\nThree variable X, Y and Z takes integer values satisfying 0≤X,Y,Z≤K.\n\nHow many different assignments of values to X, Y and Z are there such that X + Y + Z = S?\n\nConstraints\n\n2≤K≤2500\n\n0≤S≤3K\n\nK and S are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nK S\n\nOutput\n\nPrint the number of the triples of X, Y and Z that satisfy the condition.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n6\n\nThere are six triples of X, Y and Z that satisfy the condition:\n\nX = 0, Y = 0, Z = 2\n\nX = 0, Y = 2, Z = 0\n\nX = 2, Y = 0, Z = 0\n\nX = 0, Y = 1, Z = 1\n\nX = 1, Y = 0, Z = 1\n\nX = 1, Y = 1, Z = 0\n\nSample Input 2\n\n5 15\n\nSample Output 2\n\n1\n\nThe maximum value of X + Y + Z is 15, achieved by one triple of X, Y and Z.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 459, "cpu_time_ms": 108, "memory_kb": 25172}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s081641599", "group_id": "codeNet:p03835", "input_text": "import java.util.*;\n\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int K = sc.nextInt();\n int S = sc.nextInt();\n\n int count = 0;\n\n for(int X = 0 ; X <= K ; X ++){\n for(int Y = 0 ; Y <= K ; Y ++){\n int Z = S - X - Y ;\n if( Z >= 0 && Z <= K ){\n count ++;\n }\n }\n }\n System.out.println(count);\n }\n}\n", "language": "Java", "metadata": {"date": 1526770531, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03835.html", "problem_id": "p03835", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03835/input.txt", "sample_output_relpath": "derived/input_output/data/p03835/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03835/Java/s081641599.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s081641599", "user_id": "u829407811"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int K = sc.nextInt();\n int S = sc.nextInt();\n\n int count = 0;\n\n for(int X = 0 ; X <= K ; X ++){\n for(int Y = 0 ; Y <= K ; Y ++){\n int Z = S - X - Y ;\n if( Z >= 0 && Z <= K ){\n count ++;\n }\n }\n }\n System.out.println(count);\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given two integers K and S.\n\nThree variable X, Y and Z takes integer values satisfying 0≤X,Y,Z≤K.\n\nHow many different assignments of values to X, Y and Z are there such that X + Y + Z = S?\n\nConstraints\n\n2≤K≤2500\n\n0≤S≤3K\n\nK and S are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nK S\n\nOutput\n\nPrint the number of the triples of X, Y and Z that satisfy the condition.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n6\n\nThere are six triples of X, Y and Z that satisfy the condition:\n\nX = 0, Y = 0, Z = 2\n\nX = 0, Y = 2, Z = 0\n\nX = 2, Y = 0, Z = 0\n\nX = 0, Y = 1, Z = 1\n\nX = 1, Y = 0, Z = 1\n\nX = 1, Y = 1, Z = 0\n\nSample Input 2\n\n5 15\n\nSample Output 2\n\n1\n\nThe maximum value of X + Y + Z is 15, achieved by one triple of X, Y and Z.", "sample_input": "2 2\n"}, "reference_outputs": ["6\n"], "source_document_id": "p03835", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given two integers K and S.\n\nThree variable X, Y and Z takes integer values satisfying 0≤X,Y,Z≤K.\n\nHow many different assignments of values to X, Y and Z are there such that X + Y + Z = S?\n\nConstraints\n\n2≤K≤2500\n\n0≤S≤3K\n\nK and S are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nK S\n\nOutput\n\nPrint the number of the triples of X, Y and Z that satisfy the condition.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n6\n\nThere are six triples of X, Y and Z that satisfy the condition:\n\nX = 0, Y = 0, Z = 2\n\nX = 0, Y = 2, Z = 0\n\nX = 2, Y = 0, Z = 0\n\nX = 0, Y = 1, Z = 1\n\nX = 1, Y = 0, Z = 1\n\nX = 1, Y = 1, Z = 0\n\nSample Input 2\n\n5 15\n\nSample Output 2\n\n1\n\nThe maximum value of X + Y + Z is 15, achieved by one triple of X, Y and Z.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 110, "memory_kb": 22100}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s445694411", "group_id": "codeNet:p03835", "input_text": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\n\npublic class Main {\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tString line = \"\";\n\t\tint strN = 1; // 文字列を何行受け取るか\n\t\tfor (int i = 0; i < strN; i++) {\n\t\t\tline += br.readLine() + \" \";\n\t\t}\n\t\tString[] param = line.split(\" \");\n\t\tAtoZString(param);\n\n\t}\n\n\tstatic void AtoZString(String[] param) { //2行、Iで1追加し、Dで1減らす、処理後の最大値を出力[1]\n\t\tint K = Integer.parseInt(param[0]);\n\t\tint S = Integer.parseInt(param[1]);\n\t\t\n\t\tint count = 0;\n\t\t\n\t\tfor(int i = 0; i <= K; i++){\n\t\t\tfor(int j = 0; j <= K; j++){\n\t\t\t\tint k = S - (i + j);\n\t\t\t\tif(k >= 0 && k <= K) count++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}", "language": "Java", "metadata": {"date": 1497829457, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03835.html", "problem_id": "p03835", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03835/input.txt", "sample_output_relpath": "derived/input_output/data/p03835/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03835/Java/s445694411.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s445694411", "user_id": "u802758605"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.InputStreamReader;\n\npublic class Main {\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tString line = \"\";\n\t\tint strN = 1; // 文字列を何行受け取るか\n\t\tfor (int i = 0; i < strN; i++) {\n\t\t\tline += br.readLine() + \" \";\n\t\t}\n\t\tString[] param = line.split(\" \");\n\t\tAtoZString(param);\n\n\t}\n\n\tstatic void AtoZString(String[] param) { //2行、Iで1追加し、Dで1減らす、処理後の最大値を出力[1]\n\t\tint K = Integer.parseInt(param[0]);\n\t\tint S = Integer.parseInt(param[1]);\n\t\t\n\t\tint count = 0;\n\t\t\n\t\tfor(int i = 0; i <= K; i++){\n\t\t\tfor(int j = 0; j <= K; j++){\n\t\t\t\tint k = S - (i + j);\n\t\t\t\tif(k >= 0 && k <= K) count++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given two integers K and S.\n\nThree variable X, Y and Z takes integer values satisfying 0≤X,Y,Z≤K.\n\nHow many different assignments of values to X, Y and Z are there such that X + Y + Z = S?\n\nConstraints\n\n2≤K≤2500\n\n0≤S≤3K\n\nK and S are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nK S\n\nOutput\n\nPrint the number of the triples of X, Y and Z that satisfy the condition.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n6\n\nThere are six triples of X, Y and Z that satisfy the condition:\n\nX = 0, Y = 0, Z = 2\n\nX = 0, Y = 2, Z = 0\n\nX = 2, Y = 0, Z = 0\n\nX = 0, Y = 1, Z = 1\n\nX = 1, Y = 0, Z = 1\n\nX = 1, Y = 1, Z = 0\n\nSample Input 2\n\n5 15\n\nSample Output 2\n\n1\n\nThe maximum value of X + Y + Z is 15, achieved by one triple of X, Y and Z.", "sample_input": "2 2\n"}, "reference_outputs": ["6\n"], "source_document_id": "p03835", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given two integers K and S.\n\nThree variable X, Y and Z takes integer values satisfying 0≤X,Y,Z≤K.\n\nHow many different assignments of values to X, Y and Z are there such that X + Y + Z = S?\n\nConstraints\n\n2≤K≤2500\n\n0≤S≤3K\n\nK and S are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nK S\n\nOutput\n\nPrint the number of the triples of X, Y and Z that satisfy the condition.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n6\n\nThere are six triples of X, Y and Z that satisfy the condition:\n\nX = 0, Y = 0, Z = 2\n\nX = 0, Y = 2, Z = 0\n\nX = 2, Y = 0, Z = 0\n\nX = 0, Y = 1, Z = 1\n\nX = 1, Y = 0, Z = 1\n\nX = 1, Y = 1, Z = 0\n\nSample Input 2\n\n5 15\n\nSample Output 2\n\n1\n\nThe maximum value of X + Y + Z is 15, achieved by one triple of X, Y and Z.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 810, "cpu_time_ms": 85, "memory_kb": 21204}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s071798115", "group_id": "codeNet:p03835", "input_text": "import java.lang.*;\nimport java.io.*;\nimport java.util.*;\n\n\npublic class Main {\n\n\tpublic static void main(String[] args) throws java.lang.Exception {\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tInputReader in = new InputReader(inputStream);\n\t\tPrintWriter out = new PrintWriter(outputStream);\n\t\tTaskA solver = new TaskA();\n\t\tsolver.solve(in, out);\n\t\tout.close();\n\t}\n}\n\nclass TaskA {\n\n\tpublic void solve(InputReader in, PrintWriter out) {\n\t\tint k = in.nextInt(), s = in.nextInt();\n\t\tint x, y, z;\n\t\tint ans = 0;\n\n\t\tfor (x=0; x<=k&&x<=s; ++x) {\n\t\t\tfor (y=0; y<=k&&x+y<=s; ++y) {\n\t\t\t\tz = s - (x + y);\n\t\t\t\tif (z>=0 && z<=k)\n\t\t\t\t\t++ans;\n\t\t\t}\n\t\t}\n\n\t\tout.println(ans);\n\t}\n}\n\n\nclass InputReader {\n\tpublic BufferedReader reader;\n\tpublic StringTokenizer tokenizer;\n\n\n\tpublic InputReader(InputStream stream) {\n\t\treader = new BufferedReader(new InputStreamReader(stream), 32768);\n\t\ttokenizer = null;\n\t}\n\n\tpublic String next() {\n\t\twhile (tokenizer==null || !tokenizer.hasMoreTokens()) {\n\t\t\ttry {\n\t\t\t\ttokenizer = new StringTokenizer(reader.readLine());\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}\n\t\t}\n\t\treturn tokenizer.nextToken();\n\t}\n\n\tpublic int nextInt() {\n\t\treturn Integer.parseInt(next());\n\t}\n\n\tpublic long nextLong() {\n\t\treturn Long.parseLong(next());\n\t}\n\n\tpublic double nextDouble() {\n\t\treturn Double.parseDouble(next());\n\t}\n}\n", "language": "Java", "metadata": {"date": 1492652562, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03835.html", "problem_id": "p03835", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03835/input.txt", "sample_output_relpath": "derived/input_output/data/p03835/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03835/Java/s071798115.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s071798115", "user_id": "u841907810"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "import java.lang.*;\nimport java.io.*;\nimport java.util.*;\n\n\npublic class Main {\n\n\tpublic static void main(String[] args) throws java.lang.Exception {\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tInputReader in = new InputReader(inputStream);\n\t\tPrintWriter out = new PrintWriter(outputStream);\n\t\tTaskA solver = new TaskA();\n\t\tsolver.solve(in, out);\n\t\tout.close();\n\t}\n}\n\nclass TaskA {\n\n\tpublic void solve(InputReader in, PrintWriter out) {\n\t\tint k = in.nextInt(), s = in.nextInt();\n\t\tint x, y, z;\n\t\tint ans = 0;\n\n\t\tfor (x=0; x<=k&&x<=s; ++x) {\n\t\t\tfor (y=0; y<=k&&x+y<=s; ++y) {\n\t\t\t\tz = s - (x + y);\n\t\t\t\tif (z>=0 && z<=k)\n\t\t\t\t\t++ans;\n\t\t\t}\n\t\t}\n\n\t\tout.println(ans);\n\t}\n}\n\n\nclass InputReader {\n\tpublic BufferedReader reader;\n\tpublic StringTokenizer tokenizer;\n\n\n\tpublic InputReader(InputStream stream) {\n\t\treader = new BufferedReader(new InputStreamReader(stream), 32768);\n\t\ttokenizer = null;\n\t}\n\n\tpublic String next() {\n\t\twhile (tokenizer==null || !tokenizer.hasMoreTokens()) {\n\t\t\ttry {\n\t\t\t\ttokenizer = new StringTokenizer(reader.readLine());\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}\n\t\t}\n\t\treturn tokenizer.nextToken();\n\t}\n\n\tpublic int nextInt() {\n\t\treturn Integer.parseInt(next());\n\t}\n\n\tpublic long nextLong() {\n\t\treturn Long.parseLong(next());\n\t}\n\n\tpublic double nextDouble() {\n\t\treturn Double.parseDouble(next());\n\t}\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given two integers K and S.\n\nThree variable X, Y and Z takes integer values satisfying 0≤X,Y,Z≤K.\n\nHow many different assignments of values to X, Y and Z are there such that X + Y + Z = S?\n\nConstraints\n\n2≤K≤2500\n\n0���S≤3K\n\nK and S are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nK S\n\nOutput\n\nPrint the number of the triples of X, Y and Z that satisfy the condition.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n6\n\nThere are six triples of X, Y and Z that satisfy the condition:\n\nX = 0, Y = 0, Z = 2\n\nX = 0, Y = 2, Z = 0\n\nX = 2, Y = 0, Z = 0\n\nX = 0, Y = 1, Z = 1\n\nX = 1, Y = 0, Z = 1\n\nX = 1, Y = 1, Z = 0\n\nSample Input 2\n\n5 15\n\nSample Output 2\n\n1\n\nThe maximum value of X + Y + Z is 15, achieved by one triple of X, Y and Z.", "sample_input": "2 2\n"}, "reference_outputs": ["6\n"], "source_document_id": "p03835", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given two integers K and S.\n\nThree variable X, Y and Z takes integer values satisfying 0≤X,Y,Z≤K.\n\nHow many different assignments of values to X, Y and Z are there such that X + Y + Z = S?\n\nConstraints\n\n2≤K≤2500\n\n0≤S≤3K\n\nK and S are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nK S\n\nOutput\n\nPrint the number of the triples of X, Y and Z that satisfy the condition.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n6\n\nThere are six triples of X, Y and Z that satisfy the condition:\n\nX = 0, Y = 0, Z = 2\n\nX = 0, Y = 2, Z = 0\n\nX = 2, Y = 0, Z = 0\n\nX = 0, Y = 1, Z = 1\n\nX = 1, Y = 0, Z = 1\n\nX = 1, Y = 1, Z = 0\n\nSample Input 2\n\n5 15\n\nSample Output 2\n\n1\n\nThe maximum value of X + Y + Z is 15, achieved by one triple of X, Y and Z.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 91, "memory_kb": 21460}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s591743025", "group_id": "codeNet:p03835", "input_text": "import java.util.*;\npublic class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int k = sc.nextInt();\n int s = sc.nextInt();\n int result=0;\n for(int x=0;x<=k;x++){\n for(int y=0;y<=k;y++){\nif(x+y<=s&&x+y+k>=s){\nresult++;\n}\n} \n}\nSystem.out.println(result);\n }\n}", "language": "Java", "metadata": {"date": 1483845275, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03835.html", "problem_id": "p03835", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03835/input.txt", "sample_output_relpath": "derived/input_output/data/p03835/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03835/Java/s591743025.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s591743025", "user_id": "u142032032"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int k = sc.nextInt();\n int s = sc.nextInt();\n int result=0;\n for(int x=0;x<=k;x++){\n for(int y=0;y<=k;y++){\nif(x+y<=s&&x+y+k>=s){\nresult++;\n}\n} \n}\nSystem.out.println(result);\n }\n}", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given two integers K and S.\n\nThree variable X, Y and Z takes integer values satisfying 0≤X,Y,Z≤K.\n\nHow many different assignments of values to X, Y and Z are there such that X + Y + Z = S?\n\nConstraints\n\n2≤K≤2500\n\n0≤S≤3K\n\nK and S are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nK S\n\nOutput\n\nPrint the number of the triples of X, Y and Z that satisfy the condition.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n6\n\nThere are six triples of X, Y and Z that satisfy the condition:\n\nX = 0, Y = 0, Z = 2\n\nX = 0, Y = 2, Z = 0\n\nX = 2, Y = 0, Z = 0\n\nX = 0, Y = 1, Z = 1\n\nX = 1, Y = 0, Z = 1\n\nX = 1, Y = 1, Z = 0\n\nSample Input 2\n\n5 15\n\nSample Output 2\n\n1\n\nThe maximum value of X + Y + Z is 15, achieved by one triple of X, Y and Z.", "sample_input": "2 2\n"}, "reference_outputs": ["6\n"], "source_document_id": "p03835", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given two integers K and S.\n\nThree variable X, Y and Z takes integer values satisfying 0≤X,Y,Z≤K.\n\nHow many different assignments of values to X, Y and Z are there such that X + Y + Z = S?\n\nConstraints\n\n2≤K≤2500\n\n0≤S≤3K\n\nK and S are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nK S\n\nOutput\n\nPrint the number of the triples of X, Y and Z that satisfy the condition.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n6\n\nThere are six triples of X, Y and Z that satisfy the condition:\n\nX = 0, Y = 0, Z = 2\n\nX = 0, Y = 2, Z = 0\n\nX = 2, Y = 0, Z = 0\n\nX = 0, Y = 1, Z = 1\n\nX = 1, Y = 0, Z = 1\n\nX = 1, Y = 1, Z = 0\n\nSample Input 2\n\n5 15\n\nSample Output 2\n\n1\n\nThe maximum value of X + Y + Z is 15, achieved by one triple of X, Y and Z.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 149, "memory_kb": 9812}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s877630783", "group_id": "codeNet:p03835", "input_text": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author @MaxHeap\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastReader in = new FastReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n TripletSum solver = new TripletSum();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class TripletSum {\n public void solve(int testNumber, FastReader fs, PrintWriter pw) {\n int k = fs.nextInt(), Sum = fs.nextInt();\n int ans = 0;\n for (int i = 0; i <= k; i++) {\n for (int j = 0; j <= k; j++) {\n int p = Sum - i - j;\n if (p < 0 || p > k) continue;\n ans += 1;\n }\n }\n pw.println(ans);\n }\n\n }\n\n static class FastReader {\n BufferedReader bf;\n StringTokenizer st;\n\n public FastReader(InputStream is) {\n bf = new BufferedReader(new InputStreamReader(is));\n st = null;\n }\n\n public String next() {\n try {\n while (st == null || !st.hasMoreTokens()) {\n String line = bf.readLine();\n if (line == null) return null;\n st = new StringTokenizer(line);\n }\n } catch (Exception e) {\n }\n\n return st.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n }\n}\n\n", "language": "Java", "metadata": {"date": 1483841953, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03835.html", "problem_id": "p03835", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03835/input.txt", "sample_output_relpath": "derived/input_output/data/p03835/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03835/Java/s877630783.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s877630783", "user_id": "u013734211"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author @MaxHeap\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastReader in = new FastReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n TripletSum solver = new TripletSum();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class TripletSum {\n public void solve(int testNumber, FastReader fs, PrintWriter pw) {\n int k = fs.nextInt(), Sum = fs.nextInt();\n int ans = 0;\n for (int i = 0; i <= k; i++) {\n for (int j = 0; j <= k; j++) {\n int p = Sum - i - j;\n if (p < 0 || p > k) continue;\n ans += 1;\n }\n }\n pw.println(ans);\n }\n\n }\n\n static class FastReader {\n BufferedReader bf;\n StringTokenizer st;\n\n public FastReader(InputStream is) {\n bf = new BufferedReader(new InputStreamReader(is));\n st = null;\n }\n\n public String next() {\n try {\n while (st == null || !st.hasMoreTokens()) {\n String line = bf.readLine();\n if (line == null) return null;\n st = new StringTokenizer(line);\n }\n } catch (Exception e) {\n }\n\n return st.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n }\n}\n\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given two integers K and S.\n\nThree variable X, Y and Z takes integer values satisfying 0≤X,Y,Z≤K.\n\nHow many different assignments of values to X, Y and Z are there such that X + Y + Z = S?\n\nConstraints\n\n2≤K≤2500\n\n0≤S≤3K\n\nK and S are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nK S\n\nOutput\n\nPrint the number of the triples of X, Y and Z that satisfy the condition.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n6\n\nThere are six triples of X, Y and Z that satisfy the condition:\n\nX = 0, Y = 0, Z = 2\n\nX = 0, Y = 2, Z = 0\n\nX = 2, Y = 0, Z = 0\n\nX = 0, Y = 1, Z = 1\n\nX = 1, Y = 0, Z = 1\n\nX = 1, Y = 1, Z = 0\n\nSample Input 2\n\n5 15\n\nSample Output 2\n\n1\n\nThe maximum value of X + Y + Z is 15, achieved by one triple of X, Y and Z.", "sample_input": "2 2\n"}, "reference_outputs": ["6\n"], "source_document_id": "p03835", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given two integers K and S.\n\nThree variable X, Y and Z takes integer values satisfying 0≤X,Y,Z≤K.\n\nHow many different assignments of values to X, Y and Z are there such that X + Y + Z = S?\n\nConstraints\n\n2≤K≤2500\n\n0≤S≤3K\n\nK and S are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nK S\n\nOutput\n\nPrint the number of the triples of X, Y and Z that satisfy the condition.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n6\n\nThere are six triples of X, Y and Z that satisfy the condition:\n\nX = 0, Y = 0, Z = 2\n\nX = 0, Y = 2, Z = 0\n\nX = 2, Y = 0, Z = 0\n\nX = 0, Y = 1, Z = 1\n\nX = 1, Y = 0, Z = 1\n\nX = 1, Y = 1, Z = 0\n\nSample Input 2\n\n5 15\n\nSample Output 2\n\n1\n\nThe maximum value of X + Y + Z is 15, achieved by one triple of X, Y and Z.", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1886, "cpu_time_ms": 117, "memory_kb": 8528}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s160746523", "group_id": "codeNet:p03854", "input_text": "import java.util.*;\npublic class Main {\n\n public static void main(String[] args) {\n Scanner no=new Scanner(System.in);\n String s=no.next();\n int y=s.length()-1;\n int i=y;\n for(i=y;i>=0;i--){\n if(s.charAt(i)=='m'){\n if(i-4<0){\n System.out.println(\"NO\");\n }\n else{\n String r=s.substring(i-4,i+1);\n if(r.equals(\"dream\")){\n i=i-4;\n }\n else{\n System.out.println(\"NO\");\n break;\n }\n }\n }\n else if(s.charAt(i)=='e'){\n if(i-4<0){\n System.out.println(\"NO\");\n }\n else{\n String r=s.substring(i-4,i+1);\n if(r.equals(\"erase\")){\n i=i-4;\n }\n }\n }\n else if(s.charAt(i)=='r'){\n boolean t=false;\n boolean t1=false;\n String r=\"\";\n String r1=\"\";\n if(i-6>=0){\n r=s.substring(i-6,i+1);\n t=true;\n }\n if(i-5>=0){\n r1=s.substring(i-5,i+1);\n t1=true;\n }\n if(t==true&&r.equals(\"dreamer\")){\n i=i-6;\n }\n else if(t1==true&&r1.equals(\"eraser\")){\n i=i-5;\n }\n else{\n System.out.println(\"NO\");\n break;\n }\n }\n else{\n System.out.println(\"NO\");\n break;\n }\n }\n //System.out.println(i);\n if(i==-1){\n System.out.println(\"YES\");\n }\n }\n\n}\n", "language": "Java", "metadata": {"date": 1601089375, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p03854.html", "problem_id": "p03854", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03854/input.txt", "sample_output_relpath": "derived/input_output/data/p03854/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03854/Java/s160746523.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s160746523", "user_id": "u411505922"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "import java.util.*;\npublic class Main {\n\n public static void main(String[] args) {\n Scanner no=new Scanner(System.in);\n String s=no.next();\n int y=s.length()-1;\n int i=y;\n for(i=y;i>=0;i--){\n if(s.charAt(i)=='m'){\n if(i-4<0){\n System.out.println(\"NO\");\n }\n else{\n String r=s.substring(i-4,i+1);\n if(r.equals(\"dream\")){\n i=i-4;\n }\n else{\n System.out.println(\"NO\");\n break;\n }\n }\n }\n else if(s.charAt(i)=='e'){\n if(i-4<0){\n System.out.println(\"NO\");\n }\n else{\n String r=s.substring(i-4,i+1);\n if(r.equals(\"erase\")){\n i=i-4;\n }\n }\n }\n else if(s.charAt(i)=='r'){\n boolean t=false;\n boolean t1=false;\n String r=\"\";\n String r1=\"\";\n if(i-6>=0){\n r=s.substring(i-6,i+1);\n t=true;\n }\n if(i-5>=0){\n r1=s.substring(i-5,i+1);\n t1=true;\n }\n if(t==true&&r.equals(\"dreamer\")){\n i=i-6;\n }\n else if(t1==true&&r1.equals(\"eraser\")){\n i=i-5;\n }\n else{\n System.out.println(\"NO\");\n break;\n }\n }\n else{\n System.out.println(\"NO\");\n break;\n }\n }\n //System.out.println(i);\n if(i==-1){\n System.out.println(\"YES\");\n }\n }\n\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nAnother string T is initially empty.\nDetermine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:\n\nAppend one of the following at the end of T: dream, dreamer, erase and eraser.\n\nConstraints\n\n1≦|S|≦10^5\n\nS consists of lowercase English letters.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf it is possible to obtain S = T, print YES. Otherwise, print NO.\n\nSample Input 1\n\nerasedream\n\nSample Output 1\n\nYES\n\nAppend erase and dream at the end of T in this order, to obtain S = T.\n\nSample Input 2\n\ndreameraser\n\nSample Output 2\n\nYES\n\nAppend dream and eraser at the end of T in this order, to obtain S = T.\n\nSample Input 3\n\ndreamerer\n\nSample Output 3\n\nNO", "sample_input": "erasedream\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03854", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nAnother string T is initially empty.\nDetermine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:\n\nAppend one of the following at the end of T: dream, dreamer, erase and eraser.\n\nConstraints\n\n1≦|S|≦10^5\n\nS consists of lowercase English letters.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf it is possible to obtain S = T, print YES. Otherwise, print NO.\n\nSample Input 1\n\nerasedream\n\nSample Output 1\n\nYES\n\nAppend erase and dream at the end of T in this order, to obtain S = T.\n\nSample Input 2\n\ndreameraser\n\nSample Output 2\n\nYES\n\nAppend dream and eraser at the end of T in this order, to obtain S = T.\n\nSample Input 3\n\ndreamerer\n\nSample Output 3\n\nNO", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1274, "cpu_time_ms": 178, "memory_kb": 40240}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s374100878", "group_id": "codeNet:p03854", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tString scStr = scanner.nextLine();\n\t\tint count = scStr.length() / 5;\n\n\t\tString dream = \"dream\";\n\t\tString dreamer = \"dreamer\";\n\t\tString erase = \"erase\";\n\t\tString eraser = \"eraser\";\n\n\t\tboolean result = false;\n\t\tboolean isEnd = false;\n\n\t\tfor (int i = 0; i <= count; i++) {\n\t\t\tif (isEnd == true)\n\t\t\t\tbreak;\n\t\t\tif (scStr.endsWith(dreamer)) {\n\t\t\t\tscStr = scStr.substring(0,scStr.length()-7);\n\t\t\t} else if (scStr.endsWith(dream)) {\n\t\t\t\tscStr = scStr.substring(0,scStr.length()-5);\n\t\t\t} else if (scStr.endsWith(eraser)) {\n\t\t\t\tscStr = scStr.substring(0,scStr.length()-6);\n\t\t\t} else if (scStr.endsWith(erase)) {\n\t\t\t\tscStr = scStr.substring(0,scStr.length()-5);\n\t\t\t} else if (scStr.length() <= 7) {\n\t\t\t\tif (scStr.length() == 0) {\n\t\t\t\t\tresult = true;\n\t\t\t\t} else if (scStr.length() == 7 && (scStr.endsWith(dreamer))) {\n\t\t\t\t\tresult = true;\n\t\t\t\t\tisEnd = true;\n\t\t\t\t} else if (scStr.length() == 6 && (scStr.endsWith(eraser))) {\n\t\t\t\t\tresult = true;\n\t\t\t\t\tisEnd = true;\n\t\t\t\t} else if (scStr.length() == 5 && (scStr.endsWith(dream) || scStr.endsWith(erase))) {\n\t\t\t\t\tresult = true;\n\t\t\t\t\tisEnd = true;\n\t\t\t\t}else {\n\t\t\t\t\tisEnd = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (result == true) {\n\t\t\tSystem.out.println(\"YES\");\n\t\t}else {\n\t\t\tSystem.out.println(\"NO\");\n\t\t}\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1600558600, "filename_ext": "java", "original_language": "Java (OpenJDK 11.0.6)", "problem_description_relpath": "problem_descriptions/p03854.html", "problem_id": "p03854", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03854/input.txt", "sample_output_relpath": "derived/input_output/data/p03854/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03854/Java/s374100878.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s374100878", "user_id": "u783523887"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tString scStr = scanner.nextLine();\n\t\tint count = scStr.length() / 5;\n\n\t\tString dream = \"dream\";\n\t\tString dreamer = \"dreamer\";\n\t\tString erase = \"erase\";\n\t\tString eraser = \"eraser\";\n\n\t\tboolean result = false;\n\t\tboolean isEnd = false;\n\n\t\tfor (int i = 0; i <= count; i++) {\n\t\t\tif (isEnd == true)\n\t\t\t\tbreak;\n\t\t\tif (scStr.endsWith(dreamer)) {\n\t\t\t\tscStr = scStr.substring(0,scStr.length()-7);\n\t\t\t} else if (scStr.endsWith(dream)) {\n\t\t\t\tscStr = scStr.substring(0,scStr.length()-5);\n\t\t\t} else if (scStr.endsWith(eraser)) {\n\t\t\t\tscStr = scStr.substring(0,scStr.length()-6);\n\t\t\t} else if (scStr.endsWith(erase)) {\n\t\t\t\tscStr = scStr.substring(0,scStr.length()-5);\n\t\t\t} else if (scStr.length() <= 7) {\n\t\t\t\tif (scStr.length() == 0) {\n\t\t\t\t\tresult = true;\n\t\t\t\t} else if (scStr.length() == 7 && (scStr.endsWith(dreamer))) {\n\t\t\t\t\tresult = true;\n\t\t\t\t\tisEnd = true;\n\t\t\t\t} else if (scStr.length() == 6 && (scStr.endsWith(eraser))) {\n\t\t\t\t\tresult = true;\n\t\t\t\t\tisEnd = true;\n\t\t\t\t} else if (scStr.length() == 5 && (scStr.endsWith(dream) || scStr.endsWith(erase))) {\n\t\t\t\t\tresult = true;\n\t\t\t\t\tisEnd = true;\n\t\t\t\t}else {\n\t\t\t\t\tisEnd = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (result == true) {\n\t\t\tSystem.out.println(\"YES\");\n\t\t}else {\n\t\t\tSystem.out.println(\"NO\");\n\t\t}\n\t}\n\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nAnother string T is initially empty.\nDetermine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:\n\nAppend one of the following at the end of T: dream, dreamer, erase and eraser.\n\nConstraints\n\n1≦|S|≦10^5\n\nS consists of lowercase English letters.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf it is possible to obtain S = T, print YES. Otherwise, print NO.\n\nSample Input 1\n\nerasedream\n\nSample Output 1\n\nYES\n\nAppend erase and dream at the end of T in this order, to obtain S = T.\n\nSample Input 2\n\ndreameraser\n\nSample Output 2\n\nYES\n\nAppend dream and eraser at the end of T in this order, to obtain S = T.\n\nSample Input 3\n\ndreamerer\n\nSample Output 3\n\nNO", "sample_input": "erasedream\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03854", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nAnother string T is initially empty.\nDetermine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:\n\nAppend one of the following at the end of T: dream, dreamer, erase and eraser.\n\nConstraints\n\n1≦|S|≦10^5\n\nS consists of lowercase English letters.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf it is possible to obtain S = T, print YES. Otherwise, print NO.\n\nSample Input 1\n\nerasedream\n\nSample Output 1\n\nYES\n\nAppend erase and dream at the end of T in this order, to obtain S = T.\n\nSample Input 2\n\ndreameraser\n\nSample Output 2\n\nYES\n\nAppend dream and eraser at the end of T in this order, to obtain S = T.\n\nSample Input 3\n\ndreamerer\n\nSample Output 3\n\nNO", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1364, "cpu_time_ms": 288, "memory_kb": 56480}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s127814305", "group_id": "codeNet:p03854", "input_text": "\nimport java.text.DecimalFormat;\nimport java.util.stream.LongStream;\nimport java.util.stream.IntStream;\nimport java.io.*;\nimport java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n FastScanner sc = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n\n AtCoder problem = new AtCoder(sc);\n problem.solve(out);\n\n out.flush();\n }\n\n}\n\nclass AtCoder {\n\n String S;\n\n AtCoder(FastScanner sc) {\n S = sc.next();\n }\n\n void solve(PrintWriter out) {\n StringBuilder sb = new StringBuilder(S).reverse();\n while (sb.length() > 0) {\n if (sb.substring(0, 5).equals(\"maerd\")) sb.delete(0, 5);\n else if (sb.substring(0, 5).equals(\"esare\")) sb.delete(0, 5);\n else if (sb.substring(0, 6).equals(\"resare\")) sb.delete(0, 6);\n else if (sb.substring(0, 7).equals(\"remaerd\")) sb.delete(0, 7);\n else {\n out.println(\"NO\");\n return;\n }\n }\n out.println(\"YES\");\n }\n\n}\n\nclass FastScanner {\n\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte()) {\n return buffer[ptr++];\n } else {\n return -1;\n }\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr])) {\n ptr++;\n }\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {\n throw new NumberFormatException();\n }\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public int[] arrayInt(int N) {\n int[] array = new int[N];\n for (int i = 0; i < N; i++) {\n array[i] = nextInt();\n }\n return array;\n }\n\n public long[] arrayLong(int N) {\n long[] array = new long[N];\n for (int i = 0; i < N; i++) {\n array[i] = nextLong();\n }\n return array;\n }\n\n public double[] arrayDouble(int N) {\n double[] array = new double[N];\n for (int i = 0; i < N; i++) {\n array[i] = nextDouble();\n }\n return array;\n }\n\n public String[] arrayString(int N) {\n String[] array = new String[N];\n for (int i = 0; i < N; i++) {\n array[i] = next();\n }\n return array;\n }\n}\n\nclass My {\n\n static String sort(String s) {\n char[] ch = s.toCharArray();\n Arrays.sort(ch);\n return String.valueOf(ch);\n }\n\n static String reverse(String s) {\n return new StringBuilder(s).reverse().toString();\n }\n\n static int[] reverse(int[] array) {\n for (int i = 0; i < array.length / 2; i++) {\n int temp = array[i];\n array[i] = array[array.length - 1 - i];\n array[array.length - 1 - i] = temp;\n }\n return array;\n }\n\n static long[] reverse(long[] array) {\n for (int i = 0; i < array.length / 2; i++) {\n long temp = array[i];\n array[i] = array[array.length - 1 - i];\n array[array.length - 1 - i] = temp;\n }\n return array;\n }\n\n static double[] reverse(double[] array) {\n for (int i = 0; i < array.length / 2; i++) {\n double temp = array[i];\n array[i] = array[array.length - 1 - i];\n array[array.length - 1 - i] = temp;\n }\n return array;\n }\n\n static String[] reverse(String[] array) {\n for (int i = 0; i < array.length / 2; i++) {\n String temp = array[i];\n array[i] = array[array.length - 1 - i];\n array[array.length - 1 - i] = temp;\n }\n return array;\n }\n\n static char[] reverse(char[] array) {\n for (int i = 0; i < array.length / 2; i++) {\n char temp = array[i];\n array[i] = array[array.length - 1 - i];\n array[array.length - 1 - i] = temp;\n }\n return array;\n }\n\n static long min(long... numbers) {\n Arrays.sort(numbers);\n return numbers[0];\n }\n\n static int min(int... numbers) {\n Arrays.sort(numbers);\n return numbers[0];\n }\n\n static double min(double... numbers) {\n Arrays.sort(numbers);\n return numbers[0];\n }\n\n static long max(long... numbers) {\n Arrays.sort(numbers);\n return numbers[numbers.length - 1];\n }\n\n static int max(int... numbers) {\n Arrays.sort(numbers);\n return numbers[numbers.length - 1];\n }\n\n static double max(double... numbers) {\n Arrays.sort(numbers);\n return numbers[numbers.length - 1];\n }\n\n static int sum(long number) {\n int sum = 0;\n while (number > 0) {\n sum += number % 10;\n number /= 10;\n }\n return sum;\n }\n\n static Map tally(int[] array) {\n Map map = new TreeMap<>();\n for (int k : array) {\n int v = map.getOrDefault(k, 0);\n map.put(k, ++v);\n }\n return map;\n }\n\n static Map tally(long[] array) {\n Map map = new TreeMap<>();\n for (long k : array) {\n int v = map.getOrDefault(k, 0);\n map.put(k, ++v);\n }\n return map;\n }\n\n static Map tally(double[] array) {\n Map map = new TreeMap<>();\n for (double k : array) {\n int v = map.getOrDefault(k, 0);\n map.put(k, ++v);\n }\n return map;\n }\n\n static Map tally(String[] array) {\n Map map = new TreeMap<>();\n for (String k : array) {\n int v = map.getOrDefault(k, 0);\n map.put(k, ++v);\n }\n return map;\n }\n\n static Map tally(char[] array) {\n Map map = new TreeMap<>();\n for (char k : array) {\n int v = map.getOrDefault(k, 0);\n map.put(k, ++v);\n }\n return map;\n }\n\n}\n", "language": "Java", "metadata": {"date": 1592085448, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03854.html", "problem_id": "p03854", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03854/input.txt", "sample_output_relpath": "derived/input_output/data/p03854/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03854/Java/s127814305.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s127814305", "user_id": "u871244227"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "\nimport java.text.DecimalFormat;\nimport java.util.stream.LongStream;\nimport java.util.stream.IntStream;\nimport java.io.*;\nimport java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n FastScanner sc = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n\n AtCoder problem = new AtCoder(sc);\n problem.solve(out);\n\n out.flush();\n }\n\n}\n\nclass AtCoder {\n\n String S;\n\n AtCoder(FastScanner sc) {\n S = sc.next();\n }\n\n void solve(PrintWriter out) {\n StringBuilder sb = new StringBuilder(S).reverse();\n while (sb.length() > 0) {\n if (sb.substring(0, 5).equals(\"maerd\")) sb.delete(0, 5);\n else if (sb.substring(0, 5).equals(\"esare\")) sb.delete(0, 5);\n else if (sb.substring(0, 6).equals(\"resare\")) sb.delete(0, 6);\n else if (sb.substring(0, 7).equals(\"remaerd\")) sb.delete(0, 7);\n else {\n out.println(\"NO\");\n return;\n }\n }\n out.println(\"YES\");\n }\n\n}\n\nclass FastScanner {\n\n private final InputStream in = System.in;\n private final byte[] buffer = new byte[1024];\n private int ptr = 0;\n private int buflen = 0;\n\n private boolean hasNextByte() {\n if (ptr < buflen) {\n return true;\n } else {\n ptr = 0;\n try {\n buflen = in.read(buffer);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (buflen <= 0) {\n return false;\n }\n }\n return true;\n }\n\n private int readByte() {\n if (hasNextByte()) {\n return buffer[ptr++];\n } else {\n return -1;\n }\n }\n\n private static boolean isPrintableChar(int c) {\n return 33 <= c && c <= 126;\n }\n\n public boolean hasNext() {\n while (hasNextByte() && !isPrintableChar(buffer[ptr])) {\n ptr++;\n }\n return hasNextByte();\n }\n\n public String next() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n StringBuilder sb = new StringBuilder();\n int b = readByte();\n while (isPrintableChar(b)) {\n sb.appendCodePoint(b);\n b = readByte();\n }\n return sb.toString();\n }\n\n public long nextLong() {\n if (!hasNext()) {\n throw new NoSuchElementException();\n }\n long n = 0;\n boolean minus = false;\n int b = readByte();\n if (b == '-') {\n minus = true;\n b = readByte();\n }\n if (b < '0' || '9' < b) {\n throw new NumberFormatException();\n }\n while (true) {\n if ('0' <= b && b <= '9') {\n n *= 10;\n n += b - '0';\n } else if (b == -1 || !isPrintableChar(b)) {\n return minus ? -n : n;\n } else {\n throw new NumberFormatException();\n }\n b = readByte();\n }\n }\n\n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {\n throw new NumberFormatException();\n }\n return (int) nl;\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public int[] arrayInt(int N) {\n int[] array = new int[N];\n for (int i = 0; i < N; i++) {\n array[i] = nextInt();\n }\n return array;\n }\n\n public long[] arrayLong(int N) {\n long[] array = new long[N];\n for (int i = 0; i < N; i++) {\n array[i] = nextLong();\n }\n return array;\n }\n\n public double[] arrayDouble(int N) {\n double[] array = new double[N];\n for (int i = 0; i < N; i++) {\n array[i] = nextDouble();\n }\n return array;\n }\n\n public String[] arrayString(int N) {\n String[] array = new String[N];\n for (int i = 0; i < N; i++) {\n array[i] = next();\n }\n return array;\n }\n}\n\nclass My {\n\n static String sort(String s) {\n char[] ch = s.toCharArray();\n Arrays.sort(ch);\n return String.valueOf(ch);\n }\n\n static String reverse(String s) {\n return new StringBuilder(s).reverse().toString();\n }\n\n static int[] reverse(int[] array) {\n for (int i = 0; i < array.length / 2; i++) {\n int temp = array[i];\n array[i] = array[array.length - 1 - i];\n array[array.length - 1 - i] = temp;\n }\n return array;\n }\n\n static long[] reverse(long[] array) {\n for (int i = 0; i < array.length / 2; i++) {\n long temp = array[i];\n array[i] = array[array.length - 1 - i];\n array[array.length - 1 - i] = temp;\n }\n return array;\n }\n\n static double[] reverse(double[] array) {\n for (int i = 0; i < array.length / 2; i++) {\n double temp = array[i];\n array[i] = array[array.length - 1 - i];\n array[array.length - 1 - i] = temp;\n }\n return array;\n }\n\n static String[] reverse(String[] array) {\n for (int i = 0; i < array.length / 2; i++) {\n String temp = array[i];\n array[i] = array[array.length - 1 - i];\n array[array.length - 1 - i] = temp;\n }\n return array;\n }\n\n static char[] reverse(char[] array) {\n for (int i = 0; i < array.length / 2; i++) {\n char temp = array[i];\n array[i] = array[array.length - 1 - i];\n array[array.length - 1 - i] = temp;\n }\n return array;\n }\n\n static long min(long... numbers) {\n Arrays.sort(numbers);\n return numbers[0];\n }\n\n static int min(int... numbers) {\n Arrays.sort(numbers);\n return numbers[0];\n }\n\n static double min(double... numbers) {\n Arrays.sort(numbers);\n return numbers[0];\n }\n\n static long max(long... numbers) {\n Arrays.sort(numbers);\n return numbers[numbers.length - 1];\n }\n\n static int max(int... numbers) {\n Arrays.sort(numbers);\n return numbers[numbers.length - 1];\n }\n\n static double max(double... numbers) {\n Arrays.sort(numbers);\n return numbers[numbers.length - 1];\n }\n\n static int sum(long number) {\n int sum = 0;\n while (number > 0) {\n sum += number % 10;\n number /= 10;\n }\n return sum;\n }\n\n static Map tally(int[] array) {\n Map map = new TreeMap<>();\n for (int k : array) {\n int v = map.getOrDefault(k, 0);\n map.put(k, ++v);\n }\n return map;\n }\n\n static Map tally(long[] array) {\n Map map = new TreeMap<>();\n for (long k : array) {\n int v = map.getOrDefault(k, 0);\n map.put(k, ++v);\n }\n return map;\n }\n\n static Map tally(double[] array) {\n Map map = new TreeMap<>();\n for (double k : array) {\n int v = map.getOrDefault(k, 0);\n map.put(k, ++v);\n }\n return map;\n }\n\n static Map tally(String[] array) {\n Map map = new TreeMap<>();\n for (String k : array) {\n int v = map.getOrDefault(k, 0);\n map.put(k, ++v);\n }\n return map;\n }\n\n static Map tally(char[] array) {\n Map map = new TreeMap<>();\n for (char k : array) {\n int v = map.getOrDefault(k, 0);\n map.put(k, ++v);\n }\n return map;\n }\n\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nAnother string T is initially empty.\nDetermine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:\n\nAppend one of the following at the end of T: dream, dreamer, erase and eraser.\n\nConstraints\n\n1≦|S|≦10^5\n\nS consists of lowercase English letters.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf it is possible to obtain S = T, print YES. Otherwise, print NO.\n\nSample Input 1\n\nerasedream\n\nSample Output 1\n\nYES\n\nAppend erase and dream at the end of T in this order, to obtain S = T.\n\nSample Input 2\n\ndreameraser\n\nSample Output 2\n\nYES\n\nAppend dream and eraser at the end of T in this order, to obtain S = T.\n\nSample Input 3\n\ndreamerer\n\nSample Output 3\n\nNO", "sample_input": "erasedream\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03854", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nAnother string T is initially empty.\nDetermine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:\n\nAppend one of the following at the end of T: dream, dreamer, erase and eraser.\n\nConstraints\n\n1≦|S|≦10^5\n\nS consists of lowercase English letters.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf it is possible to obtain S = T, print YES. Otherwise, print NO.\n\nSample Input 1\n\nerasedream\n\nSample Output 1\n\nYES\n\nAppend erase and dream at the end of T in this order, to obtain S = T.\n\nSample Input 2\n\ndreameraser\n\nSample Output 2\n\nYES\n\nAppend dream and eraser at the end of T in this order, to obtain S = T.\n\nSample Input 3\n\ndreamerer\n\nSample Output 3\n\nNO", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 7827, "cpu_time_ms": 171, "memory_kb": 25812}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s595776800", "group_id": "codeNet:p03854", "input_text": "import java.util.Scanner;\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner stdIn = new Scanner(System.in);\n\t\t\n\t\t/*<考察>\n\t\t * dream を a\n\t\t * dreamer を b\n\t\t * erase を c\n\t\t * eraser を d とおく。\n\t\t * \n\t\t * s と a,b,c,dを何度も比較する 4 *10^5で十分間に合う\n\t\t * 比較するときに文字列がずれるためできないのでは。。。?\n\t\t * 前から比較するとdream,dreamerのどっちで切っていいか分からなくなる、このような関係をprefixという。\n\t\t * \n\t\t * dream,dreamer,erase,eraser以外の異物が入っているときに絶対不可能であるため、\n\t\t * 変な文字が入ってないか確認するか?\n\t\t * \t\t\n\t\t*/\n\t\t\n\t\t/*String s = stdIn.next();\n\t\t\n\t\tif(!(s.contains(\"dream\") || s.contains(\"dreamer\") || s.contains(\"erase\") || s.contains(\"eraser\")) ) {\n\t\t\tSystem.out.println(\"NO\");\n\t\t}else {\n\t\t\tSystem.out.println(\"YES\");\n\t\t}\n\t\t*/\n\t\t\n//\t\tString[] divide = new String[] {\"dream\",\"dreamer\",\"erase\",\"eraser\"};\n\t\tStringBuilder[] sb = new StringBuilder[] {new StringBuilder(\"dream\"),new StringBuilder(\"dreamer\"),new StringBuilder(\"erase\"),new StringBuilder(\"eraser\")};\n\t\t\n\t\tfor(int i = 0; i < sb.length; i++) {\n\t\t\tsb[i] = sb[i].reverse();\n\t\t}\n\t\t\n\t\tString s2 = stdIn.next();\n\t\t\n\t\tStringBuilder s1 = new StringBuilder(s2);\n\t\tString s = s1.reverse().toString();\n\t\t\n\t\t\n\t\tboolean flag = true;\n\t\t\n\t\t\n\tOuter:\tfor(int i = 0; i < s.length();) {\n\t\t\tboolean flag2 = false; //4個の文字列のうちあてはまるものはあるか\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tif(s.length() - i == 5) {\n\t\t\t\tif(s.substring(i,s.length()).equals(\"maerd\") || s.substring(i,s.length()).equals(\"esare\")) {\n\t\t\t\t\tflag2 = true;\n\t\t\t\t\tbreak Outer;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(s.length() - i == 6) {\n\t\t\t\tif(s.substring(i,s.length()).equals(\"resare\")){\n\t\t\t\t\tflag2 = true;\n\t\t\t\t\tbreak Outer;\n\t\t\t\t}\n\t\t\t}\n\t\t\n\t\t\t\n\t\t\tfor(int j = 0; j < 4; j++) {\n\t\t\t\tString d = sb[j].toString();\n\t\t\t\t\n\t\n\t\t\t\tif(s.substring(i,i+d.length()).equals(d)) { //あてはまった\n\t\t\t\t\tflag2 = true;\n\t\t\t\t\ti += d.length();\n\t\t\t\t\tcontinue Outer;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tif(!flag2) {\n\t\t\t\tflag = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(flag) {\n\t\t\tSystem.out.println(\"YES\");\n\t\t}else {\n\t\t\tSystem.out.println(\"NO\");\n\t\t}\n\t\t\n\t}\n\n}\n", "language": "Java", "metadata": {"date": 1591906023, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03854.html", "problem_id": "p03854", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03854/input.txt", "sample_output_relpath": "derived/input_output/data/p03854/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03854/Java/s595776800.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s595776800", "user_id": "u015418292"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "import java.util.Scanner;\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner stdIn = new Scanner(System.in);\n\t\t\n\t\t/*<考察>\n\t\t * dream を a\n\t\t * dreamer を b\n\t\t * erase を c\n\t\t * eraser を d とおく。\n\t\t * \n\t\t * s と a,b,c,dを何度も比較する 4 *10^5で十分間に合う\n\t\t * 比較するときに文字列がずれるためできないのでは。。。?\n\t\t * 前から比較するとdream,dreamerのどっちで切っていいか分からなくなる、このような関係をprefixという。\n\t\t * \n\t\t * dream,dreamer,erase,eraser以外の異物が入っているときに絶対不可能であるため、\n\t\t * 変な文字が入ってないか確認するか?\n\t\t * \t\t\n\t\t*/\n\t\t\n\t\t/*String s = stdIn.next();\n\t\t\n\t\tif(!(s.contains(\"dream\") || s.contains(\"dreamer\") || s.contains(\"erase\") || s.contains(\"eraser\")) ) {\n\t\t\tSystem.out.println(\"NO\");\n\t\t}else {\n\t\t\tSystem.out.println(\"YES\");\n\t\t}\n\t\t*/\n\t\t\n//\t\tString[] divide = new String[] {\"dream\",\"dreamer\",\"erase\",\"eraser\"};\n\t\tStringBuilder[] sb = new StringBuilder[] {new StringBuilder(\"dream\"),new StringBuilder(\"dreamer\"),new StringBuilder(\"erase\"),new StringBuilder(\"eraser\")};\n\t\t\n\t\tfor(int i = 0; i < sb.length; i++) {\n\t\t\tsb[i] = sb[i].reverse();\n\t\t}\n\t\t\n\t\tString s2 = stdIn.next();\n\t\t\n\t\tStringBuilder s1 = new StringBuilder(s2);\n\t\tString s = s1.reverse().toString();\n\t\t\n\t\t\n\t\tboolean flag = true;\n\t\t\n\t\t\n\tOuter:\tfor(int i = 0; i < s.length();) {\n\t\t\tboolean flag2 = false; //4個の文字列のうちあてはまるものはあるか\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tif(s.length() - i == 5) {\n\t\t\t\tif(s.substring(i,s.length()).equals(\"maerd\") || s.substring(i,s.length()).equals(\"esare\")) {\n\t\t\t\t\tflag2 = true;\n\t\t\t\t\tbreak Outer;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(s.length() - i == 6) {\n\t\t\t\tif(s.substring(i,s.length()).equals(\"resare\")){\n\t\t\t\t\tflag2 = true;\n\t\t\t\t\tbreak Outer;\n\t\t\t\t}\n\t\t\t}\n\t\t\n\t\t\t\n\t\t\tfor(int j = 0; j < 4; j++) {\n\t\t\t\tString d = sb[j].toString();\n\t\t\t\t\n\t\n\t\t\t\tif(s.substring(i,i+d.length()).equals(d)) { //あてはまった\n\t\t\t\t\tflag2 = true;\n\t\t\t\t\ti += d.length();\n\t\t\t\t\tcontinue Outer;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tif(!flag2) {\n\t\t\t\tflag = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(flag) {\n\t\t\tSystem.out.println(\"YES\");\n\t\t}else {\n\t\t\tSystem.out.println(\"NO\");\n\t\t}\n\t\t\n\t}\n\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nAnother string T is initially empty.\nDetermine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:\n\nAppend one of the following at the end of T: dream, dreamer, erase and eraser.\n\nConstraints\n\n1≦|S|≦10^5\n\nS consists of lowercase English letters.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf it is possible to obtain S = T, print YES. Otherwise, print NO.\n\nSample Input 1\n\nerasedream\n\nSample Output 1\n\nYES\n\nAppend erase and dream at the end of T in this order, to obtain S = T.\n\nSample Input 2\n\ndreameraser\n\nSample Output 2\n\nYES\n\nAppend dream and eraser at the end of T in this order, to obtain S = T.\n\nSample Input 3\n\ndreamerer\n\nSample Output 3\n\nNO", "sample_input": "erasedream\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03854", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nAnother string T is initially empty.\nDetermine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:\n\nAppend one of the following at the end of T: dream, dreamer, erase and eraser.\n\nConstraints\n\n1≦|S|≦10^5\n\nS consists of lowercase English letters.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf it is possible to obtain S = T, print YES. Otherwise, print NO.\n\nSample Input 1\n\nerasedream\n\nSample Output 1\n\nYES\n\nAppend erase and dream at the end of T in this order, to obtain S = T.\n\nSample Input 2\n\ndreameraser\n\nSample Output 2\n\nYES\n\nAppend dream and eraser at the end of T in this order, to obtain S = T.\n\nSample Input 3\n\ndreamerer\n\nSample Output 3\n\nNO", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2233, "cpu_time_ms": 165, "memory_kb": 31076}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s049728738", "group_id": "codeNet:p03854", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString str = sc.next();\n\t\tstr = str.replaceAll(\"eraser\", \"-\");\n\t\tstr = str.replaceAll(\"erase\", \"-\");\n\t\tstr = str.replaceAll(\"dreamer\", \"-\");\n\t\tstr = str.replaceAll(\"dream\", \"-\");\n\t\t\n\t\tstr = str.replaceAll(\"-\", \"\");\n\t\t\n\t\tif(str.length() == 0) {\n\t\t\tSystem.out.println(\"YES\");\n\t\t} else {\n\t\t\tSystem.out.println(\"NO\");\n\t\t}\n\t\t\n\t}\n}", "language": "Java", "metadata": {"date": 1589993383, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03854.html", "problem_id": "p03854", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03854/input.txt", "sample_output_relpath": "derived/input_output/data/p03854/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03854/Java/s049728738.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s049728738", "user_id": "u368688902"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString str = sc.next();\n\t\tstr = str.replaceAll(\"eraser\", \"-\");\n\t\tstr = str.replaceAll(\"erase\", \"-\");\n\t\tstr = str.replaceAll(\"dreamer\", \"-\");\n\t\tstr = str.replaceAll(\"dream\", \"-\");\n\t\t\n\t\tstr = str.replaceAll(\"-\", \"\");\n\t\t\n\t\tif(str.length() == 0) {\n\t\t\tSystem.out.println(\"YES\");\n\t\t} else {\n\t\t\tSystem.out.println(\"NO\");\n\t\t}\n\t\t\n\t}\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nAnother string T is initially empty.\nDetermine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:\n\nAppend one of the following at the end of T: dream, dreamer, erase and eraser.\n\nConstraints\n\n1≦|S|≦10^5\n\nS consists of lowercase English letters.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf it is possible to obtain S = T, print YES. Otherwise, print NO.\n\nSample Input 1\n\nerasedream\n\nSample Output 1\n\nYES\n\nAppend erase and dream at the end of T in this order, to obtain S = T.\n\nSample Input 2\n\ndreameraser\n\nSample Output 2\n\nYES\n\nAppend dream and eraser at the end of T in this order, to obtain S = T.\n\nSample Input 3\n\ndreamerer\n\nSample Output 3\n\nNO", "sample_input": "erasedream\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03854", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nAnother string T is initially empty.\nDetermine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:\n\nAppend one of the following at the end of T: dream, dreamer, erase and eraser.\n\nConstraints\n\n1≦|S|≦10^5\n\nS consists of lowercase English letters.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf it is possible to obtain S = T, print YES. Otherwise, print NO.\n\nSample Input 1\n\nerasedream\n\nSample Output 1\n\nYES\n\nAppend erase and dream at the end of T in this order, to obtain S = T.\n\nSample Input 2\n\ndreameraser\n\nSample Output 2\n\nYES\n\nAppend dream and eraser at the end of T in this order, to obtain S = T.\n\nSample Input 3\n\ndreamerer\n\nSample Output 3\n\nNO", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 455, "cpu_time_ms": 196, "memory_kb": 28812}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s715449766", "group_id": "codeNet:p03854", "input_text": "import java.util.*;\nimport java.io.*;\n \npublic class Main {\n static String[] word = {\"dream\", \"dreamer\", \"erase\", \"eraser\"};\n static int[] wordlen = {5,7,5,6};\n public static void main(String[] args) throws Exception {\n FastScanner sc = new FastScanner(System.in);\n String s = sc.next();\n int nowIndex = s.length();\n while(nowIndex > 0){\n boolean flg = false;\n for(int i = 0; i < 4; i++){\n if(nowIndex >= wordlen[i] && s.substring(nowIndex-wordlen[i],nowIndex).equals(word[i])){\n nowIndex -= wordlen[i];\n flg = true;\n break;\n }\n }\n if(!flg){\n break;\n }\n }\n System.out.println(nowIndex == 0 ? \"YES\" : \"NO\");\n }\n}\n\nclass FastScanner {\n private BufferedReader reader = null;\n private StringTokenizer tokenizer = null;\n public FastScanner(InputStream in) {\n reader = new BufferedReader(new InputStreamReader(in));\n tokenizer = null;\n }\n\n public String next() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public String nextLine() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n return reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken(\"\\n\");\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public int[] nextIntArray(int n) {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n return a;\n }\n\n public long[] nextLongArray(int n) {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = nextLong();\n return a;\n } \n}\n", "language": "Java", "metadata": {"date": 1589421396, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03854.html", "problem_id": "p03854", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03854/input.txt", "sample_output_relpath": "derived/input_output/data/p03854/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03854/Java/s715449766.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s715449766", "user_id": "u578775554"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "import java.util.*;\nimport java.io.*;\n \npublic class Main {\n static String[] word = {\"dream\", \"dreamer\", \"erase\", \"eraser\"};\n static int[] wordlen = {5,7,5,6};\n public static void main(String[] args) throws Exception {\n FastScanner sc = new FastScanner(System.in);\n String s = sc.next();\n int nowIndex = s.length();\n while(nowIndex > 0){\n boolean flg = false;\n for(int i = 0; i < 4; i++){\n if(nowIndex >= wordlen[i] && s.substring(nowIndex-wordlen[i],nowIndex).equals(word[i])){\n nowIndex -= wordlen[i];\n flg = true;\n break;\n }\n }\n if(!flg){\n break;\n }\n }\n System.out.println(nowIndex == 0 ? \"YES\" : \"NO\");\n }\n}\n\nclass FastScanner {\n private BufferedReader reader = null;\n private StringTokenizer tokenizer = null;\n public FastScanner(InputStream in) {\n reader = new BufferedReader(new InputStreamReader(in));\n tokenizer = null;\n }\n\n public String next() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public String nextLine() {\n if (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n return reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken(\"\\n\");\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public int[] nextIntArray(int n) {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n return a;\n }\n\n public long[] nextLongArray(int n) {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = nextLong();\n return a;\n } \n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nAnother string T is initially empty.\nDetermine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:\n\nAppend one of the following at the end of T: dream, dreamer, erase and eraser.\n\nConstraints\n\n1≦|S|≦10^5\n\nS consists of lowercase English letters.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf it is possible to obtain S = T, print YES. Otherwise, print NO.\n\nSample Input 1\n\nerasedream\n\nSample Output 1\n\nYES\n\nAppend erase and dream at the end of T in this order, to obtain S = T.\n\nSample Input 2\n\ndreameraser\n\nSample Output 2\n\nYES\n\nAppend dream and eraser at the end of T in this order, to obtain S = T.\n\nSample Input 3\n\ndreamerer\n\nSample Output 3\n\nNO", "sample_input": "erasedream\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03854", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nAnother string T is initially empty.\nDetermine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:\n\nAppend one of the following at the end of T: dream, dreamer, erase and eraser.\n\nConstraints\n\n1≦|S|≦10^5\n\nS consists of lowercase English letters.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf it is possible to obtain S = T, print YES. Otherwise, print NO.\n\nSample Input 1\n\nerasedream\n\nSample Output 1\n\nYES\n\nAppend erase and dream at the end of T in this order, to obtain S = T.\n\nSample Input 2\n\ndreameraser\n\nSample Output 2\n\nYES\n\nAppend dream and eraser at the end of T in this order, to obtain S = T.\n\nSample Input 3\n\ndreamerer\n\nSample Output 3\n\nNO", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2273, "cpu_time_ms": 108, "memory_kb": 25172}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s584641627", "group_id": "codeNet:p03854", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) throws Exception {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString S = sc.nextLine();\n\t\tS = S.replaceAll(\"eraser\",\"\").replaceAll(\"erase\",\"\").replaceAll(\"dreamer\",\"\").replaceAll(\"dream\",\"\");\n\n\t\tSystem.out.println(S);\n\n\t\tif(S.length() == 0) {\n\t\t\tSystem.out.println(\"YES\");\n\t\t}else {\n\t\t\tSystem.out.println(\"NO\");\n\t\t}\n\t}\n}\n", "language": "Java", "metadata": {"date": 1556920037, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03854.html", "problem_id": "p03854", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03854/input.txt", "sample_output_relpath": "derived/input_output/data/p03854/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03854/Java/s584641627.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s584641627", "user_id": "u319039941"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) throws Exception {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString S = sc.nextLine();\n\t\tS = S.replaceAll(\"eraser\",\"\").replaceAll(\"erase\",\"\").replaceAll(\"dreamer\",\"\").replaceAll(\"dream\",\"\");\n\n\t\tSystem.out.println(S);\n\n\t\tif(S.length() == 0) {\n\t\t\tSystem.out.println(\"YES\");\n\t\t}else {\n\t\t\tSystem.out.println(\"NO\");\n\t\t}\n\t}\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nAnother string T is initially empty.\nDetermine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:\n\nAppend one of the following at the end of T: dream, dreamer, erase and eraser.\n\nConstraints\n\n1≦|S|≦10^5\n\nS consists of lowercase English letters.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf it is possible to obtain S = T, print YES. Otherwise, print NO.\n\nSample Input 1\n\nerasedream\n\nSample Output 1\n\nYES\n\nAppend erase and dream at the end of T in this order, to obtain S = T.\n\nSample Input 2\n\ndreameraser\n\nSample Output 2\n\nYES\n\nAppend dream and eraser at the end of T in this order, to obtain S = T.\n\nSample Input 3\n\ndreamerer\n\nSample Output 3\n\nNO", "sample_input": "erasedream\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03854", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nAnother string T is initially empty.\nDetermine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:\n\nAppend one of the following at the end of T: dream, dreamer, erase and eraser.\n\nConstraints\n\n1≦|S|≦10^5\n\nS consists of lowercase English letters.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf it is possible to obtain S = T, print YES. Otherwise, print NO.\n\nSample Input 1\n\nerasedream\n\nSample Output 1\n\nYES\n\nAppend erase and dream at the end of T in this order, to obtain S = T.\n\nSample Input 2\n\ndreameraser\n\nSample Output 2\n\nYES\n\nAppend dream and eraser at the end of T in this order, to obtain S = T.\n\nSample Input 3\n\ndreamerer\n\nSample Output 3\n\nNO", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 189, "memory_kb": 29240}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s567869467", "group_id": "codeNet:p03854", "input_text": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\npublic class Main {\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tif(br.readLine( ).matches(\"^((dreamer)|(eraser)|(dream)|(erase))+$\") ){\n\t\t\tSystem.out.println(\"YES\");\n\t\t}else{\n\t\t\tSystem.out.println(\"NO\");\n\t\t}\n\t}\n}", "language": "Java", "metadata": {"date": 1544406411, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03854.html", "problem_id": "p03854", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03854/input.txt", "sample_output_relpath": "derived/input_output/data/p03854/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03854/Java/s567869467.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s567869467", "user_id": "u357377531"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\npublic class Main {\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tif(br.readLine( ).matches(\"^((dreamer)|(eraser)|(dream)|(erase))+$\") ){\n\t\t\tSystem.out.println(\"YES\");\n\t\t}else{\n\t\t\tSystem.out.println(\"NO\");\n\t\t}\n\t}\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nAnother string T is initially empty.\nDetermine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:\n\nAppend one of the following at the end of T: dream, dreamer, erase and eraser.\n\nConstraints\n\n1≦|S|≦10^5\n\nS consists of lowercase English letters.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf it is possible to obtain S = T, print YES. Otherwise, print NO.\n\nSample Input 1\n\nerasedream\n\nSample Output 1\n\nYES\n\nAppend erase and dream at the end of T in this order, to obtain S = T.\n\nSample Input 2\n\ndreameraser\n\nSample Output 2\n\nYES\n\nAppend dream and eraser at the end of T in this order, to obtain S = T.\n\nSample Input 3\n\ndreamerer\n\nSample Output 3\n\nNO", "sample_input": "erasedream\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03854", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nAnother string T is initially empty.\nDetermine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:\n\nAppend one of the following at the end of T: dream, dreamer, erase and eraser.\n\nConstraints\n\n1≦|S|≦10^5\n\nS consists of lowercase English letters.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf it is possible to obtain S = T, print YES. Otherwise, print NO.\n\nSample Input 1\n\nerasedream\n\nSample Output 1\n\nYES\n\nAppend erase and dream at the end of T in this order, to obtain S = T.\n\nSample Input 2\n\ndreameraser\n\nSample Output 2\n\nYES\n\nAppend dream and eraser at the end of T in this order, to obtain S = T.\n\nSample Input 3\n\ndreamerer\n\nSample Output 3\n\nNO", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 117, "memory_kb": 38580}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s739694902", "group_id": "codeNet:p03854", "input_text": "import java.util.*;\nimport java.util.stream.*;\n\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n // programming\n String s = getInputString(sc);\n StringBuilder temp = new StringBuilder(s);\n boolean isFound = false;\n String[] words = {\"dream\",\"dreamer\",\"erase\",\"eraser\"};\n\n if (temp.length() == 0) {\n output(\"NO\");\n return;\n }\n l1: while (true) {\n for (String w : words) {\n if (temp.toString().endsWith(w)) {\n temp = temp.delete(temp.toString().length() - w.length(), temp.toString().length());\n if (temp.toString().length() == 0) {\n\t\t isFound = true;\n\t\t break l1;\n\t\t }\n\t\t continue l1;\n }\n }\n\n break;\n }\n if (isFound) {\n output(\"YES\");\n } else {\n output(\"NO\");\n }\n\t}\n\n\tpublic static String getInputString(Scanner sc) {\n\t\treturn sc.next();\n\t}\n\n\tpublic static int getInputInteger(Scanner sc) {\n\t\treturn Integer.parseInt(sc.next());\n\t}\n\n\tpublic static void output(String... params) {\n\t\tboolean isInit = true;\n\t\tString str = \"\";\n\t\tfor (String s : params) {\n\t\t\tif (!isInit) {\n\t\t\t\tstr += \" \";\n\t\t\t}\n\t\t\tstr += s;\n\t\t\tisInit = false;\n\t\t}\n\t\tSystem.out.println(str);\n\t}\n\n public static int[] toIntegerList(String[] ss) {\n return Stream.of(ss).mapToInt(Integer::parseInt).toArray();\n }\n\n public static String[] toList(String s) {\n String[] ret = s.split(\"\");\n return ret;\n }\n\n public static int sum(int[] vals) {\n int sum = 0;\n for (int val : vals) {\n sum += val;\n }\n return sum;\n }\n\n public static int[] sort(int[] vals, boolean isAsc) {\n Arrays.sort(vals);\n\t\tif (isAsc) {\n\t\t\treturn vals;\n\t\t}\n int[] ret = new int[vals.length];\n for (int i = 0; i < vals.length; i++) {\n ret[vals.length - i - 1] = vals[i];\n }\n\t\treturn ret;\n\t}\n}", "language": "Java", "metadata": {"date": 1541378043, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03854.html", "problem_id": "p03854", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03854/input.txt", "sample_output_relpath": "derived/input_output/data/p03854/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03854/Java/s739694902.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Memory Limit Exceeded", "submission_id": "s739694902", "user_id": "u486448566"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "import java.util.*;\nimport java.util.stream.*;\n\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n // programming\n String s = getInputString(sc);\n StringBuilder temp = new StringBuilder(s);\n boolean isFound = false;\n String[] words = {\"dream\",\"dreamer\",\"erase\",\"eraser\"};\n\n if (temp.length() == 0) {\n output(\"NO\");\n return;\n }\n l1: while (true) {\n for (String w : words) {\n if (temp.toString().endsWith(w)) {\n temp = temp.delete(temp.toString().length() - w.length(), temp.toString().length());\n if (temp.toString().length() == 0) {\n\t\t isFound = true;\n\t\t break l1;\n\t\t }\n\t\t continue l1;\n }\n }\n\n break;\n }\n if (isFound) {\n output(\"YES\");\n } else {\n output(\"NO\");\n }\n\t}\n\n\tpublic static String getInputString(Scanner sc) {\n\t\treturn sc.next();\n\t}\n\n\tpublic static int getInputInteger(Scanner sc) {\n\t\treturn Integer.parseInt(sc.next());\n\t}\n\n\tpublic static void output(String... params) {\n\t\tboolean isInit = true;\n\t\tString str = \"\";\n\t\tfor (String s : params) {\n\t\t\tif (!isInit) {\n\t\t\t\tstr += \" \";\n\t\t\t}\n\t\t\tstr += s;\n\t\t\tisInit = false;\n\t\t}\n\t\tSystem.out.println(str);\n\t}\n\n public static int[] toIntegerList(String[] ss) {\n return Stream.of(ss).mapToInt(Integer::parseInt).toArray();\n }\n\n public static String[] toList(String s) {\n String[] ret = s.split(\"\");\n return ret;\n }\n\n public static int sum(int[] vals) {\n int sum = 0;\n for (int val : vals) {\n sum += val;\n }\n return sum;\n }\n\n public static int[] sort(int[] vals, boolean isAsc) {\n Arrays.sort(vals);\n\t\tif (isAsc) {\n\t\t\treturn vals;\n\t\t}\n int[] ret = new int[vals.length];\n for (int i = 0; i < vals.length; i++) {\n ret[vals.length - i - 1] = vals[i];\n }\n\t\treturn ret;\n\t}\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nAnother string T is initially empty.\nDetermine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:\n\nAppend one of the following at the end of T: dream, dreamer, erase and eraser.\n\nConstraints\n\n1≦|S|≦10^5\n\nS consists of lowercase English letters.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf it is possible to obtain S = T, print YES. Otherwise, print NO.\n\nSample Input 1\n\nerasedream\n\nSample Output 1\n\nYES\n\nAppend erase and dream at the end of T in this order, to obtain S = T.\n\nSample Input 2\n\ndreameraser\n\nSample Output 2\n\nYES\n\nAppend dream and eraser at the end of T in this order, to obtain S = T.\n\nSample Input 3\n\ndreamerer\n\nSample Output 3\n\nNO", "sample_input": "erasedream\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03854", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nAnother string T is initially empty.\nDetermine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:\n\nAppend one of the following at the end of T: dream, dreamer, erase and eraser.\n\nConstraints\n\n1≦|S|≦10^5\n\nS consists of lowercase English letters.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf it is possible to obtain S = T, print YES. Otherwise, print NO.\n\nSample Input 1\n\nerasedream\n\nSample Output 1\n\nYES\n\nAppend erase and dream at the end of T in this order, to obtain S = T.\n\nSample Input 2\n\ndreameraser\n\nSample Output 2\n\nYES\n\nAppend dream and eraser at the end of T in this order, to obtain S = T.\n\nSample Input 3\n\ndreamerer\n\nSample Output 3\n\nNO", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2066, "cpu_time_ms": 1452, "memory_kb": 347732}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s271810206", "group_id": "codeNet:p03854", "input_text": "import java.util.Scanner;\n\n/**\n *\n * @author psygn\n */\npublic class Main {\n\n /**\n * @param args the command line arguments\n */\n public static void main(String[] args) {\n\n Scanner scanner = new Scanner(System.in);\n\n String str = scanner.nextLine();\n String ans = \"NO\";\n str = str.replace(\"dreamer\", \"[space]\");\n str = str.replace(\"dream\", \"[space]\");\n str = str.replace(\"eraser\", \"[space]\");\n str = str.replace(\"erase\", \"[space]\");\n str = str.replace(\"[space]\", \"\");\n if (\"\".equals(str)){\n ans = \"YES\";\n }\n System.out.println(ans);\n }\n}\n", "language": "Java", "metadata": {"date": 1527436463, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03854.html", "problem_id": "p03854", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03854/input.txt", "sample_output_relpath": "derived/input_output/data/p03854/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03854/Java/s271810206.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s271810206", "user_id": "u595963843"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "import java.util.Scanner;\n\n/**\n *\n * @author psygn\n */\npublic class Main {\n\n /**\n * @param args the command line arguments\n */\n public static void main(String[] args) {\n\n Scanner scanner = new Scanner(System.in);\n\n String str = scanner.nextLine();\n String ans = \"NO\";\n str = str.replace(\"dreamer\", \"[space]\");\n str = str.replace(\"dream\", \"[space]\");\n str = str.replace(\"eraser\", \"[space]\");\n str = str.replace(\"erase\", \"[space]\");\n str = str.replace(\"[space]\", \"\");\n if (\"\".equals(str)){\n ans = \"YES\";\n }\n System.out.println(ans);\n }\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nAnother string T is initially empty.\nDetermine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:\n\nAppend one of the following at the end of T: dream, dreamer, erase and eraser.\n\nConstraints\n\n1≦|S|≦10^5\n\nS consists of lowercase English letters.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf it is possible to obtain S = T, print YES. Otherwise, print NO.\n\nSample Input 1\n\nerasedream\n\nSample Output 1\n\nYES\n\nAppend erase and dream at the end of T in this order, to obtain S = T.\n\nSample Input 2\n\ndreameraser\n\nSample Output 2\n\nYES\n\nAppend dream and eraser at the end of T in this order, to obtain S = T.\n\nSample Input 3\n\ndreamerer\n\nSample Output 3\n\nNO", "sample_input": "erasedream\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03854", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nAnother string T is initially empty.\nDetermine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:\n\nAppend one of the following at the end of T: dream, dreamer, erase and eraser.\n\nConstraints\n\n1≦|S|≦10^5\n\nS consists of lowercase English letters.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf it is possible to obtain S = T, print YES. Otherwise, print NO.\n\nSample Input 1\n\nerasedream\n\nSample Output 1\n\nYES\n\nAppend erase and dream at the end of T in this order, to obtain S = T.\n\nSample Input 2\n\ndreameraser\n\nSample Output 2\n\nYES\n\nAppend dream and eraser at the end of T in this order, to obtain S = T.\n\nSample Input 3\n\ndreamerer\n\nSample Output 3\n\nNO", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 641, "cpu_time_ms": 205, "memory_kb": 30436}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s074584069", "group_id": "codeNet:p03854", "input_text": "import java.util.ArrayList;\nimport java.util.Scanner;\n\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc=new Scanner(System.in);\n\t\tString S=sc.next();\n\t\tif(S.length()<5)System.out.println(\"NO\");\n\t\tStringBuilder s=new StringBuilder(S); \n\t\tArrayListde=new ArrayList<>();\n\t\tde.add(\"dream\");\n\t\tde.add(\"dreamer\");\n\t\tde.add(\"erase\");\n\t\tde.add(\"eraser\");\n\t\twhile(true){\n\t\t\tif(de.contains(s.substring(0,s.length()))){System.out.println(\"YES\");break;}\n\t\t\tif(s.length()<5 || s.length()==8 || s.length()==9){System.out.println(\"NO\");break;}\n\t\t\n\t\t\tif((s.length()>5&&s.substring(0,6).equals(\"dreamd\"))||(s.length()>7&&s.substring(0,8).equals(\"dreamera\")))s.delete(0,5);\n\t\t\telse if(s.length()>=6&&(s.substring(0,6).equals(\"erasee\")||s.substring(0,6).equals(\"erased\")))s.delete(0,5);\n\t\t\telse if(s.length()>=7&&(s.substring(0,7).equals(\"erasere\")||s.substring(0,7).equals(\"eraserd\")))s.delete(0,6);\n\t\t\telse if(s.length()>=8&&(s.substring(0,8).equals(\"dreamerd\")||s.substring(0,8).equals(\"dreamere\")))s.delete(0,7);\n\t\t\telse {System.out.println(\"NO\");break;}\n\t\t\t\n\t\t}\n}\n}", "language": "Java", "metadata": {"date": 1481509024, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03854.html", "problem_id": "p03854", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03854/input.txt", "sample_output_relpath": "derived/input_output/data/p03854/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03854/Java/s074584069.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Memory Limit Exceeded", "submission_id": "s074584069", "user_id": "u421764188"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "import java.util.ArrayList;\nimport java.util.Scanner;\n\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc=new Scanner(System.in);\n\t\tString S=sc.next();\n\t\tif(S.length()<5)System.out.println(\"NO\");\n\t\tStringBuilder s=new StringBuilder(S); \n\t\tArrayListde=new ArrayList<>();\n\t\tde.add(\"dream\");\n\t\tde.add(\"dreamer\");\n\t\tde.add(\"erase\");\n\t\tde.add(\"eraser\");\n\t\twhile(true){\n\t\t\tif(de.contains(s.substring(0,s.length()))){System.out.println(\"YES\");break;}\n\t\t\tif(s.length()<5 || s.length()==8 || s.length()==9){System.out.println(\"NO\");break;}\n\t\t\n\t\t\tif((s.length()>5&&s.substring(0,6).equals(\"dreamd\"))||(s.length()>7&&s.substring(0,8).equals(\"dreamera\")))s.delete(0,5);\n\t\t\telse if(s.length()>=6&&(s.substring(0,6).equals(\"erasee\")||s.substring(0,6).equals(\"erased\")))s.delete(0,5);\n\t\t\telse if(s.length()>=7&&(s.substring(0,7).equals(\"erasere\")||s.substring(0,7).equals(\"eraserd\")))s.delete(0,6);\n\t\t\telse if(s.length()>=8&&(s.substring(0,8).equals(\"dreamerd\")||s.substring(0,8).equals(\"dreamere\")))s.delete(0,7);\n\t\t\telse {System.out.println(\"NO\");break;}\n\t\t\t\n\t\t}\n}\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nAnother string T is initially empty.\nDetermine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:\n\nAppend one of the following at the end of T: dream, dreamer, erase and eraser.\n\nConstraints\n\n1≦|S|≦10^5\n\nS consists of lowercase English letters.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf it is possible to obtain S = T, print YES. Otherwise, print NO.\n\nSample Input 1\n\nerasedream\n\nSample Output 1\n\nYES\n\nAppend erase and dream at the end of T in this order, to obtain S = T.\n\nSample Input 2\n\ndreameraser\n\nSample Output 2\n\nYES\n\nAppend dream and eraser at the end of T in this order, to obtain S = T.\n\nSample Input 3\n\ndreamerer\n\nSample Output 3\n\nNO", "sample_input": "erasedream\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03854", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nAnother string T is initially empty.\nDetermine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:\n\nAppend one of the following at the end of T: dream, dreamer, erase and eraser.\n\nConstraints\n\n1≦|S|≦10^5\n\nS consists of lowercase English letters.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf it is possible to obtain S = T, print YES. Otherwise, print NO.\n\nSample Input 1\n\nerasedream\n\nSample Output 1\n\nYES\n\nAppend erase and dream at the end of T in this order, to obtain S = T.\n\nSample Input 2\n\ndreameraser\n\nSample Output 2\n\nYES\n\nAppend dream and eraser at the end of T in this order, to obtain S = T.\n\nSample Input 3\n\ndreamerer\n\nSample Output 3\n\nNO", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1087, "cpu_time_ms": 774, "memory_kb": 328536}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s138320631", "group_id": "codeNet:p03854", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\tstatic boolean checkB[] = { true, true, true, true };\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tString s = sc.next();\n\t\tString tmp = null;\n\t\twhile (true) {\n\t\t\tif(!s.equals(\"\"))\n\t\t\t\ttmp = whatNext(s);\n\t\t\tif (s.equals(\"\") || tmp == null) {\n\t\t\t\tif (s.equals(\"\"))\n\t\t\t\t\tSystem.out.println(\"YES\");\n\t\t\t\telse {\n\t\t\t\t\tSystem.out.println(\"NO\");\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\ts = cut(s, tmp);\n\t\t}\n\t}\n\n\tstatic String cut(String tx, String cut) {\n\t\tint tmp = tx.indexOf(cut);\n\t\ttmp += cut.length();\n\t\ttry {\n\t\t\tString tmpS = tx.substring(tmp);\n\t\t\tcheckIn(tmpS);\n\t\t\treturn tmpS;\n\t\t} catch (StringIndexOutOfBoundsException e) {\n\t\t\tfor (int i = 0; i < 4; i++) {\n\t\t\t\tcheckB[i] = false;\n\t\t\t}\n\t\t\treturn \"\";\n\t\t}\n\t}\n\n\tstatic String whatNext(String tx) {\n\t\ttry{\n\t\tchar first = tx.charAt(0);\n\t\tif (checkB[0] && first == 'd') {\n\t\t\t// dreamあり\n\t\t\tif (!checkB[2] || tx.charAt(7) == 'a' || tx.charAt(5) == 'd' )\n\t\t\t\treturn \"dream\";\n\t\t\telse\n\t\t\t\treturn \"dreamer\";\n\n\t\t} else if (checkB[2] && first == 'e') { // eraseある\n\t\t\tif (tx.charAt(4) == 'e') {\n\t\t\t\tif (!checkB[0] || tx.charAt(5) == 'r' || tx.charAt(5) == 'e') {\n\t\t\t\t\treturn \"eraser\";\n\t\t\t\t} else {\n\t\t\t\t\treturn \"erase\";\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tcheckB[2] = false;\n\t\t\t\tcheckB[3] = false;\n\t\t\t\treturn null;\n\t\t\t}\n\t\t} else {\n\t\t\treturn null;\n\t\t}\n\t\t}catch (StringIndexOutOfBoundsException e) {\n\t\t\treturn null;\n\t\t}\n\t}\n\tstatic void checkIn(String tx) {\n\t\tif (checkB[0]) {\n\t\t\tif (!tx.contains(\"dream\")) {\n\t\t\t\tcheckB[0] = false;\n\t\t\t\tcheckB[1] = false;\n\t\t\t}\n\t\t}\n\t\tif (checkB[1]) {\n\t\t\tif (!tx.contains(\"dreamer\")) {\n\t\t\t\tcheckB[1] = false;\n\t\t\t}\n\t\t}\n\t\tif (checkB[2]) {\n\t\t\tif (!tx.contains(\"erase\")) {\n\t\t\t\tcheckB[2] = false;\n\t\t\t\tcheckB[3] = false;\n\t\t\t}\n\t\t}\n\t\tif (checkB[3]) {\n\t\t\tif (!tx.contains(\"eraser\")) {\n\t\t\t\tcheckB[3] = false;\n\t\t\t}\n\t\t}\n\t}\n}\n", "language": "Java", "metadata": {"date": 1481427290, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03854.html", "problem_id": "p03854", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03854/input.txt", "sample_output_relpath": "derived/input_output/data/p03854/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03854/Java/s138320631.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Memory Limit Exceeded", "submission_id": "s138320631", "user_id": "u790070623"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n\tstatic boolean checkB[] = { true, true, true, true };\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tString s = sc.next();\n\t\tString tmp = null;\n\t\twhile (true) {\n\t\t\tif(!s.equals(\"\"))\n\t\t\t\ttmp = whatNext(s);\n\t\t\tif (s.equals(\"\") || tmp == null) {\n\t\t\t\tif (s.equals(\"\"))\n\t\t\t\t\tSystem.out.println(\"YES\");\n\t\t\t\telse {\n\t\t\t\t\tSystem.out.println(\"NO\");\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\ts = cut(s, tmp);\n\t\t}\n\t}\n\n\tstatic String cut(String tx, String cut) {\n\t\tint tmp = tx.indexOf(cut);\n\t\ttmp += cut.length();\n\t\ttry {\n\t\t\tString tmpS = tx.substring(tmp);\n\t\t\tcheckIn(tmpS);\n\t\t\treturn tmpS;\n\t\t} catch (StringIndexOutOfBoundsException e) {\n\t\t\tfor (int i = 0; i < 4; i++) {\n\t\t\t\tcheckB[i] = false;\n\t\t\t}\n\t\t\treturn \"\";\n\t\t}\n\t}\n\n\tstatic String whatNext(String tx) {\n\t\ttry{\n\t\tchar first = tx.charAt(0);\n\t\tif (checkB[0] && first == 'd') {\n\t\t\t// dreamあり\n\t\t\tif (!checkB[2] || tx.charAt(7) == 'a' || tx.charAt(5) == 'd' )\n\t\t\t\treturn \"dream\";\n\t\t\telse\n\t\t\t\treturn \"dreamer\";\n\n\t\t} else if (checkB[2] && first == 'e') { // eraseある\n\t\t\tif (tx.charAt(4) == 'e') {\n\t\t\t\tif (!checkB[0] || tx.charAt(5) == 'r' || tx.charAt(5) == 'e') {\n\t\t\t\t\treturn \"eraser\";\n\t\t\t\t} else {\n\t\t\t\t\treturn \"erase\";\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tcheckB[2] = false;\n\t\t\t\tcheckB[3] = false;\n\t\t\t\treturn null;\n\t\t\t}\n\t\t} else {\n\t\t\treturn null;\n\t\t}\n\t\t}catch (StringIndexOutOfBoundsException e) {\n\t\t\treturn null;\n\t\t}\n\t}\n\tstatic void checkIn(String tx) {\n\t\tif (checkB[0]) {\n\t\t\tif (!tx.contains(\"dream\")) {\n\t\t\t\tcheckB[0] = false;\n\t\t\t\tcheckB[1] = false;\n\t\t\t}\n\t\t}\n\t\tif (checkB[1]) {\n\t\t\tif (!tx.contains(\"dreamer\")) {\n\t\t\t\tcheckB[1] = false;\n\t\t\t}\n\t\t}\n\t\tif (checkB[2]) {\n\t\t\tif (!tx.contains(\"erase\")) {\n\t\t\t\tcheckB[2] = false;\n\t\t\t\tcheckB[3] = false;\n\t\t\t}\n\t\t}\n\t\tif (checkB[3]) {\n\t\t\tif (!tx.contains(\"eraser\")) {\n\t\t\t\tcheckB[3] = false;\n\t\t\t}\n\t\t}\n\t}\n}\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nAnother string T is initially empty.\nDetermine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:\n\nAppend one of the following at the end of T: dream, dreamer, erase and eraser.\n\nConstraints\n\n1≦|S|≦10^5\n\nS consists of lowercase English letters.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf it is possible to obtain S = T, print YES. Otherwise, print NO.\n\nSample Input 1\n\nerasedream\n\nSample Output 1\n\nYES\n\nAppend erase and dream at the end of T in this order, to obtain S = T.\n\nSample Input 2\n\ndreameraser\n\nSample Output 2\n\nYES\n\nAppend dream and eraser at the end of T in this order, to obtain S = T.\n\nSample Input 3\n\ndreamerer\n\nSample Output 3\n\nNO", "sample_input": "erasedream\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03854", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nAnother string T is initially empty.\nDetermine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:\n\nAppend one of the following at the end of T: dream, dreamer, erase and eraser.\n\nConstraints\n\n1≦|S|≦10^5\n\nS consists of lowercase English letters.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf it is possible to obtain S = T, print YES. Otherwise, print NO.\n\nSample Input 1\n\nerasedream\n\nSample Output 1\n\nYES\n\nAppend erase and dream at the end of T in this order, to obtain S = T.\n\nSample Input 2\n\ndreameraser\n\nSample Output 2\n\nYES\n\nAppend dream and eraser at the end of T in this order, to obtain S = T.\n\nSample Input 3\n\ndreamerer\n\nSample Output 3\n\nNO", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1843, "cpu_time_ms": 704, "memory_kb": 327936}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s355270646", "group_id": "codeNet:p03854", "input_text": "package src;\n\nimport java.util.*;\nclass Main{\n\tstatic Scanner s = new Scanner(System.in);\n\tpublic static void main(String[] args) {\n\t\tStringBuilder str = new StringBuilder(s.next()\n\t\t\t\t.replaceAll(\"eraser\", \"\")\n\t\t\t\t.replaceAll(\"dream\", \"D\")\n\t\t\t\t.replaceAll(\"er\", \"R\")\n\t\t\t\t.replaceAll(\"as\", \"A\"));\n\t\tString[] m = {\"RAe\",\"DR\",\"D\"};\n\t\tString b,st;\n\t\tboolean f;\n\t\tdo {\n\t\t\tf=false;\n\t\t\tfor(int i=0;i 0){\n\t\t\tif(current >= 7){\n\t\t\t\tString sub = S.substring(current-7, current);\n\t\t\t\tif(sub.equals(\"dreamer\")){\n\t\t\t\t\tcurrent -= 7;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif(current >= 6){\n\t\t\t\tString sub = S.substring(current-6, current);\n\t\t\t\tif(sub.equals(\"eraser\")){\n\t\t\t\t\tcurrent -= 6;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif(current >= 5){\n\t\t\t\tString sub = S.substring(current-5, current);\n\t\t\t\tif(sub.equals(\"dream\") || sub.equals(\"erase\")){\n\t\t\t\t\tcurrent -= 5;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tSystem.out.println(\"NO\");\n return;\n\t\t}\n\t\t\n\t\tSystem.out.println(\"YES\"); \n \n \n } \n}\n \n \n ", "language": "Java", "metadata": {"date": 1498192280, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03856.html", "problem_id": "p03856", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03856/input.txt", "sample_output_relpath": "derived/input_output/data/p03856/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03856/Java/s420320317.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s420320317", "user_id": "u918497744"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "import java.util.*;\n\npublic class Main { \n public static void main(String[] args){\n\n Scanner sc = new Scanner(System.in);\n \n String S = sc.next();\n\t\tint N = S.length();\n\t\n\t\tint current = N;\n\t\n\t\twhile(current > 0){\n\t\t\tif(current >= 7){\n\t\t\t\tString sub = S.substring(current-7, current);\n\t\t\t\tif(sub.equals(\"dreamer\")){\n\t\t\t\t\tcurrent -= 7;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif(current >= 6){\n\t\t\t\tString sub = S.substring(current-6, current);\n\t\t\t\tif(sub.equals(\"eraser\")){\n\t\t\t\t\tcurrent -= 6;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif(current >= 5){\n\t\t\t\tString sub = S.substring(current-5, current);\n\t\t\t\tif(sub.equals(\"dream\") || sub.equals(\"erase\")){\n\t\t\t\t\tcurrent -= 5;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tSystem.out.println(\"NO\");\n return;\n\t\t}\n\t\t\n\t\tSystem.out.println(\"YES\"); \n \n \n } \n}\n \n \n ", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nAnother string T is initially empty.\nDetermine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:\n\nAppend one of the following at the end of T: dream, dreamer, erase and eraser.\n\nConstraints\n\n1≦|S|≦10^5\n\nS consists of lowercase English letters.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf it is possible to obtain S = T, print YES. Otherwise, print NO.\n\nSample Input 1\n\nerasedream\n\nSample Output 1\n\nYES\n\nAppend erase and dream at the end of T in this order, to obtain S = T.\n\nSample Input 2\n\ndreameraser\n\nSample Output 2\n\nYES\n\nAppend dream and eraser at the end of T in this order, to obtain S = T.\n\nSample Input 3\n\ndreamerer\n\nSample Output 3\n\nNO", "sample_input": "erasedream\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03856", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nAnother string T is initially empty.\nDetermine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:\n\nAppend one of the following at the end of T: dream, dreamer, erase and eraser.\n\nConstraints\n\n1≦|S|≦10^5\n\nS consists of lowercase English letters.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf it is possible to obtain S = T, print YES. Otherwise, print NO.\n\nSample Input 1\n\nerasedream\n\nSample Output 1\n\nYES\n\nAppend erase and dream at the end of T in this order, to obtain S = T.\n\nSample Input 2\n\ndreameraser\n\nSample Output 2\n\nYES\n\nAppend dream and eraser at the end of T in this order, to obtain S = T.\n\nSample Input 3\n\ndreamerer\n\nSample Output 3\n\nNO", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 918, "cpu_time_ms": 162, "memory_kb": 27760}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s838609982", "group_id": "codeNet:p03856", "input_text": "import java.util.Scanner;\n\npublic class Main {\n \n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String input = sc.next();\n String []PARTS = {\"dream\",\"dreamer\",\"erase\",\"eraser\"};\n boolean flag = true;\n boolean able = true;\n while(flag) {\n flag = false;\n if (input.equals(\"\")) able =true;\n for (int i = 0; i < PARTS.length; i++) {\n if (input.endsWith(PARTS[i])) {\n input = input.substring(0, input.length() - PARTS[i].length());\n flag= true;\n }\n }\n if (input.equals(\"\")) able =true;\n else able = false;\n }\n if(able){\n System.out.println(\"YES\");\n }\n else{\n System.out.println(\"NO\");\n }\n\n sc.close();\n\n }\n\n// private static boolean check(String s){\n// boolean flag = true;\n// while(flag) {\n// flag = false;\n// if (s.equals(\"\")) return true;\n// for (int i = 0; i < PARTS.length; i++) {\n// if (s.endsWith(PARTS[i])) {\n// s = s.substring(0, s.length() - PARTS[i].length());\n// flag= true;\n// }\n// }\n// }\n// return false;\n// }\n\n}", "language": "Java", "metadata": {"date": 1481423694, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p03856.html", "problem_id": "p03856", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03856/input.txt", "sample_output_relpath": "derived/input_output/data/p03856/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03856/Java/s838609982.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Memory Limit Exceeded", "submission_id": "s838609982", "user_id": "u953364667"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "import java.util.Scanner;\n\npublic class Main {\n \n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String input = sc.next();\n String []PARTS = {\"dream\",\"dreamer\",\"erase\",\"eraser\"};\n boolean flag = true;\n boolean able = true;\n while(flag) {\n flag = false;\n if (input.equals(\"\")) able =true;\n for (int i = 0; i < PARTS.length; i++) {\n if (input.endsWith(PARTS[i])) {\n input = input.substring(0, input.length() - PARTS[i].length());\n flag= true;\n }\n }\n if (input.equals(\"\")) able =true;\n else able = false;\n }\n if(able){\n System.out.println(\"YES\");\n }\n else{\n System.out.println(\"NO\");\n }\n\n sc.close();\n\n }\n\n// private static boolean check(String s){\n// boolean flag = true;\n// while(flag) {\n// flag = false;\n// if (s.equals(\"\")) return true;\n// for (int i = 0; i < PARTS.length; i++) {\n// if (s.endsWith(PARTS[i])) {\n// s = s.substring(0, s.length() - PARTS[i].length());\n// flag= true;\n// }\n// }\n// }\n// return false;\n// }\n\n}", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nAnother string T is initially empty.\nDetermine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:\n\nAppend one of the following at the end of T: dream, dreamer, erase and eraser.\n\nConstraints\n\n1≦|S|≦10^5\n\nS consists of lowercase English letters.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf it is possible to obtain S = T, print YES. Otherwise, print NO.\n\nSample Input 1\n\nerasedream\n\nSample Output 1\n\nYES\n\nAppend erase and dream at the end of T in this order, to obtain S = T.\n\nSample Input 2\n\ndreameraser\n\nSample Output 2\n\nYES\n\nAppend dream and eraser at the end of T in this order, to obtain S = T.\n\nSample Input 3\n\ndreamerer\n\nSample Output 3\n\nNO", "sample_input": "erasedream\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03856", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nAnother string T is initially empty.\nDetermine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:\n\nAppend one of the following at the end of T: dream, dreamer, erase and eraser.\n\nConstraints\n\n1≦|S|≦10^5\n\nS consists of lowercase English letters.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf it is possible to obtain S = T, print YES. Otherwise, print NO.\n\nSample Input 1\n\nerasedream\n\nSample Output 1\n\nYES\n\nAppend erase and dream at the end of T in this order, to obtain S = T.\n\nSample Input 2\n\ndreameraser\n\nSample Output 2\n\nYES\n\nAppend dream and eraser at the end of T in this order, to obtain S = T.\n\nSample Input 3\n\ndreamerer\n\nSample Output 3\n\nNO", "split": "test_out_of_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1349, "cpu_time_ms": 742, "memory_kb": 330448}, "variant": "high_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Java:s995294438", "group_id": "codeNet:p03856", "input_text": "import java.util.Scanner;\n\npublic class Main {\n\n static String []PARTS = {\"dream\",\"dreamer\",\"erase\",\"eraser\"};\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String input = sc.next();\n if(check(input)){\n System.out.println(\"YES\");\n }\n else{\n System.out.println(\"NO\");\n }\n sc.close();\n\n }\n\n private static boolean check(String s){\n boolean flag = true;\n if(s.equals(\"\")) return flag;\n for(int i=0;i strList = scanList(sc,strNum);\n\n\n System.out.println(execute(strNum,strLen,strList));\n\n }\n\n public static String execute(int strNum, int strLen, List strList) {\n strList.sort(Comparator.naturalOrder());\n StringBuffer buf = new StringBuffer();\n for(String str : strList){\n buf.append(str);\n }\n\n return buf.toString();\n }\n\n public static List scanList(Scanner sc,int num){\n List scanList = new ArrayList<>();\n for(int i = 0; i <= num ; i++){\n scanList.add(sc.nextLine());\n }\n return scanList;\n }\n}\n", "language": "Java", "metadata": {"date": 1576527622, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p04044.html", "problem_id": "p04044", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p04044/input.txt", "sample_output_relpath": "derived/input_output/data/p04044/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04044/Java/s480734943.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s480734943", "user_id": "u735985045"}, "prompt_components": {"gold_output": "axxcxxdxx\n", "input_to_evaluate": "\nimport java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n int strNum = sc.nextInt();\n int strLen = sc.nextInt();\n List strList = scanList(sc,strNum);\n\n\n System.out.println(execute(strNum,strLen,strList));\n\n }\n\n public static String execute(int strNum, int strLen, List strList) {\n strList.sort(Comparator.naturalOrder());\n StringBuffer buf = new StringBuffer();\n for(String str : strList){\n buf.append(str);\n }\n\n return buf.toString();\n }\n\n public static List scanList(Scanner sc,int num){\n List scanList = new ArrayList<>();\n for(int i = 0; i <= num ; i++){\n scanList.add(sc.nextLine());\n }\n return scanList;\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nIroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L.\n\nShe will concatenate all of the strings in some order, to produce a long string.\n\nAmong all strings that she can produce in this way, find the lexicographically smallest one.\n\nHere, a string s=s_1s_2s_3...s_n is lexicographically smaller than another string t=t_1t_2t_3...t_m if and only if one of the following holds:\n\nThere exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j s = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n s.add(stdin.next());\n }\n \n String ans = s.stream().sorted().collect(Collectors.joining());\n System.out.println(ans);\n }\n\n}\n", "language": "Java", "metadata": {"date": 1558563748, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p04044.html", "problem_id": "p04044", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p04044/input.txt", "sample_output_relpath": "derived/input_output/data/p04044/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04044/Java/s932144847.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s932144847", "user_id": "u794250528"}, "prompt_components": {"gold_output": "axxcxxdxx\n", "input_to_evaluate": "import java.util.ArrayList;\nimport java.util.List;\nimport java.util.Scanner;\nimport java.util.stream.Collectors;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner stdin = new Scanner(System.in);\n int n = stdin.nextInt();\n int l = stdin.nextInt();\n List s = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n s.add(stdin.next());\n }\n \n String ans = s.stream().sorted().collect(Collectors.joining());\n System.out.println(ans);\n }\n\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nIroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L.\n\nShe will concatenate all of the strings in some order, to produce a long string.\n\nAmong all strings that she can produce in this way, find the lexicographically smallest one.\n\nHere, a string s=s_1s_2s_3...s_n is lexicographically smaller than another string t=t_1t_2t_3...t_m if and only if one of the following holds:\n\nThere exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j strs = new ArrayList<>();\n for (int i = 0; i < N; i ++) {\n strs.add(scanner.nextLine());\n }\n\n Collections.sort(strs);\n\n System.out.println(String.join(\"\", strs));\n }\n\n private int[] splitInt(String s) {\n String[] split = s.split(\" \");\n int[] splitInt = new int[split.length];\n for (int i = 0; i < split.length; i ++) {\n splitInt[i] = Integer.parseInt(split[i]);\n }\n return splitInt;\n }\n}\n", "language": "Java", "metadata": {"date": 1509118192, "filename_ext": "java", "original_language": "Java8 (OpenJDK 1.8.0)", "problem_description_relpath": "problem_descriptions/p04044.html", "problem_id": "p04044", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p04044/input.txt", "sample_output_relpath": "derived/input_output/data/p04044/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04044/Java/s297265129.java", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s297265129", "user_id": "u783939477"}, "prompt_components": {"gold_output": "axxcxxdxx\n", "input_to_evaluate": "import java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n new Solver().solve(new Scanner(System.in));\n// new Solver().solve(new Scanner(ex));\n }\n\n private static final String ex = \"3 3\\n\" +\n \"dxx\\n\" +\n \"axx\\n\" +\n \"cxx\";\n}\n\nclass Solver {\n Solver() {}\n\n void solve(Scanner scanner) {\n int[] split = splitInt(scanner.nextLine());\n int N = split[0];\n int L = split[1];\n\n List strs = new ArrayList<>();\n for (int i = 0; i < N; i ++) {\n strs.add(scanner.nextLine());\n }\n\n Collections.sort(strs);\n\n System.out.println(String.join(\"\", strs));\n }\n\n private int[] splitInt(String s) {\n String[] split = s.split(\" \");\n int[] splitInt = new int[split.length];\n for (int i = 0; i < split.length; i ++) {\n splitInt[i] = Integer.parseInt(split[i]);\n }\n return splitInt;\n }\n}\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nIroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L.\n\nShe will concatenate all of the strings in some order, to produce a long string.\n\nAmong all strings that she can produce in this way, find the lexicographically smallest one.\n\nHere, a string s=s_1s_2s_3...s_n is lexicographically smaller than another string t=t_1t_2t_3...t_m if and only if one of the following holds:\n\nThere exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j() {\n @Override\n public int compare(String o1, String o2) {\n return o1.compareTo(o2);\n }\n });\n for(int i=0; i() {\n @Override\n public int compare(String o1, String o2) {\n return o1.compareTo(o2);\n }\n });\n for(int i=0; i