diff --git "a/languages/javascript/test_out_of_distribution.jsonl" "b/languages/javascript/test_out_of_distribution.jsonl" new file mode 100644--- /dev/null +++ "b/languages/javascript/test_out_of_distribution.jsonl" @@ -0,0 +1,1000 @@ +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s126477121", "group_id": "codeNet:p02262", "input_text": "(function(input) {\n var p = input.split('\\n');\n var n = p.shift();\n var a = p.slice(0, n);\n var count = 0;\n var g = [];\n for (var i = 0;; i++) {\n var m = Math.pow(2, i);\n if (m > a.length) {\n break;\n }\n g.unshift(m);\n }\n sortShell(a, g);\n console.log(g.length);\n console.log(g.join(' '));\n console.log(count);\n console.log(a.join('\\n'));\n\n function sortShell(a, g) {\n for (var i = 0; i < g.length; i++) {\n sortInsertion(a, g[i]);\n }\n\n function sortInsertion(a, g) {\n //console.log(a.join(' '));\n for (var i = g; i < a.length; i += g) {\n var v = a[i];\n var j = i - g;\n while (j >= 0 && a[j] > v) {\n a[j + g] = a[j];\n j -= g;\n count++;\n }\n a[j + g] = v;\n //console.log(a.join(' '));\n }\n }\n }\n\n})(require('fs').readFileSync('/dev/stdin', 'utf8'));", "language": "JavaScript", "metadata": {"date": 1428217126, "filename_ext": "js", "original_language": "JavaScript", "problem_description_relpath": "problem_descriptions/p02262.html", "problem_id": "p02262", "resource_group": "medium_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/JavaScript/s126477121.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s126477121", "user_id": "u759826653"}, "prompt_components": {"gold_output": "2\n4 1\n3\n1\n2\n3\n4\n5\n", "input_to_evaluate": "(function(input) {\n var p = input.split('\\n');\n var n = p.shift();\n var a = p.slice(0, n);\n var count = 0;\n var g = [];\n for (var i = 0;; i++) {\n var m = Math.pow(2, i);\n if (m > a.length) {\n break;\n }\n g.unshift(m);\n }\n sortShell(a, g);\n console.log(g.length);\n console.log(g.join(' '));\n console.log(count);\n console.log(a.join('\\n'));\n\n function sortShell(a, g) {\n for (var i = 0; i < g.length; i++) {\n sortInsertion(a, g[i]);\n }\n\n function sortInsertion(a, g) {\n //console.log(a.join(' '));\n for (var i = g; i < a.length; i += g) {\n var v = a[i];\n var j = i - g;\n while (j >= 0 && a[j] > v) {\n a[j + g] = a[j];\n j -= g;\n count++;\n }\n a[j + g] = v;\n //console.log(a.join(' '));\n }\n }\n }\n\n})(require('fs').readFileSync('/dev/stdin', 'utf8'));", "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": 1044, "cpu_time_ms": 20, "memory_kb": 7908}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s482522062", "group_id": "codeNet:p02262", "input_text": "(function(input) {\n var p = input.split('\\n').map(Number);\n var n = p.shift();\n var a = p.slice(0, n);\n var count = 0;\n var g = [];\n for (var i = 0;; i++) {\n var m = Math.pow(4, i);\n if (m > a.length) {\n break;\n }\n g.unshift(m);\n }\n sortShell(a, g);\n console.log(g.length);\n console.log(g.join(' '));\n console.log(count);\n console.log(a.join('\\n'));\n\n function sortShell(a, g) {\n for (var i = 0; i < g.length; i++) {\n sortInsertion(a, g[i]);\n }\n\n function sortInsertion(a, g) {\n //console.log(a.join(' '));\n for (var i = g; i < a.length; i++) {\n var v = a[i];\n var j = i - g;\n while (j >= 0 && a[j] > v) {\n a[j + g] = a[j];\n j -= g;\n count++;\n }\n a[j + g] = v;\n //console.log(a.join(' '));\n }\n }\n }\n\n})(require('fs').readFileSync('/dev/stdin', 'utf8'));", "language": "JavaScript", "metadata": {"date": 1428217784, "filename_ext": "js", "original_language": "JavaScript", "problem_description_relpath": "problem_descriptions/p02262.html", "problem_id": "p02262", "resource_group": "medium_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/JavaScript/s482522062.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s482522062", "user_id": "u759826653"}, "prompt_components": {"gold_output": "2\n4 1\n3\n1\n2\n3\n4\n5\n", "input_to_evaluate": "(function(input) {\n var p = input.split('\\n').map(Number);\n var n = p.shift();\n var a = p.slice(0, n);\n var count = 0;\n var g = [];\n for (var i = 0;; i++) {\n var m = Math.pow(4, i);\n if (m > a.length) {\n break;\n }\n g.unshift(m);\n }\n sortShell(a, g);\n console.log(g.length);\n console.log(g.join(' '));\n console.log(count);\n console.log(a.join('\\n'));\n\n function sortShell(a, g) {\n for (var i = 0; i < g.length; i++) {\n sortInsertion(a, g[i]);\n }\n\n function sortInsertion(a, g) {\n //console.log(a.join(' '));\n for (var i = g; i < a.length; i++) {\n var v = a[i];\n var j = i - g;\n while (j >= 0 && a[j] > v) {\n a[j + g] = a[j];\n j -= g;\n count++;\n }\n a[j + g] = v;\n //console.log(a.join(' '));\n }\n }\n }\n\n})(require('fs').readFileSync('/dev/stdin', 'utf8'));", "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": 1053, "cpu_time_ms": 3090, "memory_kb": 135048}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s329144876", "group_id": "codeNet:p02262", "input_text": "var input = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\\n').map(Number);\nvar n = input.shift();\nvar m = 0;\nvar g = [1];\nvar count = 0;\n\nfunction insertionSort(array, n, g) {\n for (var i = g; i < array.length; i++) {\n var v = array[i];\n var j = i - g;\n while (j >= 0 && array[j] > v) {\n var tmp = array[j + g];\n array[j + g] = array[j];\n array[j] = tmp;\n j -= g;\n count++;\n }\n }\n}\n\nfunction shellSort(array, n) {\n m = Math.floor(array.length / 3);\n for (var i = 1; i < m; i++) {\n g[i] = g[i - 1] * 3 + 1;\n }\n g = g.filter(function(j) {\n return (j < n);\n });\n m = g.length;\n g.reverse();\n\n for (var i = 0; i < m; i++) {\n insertionSort(array, n, g[i]);\n }\n\n return array;\n}\n\nvar sorted = shellSort(input, n);\nconsole.log(m);\nconsole.log(g.join(' '));\nconsole.log(count);\nconsole.log(sorted.join('\\n'));", "language": "JavaScript", "metadata": {"date": 1481228178, "filename_ext": "js", "original_language": "JavaScript", "problem_description_relpath": "problem_descriptions/p02262.html", "problem_id": "p02262", "resource_group": "medium_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/JavaScript/s329144876.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s329144876", "user_id": "u899293860"}, "prompt_components": {"gold_output": "2\n4 1\n3\n1\n2\n3\n4\n5\n", "input_to_evaluate": "var input = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\\n').map(Number);\nvar n = input.shift();\nvar m = 0;\nvar g = [1];\nvar count = 0;\n\nfunction insertionSort(array, n, g) {\n for (var i = g; i < array.length; i++) {\n var v = array[i];\n var j = i - g;\n while (j >= 0 && array[j] > v) {\n var tmp = array[j + g];\n array[j + g] = array[j];\n array[j] = tmp;\n j -= g;\n count++;\n }\n }\n}\n\nfunction shellSort(array, n) {\n m = Math.floor(array.length / 3);\n for (var i = 1; i < m; i++) {\n g[i] = g[i - 1] * 3 + 1;\n }\n g = g.filter(function(j) {\n return (j < n);\n });\n m = g.length;\n g.reverse();\n\n for (var i = 0; i < m; i++) {\n insertionSort(array, n, g[i]);\n }\n\n return array;\n}\n\nvar sorted = shellSort(input, n);\nconsole.log(m);\nconsole.log(g.join(' '));\nconsole.log(count);\nconsole.log(sorted.join('\\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": 877, "cpu_time_ms": 50, "memory_kb": 15536}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s379411927", "group_id": "codeNet:p02262", "input_text": "var cnt;\n\nfunction insertionSort(A, n, g) {\n\tfor (var i = g; i < n; i++) {\n\t\tvar v = A[i];\n\t\tvar j = i - g;\n\t\twhile (j >=0 && A[j] > v) {\n\t\t\tA[j + g] = A[j];\n\t\t\tj = j - g;\n\t\t\tcnt ++;\n\t\t}\n\t\tA[j + g] = v;\n\t}\n}\n\nfunction shellSort(A, n) {\n\tcnt = 0;\n\n\tvar G = [];\n\tfor (var i = 0; i * 3 + 1 <= n; i++) {\n\t\tG.push(i * 3 + 1);\n\t}\n\tG.reverse();\n\tvar m = G.length;\n\n\tfor (var i = 0; i < m; i++) {\n\t\tinsertionSort(A, n, G[i]);\n\t}\n\n\tconsole.log(m);\n\tconsole.log(G.join(' '));\n\tconsole.log(cnt);\n\tfor (var i = 0; i < n; i++) {\n\t\tconsole.log(A[i]);\n\t}\n}\n\nvar input = require('fs').readFileSync('/dev/stdin', 'utf8');\nvar lines = input.split('\\n');\nvar n = lines.shift();\n\nshellSort(lines, n);", "language": "JavaScript", "metadata": {"date": 1399008313, "filename_ext": "js", "original_language": "JavaScript", "problem_description_relpath": "problem_descriptions/p02262.html", "problem_id": "p02262", "resource_group": "medium_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/JavaScript/s379411927.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s379411927", "user_id": "u845053458"}, "prompt_components": {"gold_output": "2\n4 1\n3\n1\n2\n3\n4\n5\n", "input_to_evaluate": "var cnt;\n\nfunction insertionSort(A, n, g) {\n\tfor (var i = g; i < n; i++) {\n\t\tvar v = A[i];\n\t\tvar j = i - g;\n\t\twhile (j >=0 && A[j] > v) {\n\t\t\tA[j + g] = A[j];\n\t\t\tj = j - g;\n\t\t\tcnt ++;\n\t\t}\n\t\tA[j + g] = v;\n\t}\n}\n\nfunction shellSort(A, n) {\n\tcnt = 0;\n\n\tvar G = [];\n\tfor (var i = 0; i * 3 + 1 <= n; i++) {\n\t\tG.push(i * 3 + 1);\n\t}\n\tG.reverse();\n\tvar m = G.length;\n\n\tfor (var i = 0; i < m; i++) {\n\t\tinsertionSort(A, n, G[i]);\n\t}\n\n\tconsole.log(m);\n\tconsole.log(G.join(' '));\n\tconsole.log(cnt);\n\tfor (var i = 0; i < n; i++) {\n\t\tconsole.log(A[i]);\n\t}\n}\n\nvar input = require('fs').readFileSync('/dev/stdin', 'utf8');\nvar lines = input.split('\\n');\nvar n = lines.shift();\n\nshellSort(lines, 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": 680, "cpu_time_ms": 20, "memory_kb": 7640}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s461538288", "group_id": "codeNet:p02269", "input_text": "'use strict';\n\nwaterfall([\n function(next) {\n lineReader(1, next);\n }, function(line, next) {\n lineReader(parseInt(line[0]), next);\n }, function(lines, next) {\n lines.reduce(function(hash, line) {\n var command = line.split(' ')[0];\n var key = line.split(' ')[1];\n if (command === 'insert') {\n hash[key] = true;\n return hash;\n }\n if (hash[key]) {\n console.log('yes');\n } else {\n console.log('no');\n }\n return hash;\n }, {})\n next(null);\n }], function(result) {\n process.exit(0);\n });\n\nfunction strMap(str, map) {\n var newStr = '';\n for (var i = 0; i < str.length; i++) {\n newStr += map(str.charAt(i), i);\n }\n return newStr;\n}\n\nfunction lineReader(limit, cb) {\n var reader = require('readline').createInterface({\n input: process.stdin,\n output: process.stdout,\n });\n var lines = [];\n var counter = 0;\n reader.on('line', function(line) {\n lines.push(line);\n ++counter;\n if (counter === limit) {\n reader.close();\n return cb(lines);\n }\n });\n reader.on('close', function() {});\n reader.on('error', function(err) {\n cb(err);\n });\n}\n\nfunction waterfall(tasks, cb) {\n var taskIndex = 0;\n function nextTask(args) {\n if (taskIndex === tasks.length)\n return cb.apply(null, args);\n\n var taskCallback = function() {\n var _arguments = arguments;\n nextTask(Object.keys(_arguments).reduce(function(memo, key) {\n memo.push(_arguments[key]);\n return memo;\n }, []));\n };\n args.push(taskCallback);\n var task = tasks[taskIndex++];\n task.apply(null, args);\n }\n nextTask([]);\n}", "language": "JavaScript", "metadata": {"date": 1464506196, "filename_ext": "js", "original_language": "JavaScript", "problem_description_relpath": "problem_descriptions/p02269.html", "problem_id": "p02269", "resource_group": "medium_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/JavaScript/s461538288.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s461538288", "user_id": "u027872723"}, "prompt_components": {"gold_output": "no\nyes\n", "input_to_evaluate": "'use strict';\n\nwaterfall([\n function(next) {\n lineReader(1, next);\n }, function(line, next) {\n lineReader(parseInt(line[0]), next);\n }, function(lines, next) {\n lines.reduce(function(hash, line) {\n var command = line.split(' ')[0];\n var key = line.split(' ')[1];\n if (command === 'insert') {\n hash[key] = true;\n return hash;\n }\n if (hash[key]) {\n console.log('yes');\n } else {\n console.log('no');\n }\n return hash;\n }, {})\n next(null);\n }], function(result) {\n process.exit(0);\n });\n\nfunction strMap(str, map) {\n var newStr = '';\n for (var i = 0; i < str.length; i++) {\n newStr += map(str.charAt(i), i);\n }\n return newStr;\n}\n\nfunction lineReader(limit, cb) {\n var reader = require('readline').createInterface({\n input: process.stdin,\n output: process.stdout,\n });\n var lines = [];\n var counter = 0;\n reader.on('line', function(line) {\n lines.push(line);\n ++counter;\n if (counter === limit) {\n reader.close();\n return cb(lines);\n }\n });\n reader.on('close', function() {});\n reader.on('error', function(err) {\n cb(err);\n });\n}\n\nfunction waterfall(tasks, cb) {\n var taskIndex = 0;\n function nextTask(args) {\n if (taskIndex === tasks.length)\n return cb.apply(null, args);\n\n var taskCallback = function() {\n var _arguments = arguments;\n nextTask(Object.keys(_arguments).reduce(function(memo, key) {\n memo.push(_arguments[key]);\n return memo;\n }, []));\n };\n args.push(taskCallback);\n var task = tasks[taskIndex++];\n task.apply(null, args);\n }\n nextTask([]);\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": 1646, "cpu_time_ms": 60, "memory_kb": 15684}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s761208335", "group_id": "codeNet:p02269", "input_text": "'use strict';\n\nvar input = require('fs').readFileSync('/dev/stdin', 'utf8');\nvar lines = (input.trim()).split('\\n');\nlines.shift();\nvar hash = {};\n\nlines.forEach(function(line) {\n var cmd = line.split(' ')[0];\n var key = line.split(' ')[1];\n if (cmd === 'insert') {\n hash[key] = true;\n return;\n }\n if (hash[key]) {\n console.log('yes');\n } else {\n console.log('no');\n }\n});", "language": "JavaScript", "metadata": {"date": 1464509811, "filename_ext": "js", "original_language": "JavaScript", "problem_description_relpath": "problem_descriptions/p02269.html", "problem_id": "p02269", "resource_group": "medium_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/JavaScript/s761208335.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s761208335", "user_id": "u027872723"}, "prompt_components": {"gold_output": "no\nyes\n", "input_to_evaluate": "'use strict';\n\nvar input = require('fs').readFileSync('/dev/stdin', 'utf8');\nvar lines = (input.trim()).split('\\n');\nlines.shift();\nvar hash = {};\n\nlines.forEach(function(line) {\n var cmd = line.split(' ')[0];\n var key = line.split(' ')[1];\n if (cmd === 'insert') {\n hash[key] = true;\n return;\n }\n if (hash[key]) {\n console.log('yes');\n } else {\n console.log('no');\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": 391, "cpu_time_ms": 5400, "memory_kb": 156300}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s218957445", "group_id": "codeNet:p02269", "input_text": "process.stdin.resume();\nprocess.stdin.setEncoding('utf8');\n \nprocess.stdin.on('data', function (chunk) {\n var xs = chunk.toString().trim().split('\\n').slice(1).map(function(x){ return x.split(' '); });\n var ys = {};\n xs.forEach(function(x){\n if(x[0] === 'insert'){\n ys[x[1]] = true;\n }else if(x[0] === 'find'){\n console.log(ys.hasOwnProperty(x[1]) ? 'yes' : 'no');\n }\n });\n});\n", "language": "JavaScript", "metadata": {"date": 1517054156, "filename_ext": "js", "original_language": "JavaScript", "problem_description_relpath": "problem_descriptions/p02269.html", "problem_id": "p02269", "resource_group": "medium_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/JavaScript/s218957445.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s218957445", "user_id": "u912124184"}, "prompt_components": {"gold_output": "no\nyes\n", "input_to_evaluate": "process.stdin.resume();\nprocess.stdin.setEncoding('utf8');\n \nprocess.stdin.on('data', function (chunk) {\n var xs = chunk.toString().trim().split('\\n').slice(1).map(function(x){ return x.split(' '); });\n var ys = {};\n xs.forEach(function(x){\n if(x[0] === 'insert'){\n ys[x[1]] = true;\n }else if(x[0] === 'find'){\n console.log(ys.hasOwnProperty(x[1]) ? 'yes' : 'no');\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": 432, "cpu_time_ms": 100, "memory_kb": 21308}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s426241448", "group_id": "codeNet:p02269", "input_text": "class ACGTHashList {\n static get MAP() {\n return {\n 'A': 1,\n 'C': 2,\n 'G': 3,\n 'T': 4,\n }\n }\n\n constructor(M) {\n this.M = M;\n this.H = [];\n for (let i = 0; i < M; i++) this.H[i] = '';\n }\n\n static _getKey(str) {\n let sum = 0;\n let p = 1;\n for (let i = 0, p = 1; i < str.length; i++, p *= 5) sum += p * ACGTHashList.MAP[str[i]];\n return sum;\n }\n\n _h1(key) { return key % this.M;}\n\n _h2(key) { return 1 + key % (this.M - 1);}\n\n find(str) {\n let key = ACGTHashList._getKey(str);\n let h;\n const h1 = this._h1(key), h2 = this._h2(key);\n for (let i = 0;; i++) {\n h = (h1 + i * h2) % this.M;\n if (this.H[h] === str) return 1;\n else if (this.H[h] === '') return 0;\n }\n return 0;\n }\n\n insert(str) {\n let key = ACGTHashList._getKey(str);\n let h;\n const h1 = this._h1(key), h2 = this._h2(key);\n for (let i = 0;; i++) {\n h = (h1 + i * h2) % this.M;\n if (this.H[h] === str) return 1;\n else if (this.H[h] === '') {\n this.H[h] = str;\n return 0;\n }\n }\n return 0;\n }\n\n}\n\n(function main(){\n const lines = require('fs').readFileSync('/dev/stdin', 'utf8');\n var Arr=(lines.trim()).split(\"\\n\").slice(1);\n console.log(Arr);\n const commands = Arr.map(l => l.split(' '));\n\n let hl = new ACGTHashList(1046527);\n commands.forEach(cmd => {\n if (cmd[0][0] === 'i') {\n hl.insert(cmd[1]);\n } else {\n console.log(hl.find(cmd[1]) ? 'yes' : 'no');\n }\n });\n})();\n\n", "language": "JavaScript", "metadata": {"date": 1530128657, "filename_ext": "js", "original_language": "JavaScript", "problem_description_relpath": "problem_descriptions/p02269.html", "problem_id": "p02269", "resource_group": "medium_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/JavaScript/s426241448.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s426241448", "user_id": "u298224238"}, "prompt_components": {"gold_output": "no\nyes\n", "input_to_evaluate": "class ACGTHashList {\n static get MAP() {\n return {\n 'A': 1,\n 'C': 2,\n 'G': 3,\n 'T': 4,\n }\n }\n\n constructor(M) {\n this.M = M;\n this.H = [];\n for (let i = 0; i < M; i++) this.H[i] = '';\n }\n\n static _getKey(str) {\n let sum = 0;\n let p = 1;\n for (let i = 0, p = 1; i < str.length; i++, p *= 5) sum += p * ACGTHashList.MAP[str[i]];\n return sum;\n }\n\n _h1(key) { return key % this.M;}\n\n _h2(key) { return 1 + key % (this.M - 1);}\n\n find(str) {\n let key = ACGTHashList._getKey(str);\n let h;\n const h1 = this._h1(key), h2 = this._h2(key);\n for (let i = 0;; i++) {\n h = (h1 + i * h2) % this.M;\n if (this.H[h] === str) return 1;\n else if (this.H[h] === '') return 0;\n }\n return 0;\n }\n\n insert(str) {\n let key = ACGTHashList._getKey(str);\n let h;\n const h1 = this._h1(key), h2 = this._h2(key);\n for (let i = 0;; i++) {\n h = (h1 + i * h2) % this.M;\n if (this.H[h] === str) return 1;\n else if (this.H[h] === '') {\n this.H[h] = str;\n return 0;\n }\n }\n return 0;\n }\n\n}\n\n(function main(){\n const lines = require('fs').readFileSync('/dev/stdin', 'utf8');\n var Arr=(lines.trim()).split(\"\\n\").slice(1);\n console.log(Arr);\n const commands = Arr.map(l => l.split(' '));\n\n let hl = new ACGTHashList(1046527);\n commands.forEach(cmd => {\n if (cmd[0][0] === 'i') {\n hl.insert(cmd[1]);\n } else {\n console.log(hl.find(cmd[1]) ? 'yes' : 'no');\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": 1466, "cpu_time_ms": 100, "memory_kb": 44076}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s120702758", "group_id": "codeNet:p02269", "input_text": "var input = require('fs').readFileSync('/dev/stdin', 'utf8');\nvar lines = input.split('\\n');\n\nlines.shift();\n\nvar dic = {};\nlines.forEach(function (line) {\n\tvar command = line.split(' ');\n\tif (command[0] == 'insert')\n\t\tdic[command[1]] = true;\n\telse {\n\t\tif (dic[command[1]]) {\n\t\t\tconsole.log('yes');\n\t\t} else {\n\t\t\tconsole.log('no');\n\t\t}\n\t}\n});", "language": "JavaScript", "metadata": {"date": 1399040750, "filename_ext": "js", "original_language": "JavaScript", "problem_description_relpath": "problem_descriptions/p02269.html", "problem_id": "p02269", "resource_group": "medium_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/JavaScript/s120702758.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s120702758", "user_id": "u845053458"}, "prompt_components": {"gold_output": "no\nyes\n", "input_to_evaluate": "var input = require('fs').readFileSync('/dev/stdin', 'utf8');\nvar lines = input.split('\\n');\n\nlines.shift();\n\nvar dic = {};\nlines.forEach(function (line) {\n\tvar command = line.split(' ');\n\tif (command[0] == 'insert')\n\t\tdic[command[1]] = true;\n\telse {\n\t\tif (dic[command[1]]) {\n\t\t\tconsole.log('yes');\n\t\t} else {\n\t\t\tconsole.log('no');\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": 342, "cpu_time_ms": 20, "memory_kb": 7640}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s375394460", "group_id": "codeNet:p02269", "input_text": "process.stdin.resume()\nprocess.stdin.setEncoding(\"utf8\")\n\nconst reader = require(\"readline\").createInterface({\n input: process.stdin,\n output: process.stdout,\n})\n\nconst lines = []\n\nreader.on(\"line\", (line) => {\n lines.push(line)\n})\n\nreader.on(\"close\", () => {\n const n = lines[0] - 0\n const hm = new HM()\n for (let i = 1; i <= n; i++) {\n const [method, arg] = lines[i].split(\" \")\n if (method === \"insert\") {\n hm.insert(arg)\n } else if (method === \"find\") {\n console.log(hm.find(arg) ? \"yes\" : \"no\")\n }\n }\n})\n\nconst m = 1000003\n\nconst strToNumber = (str) => {\n let numWeight = 1\n let numWeightPerDigit = 4\n let ret = 0\n str\n .split(\"\")\n .reverse()\n .forEach((c) => {\n let num = 0\n switch (c) {\n case \"A\":\n num = 1\n break\n case \"C\":\n num = 2\n break\n case \"G\":\n num = 3\n break\n case \"T\":\n num = 4\n break\n }\n ret += num * numWeight\n numWeight *= numWeightPerDigit\n }, 0)\n\n return ret\n}\n\nfunction h1(key) {\n return key % m\n}\n\nfunction h2(key) {\n return 1 + (key % (m - 1))\n}\n\nfunction h(key, i) {\n return (h1(key) + i * h2(key)) % m\n}\n\nclass HM {\n constructor() {\n this.T = Array(m)\n }\n\n insert(str) {\n let i = 0,\n j\n const key = strToNumber(str)\n const T = this.T\n while (true) {\n j = h(key, i)\n if (T[j] == null) {\n T[j] = key\n return j\n } else {\n i++\n }\n }\n }\n\n find(str) {\n let i = 0,\n j\n const key = strToNumber(str)\n const T = this.T\n while (true) {\n j = h(key, i)\n if (T[j] === key) {\n return true\n } else if (T[j] == null || i >= m) {\n return false\n } else {\n i++\n }\n }\n }\n}\n\n", "language": "JavaScript", "metadata": {"date": 1596956060, "filename_ext": "js", "original_language": "JavaScript", "problem_description_relpath": "problem_descriptions/p02269.html", "problem_id": "p02269", "resource_group": "medium_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/JavaScript/s375394460.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s375394460", "user_id": "u866361728"}, "prompt_components": {"gold_output": "no\nyes\n", "input_to_evaluate": "process.stdin.resume()\nprocess.stdin.setEncoding(\"utf8\")\n\nconst reader = require(\"readline\").createInterface({\n input: process.stdin,\n output: process.stdout,\n})\n\nconst lines = []\n\nreader.on(\"line\", (line) => {\n lines.push(line)\n})\n\nreader.on(\"close\", () => {\n const n = lines[0] - 0\n const hm = new HM()\n for (let i = 1; i <= n; i++) {\n const [method, arg] = lines[i].split(\" \")\n if (method === \"insert\") {\n hm.insert(arg)\n } else if (method === \"find\") {\n console.log(hm.find(arg) ? \"yes\" : \"no\")\n }\n }\n})\n\nconst m = 1000003\n\nconst strToNumber = (str) => {\n let numWeight = 1\n let numWeightPerDigit = 4\n let ret = 0\n str\n .split(\"\")\n .reverse()\n .forEach((c) => {\n let num = 0\n switch (c) {\n case \"A\":\n num = 1\n break\n case \"C\":\n num = 2\n break\n case \"G\":\n num = 3\n break\n case \"T\":\n num = 4\n break\n }\n ret += num * numWeight\n numWeight *= numWeightPerDigit\n }, 0)\n\n return ret\n}\n\nfunction h1(key) {\n return key % m\n}\n\nfunction h2(key) {\n return 1 + (key % (m - 1))\n}\n\nfunction h(key, i) {\n return (h1(key) + i * h2(key)) % m\n}\n\nclass HM {\n constructor() {\n this.T = Array(m)\n }\n\n insert(str) {\n let i = 0,\n j\n const key = strToNumber(str)\n const T = this.T\n while (true) {\n j = h(key, i)\n if (T[j] == null) {\n T[j] = key\n return j\n } else {\n i++\n }\n }\n }\n\n find(str) {\n let i = 0,\n j\n const key = strToNumber(str)\n const T = this.T\n while (true) {\n j = h(key, i)\n if (T[j] === key) {\n return true\n } else if (T[j] == null || i >= m) {\n return false\n } else {\n i++\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": 1789, "cpu_time_ms": 6960, "memory_kb": 200976}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s300393770", "group_id": "codeNet:p02269", "input_text": "class dictionary{\n constructor(m){\n this.S = new Array(m);\n this.m = m;\n }\n \n h1(key){\n return key % this.m;\n }\n h2(key){\n return 1 + key % (this.m-1);\n }\n h(key,i){\n return (this.h1(key)+i*this.h2(key)) % this.m;\n }\n insert(key){\n let i = 0;\n while(true){\n let j = this.h(key,i);\n if(typeof this.S[j]===\"undefined\"){\n this.S[j] = key;\n return j;\n }else{\n i++;\n }\n }\n }\n search(key){\n let i = 0;\n while(true){\n let j = this.h(key,i);\n if(this.S[j]===key){\n return j;\n }else if(i>=this.m || typeof this.S[j]===\"undefined\"){\n return false;\n }else{\n i++;\n }\n }\n }\n}\n\nfunction main(input){\n let lines = input.trim().split(\"\\n\");\n let length = parseInt(lines.shift());\n let dict = new dictionary(length);\n\n for(let i =0;i=this.m || typeof this.S[j]===\"undefined\"){\n return false;\n }else{\n i++;\n }\n }\n }\n}\n\nfunction main(input){\n let lines = input.trim().split(\"\\n\");\n let length = parseInt(lines.shift());\n let dict = new dictionary(length);\n\n for(let i =0;i {\n let input = '';\n for await (const chunk of process.stdin) input += chunk;\n let values = input.split(/\\s/).map(v => +v);\n \n const length = values.shift();\n values = values.slice(0, length);\n\n let sum = 0;\n let tmp = 0;\n for (let i = length - 2; i >= 0; i--) {\n tmp += values[i + 1];\n sum = (sum + values[i] * tmp) % (1e9 + 7);\n }\n\n console.log(sum % (1e9 + 7));\n\n})();\n", "language": "JavaScript", "metadata": {"date": 1599658360, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02572.html", "problem_id": "p02572", "resource_group": "medium_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/JavaScript/s710419083.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s710419083", "user_id": "u304747714"}, "prompt_components": {"gold_output": "11\n", "input_to_evaluate": "(async () => {\n let input = '';\n for await (const chunk of process.stdin) input += chunk;\n let values = input.split(/\\s/).map(v => +v);\n \n const length = values.shift();\n values = values.slice(0, length);\n\n let sum = 0;\n let tmp = 0;\n for (let i = length - 2; i >= 0; i--) {\n tmp += values[i + 1];\n sum = (sum + values[i] * tmp) % (1e9 + 7);\n }\n\n console.log(sum % (1e9 + 7));\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": 431, "cpu_time_ms": 246, "memory_kb": 53412}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s972948484", "group_id": "codeNet:p02572", "input_text": "function Main(input) {\n input = input.split(\"\\n\");\n const N = parseInt(input[0], 10);\n const A = input[1].split(\" \").map(n => parseInt(n, 10));\n\n var count = 0;\n var sum = 0;\n\n A.forEach(function(a) {\n sum += a;\n });\n\n for(var i = 0; i < (N-1); i++){\n sum-=A[i]\n count+=A[i]*sum\n count = count%1000000007\n }\n \n console.log(count);\n \n}\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "language": "JavaScript", "metadata": {"date": 1598794351, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02572.html", "problem_id": "p02572", "resource_group": "medium_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/JavaScript/s972948484.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s972948484", "user_id": "u759847764"}, "prompt_components": {"gold_output": "11\n", "input_to_evaluate": "function Main(input) {\n input = input.split(\"\\n\");\n const N = parseInt(input[0], 10);\n const A = input[1].split(\" \").map(n => parseInt(n, 10));\n\n var count = 0;\n var sum = 0;\n\n A.forEach(function(a) {\n sum += a;\n });\n\n for(var i = 0; i < (N-1); i++){\n sum-=A[i]\n count+=A[i]*sum\n count = count%1000000007\n }\n \n console.log(count);\n \n}\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "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": 414, "cpu_time_ms": 120, "memory_kb": 53988}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s148643336", "group_id": "codeNet:p02572", "input_text": "function main(arg) {\n \n let n = Number(arg.split(\"\\n\")[0])\n let a = arg.split(\"\\n\")[1].split(\" \").map(Number)\n\n let mod = 10**9+7\n let sum = new Array(n+1)\n sum[0] = a[0]\n for(let i=0; i {\n const arr = input.trim().split('\\n')[1].split(' ');\n const l = arr.length;\n const n = 1000000007;\n let sum = 0;\n\n for (let i = 0; i < l - 1; i++) {\n for (let j = i + 1; j < l; j++) {\n sum += arr[i] % n * arr[j] % n;\n }\n }\n\n console.log(sum % n);\n})(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "language": "JavaScript", "metadata": {"date": 1598732880, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02572.html", "problem_id": "p02572", "resource_group": "medium_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/JavaScript/s904159689.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s904159689", "user_id": "u827651214"}, "prompt_components": {"gold_output": "11\n", "input_to_evaluate": "((input) => {\n const arr = input.trim().split('\\n')[1].split(' ');\n const l = arr.length;\n const n = 1000000007;\n let sum = 0;\n\n for (let i = 0; i < l - 1; i++) {\n for (let j = i + 1; j < l; j++) {\n sum += arr[i] % n * arr[j] % n;\n }\n }\n\n console.log(sum % n);\n})(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "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": 332, "cpu_time_ms": 2208, "memory_kb": 59164}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s367727613", "group_id": "codeNet:p02572", "input_text": "function Main(input) {\n const lines = input.split('\\n');\n const N = lines[0];\n const A = lines[1].split(' ').map(i => parseInt(i));\n const D = Math.pow(10, 9) + 7;\n const notes = [];\n let sum = 0;\n A.reverse().map(a => {\n sum += a;\n sum = sum % D;\n notes.push(sum);\n });\n notes.reverse();\n A.reverse();\n console.log(A);\n console.log(notes);\n sum = 0;\n A.forEach((a, i) => {\n if (i !== N - 1) {\n console.log(a, notes[i+1]);\n sum += (a * notes[i+1]) % D;\n }\n });\n console.log(sum % D);\n}\n\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));\n", "language": "JavaScript", "metadata": {"date": 1598730723, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02572.html", "problem_id": "p02572", "resource_group": "medium_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/JavaScript/s367727613.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s367727613", "user_id": "u271315519"}, "prompt_components": {"gold_output": "11\n", "input_to_evaluate": "function Main(input) {\n const lines = input.split('\\n');\n const N = lines[0];\n const A = lines[1].split(' ').map(i => parseInt(i));\n const D = Math.pow(10, 9) + 7;\n const notes = [];\n let sum = 0;\n A.reverse().map(a => {\n sum += a;\n sum = sum % D;\n notes.push(sum);\n });\n notes.reverse();\n A.reverse();\n console.log(A);\n console.log(notes);\n sum = 0;\n A.forEach((a, i) => {\n if (i !== N - 1) {\n console.log(a, notes[i+1]);\n sum += (a * notes[i+1]) % D;\n }\n });\n console.log(sum % D);\n}\n\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));\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": 584, "cpu_time_ms": 883, "memory_kb": 95012}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s179485492", "group_id": "codeNet:p02572", "input_text": "function Main(input) {\n input = input.split(\"\\n\");\n const N = input[0];\n const A = input[1].split(\" \");\n\n var count = 0;\n\n for(var i = 0; i < (N-1); i++){\n for(var j = i+1; j < N; j++){\n count += (A[i]%1000000007)*(A[j]%1000000007)\n }\n }\n \n console.log(count%1000000007);\n \n}\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "language": "JavaScript", "metadata": {"date": 1598730372, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02572.html", "problem_id": "p02572", "resource_group": "medium_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/JavaScript/s179485492.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s179485492", "user_id": "u759847764"}, "prompt_components": {"gold_output": "11\n", "input_to_evaluate": "function Main(input) {\n input = input.split(\"\\n\");\n const N = input[0];\n const A = input[1].split(\" \");\n\n var count = 0;\n\n for(var i = 0; i < (N-1); i++){\n for(var j = i+1; j < N; j++){\n count += (A[i]%1000000007)*(A[j]%1000000007)\n }\n }\n \n console.log(count%1000000007);\n \n}\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "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": 351, "cpu_time_ms": 2207, "memory_kb": 49540}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s886253016", "group_id": "codeNet:p02572", "input_text": "function Main(input) {\n tmp = input.split(\"\\n\");\n n = parseInt(tmp[0], 10);\n a = tmp[1].split(\" \").map(Number);\n MOD = 1000000007;\n\tresult = 0;\n\n for (let i = 0; i < n; i++) {\n \n for (let j = 1; j < n; j++) {\n\t\t\tnum1 = a[i] % MOD;\n num2 = a[j] % MOD;\n\n if (i < j) { \n \t\tresult += (num1 * num2) % MOD;\n \tresult = result % MOD\n }\n } \n }\n \n console.log(result);\n\n}\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "language": "JavaScript", "metadata": {"date": 1598730277, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02572.html", "problem_id": "p02572", "resource_group": "medium_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/JavaScript/s886253016.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s886253016", "user_id": "u720379252"}, "prompt_components": {"gold_output": "11\n", "input_to_evaluate": "function Main(input) {\n tmp = input.split(\"\\n\");\n n = parseInt(tmp[0], 10);\n a = tmp[1].split(\" \").map(Number);\n MOD = 1000000007;\n\tresult = 0;\n\n for (let i = 0; i < n; i++) {\n \n for (let j = 1; j < n; j++) {\n\t\t\tnum1 = a[i] % MOD;\n num2 = a[j] % MOD;\n\n if (i < j) { \n \t\tresult += (num1 * num2) % MOD;\n \tresult = result % MOD\n }\n } \n }\n \n console.log(result);\n\n}\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "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": 549, "cpu_time_ms": 2207, "memory_kb": 51184}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s356058271", "group_id": "codeNet:p02572", "input_text": "const main = (input) => {\n input = input.trim().split('\\n')\n const mod = 10n**9n + 7n\n const arr = input[1].split(' ').map(BigInt).sort((a, b) => b - a)\n\n let sum = arr[0] + arr[1]\n let ans = arr[0] * arr[1] % mod\n\n for (let i=2; i {\n input = input.trim().split('\\n')\n const mod = 10n**9n + 7n\n const arr = input[1].split(' ').map(BigInt).sort((a, b) => b - a)\n\n let sum = arr[0] + arr[1]\n let ans = arr[0] * arr[1] % mod\n\n for (let i=2; i {\n input = input.trim().split('\\n')\n const mod = BigInt(10**9 + 7)\n const arr = input[1].split(' ').map(BigInt).sort((a, b) => a - b)\n\n let ans = 0n\n\n for (let i=0; i {\n input = input.trim().split('\\n')\n const mod = BigInt(10**9 + 7)\n const arr = input[1].split(' ').map(BigInt).sort((a, b) => a - b)\n\n let ans = 0n\n\n for (let i=0; i {\n let flg = (new Array(n)).fill(0)/* set flg[i] to true when it is seived */\n let primes = []/* list of prime numbers */\n for(let i=2; i*i<=n; i++) {\n if(!flg[i]) {\n primes.push(i)\n for(let j=i; j*j<=n; j+=i) {\n flg[j] = 1\n }\n }\n }\n return primes\n}\n\nconst factorizationBySoE = (n, primes) => {\n //const primes = SieveOfEratosthenes(n)\n let factors = {}\n primes.some(p => {\n if(n < p) return true\n while(n%p===0) {\n if(!factors[p])factors[p]=1\n else factors[p]++\n n/=p\n }\n })\n if(n>1)factors[n]=1\n return factors\n}\n\n\nconst getGCD = (a,b) => {\n if(b===0)return a\n else if(a===0)return b\n return getGCD(b, a%b)\n}\n\nconst main = (arg) => {\n const N = Number(arg.split(\"\\n\")[0])\n const a = arg.split(\"\\n\")[1].split(\" \").map(Number)\n \n const MAX_A = 10**6+100\n const A = Math.max(...a)\n \n // check if p is in {a} (paircoprime)\n //const primes = SieveOfEratosthenes(A)\n let set = [...new Array(MAX_A+100)].fill(0)\n isPairCoprime = true\n /*\n for(let i=0; i1) {\n isPairCoprime = false\n }\n }\n \n if(isPairCoprime) {\n console.log(\"pairwise coprime\")\n return\n }\n \n // setcoprime\n // let gcd = getGCD(a[0], a[1])\n let gcd = 0\n for(let i=0; i {\n let flg = (new Array(n)).fill(0)/* set flg[i] to true when it is seived */\n let primes = []/* list of prime numbers */\n for(let i=2; i*i<=n; i++) {\n if(!flg[i]) {\n primes.push(i)\n for(let j=i; j*j<=n; j+=i) {\n flg[j] = 1\n }\n }\n }\n return primes\n}\n\nconst factorizationBySoE = (n, primes) => {\n //const primes = SieveOfEratosthenes(n)\n let factors = {}\n primes.some(p => {\n if(n < p) return true\n while(n%p===0) {\n if(!factors[p])factors[p]=1\n else factors[p]++\n n/=p\n }\n })\n if(n>1)factors[n]=1\n return factors\n}\n\n\nconst getGCD = (a,b) => {\n if(b===0)return a\n else if(a===0)return b\n return getGCD(b, a%b)\n}\n\nconst main = (arg) => {\n const N = Number(arg.split(\"\\n\")[0])\n const a = arg.split(\"\\n\")[1].split(\" \").map(Number)\n \n const MAX_A = 10**6+100\n const A = Math.max(...a)\n \n // check if p is in {a} (paircoprime)\n //const primes = SieveOfEratosthenes(A)\n let set = [...new Array(MAX_A+100)].fill(0)\n isPairCoprime = true\n /*\n for(let i=0; i1) {\n isPairCoprime = false\n }\n }\n \n if(isPairCoprime) {\n console.log(\"pairwise coprime\")\n return\n }\n \n // setcoprime\n // let gcd = getGCD(a[0], a[1])\n let gcd = 0\n for(let i=0; i {\n let flg = (new Array(n)).fill(0)/* set flg[i] to true when it is seived */\n let primes = []/* list of prime numbers */\n for(let i=2; i*i<=n; i++) {\n if(!flg[i]) {\n primes.push(i)\n for(let j=i; j*j<=n; j+=i) {\n flg[j] = 1\n }\n }\n }\n return primes\n}\n\nconst factorizationBySoE = (n, primes) => {\n //const primes = SieveOfEratosthenes(n)\n let factors = {}\n primes.some(p => {\n if(n < p) return true\n while(n%p===0) {\n if(!factors[p])factors[p]=1\n else factors[p]++\n n/=p\n }\n })\n if(n>1)factors[n]=1\n return factors\n}\n\n\nconst getGCD = (a,b) => {\n if(b===0)return a\n else if(a===0)return b\n return getGCD(b, a%b)\n}\n\nconst main = (arg) => {\n const N = Number(arg.split(\"\\n\")[0])\n const a = arg.split(\"\\n\")[1].split(\" \").map(Number)\n const MAX_A = 10**6\n const A = Math.max(...a)\n \n // check if p is in {a} (paircoprime)\n const primes = SieveOfEratosthenes(A)\n let set = [...new Array(MAX_A)].fill(0)\n isPairCoprime = true\n for(let i=0; i1) {\n // isPairCoprime = false\n // }\n // }\n \n if(isPairCoprime) {\n console.log(\"pairwise coprime\")\n return\n }\n \n // setcoprime\n // let gcd = getGCD(a[0], a[1])\n let gcd = 0\n for(let i=0; i {\n let flg = (new Array(n)).fill(0)/* set flg[i] to true when it is seived */\n let primes = []/* list of prime numbers */\n for(let i=2; i*i<=n; i++) {\n if(!flg[i]) {\n primes.push(i)\n for(let j=i; j*j<=n; j+=i) {\n flg[j] = 1\n }\n }\n }\n return primes\n}\n\nconst factorizationBySoE = (n, primes) => {\n //const primes = SieveOfEratosthenes(n)\n let factors = {}\n primes.some(p => {\n if(n < p) return true\n while(n%p===0) {\n if(!factors[p])factors[p]=1\n else factors[p]++\n n/=p\n }\n })\n if(n>1)factors[n]=1\n return factors\n}\n\n\nconst getGCD = (a,b) => {\n if(b===0)return a\n else if(a===0)return b\n return getGCD(b, a%b)\n}\n\nconst main = (arg) => {\n const N = Number(arg.split(\"\\n\")[0])\n const a = arg.split(\"\\n\")[1].split(\" \").map(Number)\n const MAX_A = 10**6\n const A = Math.max(...a)\n \n // check if p is in {a} (paircoprime)\n const primes = SieveOfEratosthenes(A)\n let set = [...new Array(MAX_A)].fill(0)\n isPairCoprime = true\n for(let i=0; i1) {\n // isPairCoprime = false\n // }\n // }\n \n if(isPairCoprime) {\n console.log(\"pairwise coprime\")\n return\n }\n \n // setcoprime\n // let gcd = getGCD(a[0], a[1])\n let gcd = 0\n for(let i=0; i {\n let flg = (new Array(n)).fill(0)/* set flg[i] to true when it is seived */\n let primes = []/* list of prime numbers */\n for(let i=2; i*i<=n; i++) {\n if(!flg[i]) {\n primes.push(i)\n for(let j=i; j*j<=n; j+=i) {\n flg[j] = 1\n }\n }\n }\n return primes\n}\n\nconst factorizationBySoE = (n, primes) => {\n //const primes = SieveOfEratosthenes(n)\n let factors = {}\n primes.some(p => {\n if(n < p) return true\n while(n%p===0) {\n if(!factors[p])factors[p]=1\n else factors[p]++\n n/=p\n }\n })\n if(n>1)factors[n]=1\n return factors\n}\n\n\nconst getGCD = (a,b) => {\n if(b===0)return a\n else if(a===0)return b\n return getGCD(b, a%b)\n}\n\nconst main = (arg) => {\n const N = Number(arg.split(\"\\n\")[0])\n const a = arg.split(\"\\n\")[1].split(\" \").map(Number)\n const MAX_A = 10**6 + 5\n \n // check if p is in {a} (paircoprime)\n // const primes = SieveOfEratosthenes(MAX_A)\n let set = [...new Array(MAX_A)].fill(0)\n isPairCoprime = true\n // for(let i=0; i1) {\n isPairCoprime = false\n }\n }\n \n if(isPairCoprime) {\n console.log(\"pairwise coprime\")\n return\n }\n return\n \n // setcoprime\n // let gcd = getGCD(a[0], a[1])\n let gcd = 0\n for(let i=0; i {\n let flg = (new Array(n)).fill(0)/* set flg[i] to true when it is seived */\n let primes = []/* list of prime numbers */\n for(let i=2; i*i<=n; i++) {\n if(!flg[i]) {\n primes.push(i)\n for(let j=i; j*j<=n; j+=i) {\n flg[j] = 1\n }\n }\n }\n return primes\n}\n\nconst factorizationBySoE = (n, primes) => {\n //const primes = SieveOfEratosthenes(n)\n let factors = {}\n primes.some(p => {\n if(n < p) return true\n while(n%p===0) {\n if(!factors[p])factors[p]=1\n else factors[p]++\n n/=p\n }\n })\n if(n>1)factors[n]=1\n return factors\n}\n\n\nconst getGCD = (a,b) => {\n if(b===0)return a\n else if(a===0)return b\n return getGCD(b, a%b)\n}\n\nconst main = (arg) => {\n const N = Number(arg.split(\"\\n\")[0])\n const a = arg.split(\"\\n\")[1].split(\" \").map(Number)\n const MAX_A = 10**6 + 5\n \n // check if p is in {a} (paircoprime)\n // const primes = SieveOfEratosthenes(MAX_A)\n let set = [...new Array(MAX_A)].fill(0)\n isPairCoprime = true\n // for(let i=0; i1) {\n isPairCoprime = false\n }\n }\n \n if(isPairCoprime) {\n console.log(\"pairwise coprime\")\n return\n }\n return\n \n // setcoprime\n // let gcd = getGCD(a[0], a[1])\n let gcd = 0\n for(let i=0; i {\n let input = '';\n for await (const chunk of process.stdin) input += chunk;\n let values = input.split(/\\s/).map(v => +v);\n\n const n = values.shift();\n values = values.slice(0, n);\n const max = values.reduce((a, b) => Math.max(a, b), 0);\n\n let prims = new Array(max - 2);\n for(let i = 2; i <= max; i++){\n if(!prims[i - 2]){\n prims[i - 2] = i;\n for(let j = i * 2; j <= max; j += i){\n if(!prims[j - 2]){\n prims[j - 2] = i;\n }\n }\n }\n }\n\n const gcd = (a, b) => b ? gcd(b, a % b) : a;\n let gcd_ = values[0];\n let pairwise = true;\n for (let i = 0; i < values.length; i++) {\n if(values[i] <= 1){\n gcd_ = 1;\n continue;\n }\n if(prims[values[i] - 2] == -1 || prims[prims[values[i] - 2] - 2] == -1){\n pairwise = false;\n }else{\n prims[prims[values[i] - 2] - 2] = -1;\n }\n gcd_ = gcd(gcd_, values[i]);\n }\n if(pairwise){\n console.log('pairwise coprime');\n }else if(gcd_ === 1){\n console.log('setwise coprime');\n }else{\n console.log('not coprime');\n }\n})();\n", "language": "JavaScript", "metadata": {"date": 1599746401, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02574.html", "problem_id": "p02574", "resource_group": "medium_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/JavaScript/s855112233.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s855112233", "user_id": "u304747714"}, "prompt_components": {"gold_output": "pairwise coprime\n", "input_to_evaluate": "(async () => {\n let input = '';\n for await (const chunk of process.stdin) input += chunk;\n let values = input.split(/\\s/).map(v => +v);\n\n const n = values.shift();\n values = values.slice(0, n);\n const max = values.reduce((a, b) => Math.max(a, b), 0);\n\n let prims = new Array(max - 2);\n for(let i = 2; i <= max; i++){\n if(!prims[i - 2]){\n prims[i - 2] = i;\n for(let j = i * 2; j <= max; j += i){\n if(!prims[j - 2]){\n prims[j - 2] = i;\n }\n }\n }\n }\n\n const gcd = (a, b) => b ? gcd(b, a % b) : a;\n let gcd_ = values[0];\n let pairwise = true;\n for (let i = 0; i < values.length; i++) {\n if(values[i] <= 1){\n gcd_ = 1;\n continue;\n }\n if(prims[values[i] - 2] == -1 || prims[prims[values[i] - 2] - 2] == -1){\n pairwise = false;\n }else{\n prims[prims[values[i] - 2] - 2] = -1;\n }\n gcd_ = gcd(gcd_, values[i]);\n }\n if(pairwise){\n console.log('pairwise coprime');\n }else if(gcd_ === 1){\n console.log('setwise coprime');\n }else{\n console.log('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": 1211, "cpu_time_ms": 457, "memory_kb": 149112}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s800397565", "group_id": "codeNet:p02574", "input_text": "(async () => {\n let input = '';\n for await (const chunk of process.stdin) input += chunk;\n let values = input.split(/\\s/).map(v => +v);\n\n const n = values.shift();\n values = values.slice(0, n);\n values = values.sort((a, b) => b - a);\n\n let prims = [2];\n for(let i = 3; i <= values[0]; i++){\n const prim = prims.find((prim) => i % prim === 0)\n if(prim == undefined){\n prims.push(i);\n }else{\n prims.push(prim);\n }\n }\n\n const gcd = (a, b) => b ? gcd(b, a % b) : a;\n let gcd_ = values[0];\n for (let i = 0; i < values.length; i++) {\n if(prims[values[i] + 2] == -1){\n console.log('pairwise coprime');\n return;\n }\n prims[values[i]] = -1;\n gcd_ = gcd(gcd_, values[i]);\n }\n if(gcd_ === 1){\n console.log('setwise coprime');\n }else{\n console.log('not coprime');\n }\n})();\n", "language": "JavaScript", "metadata": {"date": 1599738655, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02574.html", "problem_id": "p02574", "resource_group": "medium_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/JavaScript/s800397565.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s800397565", "user_id": "u304747714"}, "prompt_components": {"gold_output": "pairwise coprime\n", "input_to_evaluate": "(async () => {\n let input = '';\n for await (const chunk of process.stdin) input += chunk;\n let values = input.split(/\\s/).map(v => +v);\n\n const n = values.shift();\n values = values.slice(0, n);\n values = values.sort((a, b) => b - a);\n\n let prims = [2];\n for(let i = 3; i <= values[0]; i++){\n const prim = prims.find((prim) => i % prim === 0)\n if(prim == undefined){\n prims.push(i);\n }else{\n prims.push(prim);\n }\n }\n\n const gcd = (a, b) => b ? gcd(b, a % b) : a;\n let gcd_ = values[0];\n for (let i = 0; i < values.length; i++) {\n if(prims[values[i] + 2] == -1){\n console.log('pairwise coprime');\n return;\n }\n prims[values[i]] = -1;\n gcd_ = gcd(gcd_, values[i]);\n }\n if(gcd_ === 1){\n console.log('setwise coprime');\n }else{\n console.log('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": 922, "cpu_time_ms": 2211, "memory_kb": 148632}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s828019344", "group_id": "codeNet:p02574", "input_text": "function Main(input) {\n\n input = input.split(\"\\n\");\n \n N = Number(input[0]);\n let An = input[1].split(\" \").map(Number);\n \n if (gcd(An) !== 1) {\n console.log(\"not coprime\");\n return;\n }\n \n let freq = Array(1000001).fill(0);\n for(let A of An) {\n if (A === 1) continue;\n freq[A]++;\n if (freq[A] > 1) {\n console.log(\"setwise coprime\");\n return;\n }\n }\n \n for (let i = 2; i <= 1000001; i++) {\n let tmp = 0;\n for (let j = i; j <= 1000001; j += i) {\n tmp += freq[j];\n if (tmp >= 2) {\n console.log(\"setwise coprime\");\n return;\n }\n }\n }\n \n console.log(\"pairwise coprime\");\n \n}\n\nfunction gcd(arg) {\n \n let f = (a, b) => b ? f(b, a % b) : a\n let ans = arg[0];\n for (let i = 1; i < arg.length; i++) {\n ans = f(ans, arg[i]); \n }\n return ans;\n \n}\n\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "language": "JavaScript", "metadata": {"date": 1598809314, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02574.html", "problem_id": "p02574", "resource_group": "medium_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/JavaScript/s828019344.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s828019344", "user_id": "u849155315"}, "prompt_components": {"gold_output": "pairwise coprime\n", "input_to_evaluate": "function Main(input) {\n\n input = input.split(\"\\n\");\n \n N = Number(input[0]);\n let An = input[1].split(\" \").map(Number);\n \n if (gcd(An) !== 1) {\n console.log(\"not coprime\");\n return;\n }\n \n let freq = Array(1000001).fill(0);\n for(let A of An) {\n if (A === 1) continue;\n freq[A]++;\n if (freq[A] > 1) {\n console.log(\"setwise coprime\");\n return;\n }\n }\n \n for (let i = 2; i <= 1000001; i++) {\n let tmp = 0;\n for (let j = i; j <= 1000001; j += i) {\n tmp += freq[j];\n if (tmp >= 2) {\n console.log(\"setwise coprime\");\n return;\n }\n }\n }\n \n console.log(\"pairwise coprime\");\n \n}\n\nfunction gcd(arg) {\n \n let f = (a, b) => b ? f(b, a % b) : a\n let ans = arg[0];\n for (let i = 1; i < arg.length; i++) {\n ans = f(ans, arg[i]); \n }\n return ans;\n \n}\n\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "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": 1019, "cpu_time_ms": 336, "memory_kb": 122300}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s780125842", "group_id": "codeNet:p02574", "input_text": "function Main(input) {\n\n input = input.split(\"\\n\");\n \n N = Number(input[0]);\n let An = input[1].split(\" \").map(Number);\n \n /*if (gcd(...An) !== 1) {\n console.log(\"not coprime\");\n return;\n }\n \n let freq = Array(1000001).fill(0);\n for(let A of An) {\n if (A === 1) continue;\n freq[A]++;\n if (freq[A] > 1) {\n console.log(\"setwise coprime\");\n return;\n }\n }\n \n for (let i = 2; i <= 1000001; i++) {\n let tmp = 0;\n for (let j = i; j <= 1000001; j += i) {\n tmp += freq[j];\n if (tmp >= 2) {\n console.log(\"setwise coprime\");\n return;\n }\n }\n }\n \n console.log(\"pairwise coprime\");*/\n \n}\n\nfunction gcd(...arg) {\n \n var f = (a, b) => b ? f(b, a % b) : a\n var ans = arg[0]\n for (var i = 1; i < arg.length; i++) {\n ans = f(ans, arg[i]); \n }\n return ans;\n \n}\n\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "language": "JavaScript", "metadata": {"date": 1598808670, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02574.html", "problem_id": "p02574", "resource_group": "medium_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/JavaScript/s780125842.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s780125842", "user_id": "u849155315"}, "prompt_components": {"gold_output": "pairwise coprime\n", "input_to_evaluate": "function Main(input) {\n\n input = input.split(\"\\n\");\n \n N = Number(input[0]);\n let An = input[1].split(\" \").map(Number);\n \n /*if (gcd(...An) !== 1) {\n console.log(\"not coprime\");\n return;\n }\n \n let freq = Array(1000001).fill(0);\n for(let A of An) {\n if (A === 1) continue;\n freq[A]++;\n if (freq[A] > 1) {\n console.log(\"setwise coprime\");\n return;\n }\n }\n \n for (let i = 2; i <= 1000001; i++) {\n let tmp = 0;\n for (let j = i; j <= 1000001; j += i) {\n tmp += freq[j];\n if (tmp >= 2) {\n console.log(\"setwise coprime\");\n return;\n }\n }\n }\n \n console.log(\"pairwise coprime\");*/\n \n}\n\nfunction gcd(...arg) {\n \n var f = (a, b) => b ? f(b, a % b) : a\n var ans = arg[0]\n for (var i = 1; i < arg.length; i++) {\n ans = f(ans, arg[i]); \n }\n return ans;\n \n}\n\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "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": 1028, "cpu_time_ms": 240, "memory_kb": 87184}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s173667061", "group_id": "codeNet:p02574", "input_text": "function getFactors(num) {\n const maxFactorNum = Math.floor(Math.sqrt(num));\n const factorArr = [];\n let count = 0; //count of factors found < maxFactorNum.\n\n for (let i = 1; i <= maxFactorNum; i++) {\n //inserting new elements in the middle using splice\n if (num % i === 0) {\n factorArr.push(i);\n let otherFactor = num / i; //the other factor\n if (i != otherFactor) {\n //insert these factors in the front of the array\n factorArr.push(otherFactor);\n }\n count++;\n }\n }\n\n return factorArr;\n}\n\nconst processData = (lines) => {\n const nums = lines[1].split(' ').map( x => +x)\n\n let numMap = {}\n let cache = {}\n\n for (const d of nums) {\n const factors = cache[d] || getFactors(d, cache)\n cache[d] = factors\n for (const f of factors) {\n numMap[f] = numMap[f] ? numMap[f] + 1 : 1\n }\n }\n\n let max = 1\n\n for (let p in numMap) {\n if (p != '1') {\n max = Math.max(max, numMap[p])\n }\n }\n\n console.log(max === 1 ? 'pairwise coprime' : (max === nums.length ? 'not coprime' : 'setwise coprime'))\n}\n\nlet i = ''\nprocess.stdin.on('data', c => i += c)\nprocess.stdin.on('end', () => {\n const {EOL} = require('os')\n const lines = i.split(EOL) /*your input text, split by lines*/\n processData(lines)\n})\n", "language": "JavaScript", "metadata": {"date": 1598733454, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02574.html", "problem_id": "p02574", "resource_group": "medium_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/JavaScript/s173667061.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s173667061", "user_id": "u268857806"}, "prompt_components": {"gold_output": "pairwise coprime\n", "input_to_evaluate": "function getFactors(num) {\n const maxFactorNum = Math.floor(Math.sqrt(num));\n const factorArr = [];\n let count = 0; //count of factors found < maxFactorNum.\n\n for (let i = 1; i <= maxFactorNum; i++) {\n //inserting new elements in the middle using splice\n if (num % i === 0) {\n factorArr.push(i);\n let otherFactor = num / i; //the other factor\n if (i != otherFactor) {\n //insert these factors in the front of the array\n factorArr.push(otherFactor);\n }\n count++;\n }\n }\n\n return factorArr;\n}\n\nconst processData = (lines) => {\n const nums = lines[1].split(' ').map( x => +x)\n\n let numMap = {}\n let cache = {}\n\n for (const d of nums) {\n const factors = cache[d] || getFactors(d, cache)\n cache[d] = factors\n for (const f of factors) {\n numMap[f] = numMap[f] ? numMap[f] + 1 : 1\n }\n }\n\n let max = 1\n\n for (let p in numMap) {\n if (p != '1') {\n max = Math.max(max, numMap[p])\n }\n }\n\n console.log(max === 1 ? 'pairwise coprime' : (max === nums.length ? 'not coprime' : 'setwise coprime'))\n}\n\nlet i = ''\nprocess.stdin.on('data', c => i += c)\nprocess.stdin.on('end', () => {\n const {EOL} = require('os')\n const lines = i.split(EOL) /*your input text, split by lines*/\n processData(lines)\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": 1404, "cpu_time_ms": 2213, "memory_kb": 212940}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s806083741", "group_id": "codeNet:p02574", "input_text": "function Main(input) {\n\tinput = input.trim().split(\"\\n\").map(function(x) { return x.split(\" \")});\n\tlet N = parseInt(input[0][0], 10);\n\tlet A = input[1].map(e => parseInt(e, 10));\n\tlet Amap = Array.from({length: 1e6 + 1}, () => false);\n\tlet ansFlag0 = false;\n\tlet N2 = N;\n\tlet variation = 0;\n\tfor (let i = 0; i < N; i++){\n\t\tif (Amap[A[i]]){\n\t\t\tif (A[i] !==1) ansFlag0 = true;\n\t\t\tN2 --;\n\t\t\tcontinue;\n\t\t}\n\t\tAmap[A[i]] = true;\n\t\tvariation ++;\n\t}\n\n\tlet bitmap = Array.from({length: 1e6 + 1}, () => false);\n\tbitmap[0] = true;\n\tbitmap[1] = true;\n\n\t\n\t// let ansFlag1 = false;\n\tlet countList = [];\n\tfor (let i = 2; i < bitmap.length; i++){\n\t\tif (bitmap[i]) continue;\n\t\tlet count = 0;\n\t\tlet j = 1;\n\t\tif (Amap[i * j]){\n\t\t\tcount ++;\n\t\t}\n\t\tfor (j = 2; j <= (1e6 / i); j++){\n\t\t\tbitmap[i * j] = true;\n\t\t\tif (Amap[i * j]){\n\t\t\t\tcount ++;\n\t\t\t}\n\n\t\t}\n\t\tcountList.push(count);\n\t}\n\tcountList.sort((a,b) => a - b);\n\tlet ans = \"pairwise coprime\";\n\tif (ansFlag0) ans = \"setwise coprime\";\n\tfor (let i = 0; i < countList.length; i++){\n\t\tif (countList[i] <= 1) continue;\n\t\tif(countList[countList.length - 1] < N2){\n\t\t\tans = \"setwise coprime\";\n\t\t} else {\n\t\t\tans = \"not coprime\";\n\t\t}\n\t}\n\tif (variation === 1){\n\t\tif (A[0] === 1) ans = \"pairwise coprime\";\n\t\telse ans = \"not coprime\";\n\t}\n\tconsole.log(ans);\n\t\n}\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));\n", "language": "JavaScript", "metadata": {"date": 1598731907, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02574.html", "problem_id": "p02574", "resource_group": "medium_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/JavaScript/s806083741.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s806083741", "user_id": "u624950076"}, "prompt_components": {"gold_output": "pairwise coprime\n", "input_to_evaluate": "function Main(input) {\n\tinput = input.trim().split(\"\\n\").map(function(x) { return x.split(\" \")});\n\tlet N = parseInt(input[0][0], 10);\n\tlet A = input[1].map(e => parseInt(e, 10));\n\tlet Amap = Array.from({length: 1e6 + 1}, () => false);\n\tlet ansFlag0 = false;\n\tlet N2 = N;\n\tlet variation = 0;\n\tfor (let i = 0; i < N; i++){\n\t\tif (Amap[A[i]]){\n\t\t\tif (A[i] !==1) ansFlag0 = true;\n\t\t\tN2 --;\n\t\t\tcontinue;\n\t\t}\n\t\tAmap[A[i]] = true;\n\t\tvariation ++;\n\t}\n\n\tlet bitmap = Array.from({length: 1e6 + 1}, () => false);\n\tbitmap[0] = true;\n\tbitmap[1] = true;\n\n\t\n\t// let ansFlag1 = false;\n\tlet countList = [];\n\tfor (let i = 2; i < bitmap.length; i++){\n\t\tif (bitmap[i]) continue;\n\t\tlet count = 0;\n\t\tlet j = 1;\n\t\tif (Amap[i * j]){\n\t\t\tcount ++;\n\t\t}\n\t\tfor (j = 2; j <= (1e6 / i); j++){\n\t\t\tbitmap[i * j] = true;\n\t\t\tif (Amap[i * j]){\n\t\t\t\tcount ++;\n\t\t\t}\n\n\t\t}\n\t\tcountList.push(count);\n\t}\n\tcountList.sort((a,b) => a - b);\n\tlet ans = \"pairwise coprime\";\n\tif (ansFlag0) ans = \"setwise coprime\";\n\tfor (let i = 0; i < countList.length; i++){\n\t\tif (countList[i] <= 1) continue;\n\t\tif(countList[countList.length - 1] < N2){\n\t\t\tans = \"setwise coprime\";\n\t\t} else {\n\t\t\tans = \"not coprime\";\n\t\t}\n\t}\n\tif (variation === 1){\n\t\tif (A[0] === 1) ans = \"pairwise coprime\";\n\t\telse ans = \"not coprime\";\n\t}\n\tconsole.log(ans);\n\t\n}\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));\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": 1334, "cpu_time_ms": 613, "memory_kb": 112864}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s405293045", "group_id": "codeNet:p02574", "input_text": "\"use strict\";\nvar input=require(\"fs\").readFileSync(\"/dev/stdin\",\"utf8\");\nvar cin=input.split(/ |\\n/),cid=0;\nfunction next(){return +cin[cid++];}\nfunction nextstr(){return cin[cid++];}\nfunction nextbig(){return BigInt(cin[cid++]);}\nfunction nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}\nfunction nextssort(n,a){return a?cin.slice(cid,cid+=n).map(a=>+a).sort((a,b)=>b-a):cin.slice(cid,cid+=n).map(a=>+a).sort((a,b)=>a-b);}\nfunction nextm(h,w,a){var r=[],i=0;if(a)for(;i+a));return r;}\nfunction xArray(v){var a=arguments,l=a.length,r=\"Array(a[\"+--l+\"]).fill().map(x=>{return \"+v+\";})\";while(--l)r=\"Array(a[\"+l+\"]).fill().map(x=>\"+r+\")\";return eval(r);}\n\nfunction gcd(a,b){return b?gcd(b,a%b):a;}\n\nvar myOut = main();\nif(myOut !== undefined)console.log(String(myOut));\n\nfunction main(){\n var n = next();\n var a = nexts(n);\n var b = xArray(0,1e6+1);\n var f = 1;\n for(var i = 0; i < n && f; i++){\n var t = a[i];\n for(var j = 2; j*j <= t; j++){\n if(t%j === 0){\n if(b[j]){\n f = 0;\n break;\n }\n b[j] = 1;\n while(t%j === 0)t /= j;\n }\n }\n if(t > 1){\n if(b[t]){\n f = 0;\n }else{\n b[t] = 1;\n }\n }\n }\n if(f)return \"pairwise coprime\";\n t = a[0];\n for(var i = 1; i < n; i++){\n t = gcd(t,a[i]);\n if(t === 1)return \"setwise coprime\";\n }\n return \"not coprime\";\n}", "language": "JavaScript", "metadata": {"date": 1598730728, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02574.html", "problem_id": "p02574", "resource_group": "medium_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/JavaScript/s405293045.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s405293045", "user_id": "u643613120"}, "prompt_components": {"gold_output": "pairwise coprime\n", "input_to_evaluate": "\"use strict\";\nvar input=require(\"fs\").readFileSync(\"/dev/stdin\",\"utf8\");\nvar cin=input.split(/ |\\n/),cid=0;\nfunction next(){return +cin[cid++];}\nfunction nextstr(){return cin[cid++];}\nfunction nextbig(){return BigInt(cin[cid++]);}\nfunction nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}\nfunction nextssort(n,a){return a?cin.slice(cid,cid+=n).map(a=>+a).sort((a,b)=>b-a):cin.slice(cid,cid+=n).map(a=>+a).sort((a,b)=>a-b);}\nfunction nextm(h,w,a){var r=[],i=0;if(a)for(;i+a));return r;}\nfunction xArray(v){var a=arguments,l=a.length,r=\"Array(a[\"+--l+\"]).fill().map(x=>{return \"+v+\";})\";while(--l)r=\"Array(a[\"+l+\"]).fill().map(x=>\"+r+\")\";return eval(r);}\n\nfunction gcd(a,b){return b?gcd(b,a%b):a;}\n\nvar myOut = main();\nif(myOut !== undefined)console.log(String(myOut));\n\nfunction main(){\n var n = next();\n var a = nexts(n);\n var b = xArray(0,1e6+1);\n var f = 1;\n for(var i = 0; i < n && f; i++){\n var t = a[i];\n for(var j = 2; j*j <= t; j++){\n if(t%j === 0){\n if(b[j]){\n f = 0;\n break;\n }\n b[j] = 1;\n while(t%j === 0)t /= j;\n }\n }\n if(t > 1){\n if(b[t]){\n f = 0;\n }else{\n b[t] = 1;\n }\n }\n }\n if(f)return \"pairwise coprime\";\n t = a[0];\n for(var i = 1; i < n; i++){\n t = gcd(t,a[i]);\n if(t === 1)return \"setwise coprime\";\n }\n return \"not coprime\";\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": 1480, "cpu_time_ms": 417, "memory_kb": 146092}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s060790708", "group_id": "codeNet:p02580", "input_text": "(async () => {\n let input = '';\n for await (const chunk of process.stdin) input += chunk;\n const lines = input.split(/\\n/);\n const [h, w, m] = lines[0].split(/\\s/).map(v => +v);\n const targets = lines.slice(1, m + 1).map(line => line.split(/\\s/).map(v => v - 1));\n\n let targetCount = [new Array(h).fill(0), new Array(w).fill(0)];\n let targetMap = new Array(h).fill([]).map(x => new Array(w).fill(false));\n for (const target of targets) {\n targetCount[0][target[0]]++;\n targetCount[1][target[1]]++;\n targetMap[target[0]][target[1]] = true;\n }\n const xMax = targetCount[0].slice().sort((a, b) => b - a);\n const yMax = targetCount[1].slice().sort((a, b) => b - a);\n\n let yMaxs = [];\n for (let i = 0; i < h; i++) {\n if(targetCount[1][i] == yMax[0]){\n yMaxs.push(i);\n }\n }\n let allCross = 1;\n for (let i = 0; i < h && allCross; i++) {\n if(targetCount[0][i] == xMax[0]){\n for (let j = 0; j < yMaxs.length; j++) {\n if(!targetMap[i][yMaxs[j]]){\n allCross = 0;\n break;\n }\n }\n }\n }\n console.log(yMax[0] + xMax[0] - allCross);\n})();\n", "language": "JavaScript", "metadata": {"date": 1599841657, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02580.html", "problem_id": "p02580", "resource_group": "medium_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/JavaScript/s060790708.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s060790708", "user_id": "u304747714"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "(async () => {\n let input = '';\n for await (const chunk of process.stdin) input += chunk;\n const lines = input.split(/\\n/);\n const [h, w, m] = lines[0].split(/\\s/).map(v => +v);\n const targets = lines.slice(1, m + 1).map(line => line.split(/\\s/).map(v => v - 1));\n\n let targetCount = [new Array(h).fill(0), new Array(w).fill(0)];\n let targetMap = new Array(h).fill([]).map(x => new Array(w).fill(false));\n for (const target of targets) {\n targetCount[0][target[0]]++;\n targetCount[1][target[1]]++;\n targetMap[target[0]][target[1]] = true;\n }\n const xMax = targetCount[0].slice().sort((a, b) => b - a);\n const yMax = targetCount[1].slice().sort((a, b) => b - a);\n\n let yMaxs = [];\n for (let i = 0; i < h; i++) {\n if(targetCount[1][i] == yMax[0]){\n yMaxs.push(i);\n }\n }\n let allCross = 1;\n for (let i = 0; i < h && allCross; i++) {\n if(targetCount[0][i] == xMax[0]){\n for (let j = 0; j < yMaxs.length; j++) {\n if(!targetMap[i][yMaxs[j]]){\n allCross = 0;\n break;\n }\n }\n }\n }\n console.log(yMax[0] + xMax[0] - allCross);\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": 1226, "cpu_time_ms": 3385, "memory_kb": 1974020}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s339586644", "group_id": "codeNet:p02580", "input_text": "const main = (input) => {\n input = input.trim().split('\\n')\n const [h, w, m] = input[0].split(' ').map(Number)\n\n const hs = new Array(h+1).fill(0)\n const ws = new Array(w+1).fill(0)\n const bomb = new Map()\n\n for (let i=1; i<=m; i++) {\n const [hi, wi] = input[i].split(' ').map(Number)\n hs[hi-1]++\n ws[wi-1]++\n bomb.set(`${hi-1}:${wi-1}`, true)\n }\n\n const hmx = Math.max(...hs)\n const wmx = Math.max(...ws)\n\n let topH = []\n let topW = []\n for (let i=0; i b[1] - a[1])\n // const ascW = [...Object.entries(ws)].sort((a, b) => b[1] - a[1])\n //\n // const topH = [ascH.shift()]\n // const topW = [ascW.shift()]\n // while (ascH[0] && topH[0][1] === ascH[0][1]) topH.push(ascH.shift())\n // while (ascW[0] && topW[0][1] === ascW[0][1]) topW.push(ascW.shift())\n\n for (let x=0; x {\n input = input.trim().split('\\n')\n const [h, w, m] = input[0].split(' ').map(Number)\n\n const hs = new Array(h+1).fill(0)\n const ws = new Array(w+1).fill(0)\n const bomb = new Map()\n\n for (let i=1; i<=m; i++) {\n const [hi, wi] = input[i].split(' ').map(Number)\n hs[hi-1]++\n ws[wi-1]++\n bomb.set(`${hi-1}:${wi-1}`, true)\n }\n\n const hmx = Math.max(...hs)\n const wmx = Math.max(...ws)\n\n let topH = []\n let topW = []\n for (let i=0; i b[1] - a[1])\n // const ascW = [...Object.entries(ws)].sort((a, b) => b[1] - a[1])\n //\n // const topH = [ascH.shift()]\n // const topW = [ascW.shift()]\n // while (ascH[0] && topH[0][1] === ascH[0][1]) topH.push(ascH.shift())\n // while (ascW[0] && topW[0][1] === ascW[0][1]) topW.push(ascW.shift())\n\n for (let x=0; x {\n input = input.trim().split('\\n')\n const [h, w, m] = input[0].split(' ').map(Number)\n\n const hs = {}\n const ws = {}\n\n const bomb = new Map()\n\n for (let i=1; i<=m; i++) {\n const [hi, wi] = input[i].split(' ').map(Number)\n\n hs[hi-1] = ~~hs[hi-1] + 1\n ws[wi-1] = ~~ws[wi-1] + 1\n\n bomb.set(`${hi-1}:${wi-1}`, true)\n }\n\n const ascH = [...Object.entries(hs)].sort((a, b) => b[1] - a[1])\n const ascW = [...Object.entries(ws)].sort((a, b) => b[1] - a[1])\n\n\n\n const topH = [ascH.shift()]\n while (ascH[0] && topH[0][1] === ascH[0][1]) topH.push(ascH.shift())\n const topW = [ascW.shift()]\n while (ascW[0] && topW[0][1] === ascW[0][1]) topW.push(ascW.shift())\n\n // console.log(bomb.entries())\n // console.log(topH, topW)\n\n for (let x=0; x {\n input = input.trim().split('\\n')\n const [h, w, m] = input[0].split(' ').map(Number)\n\n const hs = {}\n const ws = {}\n\n const bomb = new Map()\n\n for (let i=1; i<=m; i++) {\n const [hi, wi] = input[i].split(' ').map(Number)\n\n hs[hi-1] = ~~hs[hi-1] + 1\n ws[wi-1] = ~~ws[wi-1] + 1\n\n bomb.set(`${hi-1}:${wi-1}`, true)\n }\n\n const ascH = [...Object.entries(hs)].sort((a, b) => b[1] - a[1])\n const ascW = [...Object.entries(ws)].sort((a, b) => b[1] - a[1])\n\n\n\n const topH = [ascH.shift()]\n while (ascH[0] && topH[0][1] === ascH[0][1]) topH.push(ascH.shift())\n const topW = [ascW.shift()]\n while (ascW[0] && topW[0][1] === ascW[0][1]) topW.push(ascW.shift())\n\n // console.log(bomb.entries())\n // console.log(topH, topW)\n\n for (let x=0; x (Number(v)));\n const H = header[0], W = header[1], M = header[2];\n\n let arrH = new Int32Array(H);\n let arrW = new Int32Array(W);\n let grid = new Set();\n for (let i = 0; i < M; i++) {\n let arr = lines[i + 1].split(\" \");\n let h = arr[0] - 1, w = arr[1] - 1;\n arrH[h]++;\n arrW[w]++;\n grid.add(h * W + w);\n }\n\n let maxH = arrH[0];\n let idsH = [0];\n for (let i = 0; i < H; i++) {\n let v = arrH[i];\n if (maxH < v) {\n maxH = v;\n idsH = [i]\n } else if (maxH === v) {\n idsH.push(i);\n }\n }\n\n let maxW = arrW[0];\n let idsW = [0];\n for (let i = 0; i < W; i++) {\n let v = arrW[i];\n if (maxW < v) {\n maxW = v;\n idsW = [i]\n } else if (maxW === v) {\n idsW.push(i);\n }\n }\n\n for (let h = 0; h < idsH.length; h++) {\n let idh = idsH[h];\n for (let w = 0; w < idsW.length; w++) {\n let idw = idsW[w];\n if (!grid.has(idh * W + idw)) {\n return maxH + maxW;\n }\n }\n }\n\n return maxH + maxW - 1;\n}\n\n//******************************\nexports.main = main;\n\nfunction Main(input) {\n console.log(main(input.trim()));\n}\n\nif (process.argv[2] !== \"test\") {\n Main(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));\n}", "language": "JavaScript", "metadata": {"date": 1598140895, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02580.html", "problem_id": "p02580", "resource_group": "medium_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/JavaScript/s083674768.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s083674768", "user_id": "u607769657"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "function main(input = \"\") {\n const lines = input.split(\"\\n\");\n const header = lines[0].split(\" \").map((v) => (Number(v)));\n const H = header[0], W = header[1], M = header[2];\n\n let arrH = new Int32Array(H);\n let arrW = new Int32Array(W);\n let grid = new Set();\n for (let i = 0; i < M; i++) {\n let arr = lines[i + 1].split(\" \");\n let h = arr[0] - 1, w = arr[1] - 1;\n arrH[h]++;\n arrW[w]++;\n grid.add(h * W + w);\n }\n\n let maxH = arrH[0];\n let idsH = [0];\n for (let i = 0; i < H; i++) {\n let v = arrH[i];\n if (maxH < v) {\n maxH = v;\n idsH = [i]\n } else if (maxH === v) {\n idsH.push(i);\n }\n }\n\n let maxW = arrW[0];\n let idsW = [0];\n for (let i = 0; i < W; i++) {\n let v = arrW[i];\n if (maxW < v) {\n maxW = v;\n idsW = [i]\n } else if (maxW === v) {\n idsW.push(i);\n }\n }\n\n for (let h = 0; h < idsH.length; h++) {\n let idh = idsH[h];\n for (let w = 0; w < idsW.length; w++) {\n let idw = idsW[w];\n if (!grid.has(idh * W + idw)) {\n return maxH + maxW;\n }\n }\n }\n\n return maxH + maxW - 1;\n}\n\n//******************************\nexports.main = main;\n\nfunction Main(input) {\n console.log(main(input.trim()));\n}\n\nif (process.argv[2] !== \"test\") {\n Main(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));\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": 1475, "cpu_time_ms": 427, "memory_kb": 125340}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s484565424", "group_id": "codeNet:p02580", "input_text": "function main(input = \"\") {\n const lines = input.split(\"\\n\");\n const header = lines[0].split(\" \").map((v) => (Number(v)));\n const H = header[0], W = header[1], M = header[2];\n\n let arrH = new Int32Array(H);\n let arrW = new Int32Array(W);\n let grid = new Set();\n for (let i = 0; i < M; i++) {\n let arr = lines[i + 1].split(\" \").map((v) => (Number(v)));\n let h = arr[0] - 1, w = arr[1] - 1;\n arrH[h]++;\n arrW[w]++;\n grid.add(h * W + w);\n }\n\n let maxH = arrH[0];\n let maxHids = [0];\n for (let i = 0; i < H; i++) {\n let v = arrH[i];\n if (maxH < v) {\n maxH = v;\n maxHids.length = 0;\n maxHids.push(i);\n } else if (maxH === v) {\n maxHids.push(i);\n }\n }\n\n let maxW = arrW[0];\n let maxWids = [0];\n for (let i = 0; i < W; i++) {\n let v = arrW[i];\n if(maxW < v){\n maxW = v;\n maxWids.length = 0;\n maxWids.push(i);\n } else if ( maxW === v){\n maxWids.push(i);\n }\n }\n\n let maxCnt = -1;\n for (let h = 0; h < maxHids.length; h++) {\n let idh = maxHids[h];\n for (let w = 0; w < maxWids.length ; w++) {\n let idw = maxWids[w];\n let id = idh * W + idw;\n let cnt = maxH + maxW - (grid.has(id) ? 1 : 0);\n if (maxCnt < cnt) {\n maxCnt = cnt;\n }\n }\n }\n\n return maxCnt;\n}\n\n//******************************\nexports.main = main;\n\nfunction Main(input) {\n console.log(main(input.trim()));\n}\n\nif (process.argv[2] !== \"test\") {\n Main(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));\n}", "language": "JavaScript", "metadata": {"date": 1598140239, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02580.html", "problem_id": "p02580", "resource_group": "medium_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/JavaScript/s484565424.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s484565424", "user_id": "u607769657"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "function main(input = \"\") {\n const lines = input.split(\"\\n\");\n const header = lines[0].split(\" \").map((v) => (Number(v)));\n const H = header[0], W = header[1], M = header[2];\n\n let arrH = new Int32Array(H);\n let arrW = new Int32Array(W);\n let grid = new Set();\n for (let i = 0; i < M; i++) {\n let arr = lines[i + 1].split(\" \").map((v) => (Number(v)));\n let h = arr[0] - 1, w = arr[1] - 1;\n arrH[h]++;\n arrW[w]++;\n grid.add(h * W + w);\n }\n\n let maxH = arrH[0];\n let maxHids = [0];\n for (let i = 0; i < H; i++) {\n let v = arrH[i];\n if (maxH < v) {\n maxH = v;\n maxHids.length = 0;\n maxHids.push(i);\n } else if (maxH === v) {\n maxHids.push(i);\n }\n }\n\n let maxW = arrW[0];\n let maxWids = [0];\n for (let i = 0; i < W; i++) {\n let v = arrW[i];\n if(maxW < v){\n maxW = v;\n maxWids.length = 0;\n maxWids.push(i);\n } else if ( maxW === v){\n maxWids.push(i);\n }\n }\n\n let maxCnt = -1;\n for (let h = 0; h < maxHids.length; h++) {\n let idh = maxHids[h];\n for (let w = 0; w < maxWids.length ; w++) {\n let idw = maxWids[w];\n let id = idh * W + idw;\n let cnt = maxH + maxW - (grid.has(id) ? 1 : 0);\n if (maxCnt < cnt) {\n maxCnt = cnt;\n }\n }\n }\n\n return maxCnt;\n}\n\n//******************************\nexports.main = main;\n\nfunction Main(input) {\n console.log(main(input.trim()));\n}\n\nif (process.argv[2] !== \"test\") {\n Main(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));\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": 1688, "cpu_time_ms": 3312, "memory_kb": 122896}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s033853409", "group_id": "codeNet:p02580", "input_text": "const { format } = require('path')\n\n// let input = require('fs').readFileSync('/dev/stdin', 'utf8')\nlet input = require('fs').readFileSync('./sample_e.txt', 'utf8')\n.split(/\\n| /)\n// .map(item => parseInt(item))\n.slice(0,-1)\n\nconst [height, width, ..._targets] = input\nconst targets = _targets.slice(1)\nlet numMap = []\n\n// Map作成\nfor(let i=0; i parseInt(item))\n.slice(0,-1)\n\nconst [height, width, ..._targets] = input\nconst targets = _targets.slice(1)\nlet numMap = []\n\n// Map作成\nfor(let i=0; i{\n const [[H,W,M],...target] = args.trim().split`\\n`.map(r=>r.split` `.map(v=>v|0));\n const b = Array.from({length:H},_=>Array(W).fill(false));\n const bR = Array(H).fill(0);\n const bC = Array(W).fill(0);\n let xR = 0, xC = 0;\n for ( const [h,w] of target ) {\n b[h-1][w-1] = true;\n xR = Math.max(xR,++bR[h-1]);\n xC = Math.max(xC,++bC[w-1]);\n }\n const hR = [], hC = [];\n for ( let i = 0; i < H; i++ ) if ( bR[i] === xR ) hR.push(i);\n for ( let j = 0; j < W; j++ ) if ( bC[j] === xC ) hC.push(j);\n for ( const h of hR ) {\n for ( const w of hC ) {\n if ( !b[h][w] ) return xR+xC;\n }\n }\n return xR+xC-1;\n})(require('fs').readFileSync('/dev/stdin','utf8')));\n", "language": "JavaScript", "metadata": {"date": 1598128191, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02580.html", "problem_id": "p02580", "resource_group": "medium_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/JavaScript/s893653018.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s893653018", "user_id": "u088845406"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "console.log((args=>{\n const [[H,W,M],...target] = args.trim().split`\\n`.map(r=>r.split` `.map(v=>v|0));\n const b = Array.from({length:H},_=>Array(W).fill(false));\n const bR = Array(H).fill(0);\n const bC = Array(W).fill(0);\n let xR = 0, xC = 0;\n for ( const [h,w] of target ) {\n b[h-1][w-1] = true;\n xR = Math.max(xR,++bR[h-1]);\n xC = Math.max(xC,++bC[w-1]);\n }\n const hR = [], hC = [];\n for ( let i = 0; i < H; i++ ) if ( bR[i] === xR ) hR.push(i);\n for ( let j = 0; j < W; j++ ) if ( bC[j] === xC ) hC.push(j);\n for ( const h of hR ) {\n for ( const w of hC ) {\n if ( !b[h][w] ) return xR+xC;\n }\n }\n return xR+xC-1;\n})(require('fs').readFileSync('/dev/stdin','utf8')));\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": 703, "cpu_time_ms": 3376, "memory_kb": 1969104}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s488455817", "group_id": "codeNet:p02580", "input_text": "'use strict';\n\nfunction Main(input) {\n //H W M\n // (hi, wi)\n const tmp = input.trim().split('\\n');\n const [H, W, M] = tmp\n .shift()\n .split(' ')\n .map((v) => Number(v));\n const hw = tmp.map((v) => v.split(' ').map((v) => Number(v)));\n // console.log(H, W, M, hw);\n\n // Hの最大値\n let arr = Array(H + 1).fill(0);\n for (const v of hw) {\n arr[v[0]] += 1;\n }\n const hmax = arr.reduce((a, b) => Math.max(a, b));\n let harr = [];\n arr.forEach((v, i) => {\n if (v === hmax) harr.push(i);\n });\n\n // Hの最大値それぞれについてのWの最大値\n let wmax = 0;\n for (const value of harr) {\n const newhw = hw.filter((v) => v[0] !== value);\n let arr = Array(W + 1).fill(0);\n for (const v of newhw) {\n arr[v[1]] += 1;\n }\n const wtmp = arr.reduce((a, b) => Math.max(a, b));\n if (wtmp > wmax) {\n wmax = wtmp;\n }\n }\n\n console.log(hmax + wmax);\n\n return;\n}\nMain(require('fs').readFileSync('/dev/stdin', 'utf8'));\n", "language": "JavaScript", "metadata": {"date": 1598127328, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02580.html", "problem_id": "p02580", "resource_group": "medium_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/JavaScript/s488455817.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s488455817", "user_id": "u291678294"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "'use strict';\n\nfunction Main(input) {\n //H W M\n // (hi, wi)\n const tmp = input.trim().split('\\n');\n const [H, W, M] = tmp\n .shift()\n .split(' ')\n .map((v) => Number(v));\n const hw = tmp.map((v) => v.split(' ').map((v) => Number(v)));\n // console.log(H, W, M, hw);\n\n // Hの最大値\n let arr = Array(H + 1).fill(0);\n for (const v of hw) {\n arr[v[0]] += 1;\n }\n const hmax = arr.reduce((a, b) => Math.max(a, b));\n let harr = [];\n arr.forEach((v, i) => {\n if (v === hmax) harr.push(i);\n });\n\n // Hの最大値それぞれについてのWの最大値\n let wmax = 0;\n for (const value of harr) {\n const newhw = hw.filter((v) => v[0] !== value);\n let arr = Array(W + 1).fill(0);\n for (const v of newhw) {\n arr[v[1]] += 1;\n }\n const wtmp = arr.reduce((a, b) => Math.max(a, b));\n if (wtmp > wmax) {\n wmax = wtmp;\n }\n }\n\n console.log(hmax + wmax);\n\n return;\n}\nMain(require('fs').readFileSync('/dev/stdin', 'utf8'));\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": 1073, "cpu_time_ms": 3316, "memory_kb": 202400}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s670146810", "group_id": "codeNet:p02580", "input_text": "const input = require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\")\nconst lines = input.split('\\n')\nlet [H, W, M] = lines[0].split(' ').map(Number)\n\nconst h = Array(H + 1).fill(0)\nconst w = Array(W + 1).fill(0)\n\nconst map = Array(H + 1).fill().map(_ => Array(W + 1).fill(0))\n\nfor (let i = 1; i <= M; i++) {\n const p = lines[i].split(' ').map(Number)\n h[p[0]]++\n w[p[1]]++\n map[p[0]][p[1]] = 1\n}\n\nconst hm = h.reduce((a, b) => {\n return a > b ? a : b\n})\nconst hp = []\nh.forEach((a, i) => {\n if (a === hm) {\n hp.push(i)\n }\n})\n\nconst wm = w.reduce((a, b) => {\n return a > b ? a : b\n})\nconst wp = []\nw.forEach((a, i) => {\n if (a === wm) {\n wp.push(i)\n }\n})\n\nlet c = 1\nfor (let i = 0; i < hp.length; i++) {\n for (let j = 0; j < wp.length; j++) {\n if (!map[hp[i]][wp[j]]) {\n c = 0\n break\n }\n }\n if (c === 0) break\n}\n\nconsole.log(hm + wm - c)\n", "language": "JavaScript", "metadata": {"date": 1598127223, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02580.html", "problem_id": "p02580", "resource_group": "medium_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/JavaScript/s670146810.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s670146810", "user_id": "u968011443"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "const input = require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\")\nconst lines = input.split('\\n')\nlet [H, W, M] = lines[0].split(' ').map(Number)\n\nconst h = Array(H + 1).fill(0)\nconst w = Array(W + 1).fill(0)\n\nconst map = Array(H + 1).fill().map(_ => Array(W + 1).fill(0))\n\nfor (let i = 1; i <= M; i++) {\n const p = lines[i].split(' ').map(Number)\n h[p[0]]++\n w[p[1]]++\n map[p[0]][p[1]] = 1\n}\n\nconst hm = h.reduce((a, b) => {\n return a > b ? a : b\n})\nconst hp = []\nh.forEach((a, i) => {\n if (a === hm) {\n hp.push(i)\n }\n})\n\nconst wm = w.reduce((a, b) => {\n return a > b ? a : b\n})\nconst wp = []\nw.forEach((a, i) => {\n if (a === wm) {\n wp.push(i)\n }\n})\n\nlet c = 1\nfor (let i = 0; i < hp.length; i++) {\n for (let j = 0; j < wp.length; j++) {\n if (!map[hp[i]][wp[j]]) {\n c = 0\n break\n }\n }\n if (c === 0) break\n}\n\nconsole.log(hm + wm - c)\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": 920, "cpu_time_ms": 3366, "memory_kb": 1947496}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s013568191", "group_id": "codeNet:p02612", "input_text": "function main(input = \"\") {\n let N = 0 | input;\n res = N % 1000;\n if ( res > 0){\n return 1000 - res;\n } else { \n return 0;\n } \n}\n\n//******************************\nexports.main = main;\n\nfunction Main(input) {\n console.log(main(input.trim()));\n}\n\nif (process.argv[2] !== \"test\") {\n Main(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));\n}\n", "language": "JavaScript", "metadata": {"date": 1597602798, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "medium_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/JavaScript/s013568191.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s013568191", "user_id": "u607769657"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "function main(input = \"\") {\n let N = 0 | input;\n res = N % 1000;\n if ( res > 0){\n return 1000 - res;\n } else { \n return 0;\n } \n}\n\n//******************************\nexports.main = main;\n\nfunction Main(input) {\n console.log(main(input.trim()));\n}\n\nif (process.argv[2] !== \"test\") {\n Main(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));\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": 376, "cpu_time_ms": 220, "memory_kb": 30520}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s679746506", "group_id": "codeNet:p02612", "input_text": "function main(input){\n\tconst N = parseInt(input, 10)\n const r = N % 1000\n console.log(r === 0 ? r : 1000 - r)\n}\n\nmain(require('fs').readFileSync('/dev/stdin', 'utf8'))", "language": "JavaScript", "metadata": {"date": 1597500925, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "medium_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/JavaScript/s679746506.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s679746506", "user_id": "u744182720"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "function main(input){\n\tconst N = parseInt(input, 10)\n const r = N % 1000\n console.log(r === 0 ? r : 1000 - r)\n}\n\nmain(require('fs').readFileSync('/dev/stdin', 'utf8'))", "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": 173, "cpu_time_ms": 229, "memory_kb": 30312}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s295573431", "group_id": "codeNet:p02612", "input_text": "function Main(input) {\n\tlet input = parseint(input);\n\tfor(let i=0; i*1000 {\n const input = require('fs').readFileSync('/dev/stdin', 'UTF-8').trim()\n\nconst num = parseInt(input).toLocaleString().split(',')\nconst answer = 1000 - parseInt(num[num.length - 1])\n\nif (answer === 1000) {\n console.log('0');\n\n} else {\n console.log(answer);\n\n}\n}\n\nmain()", "language": "JavaScript", "metadata": {"date": 1596297596, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "medium_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/JavaScript/s310939759.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s310939759", "user_id": "u620230233"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "const main = async () => {\n const input = require('fs').readFileSync('/dev/stdin', 'UTF-8').trim()\n\nconst num = parseInt(input).toLocaleString().split(',')\nconst answer = 1000 - parseInt(num[num.length - 1])\n\nif (answer === 1000) {\n console.log('0');\n\n} else {\n console.log(answer);\n\n}\n}\n\nmain()", "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": 298, "cpu_time_ms": 64, "memory_kb": 30856}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s771682733", "group_id": "codeNet:p02612", "input_text": "const main = async () => {\n const input = require('fs').readFileSync('/dev/stdin', 'UTF-8').trim()\n\nconst num = parseInt(input).toLocaleString().split(',')\nconst answer = 1000 - parseInt(num[num.length - 1])\n\nif (answer === 1000) {\n console.log('1000');\n\n} else {\n console.log(answer);\n\n}\n}\n\nmain()", "language": "JavaScript", "metadata": {"date": 1596297380, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "medium_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/JavaScript/s771682733.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s771682733", "user_id": "u620230233"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "const main = async () => {\n const input = require('fs').readFileSync('/dev/stdin', 'UTF-8').trim()\n\nconst num = parseInt(input).toLocaleString().split(',')\nconst answer = 1000 - parseInt(num[num.length - 1])\n\nif (answer === 1000) {\n console.log('1000');\n\n} else {\n console.log(answer);\n\n}\n}\n\nmain()", "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": 301, "cpu_time_ms": 65, "memory_kb": 30896}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s918845134", "group_id": "codeNet:p02612", "input_text": "const main = async () => {\n const input = require('fs').readFileSync('/dev/stdin', 'UTF-8').trim()\n const n = input\n const bill = 1000\n const mod = n % bill\n const change = (bill - mod) % bill\n \n console.log(change)\n}\n\nmain()", "language": "JavaScript", "metadata": {"date": 1596290746, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "medium_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/JavaScript/s918845134.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s918845134", "user_id": "u209012153"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "const main = async () => {\n const input = require('fs').readFileSync('/dev/stdin', 'UTF-8').trim()\n const n = input\n const bill = 1000\n const mod = n % bill\n const change = (bill - mod) % bill\n \n console.log(change)\n}\n\nmain()", "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": 232, "cpu_time_ms": 66, "memory_kb": 29564}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s689108401", "group_id": "codeNet:p02612", "input_text": "function Main(input) {\n var payment = parseInt(input);\n if (payment % 1000 == 0) {\n console.log(0);\n } else {\n console.log(1000 - payment % 1000);\n }\n}\n//*この行以降は編集しないでください(標準入出力から一度に読み込み、Mainを呼び出します)\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "language": "JavaScript", "metadata": {"date": 1594871912, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "medium_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/JavaScript/s689108401.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s689108401", "user_id": "u995982668"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "function Main(input) {\n var payment = parseInt(input);\n if (payment % 1000 == 0) {\n console.log(0);\n } else {\n console.log(1000 - payment % 1000);\n }\n}\n//*この行以降は編集しないでください(標準入出力から一度に読み込み、Mainを呼び出します)\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "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": 361, "cpu_time_ms": 63, "memory_kb": 29588}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s923344457", "group_id": "codeNet:p02612", "input_text": "process.stdin.resume();\nprocess.stdin.setEncoding('utf8');\n\nvar input_lines = [];\nvar reader = require('readline').createInterface({\n input: process.stdin,\n output: process.stdout\n});\n\nreader.on('line', (line) => {\n input_lines.push(line)\n})\n\nreader.on('close', () => {\n value = parseInt(input_lines[0])\n while (value - 1000 > 0) {\n value = value - 1000;\n }\n console.log(1000 - value)\n})", "language": "JavaScript", "metadata": {"date": 1594177466, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "medium_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/JavaScript/s923344457.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s923344457", "user_id": "u119099532"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "process.stdin.resume();\nprocess.stdin.setEncoding('utf8');\n\nvar input_lines = [];\nvar reader = require('readline').createInterface({\n input: process.stdin,\n output: process.stdout\n});\n\nreader.on('line', (line) => {\n input_lines.push(line)\n})\n\nreader.on('close', () => {\n value = parseInt(input_lines[0])\n while (value - 1000 > 0) {\n value = value - 1000;\n }\n console.log(1000 - value)\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": 397, "cpu_time_ms": 75, "memory_kb": 29980}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s136513922", "group_id": "codeNet:p02612", "input_text": "consot n = Number(require('fs').readFileSync('/dev/stdin', 'utf8'))\nconsole.log(1000 - n % 1000)", "language": "JavaScript", "metadata": {"date": 1594006652, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "medium_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/JavaScript/s136513922.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s136513922", "user_id": "u944958519"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "consot n = Number(require('fs').readFileSync('/dev/stdin', 'utf8'))\nconsole.log(1000 - n % 1000)", "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": 96, "cpu_time_ms": 61, "memory_kb": 30040}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s515729766", "group_id": "codeNet:p02612", "input_text": "console.log(process.argv)", "language": "JavaScript", "metadata": {"date": 1594005934, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "medium_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/JavaScript/s515729766.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s515729766", "user_id": "u944958519"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "console.log(process.argv)", "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": 25, "cpu_time_ms": 65, "memory_kb": 29796}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s812057267", "group_id": "codeNet:p02612", "input_text": "function Main(input) {\n\tinput = input.split(\"\\n\");\n\t\n\tvar n = parseInt(input[0], 10);\n\t\n\tvar result = n\n\tfor (var i = 1; i < 11; i++) {\n\tif (result < 1000) {\n\tbreak;\n\t} else {\n\tresult = result - 1000;\n\t}\n\t}\n\t\n\tresult = 1000 - result\n\t\n\tconsole.log(result);\n\t}\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "language": "JavaScript", "metadata": {"date": 1593998174, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "medium_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/JavaScript/s812057267.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s812057267", "user_id": "u856141657"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "function Main(input) {\n\tinput = input.split(\"\\n\");\n\t\n\tvar n = parseInt(input[0], 10);\n\t\n\tvar result = n\n\tfor (var i = 1; i < 11; i++) {\n\tif (result < 1000) {\n\tbreak;\n\t} else {\n\tresult = result - 1000;\n\t}\n\t}\n\t\n\tresult = 1000 - result\n\t\n\tconsole.log(result);\n\t}\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "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": 316, "cpu_time_ms": 58, "memory_kb": 29692}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s614420265", "group_id": "codeNet:p02612", "input_text": "function main(input) {\n const inputs =input.split('\\n')\n const [N] = inputs[0].split(' ')\n if (N % 1000 === 0) {\n console.log(0)\n } else {\n console.log(\n (1000 - (N % 1000))\n )\n }\n}\n\nmain(require('fs').readFileSync('/dev/stdin', 'utf8').trim())\n", "language": "JavaScript", "metadata": {"date": 1593997996, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "medium_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/JavaScript/s614420265.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s614420265", "user_id": "u131856103"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "function main(input) {\n const inputs =input.split('\\n')\n const [N] = inputs[0].split(' ')\n if (N % 1000 === 0) {\n console.log(0)\n } else {\n console.log(\n (1000 - (N % 1000))\n )\n }\n}\n\nmain(require('fs').readFileSync('/dev/stdin', 'utf8').trim())\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": 264, "cpu_time_ms": 65, "memory_kb": 29688}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s438303425", "group_id": "codeNet:p02612", "input_text": "function Main(input) {\n\tinput = input.split(\"\\n\");\n\t\n\tvar n = parseInt(input[0], 10);\n\t\n\tvar result = n\n\tfor (var i = 1; i < 11; i++) {\n\tif (result < 1000) {\n\tbreak;\n\t} else {\n\tresult = result - 1000;\n\t}\n\t}\n\t\n\tconsole.log(result);\n\t}\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "language": "JavaScript", "metadata": {"date": 1593997979, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "medium_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/JavaScript/s438303425.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s438303425", "user_id": "u856141657"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "function Main(input) {\n\tinput = input.split(\"\\n\");\n\t\n\tvar n = parseInt(input[0], 10);\n\t\n\tvar result = n\n\tfor (var i = 1; i < 11; i++) {\n\tif (result < 1000) {\n\tbreak;\n\t} else {\n\tresult = result - 1000;\n\t}\n\t}\n\t\n\tconsole.log(result);\n\t}\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "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": 290, "cpu_time_ms": 64, "memory_kb": 29692}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s076171620", "group_id": "codeNet:p02612", "input_text": "// inputに入力データ全体が入る\nfunction Main(input) {\n // 1行目がinput[0], 2行目がinput[1], …に入る\n input = input.trim().split(\"\\n\");\n // const [X] = input[0].split(\" \").map((n) => parseInt(n));\n n = parseInt(input[0]) % 1000\n\n\n\n //出力\n console.log(n);\n}\n//*この行以降は編集しないでください(標準入出力から一度に読み込み、Mainを呼び出します)\n// Main(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));\nMain(require(\"fs\").readFileSync(\"./input.txt\", \"utf-8\"));\n", "language": "JavaScript", "metadata": {"date": 1593997856, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "medium_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/JavaScript/s076171620.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s076171620", "user_id": "u795511254"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "// inputに入力データ全体が入る\nfunction Main(input) {\n // 1行目がinput[0], 2行目がinput[1], …に入る\n input = input.trim().split(\"\\n\");\n // const [X] = input[0].split(\" \").map((n) => parseInt(n));\n n = parseInt(input[0]) % 1000\n\n\n\n //出力\n console.log(n);\n}\n//*この行以降は編集しないでください(標準入出力から一度に読み込み、Mainを呼び出します)\n// Main(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));\nMain(require(\"fs\").readFileSync(\"./input.txt\", \"utf-8\"));\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": 532, "cpu_time_ms": 57, "memory_kb": 30136}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s805617596", "group_id": "codeNet:p02612", "input_text": "function main(lines) {\n const N = +lines[0];\n \n let res;\n \n for (let i = 1000; i <= 10000; i += 1000) {\n if (i >= N) {\n res = i - N;\n break;\n }\n }\n \n console.log(res);\n}\n\n\nmain( require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\").trim().split(\"\\n\") );\n\n\n\nfunction splitN(s) {\n return s.split(' ').map(Number);\n}\n", "language": "JavaScript", "metadata": {"date": 1593997731, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "medium_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/JavaScript/s805617596.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s805617596", "user_id": "u686930335"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "function main(lines) {\n const N = +lines[0];\n \n let res;\n \n for (let i = 1000; i <= 10000; i += 1000) {\n if (i >= N) {\n res = i - N;\n break;\n }\n }\n \n console.log(res);\n}\n\n\nmain( require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\").trim().split(\"\\n\") );\n\n\n\nfunction splitN(s) {\n return s.split(' ').map(Number);\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": 334, "cpu_time_ms": 69, "memory_kb": 29692}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s666153367", "group_id": "codeNet:p02612", "input_text": "function Main(input) {\n const num = parseInt(input);\n console.log(1000 - (num%1000));\n}\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "language": "JavaScript", "metadata": {"date": 1593997428, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "medium_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/JavaScript/s666153367.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s666153367", "user_id": "u689311469"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "function Main(input) {\n const num = parseInt(input);\n console.log(1000 - (num%1000));\n}\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "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": 145, "cpu_time_ms": 67, "memory_kb": 29696}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s316638681", "group_id": "codeNet:p02612", "input_text": "function Main(input) {\n input = input.trim().split(\"\\n\").map(function(x) { return x.split(\" \")});\n var N = parseInt(input[0][0], 10);\n ans = Math.ceil(N / 1000) * 1000 - N;\n console.log(ans);\n}\n\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\")); ", "language": "JavaScript", "metadata": {"date": 1593997319, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "medium_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/JavaScript/s316638681.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s316638681", "user_id": "u624950076"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "function Main(input) {\n input = input.trim().split(\"\\n\").map(function(x) { return x.split(\" \")});\n var N = parseInt(input[0][0], 10);\n ans = Math.ceil(N / 1000) * 1000 - N;\n console.log(ans);\n}\n\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\")); ", "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": 263, "cpu_time_ms": 66, "memory_kb": 29684}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s736079091", "group_id": "codeNet:p02612", "input_text": "\"use strict\";\nvar input=require(\"fs\").readFileSync(\"/dev/stdin\",\"utf8\");\nvar cin=input.split(/ |\\n/),cid=0;\nfunction next(){return +cin[cid++];}\nfunction nextstr(){return cin[cid++];}\nfunction nextbig(){return BigInt(cin[cid++]);}\nfunction nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}\nfunction nextm(h,w,a){var r=[],i=0;if(a)for(;i+a));return r;}\nfunction xArray(v){var a=arguments,l=a.length,r=\"Array(a[\"+--l+\"]).fill().map(x=>{return \"+v+\";})\";while(--l)r=\"Array(a[\"+l+\"]).fill().map(x=>\"+r+\")\";return eval(r);}\n\nvar myOut = main();\nif(myOut !== undefined)console.log(String(myOut));\n\nfunction main(){\n var n = next();\n return (1000-n%1000)%1000;\n}", "language": "JavaScript", "metadata": {"date": 1593997279, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02612.html", "problem_id": "p02612", "resource_group": "medium_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/JavaScript/s736079091.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s736079091", "user_id": "u643613120"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "\"use strict\";\nvar input=require(\"fs\").readFileSync(\"/dev/stdin\",\"utf8\");\nvar cin=input.split(/ |\\n/),cid=0;\nfunction next(){return +cin[cid++];}\nfunction nextstr(){return cin[cid++];}\nfunction nextbig(){return BigInt(cin[cid++]);}\nfunction nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}\nfunction nextm(h,w,a){var r=[],i=0;if(a)for(;i+a));return r;}\nfunction xArray(v){var a=arguments,l=a.length,r=\"Array(a[\"+--l+\"]).fill().map(x=>{return \"+v+\";})\";while(--l)r=\"Array(a[\"+l+\"]).fill().map(x=>\"+r+\")\";return eval(r);}\n\nvar myOut = main();\nif(myOut !== undefined)console.log(String(myOut));\n\nfunction main(){\n var n = next();\n return (1000-n%1000)%1000;\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": 775, "cpu_time_ms": 61, "memory_kb": 29688}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s375938172", "group_id": "codeNet:p02618", "input_text": "var toInt = x=>parseInt(x,10);\nvar toIntArr = arr=>arr.map(x=>toInt(x));\nvar abs = x=>x>0?x:-x;\nfunction min(){var rest = arguments,val=rest[0];for(var i=1;ival)val = rest[i];return val}\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));\n \nfunction Main(input){\n\tvar input = input.split('\\n');\n\tinput = input.map(e => toIntArr(e.split(' ')));\n\tvar d = input[0][0];\n\tvar cs = input[1];\n\tvar ss = input.slice(2);\n\t//var ts = input.slice(d+2).map(e=>e[0]);\n\t\n\tvar score = 0;\n\tvar ans = [];\n\tlet type;\n\tvar lastday = [];\n\tlastday.length = 26;\n\tlastday.fill(-1);\n\n\t//let scoreDay = [];\n\n\t//day(0~25)にtype(1~26)を選んだ場合の満足度の変化(lastdayのdayは0~)\n\tfunction getScore(day,type){\n\t\tlet ans = 0;\n\t\tans += ss[day][type-1];\n\t\tfor(let t = 0; t < 26; t++){\n\t\t\tif(t!==type-1) ans -= cs[t] * (day - lastday[t]);\n\t\t}\n\t\treturn ans;\n\t}\n\n\tvar tempScore = [];\n\tlet maxType = 1;\n\tfor(let i = 0; i < d; i++){\n\ttempScore.fill(0);\n\n\t\tfor(j = 0; j < 26; j++){\n\t\t\ttempScore[j] = getScore(i,j+1);\n\t\t}\n\t\tmaxType = tempScore.indexOf(Math.max(...tempScore)) +1; //0~25 +1\n\n\n\t\ttype = maxType;\n\t\tans.push(type);\n\t\tlastday[type-1] = i;\n\n\t\tscore += tempScore[type];\n\n\t\t//scoreDay[i] = score;\n\n\t}\n\n\tconsole.log(ans.join('\\n'));\n}", "language": "JavaScript", "metadata": {"date": 1593394845, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02618.html", "problem_id": "p02618", "resource_group": "medium_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/JavaScript/s375938172.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s375938172", "user_id": "u511119682"}, "prompt_components": {"gold_output": "1\n17\n13\n14\n13\n", "input_to_evaluate": "var toInt = x=>parseInt(x,10);\nvar toIntArr = arr=>arr.map(x=>toInt(x));\nvar abs = x=>x>0?x:-x;\nfunction min(){var rest = arguments,val=rest[0];for(var i=1;ival)val = rest[i];return val}\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));\n \nfunction Main(input){\n\tvar input = input.split('\\n');\n\tinput = input.map(e => toIntArr(e.split(' ')));\n\tvar d = input[0][0];\n\tvar cs = input[1];\n\tvar ss = input.slice(2);\n\t//var ts = input.slice(d+2).map(e=>e[0]);\n\t\n\tvar score = 0;\n\tvar ans = [];\n\tlet type;\n\tvar lastday = [];\n\tlastday.length = 26;\n\tlastday.fill(-1);\n\n\t//let scoreDay = [];\n\n\t//day(0~25)にtype(1~26)を選んだ場合の満足度の変化(lastdayのdayは0~)\n\tfunction getScore(day,type){\n\t\tlet ans = 0;\n\t\tans += ss[day][type-1];\n\t\tfor(let t = 0; t < 26; t++){\n\t\t\tif(t!==type-1) ans -= cs[t] * (day - lastday[t]);\n\t\t}\n\t\treturn ans;\n\t}\n\n\tvar tempScore = [];\n\tlet maxType = 1;\n\tfor(let i = 0; i < d; i++){\n\ttempScore.fill(0);\n\n\t\tfor(j = 0; j < 26; j++){\n\t\t\ttempScore[j] = getScore(i,j+1);\n\t\t}\n\t\tmaxType = tempScore.indexOf(Math.max(...tempScore)) +1; //0~25 +1\n\n\n\t\ttype = maxType;\n\t\tans.push(type);\n\t\tlastday[type-1] = i;\n\n\t\tscore += tempScore[type];\n\n\t\t//scoreDay[i] = score;\n\n\t}\n\n\tconsole.log(ans.join('\\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": 1371, "cpu_time_ms": 73, "memory_kb": 33448}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s045206750", "group_id": "codeNet:p02618", "input_text": "'use strict'\n\nfunction main(input) {\n const inputRows = input.split('\\n');\n const d = parseInt(inputRows[0])\n let cStrArray = inputRows[1].split(' ')\n const c = cStrArray.map(str => parseInt(str))\n let s = []\n for (let i = 2; i < inputRows.length; i++) {\n s.push([])\n const tmpRow = inputRows[i].split(' ')\n for (let j = 0; j < tmpRow.length; j++) {\n s[i - 2].push(parseInt(tmpRow[j]))\n }\n }\n\n let t = []\n\n for (let i = 0; i < s.length; i++) {\n let tmpMax = s[i][0]\n let index = 0\n for (let j = 1; j < s[i].length; j++) {\n if (s[i][j] > tmpMax) {\n index = j\n tmpMax = s[i][j]\n }\n }\n t.push(index + 1)\n }\n\n console.log(t)\n}\n\nmain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));\n\nmain(input)", "language": "JavaScript", "metadata": {"date": 1593393906, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02618.html", "problem_id": "p02618", "resource_group": "medium_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/JavaScript/s045206750.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s045206750", "user_id": "u657106601"}, "prompt_components": {"gold_output": "1\n17\n13\n14\n13\n", "input_to_evaluate": "'use strict'\n\nfunction main(input) {\n const inputRows = input.split('\\n');\n const d = parseInt(inputRows[0])\n let cStrArray = inputRows[1].split(' ')\n const c = cStrArray.map(str => parseInt(str))\n let s = []\n for (let i = 2; i < inputRows.length; i++) {\n s.push([])\n const tmpRow = inputRows[i].split(' ')\n for (let j = 0; j < tmpRow.length; j++) {\n s[i - 2].push(parseInt(tmpRow[j]))\n }\n }\n\n let t = []\n\n for (let i = 0; i < s.length; i++) {\n let tmpMax = s[i][0]\n let index = 0\n for (let j = 1; j < s[i].length; j++) {\n if (s[i][j] > tmpMax) {\n index = j\n tmpMax = s[i][j]\n }\n }\n t.push(index + 1)\n }\n\n console.log(t)\n}\n\nmain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));\n\nmain(input)", "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": 759, "cpu_time_ms": 73, "memory_kb": 31528}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s558806453", "group_id": "codeNet:p02623", "input_text": "const main = (input) => {\n input = input.trim().split('\\n')\n const [n, m, k] = input[0].split(' ').map(BigInt)\n const a = input[1].split(' ').map(BigInt)\n const b = input[2].split(' ').map(BigInt)\n\n let ans = 0\n\n const a_read = [], b_read = []\n let a_sum = 0n, b_sum = 0n\n\n for (let i=0; i k && b_read.length) b_sum -= b_read.pop()\n\n if (a_sum + b_sum > k) break\n\n ans = Math.max(ans, a_read.length + b_read.length)\n }\n\n return console.log(ans)\n}\n\nprocess.env.MYTEST ? test() : main(require('fs').readFileSync('/dev/stdin', 'utf8'))", "language": "JavaScript", "metadata": {"date": 1598490466, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s558806453.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s558806453", "user_id": "u124735330"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "const main = (input) => {\n input = input.trim().split('\\n')\n const [n, m, k] = input[0].split(' ').map(BigInt)\n const a = input[1].split(' ').map(BigInt)\n const b = input[2].split(' ').map(BigInt)\n\n let ans = 0\n\n const a_read = [], b_read = []\n let a_sum = 0n, b_sum = 0n\n\n for (let i=0; i k && b_read.length) b_sum -= b_read.pop()\n\n if (a_sum + b_sum > k) break\n\n ans = Math.max(ans, a_read.length + b_read.length)\n }\n\n return console.log(ans)\n}\n\nprocess.env.MYTEST ? test() : main(require('fs').readFileSync('/dev/stdin', 'utf8'))", "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": 767, "cpu_time_ms": 261, "memory_kb": 100280}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s196832597", "group_id": "codeNet:p02623", "input_text": "const main = async () => {\n 'use strict'\n const input = require('fs').readFileSync('/dev/stdin', 'UTF-8').trim()\n \n let setting = input.split('\\n')\n\n const setting_1 = setting[0].split(' ')\n const setting_2 = setting[1].split(' ').map( str => parseInt(str, 10) )\n const setting_3 = setting[2].split(' ').map( str => parseInt(str, 10) )\n\n const a_table_book = setting_1[0] - 0\n const b_table_book = setting_1[1] - 0\n let time_sum = setting_1[2] - 0\n\n\n let count = 0\n\n let book_arr = setting_2.concat(setting_3)\n book_arr.sort(function(a,b){\n if( a < b ) return -1;\n if( a > b ) return 1;\n return 0;\n });\n\n\n while (time_sum > 0 || book_arr.length > 0) {\n if (time_sum >= book_arr[0]) {\n time_sum -= book_arr[0]\n book_arr.shift()\n count++\n } else {\n break\n }\n }\n\n console.log(count)\n\n}\n\nmain()", "language": "JavaScript", "metadata": {"date": 1596374757, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s196832597.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s196832597", "user_id": "u620230233"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "const main = async () => {\n 'use strict'\n const input = require('fs').readFileSync('/dev/stdin', 'UTF-8').trim()\n \n let setting = input.split('\\n')\n\n const setting_1 = setting[0].split(' ')\n const setting_2 = setting[1].split(' ').map( str => parseInt(str, 10) )\n const setting_3 = setting[2].split(' ').map( str => parseInt(str, 10) )\n\n const a_table_book = setting_1[0] - 0\n const b_table_book = setting_1[1] - 0\n let time_sum = setting_1[2] - 0\n\n\n let count = 0\n\n let book_arr = setting_2.concat(setting_3)\n book_arr.sort(function(a,b){\n if( a < b ) return -1;\n if( a > b ) return 1;\n return 0;\n });\n\n\n while (time_sum > 0 || book_arr.length > 0) {\n if (time_sum >= book_arr[0]) {\n time_sum -= book_arr[0]\n book_arr.shift()\n count++\n } else {\n break\n }\n }\n\n console.log(count)\n\n}\n\nmain()", "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": 2207, "memory_kb": 69440}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s098951248", "group_id": "codeNet:p02623", "input_text": "const readLines = (input) => input.split('\\n')\nconst println = (value) => console.log(value)\nconst readInt = (input) => parseInt(input, 10)\nconst readIntList = (input) => input.split(' ').map(n => parseInt(n, 10))\nconst naturalOrder = (a, b) => {\n if (b == a) return 0\n return (a < b) ? -1 : 1\n}\n\nfunction main(input) {\n const lines = readLines(input)\n const [n, m, k] = readIntList(lines[0])\n const aArray = readIntList(lines[1]).sort(naturalOrder)\n const bArray = readIntList(lines[2]).sort(naturalOrder)\n\n let aSum = aArray.reduce((acc, a) => acc + a)\n let bSum = bArray.reduce((acc, b) => acc + b)\n let nonReadCount = 0\n let ai = aArray.length - 1\n let bi = bArray.length - 1\n while (aSum + bSum > k) {\n if (ai < 0 && bi < 0) {\n break\n }\n\n nonReadCount++\n\n if (ai < 0) {\n bSum -= bArray[bi]\n bi--\n continue\n } else if (bi < 0) {\n aSum -= aArray[ai]\n ai--\n continue\n }\n\n if (aArray[ai] < bArray[bi]) {\n bSum -= bArray[bi]\n bi--\n } else {\n aSum -= aArray[ai]\n ai--\n }\n }\n println(aArray.length + bArray.length - nonReadCount)\n}\n\nmain(require('fs').readFileSync('/dev/stdin', 'utf8'));\n", "language": "JavaScript", "metadata": {"date": 1595744280, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s098951248.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s098951248", "user_id": "u784448849"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "const readLines = (input) => input.split('\\n')\nconst println = (value) => console.log(value)\nconst readInt = (input) => parseInt(input, 10)\nconst readIntList = (input) => input.split(' ').map(n => parseInt(n, 10))\nconst naturalOrder = (a, b) => {\n if (b == a) return 0\n return (a < b) ? -1 : 1\n}\n\nfunction main(input) {\n const lines = readLines(input)\n const [n, m, k] = readIntList(lines[0])\n const aArray = readIntList(lines[1]).sort(naturalOrder)\n const bArray = readIntList(lines[2]).sort(naturalOrder)\n\n let aSum = aArray.reduce((acc, a) => acc + a)\n let bSum = bArray.reduce((acc, b) => acc + b)\n let nonReadCount = 0\n let ai = aArray.length - 1\n let bi = bArray.length - 1\n while (aSum + bSum > k) {\n if (ai < 0 && bi < 0) {\n break\n }\n\n nonReadCount++\n\n if (ai < 0) {\n bSum -= bArray[bi]\n bi--\n continue\n } else if (bi < 0) {\n aSum -= aArray[ai]\n ai--\n continue\n }\n\n if (aArray[ai] < bArray[bi]) {\n bSum -= bArray[bi]\n bi--\n } else {\n aSum -= aArray[ai]\n ai--\n }\n }\n println(aArray.length + bArray.length - nonReadCount)\n}\n\nmain(require('fs').readFileSync('/dev/stdin', 'utf8'));\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": 1313, "cpu_time_ms": 291, "memory_kb": 63480}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s548032959", "group_id": "codeNet:p02623", "input_text": "process.stdin.resume();\nprocess.stdin.setEncoding('utf8');\n\nvar input_lines = [];\nvar reader = require('readline').createInterface({\n input: process.stdin,\n output: process.stdout\n});\n\nvar row = 0\nreader.on('line', (line) => {\n var column = line.split(\" \")\n var new_input_lines = []\n for(var i=0;i {\n //console.log(input_lines);\n var a_book = input_lines[1], a_turn = 0;\n var b_book = input_lines[2], b_turn = 0;\n var total_time = input_lines[0][2];\n var sum_time = 0;\n var sum_book = 0;\n\n while(true){\n //console.log(\"A = \" + a_book[a_turn]);\n //console.log(\"B = \" + b_book[b_turn]);\n if(a_book[a_turn] != null && b_book[b_turn] != null){\n if(a_book[a_turn] <= b_book[b_turn]){\n sum_time += a_book[a_turn];\n //console.log(sum_time);\n a_turn ++;\n } else {\n sum_time += b_book[b_turn];\n //console.log(sum_time);\n b_turn ++;\n }\n } else if(a_book[a_turn] != null && b_book[b_turn] == null){\n sum_time += a_book[a_turn];\n //console.log(sum_time);\n a_turn ++;\n } else if(a_book[a_turn] == null && b_book[b_turn] != null){\n sum_time += b_book[b_turn];\n //console.log(sum_time);\n b_turn ++;\n } else if(a_book[a_turn] == null && b_book[b_turn] == null){\n break;\n }\n\n if(sum_time <= total_time){\n sum_book ++;\n } else {\n break;\n }\n }\n\n console.log(sum_book);\n\n\n});\n", "language": "JavaScript", "metadata": {"date": 1594828647, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s548032959.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s548032959", "user_id": "u221893075"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "process.stdin.resume();\nprocess.stdin.setEncoding('utf8');\n\nvar input_lines = [];\nvar reader = require('readline').createInterface({\n input: process.stdin,\n output: process.stdout\n});\n\nvar row = 0\nreader.on('line', (line) => {\n var column = line.split(\" \")\n var new_input_lines = []\n for(var i=0;i {\n //console.log(input_lines);\n var a_book = input_lines[1], a_turn = 0;\n var b_book = input_lines[2], b_turn = 0;\n var total_time = input_lines[0][2];\n var sum_time = 0;\n var sum_book = 0;\n\n while(true){\n //console.log(\"A = \" + a_book[a_turn]);\n //console.log(\"B = \" + b_book[b_turn]);\n if(a_book[a_turn] != null && b_book[b_turn] != null){\n if(a_book[a_turn] <= b_book[b_turn]){\n sum_time += a_book[a_turn];\n //console.log(sum_time);\n a_turn ++;\n } else {\n sum_time += b_book[b_turn];\n //console.log(sum_time);\n b_turn ++;\n }\n } else if(a_book[a_turn] != null && b_book[b_turn] == null){\n sum_time += a_book[a_turn];\n //console.log(sum_time);\n a_turn ++;\n } else if(a_book[a_turn] == null && b_book[b_turn] != null){\n sum_time += b_book[b_turn];\n //console.log(sum_time);\n b_turn ++;\n } else if(a_book[a_turn] == null && b_book[b_turn] == null){\n break;\n }\n\n if(sum_time <= total_time){\n sum_book ++;\n } else {\n break;\n }\n }\n\n console.log(sum_book);\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": 1540, "cpu_time_ms": 217, "memory_kb": 72184}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s390653094", "group_id": "codeNet:p02623", "input_text": "process.stdin.resume();\nprocess.stdin.setEncoding('utf8');\n\nvar input_lines = [];\nvar reader = require('readline').createInterface({\n input: process.stdin,\n output: process.stdout\n});\n\nvar row = 0\nreader.on('line', (line) => {\n var column = line.split(\" \")\n var new_input_lines = []\n for(var i=0;i {\n //console.log(input_lines);\n var a_book = input_lines[1], a_turn = 0;\n var b_book = input_lines[2], b_turn = 0;\n var total_time = input_lines[0][2];\n var sum_time = 0;\n var sum_book = 0;\n\n while(true){\n //console.log(\"A = \" + a_book[a_turn]);\n //console.log(\"B = \" + b_book[b_turn]);\n if(a_book[a_turn] != null && b_book[b_turn] != null){\n if(a_book[a_turn] <= b_book[b_turn]){\n sum_time += a_book[a_turn];\n //console.log(sum_time);\n a_turn ++;\n } else {\n sum_time += b_book[b_turn];\n //console.log(sum_time);\n b_turn ++;\n }\n } else if(a_book[a_turn] != null && b_book[b_turn] == null){\n sum_time += a_book[a_turn];\n //console.log(sum_time);\n a_turn ++;\n } else if(a_book[a_turn] == null && b_book[b_turn] != null){\n sum_time += b_book[b_turn];\n //console.log(sum_time);\n b_turn ++;\n } else if(a_book[a_turn] == null && b_book[b_turn] == null){\n break;\n }\n\n if(sum_time <= total_time){\n sum_book ++;\n } else {\n break;\n }\n }\n\n console.log(sum_book);\n\n\n});\n", "language": "JavaScript", "metadata": {"date": 1594828478, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s390653094.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s390653094", "user_id": "u221893075"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "process.stdin.resume();\nprocess.stdin.setEncoding('utf8');\n\nvar input_lines = [];\nvar reader = require('readline').createInterface({\n input: process.stdin,\n output: process.stdout\n});\n\nvar row = 0\nreader.on('line', (line) => {\n var column = line.split(\" \")\n var new_input_lines = []\n for(var i=0;i {\n //console.log(input_lines);\n var a_book = input_lines[1], a_turn = 0;\n var b_book = input_lines[2], b_turn = 0;\n var total_time = input_lines[0][2];\n var sum_time = 0;\n var sum_book = 0;\n\n while(true){\n //console.log(\"A = \" + a_book[a_turn]);\n //console.log(\"B = \" + b_book[b_turn]);\n if(a_book[a_turn] != null && b_book[b_turn] != null){\n if(a_book[a_turn] <= b_book[b_turn]){\n sum_time += a_book[a_turn];\n //console.log(sum_time);\n a_turn ++;\n } else {\n sum_time += b_book[b_turn];\n //console.log(sum_time);\n b_turn ++;\n }\n } else if(a_book[a_turn] != null && b_book[b_turn] == null){\n sum_time += a_book[a_turn];\n //console.log(sum_time);\n a_turn ++;\n } else if(a_book[a_turn] == null && b_book[b_turn] != null){\n sum_time += b_book[b_turn];\n //console.log(sum_time);\n b_turn ++;\n } else if(a_book[a_turn] == null && b_book[b_turn] == null){\n break;\n }\n\n if(sum_time <= total_time){\n sum_book ++;\n } else {\n break;\n }\n }\n\n console.log(sum_book);\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": 1540, "cpu_time_ms": 192, "memory_kb": 71984}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s755718405", "group_id": "codeNet:p02623", "input_text": "function Main(input) {\n input = input.trim().split('\\n');\n const k = parseInt(input[0].split(' ')[2], 10);\n const a = input[1].split(' ');\n const b = input[2].split(' ');\n\n let t = 0;\n for(let i=0; i 0 && t > k) {\n j--;\n t -= parseInt(b[j]);\n }\n if(t > k) break;\n if(ans < i+j) ans = i+j;\n if(i === a.length) break;\n t += parseInt(a[i], 10);\n }\n console.log(ans);\n}\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));\n", "language": "JavaScript", "metadata": {"date": 1594703146, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s755718405.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s755718405", "user_id": "u016566044"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "function Main(input) {\n input = input.trim().split('\\n');\n const k = parseInt(input[0].split(' ')[2], 10);\n const a = input[1].split(' ');\n const b = input[2].split(' ');\n\n let t = 0;\n for(let i=0; i 0 && t > k) {\n j--;\n t -= parseInt(b[j]);\n }\n if(t > k) break;\n if(ans < i+j) ans = i+j;\n if(i === a.length) break;\n t += parseInt(a[i], 10);\n }\n console.log(ans);\n}\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));\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": 169, "memory_kb": 68000}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s563306931", "group_id": "codeNet:p02623", "input_text": "Main = input => {\n const [r1, r2, r3] = input.split(\"\\n\");\n const [n, m, k] = r1.split(\" \").map(Number);\n const a = r2.split(\" \").map(Number);\n const b = r3.split(\" \").map(Number);\n // 読む冊数\n for (let i = 1; i <= n + m; i++) {\n // 読めるか\n let canRead = false;\n for (let ai = 0; ai <= i && !canRead; ai++) {\n // bの冊数\n const bi = i - ai;\n // aにかかる時間\n const atime = a.filter((v, j) => j < ai).reduce((x, y) => x + y, 0);\n // bにかかる時間\n const btime = b.filter((v, j) => j < bi).reduce((x, y) => x + y, 0);\n // 総計\n const alltime = atime + btime;\n // 読めるか判定\n if (alltime <= k) canRead = true;\n }\n // 読めなかったら終わり\n if (!canRead) {\n console.log(i - 1);\n break;\n }\n // 全部読めてもおわり\n if (canRead && i == n + m) {\n console.log(i);\n break;\n }\n }\n};\n Main(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\").trim());", "language": "JavaScript", "metadata": {"date": 1594006485, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s563306931.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s563306931", "user_id": "u406545142"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "Main = input => {\n const [r1, r2, r3] = input.split(\"\\n\");\n const [n, m, k] = r1.split(\" \").map(Number);\n const a = r2.split(\" \").map(Number);\n const b = r3.split(\" \").map(Number);\n // 読む冊数\n for (let i = 1; i <= n + m; i++) {\n // 読めるか\n let canRead = false;\n for (let ai = 0; ai <= i && !canRead; ai++) {\n // bの冊数\n const bi = i - ai;\n // aにかかる時間\n const atime = a.filter((v, j) => j < ai).reduce((x, y) => x + y, 0);\n // bにかかる時間\n const btime = b.filter((v, j) => j < bi).reduce((x, y) => x + y, 0);\n // 総計\n const alltime = atime + btime;\n // 読めるか判定\n if (alltime <= k) canRead = true;\n }\n // 読めなかったら終わり\n if (!canRead) {\n console.log(i - 1);\n break;\n }\n // 全部読めてもおわり\n if (canRead && i == n + m) {\n console.log(i);\n break;\n }\n }\n};\n Main(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\").trim());", "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": 997, "cpu_time_ms": 2207, "memory_kb": 58440}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s778007391", "group_id": "codeNet:p02623", "input_text": "function main(input) {\n const [n, m, k] = shaping(input[0]);\n const a = shaping(input[1]);\n const b = shaping(input[2]);\n if (a[0] > k && b[0] > k) { return console.log(0); };\n let timeA = [0];\n let timeB = [0];\n let sumTime = 0;\n let ans = [0];\n //必要最低限のAの累積和\n for (let i = 0; i < n; i++){\n sumTime += a[i];\n if (sumTime == k) {\n timeA.push(sumTime);\n break;\n } else if(sumTime > k){\n break;\n }\n timeA.push(sumTime);\n }\n sumTime = 0;\n for (let i = 0; i < m; i++){\n sumTime += b[i];\n if (sumTime == k) {\n timeB.push(sumTime);\n break;\n } else if (sumTime > k) {\n break;\n }\n timeB.push(sumTime);\n }\n let i = 0;\n let j = timeB.length-1;\n\n while (i < timeA.length) {\n while (j > -1) {\n if (timeB[j] <= k - timeA[i]) {\n ans.push(i + j);\n break;\n } else {\n j--;\n }\n }\n i++;\n }\n console.log(Math.max(...ans));\n}\n \nfunction shaping(arr) { \n return arr.split(' ').map(Number);\n}\n\n\nmain(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split(\"\\n\"));\n", "language": "JavaScript", "metadata": {"date": 1593918231, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s778007391.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s778007391", "user_id": "u102602390"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "function main(input) {\n const [n, m, k] = shaping(input[0]);\n const a = shaping(input[1]);\n const b = shaping(input[2]);\n if (a[0] > k && b[0] > k) { return console.log(0); };\n let timeA = [0];\n let timeB = [0];\n let sumTime = 0;\n let ans = [0];\n //必要最低限のAの累積和\n for (let i = 0; i < n; i++){\n sumTime += a[i];\n if (sumTime == k) {\n timeA.push(sumTime);\n break;\n } else if(sumTime > k){\n break;\n }\n timeA.push(sumTime);\n }\n sumTime = 0;\n for (let i = 0; i < m; i++){\n sumTime += b[i];\n if (sumTime == k) {\n timeB.push(sumTime);\n break;\n } else if (sumTime > k) {\n break;\n }\n timeB.push(sumTime);\n }\n let i = 0;\n let j = timeB.length-1;\n\n while (i < timeA.length) {\n while (j > -1) {\n if (timeB[j] <= k - timeA[i]) {\n ans.push(i + j);\n break;\n } else {\n j--;\n }\n }\n i++;\n }\n console.log(Math.max(...ans));\n}\n \nfunction shaping(arr) { \n return arr.split(' ').map(Number);\n}\n\n\nmain(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split(\"\\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": 1289, "cpu_time_ms": 170, "memory_kb": 70164}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s301171455", "group_id": "codeNet:p02623", "input_text": "function main(input) {\n const [n, m, k] = shaping(input[0]);\n const a = shaping(input[1]);\n const b = shaping(input[2]);\n if (a[0] > k && b[0] > k) { return console.log(0); };\n let timeA = new Array();\n let timeB = new Array();\n let sumTime = 0;\n let ans = new Array();\n //必要最低限のAの累積和\n for (let i = 0; i < n; i++){\n sumTime += a[i];\n if (sumTime >= k) {\n if (sumTime = k) {\n ans.push(timeA.length);\n console.log(timeA.length);\n break;\n } else {\n ans.push(timeA.length - 1);\n break;\n }\n }\n timeA.push(sumTime);\n }\n sumTime = 0;\n for (let i = 0; i < m; i++){\n sumTime += b[i];\n if (sumTime >= k) {\n if (sumTime = k) {\n ans.push(timeB.length);\n break;\n } else {\n ans.push(timeB.length - 1);\n break;\n }\n }\n timeB.push(sumTime);\n }\n console.log(timeA);\n console.log(timeB);\n \n let i = 0;\n let j = timeB.length-1;\n\n while (i < timeA.length) {\n while (j > -1) {\n if (timeB[j] <= k - timeA[i]) {\n ans.push(i + j + 2);\n break;\n } else {\n j--;\n }\n }\n i++;\n }\n console.log(Math.max(...ans));\n}\n \nfunction shaping(arr) { \n return arr.split(' ').map(Number);\n}\n\n\nmain(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split(\"\\n\"));\n", "language": "JavaScript", "metadata": {"date": 1593912489, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s301171455.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s301171455", "user_id": "u102602390"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "function main(input) {\n const [n, m, k] = shaping(input[0]);\n const a = shaping(input[1]);\n const b = shaping(input[2]);\n if (a[0] > k && b[0] > k) { return console.log(0); };\n let timeA = new Array();\n let timeB = new Array();\n let sumTime = 0;\n let ans = new Array();\n //必要最低限のAの累積和\n for (let i = 0; i < n; i++){\n sumTime += a[i];\n if (sumTime >= k) {\n if (sumTime = k) {\n ans.push(timeA.length);\n console.log(timeA.length);\n break;\n } else {\n ans.push(timeA.length - 1);\n break;\n }\n }\n timeA.push(sumTime);\n }\n sumTime = 0;\n for (let i = 0; i < m; i++){\n sumTime += b[i];\n if (sumTime >= k) {\n if (sumTime = k) {\n ans.push(timeB.length);\n break;\n } else {\n ans.push(timeB.length - 1);\n break;\n }\n }\n timeB.push(sumTime);\n }\n console.log(timeA);\n console.log(timeB);\n \n let i = 0;\n let j = timeB.length-1;\n\n while (i < timeA.length) {\n while (j > -1) {\n if (timeB[j] <= k - timeA[i]) {\n ans.push(i + j + 2);\n break;\n } else {\n j--;\n }\n }\n i++;\n }\n console.log(Math.max(...ans));\n}\n \nfunction shaping(arr) { \n return arr.split(' ').map(Number);\n}\n\n\nmain(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split(\"\\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": 1573, "cpu_time_ms": 192, "memory_kb": 71268}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s263630534", "group_id": "codeNet:p02623", "input_text": "//let input = \"3 8 730\\n60 90 120\\n80 150 80 150 11 11 11 11 11\";\n\nfunction main(input){\n\tinput = input.trim();\n \tlet N = parseInt(input.split(\"\\n\")[0].split(\" \")[0]);\n \tlet M = parseInt(input.split(\"\\n\")[0].split(\" \")[1]);\n\tlet K = parseInt(input.split(\"\\n\")[0].split(\" \")[2]);\n \n\tlet nBooks = input.split(\"\\n\")[1].split(\" \");\n \tfor(let i=0; iK){nBooksKei.pop();}\n \tif(mBooksKei[mBooksKei.length-1]>K){mBooksKei.pop();}\n \n \tnBooksKei.unshift(0);\n \tmBooksKei.unshift(0);\n\n \t// console.log(K);\n\t// console.log(nBooksKei);\n \t// console.log(mBooksKei);\n \n\tlet kiroku = 0;\n \tlet sinKiroku = 0;\n \tlet bestJ = M;\n \tfor(let i=0; nBooks[i] < K; i++){\n for(let j=bestJ; j>0; j--){\n if(nBooksKei[i] + mBooksKei[j] <= K){\n \tkiroku = i + j;\n \tbestJ = j;\n \t// console.log(i + \":\" + j);\n \tif(kiroku>sinKiroku){sinKiroku=kiroku;}\n break;\n }\n }\n }\n \tconsole.log(sinKiroku);\n}//main(input);\nmain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));\n", "language": "JavaScript", "metadata": {"date": 1593898431, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s263630534.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s263630534", "user_id": "u028542581"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "//let input = \"3 8 730\\n60 90 120\\n80 150 80 150 11 11 11 11 11\";\n\nfunction main(input){\n\tinput = input.trim();\n \tlet N = parseInt(input.split(\"\\n\")[0].split(\" \")[0]);\n \tlet M = parseInt(input.split(\"\\n\")[0].split(\" \")[1]);\n\tlet K = parseInt(input.split(\"\\n\")[0].split(\" \")[2]);\n \n\tlet nBooks = input.split(\"\\n\")[1].split(\" \");\n \tfor(let i=0; iK){nBooksKei.pop();}\n \tif(mBooksKei[mBooksKei.length-1]>K){mBooksKei.pop();}\n \n \tnBooksKei.unshift(0);\n \tmBooksKei.unshift(0);\n\n \t// console.log(K);\n\t// console.log(nBooksKei);\n \t// console.log(mBooksKei);\n \n\tlet kiroku = 0;\n \tlet sinKiroku = 0;\n \tlet bestJ = M;\n \tfor(let i=0; nBooks[i] < K; i++){\n for(let j=bestJ; j>0; j--){\n if(nBooksKei[i] + mBooksKei[j] <= K){\n \tkiroku = i + j;\n \tbestJ = j;\n \t// console.log(i + \":\" + j);\n \tif(kiroku>sinKiroku){sinKiroku=kiroku;}\n break;\n }\n }\n }\n \tconsole.log(sinKiroku);\n}//main(input);\nmain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));\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": 1504, "cpu_time_ms": 154, "memory_kb": 60368}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s176770178", "group_id": "codeNet:p02623", "input_text": "function main(input){\n\tinput = input.trim();\n \tlet N = parseInt(input.split(\"\\n\")[0].split(\" \")[0]);\n \tlet M = parseInt(input.split(\"\\n\")[0].split(\" \")[1]);\n\tlet K = parseInt(input.split(\"\\n\")[0].split(\" \")[2]);\n \n\tlet nBooks = input.split(\"\\n\")[1].split(\" \");\n \tfor(let i=0; iK){break;}\n kiroku = i + j;\n console.log(goukei+\" \"+i+\"(\"+nKei+\") \"+j+\"(\"+(goukei-nKei)+\") \"+kiroku);\n if(kiroku>sinKiroku){sinKiroku=kiroku;}\n }\n }\n \n \tconsole.log(sinKiroku);\n}\n//main(input);\nmain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));\n", "language": "JavaScript", "metadata": {"date": 1593895608, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s176770178.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s176770178", "user_id": "u028542581"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "function main(input){\n\tinput = input.trim();\n \tlet N = parseInt(input.split(\"\\n\")[0].split(\" \")[0]);\n \tlet M = parseInt(input.split(\"\\n\")[0].split(\" \")[1]);\n\tlet K = parseInt(input.split(\"\\n\")[0].split(\" \")[2]);\n \n\tlet nBooks = input.split(\"\\n\")[1].split(\" \");\n \tfor(let i=0; iK){break;}\n kiroku = i + j;\n console.log(goukei+\" \"+i+\"(\"+nKei+\") \"+j+\"(\"+(goukei-nKei)+\") \"+kiroku);\n if(kiroku>sinKiroku){sinKiroku=kiroku;}\n }\n }\n \n \tconsole.log(sinKiroku);\n}\n//main(input);\nmain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));\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": 1129, "cpu_time_ms": 2237, "memory_kb": 100232}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s066452808", "group_id": "codeNet:p02623", "input_text": "console.log(3);", "language": "JavaScript", "metadata": {"date": 1593828845, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s066452808.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s066452808", "user_id": "u028542581"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "console.log(3);", "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": 15, "cpu_time_ms": 64, "memory_kb": 29500}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s950387586", "group_id": "codeNet:p02623", "input_text": "function main(input){\n input = input.split('\\n');\n const [n, m, k] = input[0].split(' ').map(Number);\n const a = input[1].split(' ').map(Number).reduce((a, x)=>{\n if(a.length === 0){\n return [x];\n } else{\n a.push(x+a[a.length-1])\n return a;\n }\n },[]);\n const b = input[2].split(' ').map(Number).reduce((a, x)=>{\n if(a.length === 0){\n return [x];\n } else{\n a.push(x+a[a.length-1]);\n return a;\n }\n },[]);\n\n const aMax = searchIndex(a, k);\n\n let max = 0;\n for(let i=0; i<=aMax; i++){\n const ak = i===0? 0 : a[i-1];\n const bMax = searchIndex(b, k-ak);\n if(bMax + i > max){\n max = bMax + i;\n }\n }\n\n console.log(max);\n}\n\nfunction searchIndex(arr, k){\n let st = 0;\n let ed = arr.length;\n while(st != ed){\n i = ((st + ed)/2) >> 0;\n if(k < arr[i]) {\n ed = i;\n }else{\n st = i+1;\n }\n }\n\n return st;\n}\n\nmain(require('fs').readFileSync('/dev/stdin', 'utf8').trim());", "language": "JavaScript", "metadata": {"date": 1593802421, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s950387586.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s950387586", "user_id": "u955037994"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "function main(input){\n input = input.split('\\n');\n const [n, m, k] = input[0].split(' ').map(Number);\n const a = input[1].split(' ').map(Number).reduce((a, x)=>{\n if(a.length === 0){\n return [x];\n } else{\n a.push(x+a[a.length-1])\n return a;\n }\n },[]);\n const b = input[2].split(' ').map(Number).reduce((a, x)=>{\n if(a.length === 0){\n return [x];\n } else{\n a.push(x+a[a.length-1]);\n return a;\n }\n },[]);\n\n const aMax = searchIndex(a, k);\n\n let max = 0;\n for(let i=0; i<=aMax; i++){\n const ak = i===0? 0 : a[i-1];\n const bMax = searchIndex(b, k-ak);\n if(bMax + i > max){\n max = bMax + i;\n }\n }\n\n console.log(max);\n}\n\nfunction searchIndex(arr, k){\n let st = 0;\n let ed = arr.length;\n while(st != ed){\n i = ((st + ed)/2) >> 0;\n if(k < arr[i]) {\n ed = i;\n }else{\n st = i+1;\n }\n }\n\n return st;\n}\n\nmain(require('fs').readFileSync('/dev/stdin', 'utf8').trim());", "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": 957, "cpu_time_ms": 159, "memory_kb": 66848}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s384915223", "group_id": "codeNet:p02623", "input_text": " let input = require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\").split(\"\\n\")\n let time = +input[0].split(\" \")[2]\n let ATab = input[1].split(\" \")\n let BTab = input[2].split(\" \")\n let count = 0\n let cost = 0\n if (+time < +ATab[0] && +time < +BTab[0]) {\n console.log(count);\n return\n }\n let all = ATab.concat(BTab).sort((a, b) => +a - +b)\n for (const index in all) {\n cost += +all[index]\n console.log(cost);\n if (cost < time) continue;\n console.log(cost > time ? +index : +index + 1);\n return\n }", "language": "JavaScript", "metadata": {"date": 1593555034, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s384915223.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s384915223", "user_id": "u544186612"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": " let input = require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\").split(\"\\n\")\n let time = +input[0].split(\" \")[2]\n let ATab = input[1].split(\" \")\n let BTab = input[2].split(\" \")\n let count = 0\n let cost = 0\n if (+time < +ATab[0] && +time < +BTab[0]) {\n console.log(count);\n return\n }\n let all = ATab.concat(BTab).sort((a, b) => +a - +b)\n for (const index in all) {\n cost += +all[index]\n console.log(cost);\n if (cost < time) continue;\n console.log(cost > time ? +index : +index + 1);\n return\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": 521, "cpu_time_ms": 1773, "memory_kb": 122420}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s536074493", "group_id": "codeNet:p02623", "input_text": " let input = require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\").split(\"\\n\")\n let time = +input[0].split(\" \")[2]\n let ATab = input[1].split(\" \")\n let BTab = input[2].split(\" \")\n let count = 0\n let cost = 0\n if (+time < +ATab[0] && +time < +BTab[0]) {\n console.log(count);\n return\n }\n let all = ATab.concat(BTab).sort((a, b) => +a - +b)\n for (const index in all) {\n cost += +all[index]\n if (cost < time) continue;\n console.log(cost > time ? index - 1 : index);\n return\n }", "language": "JavaScript", "metadata": {"date": 1593554694, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s536074493.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s536074493", "user_id": "u544186612"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": " let input = require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\").split(\"\\n\")\n let time = +input[0].split(\" \")[2]\n let ATab = input[1].split(\" \")\n let BTab = input[2].split(\" \")\n let count = 0\n let cost = 0\n if (+time < +ATab[0] && +time < +BTab[0]) {\n console.log(count);\n return\n }\n let all = ATab.concat(BTab).sort((a, b) => +a - +b)\n for (const index in all) {\n cost += +all[index]\n if (cost < time) continue;\n console.log(cost > time ? index - 1 : index);\n return\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": 496, "cpu_time_ms": 435, "memory_kb": 82448}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s481412626", "group_id": "codeNet:p02623", "input_text": "function main(arg) {\n let [N,M,K] = arg.split(\"\\n\")[0].split(\" \").map(Number)\n let A = arg.split(\"\\n\")[1].split(\" \").map(Number)\n let B = arg.split(\"\\n\")[2].split(\" \").map(Number)\n\n\n let a = [A[0]]\n for(let i=1; i K)break\n while(b[j] > tmpB) {\n //console.log(b[j])\n j--\n }\n sum = Math.max(i+1+j+1, sum)\n //console.log(` tmpB=${tmpB}, i=${i}, j=${j}`)\n }\n console.log(sum)\n \n}\n\nmain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));\n", "language": "JavaScript", "metadata": {"date": 1593552861, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s481412626.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s481412626", "user_id": "u435256638"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "function main(arg) {\n let [N,M,K] = arg.split(\"\\n\")[0].split(\" \").map(Number)\n let A = arg.split(\"\\n\")[1].split(\" \").map(Number)\n let B = arg.split(\"\\n\")[2].split(\" \").map(Number)\n\n\n let a = [A[0]]\n for(let i=1; i K)break\n while(b[j] > tmpB) {\n //console.log(b[j])\n j--\n }\n sum = Math.max(i+1+j+1, sum)\n //console.log(` tmpB=${tmpB}, i=${i}, j=${j}`)\n }\n console.log(sum)\n \n}\n\nmain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));\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": 788, "cpu_time_ms": 170, "memory_kb": 67152}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s744413143", "group_id": "codeNet:p02623", "input_text": "inp = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\\n')\n\nconst K = Number(inp[0].split(\" \")[2])\nconst timeA = inp[1].split(\" \").map(e => parseInt(e, 10))\nconst timeB = inp[2].split(\" \").map(e => parseInt(e, 10))\nlet timer = 0\nlet counter = 0\nwhile (timer <= K){\n if (timer + timeA[0] <= K || timer + timeB[0] <= K){\n if (timeA.length === 0 && timeB.length === 0 ){\n break\n } else if (timeA[0] >= timeB[0]){\n timer += timeB[0]\n timeB.shift()\n counter ++\n continue\n } else if (timeA[0] < timeB[0]){\n timer += timeA[0]\n timeA.shift()\n counter ++\n continue\n } else if (timeA.length === 0 || timeB.length !== 0){\n timer += timeB[0]\n timeB.shift()\n counter ++\n continue\n } else if (timeB.length === 0 || timeA.length !== 0){\n timer += timeA[0]\n timeA.shift()\n counter ++\n continue\n }\n } else {\n break\n }\n}\nconsole.log(counter)\n", "language": "JavaScript", "metadata": {"date": 1593357420, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s744413143.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s744413143", "user_id": "u737801844"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "inp = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\\n')\n\nconst K = Number(inp[0].split(\" \")[2])\nconst timeA = inp[1].split(\" \").map(e => parseInt(e, 10))\nconst timeB = inp[2].split(\" \").map(e => parseInt(e, 10))\nlet timer = 0\nlet counter = 0\nwhile (timer <= K){\n if (timer + timeA[0] <= K || timer + timeB[0] <= K){\n if (timeA.length === 0 && timeB.length === 0 ){\n break\n } else if (timeA[0] >= timeB[0]){\n timer += timeB[0]\n timeB.shift()\n counter ++\n continue\n } else if (timeA[0] < timeB[0]){\n timer += timeA[0]\n timeA.shift()\n counter ++\n continue\n } else if (timeA.length === 0 || timeB.length !== 0){\n timer += timeB[0]\n timeB.shift()\n counter ++\n continue\n } else if (timeB.length === 0 || timeA.length !== 0){\n timer += timeA[0]\n timeA.shift()\n counter ++\n continue\n }\n } else {\n break\n }\n}\nconsole.log(counter)\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": 1085, "cpu_time_ms": 2207, "memory_kb": 58444}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s097926896", "group_id": "codeNet:p02623", "input_text": "function main(lines) {\n const [N, M, K] = splitN(lines[0]);\n const A = splitN(lines[1]);\n const B = splitN(lines[2]);\n \n let t = K, i = 0;\n while (t-A[i] >= 0) {\n t -= A[i];\n i++;\n }\n\n let res = i, j = 0;\n while (true) {\n while (t-B[j] >= 0) {\n t -= B[j];\n j++;\n }\n res = Math.max(res, i+j);\n if (!i) break;\n t += A[i];\n i--;\n }\n \n console.log(res);\n}\n\n\nmain( require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\").trim().split(\"\\n\") );\n\n\n\nfunction splitN(s) {\n return s.split(' ').map(Number);\n}", "language": "JavaScript", "metadata": {"date": 1593353431, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s097926896.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s097926896", "user_id": "u686930335"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "function main(lines) {\n const [N, M, K] = splitN(lines[0]);\n const A = splitN(lines[1]);\n const B = splitN(lines[2]);\n \n let t = K, i = 0;\n while (t-A[i] >= 0) {\n t -= A[i];\n i++;\n }\n\n let res = i, j = 0;\n while (true) {\n while (t-B[j] >= 0) {\n t -= B[j];\n j++;\n }\n res = Math.max(res, i+j);\n if (!i) break;\n t += A[i];\n i--;\n }\n \n console.log(res);\n}\n\n\nmain( require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\").trim().split(\"\\n\") );\n\n\n\nfunction splitN(s) {\n return s.split(' ').map(Number);\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": 537, "cpu_time_ms": 150, "memory_kb": 57500}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s072568407", "group_id": "codeNet:p02623", "input_text": "const main = (input) => {\n input = input.trim().split('\\n')\n const [N, M, K] = input[0].split(' ').map(BigInt)\n const booksA = input[1].split(' ').map(BigInt)\n const booksB = input[2].split(' ').map(BigInt)\n\n let currentSum = 0n\n const maxB = []\n for (let i = 0; i < booksB.length; i++) {\n currentSum += booksB[i]\n maxB.push(booksB[i])\n\n if (currentSum > K) {\n currentSum -= maxB.pop()\n break\n }\n }\n\n let ans = maxB.length\n\n let A_sum = 0n\n const Alist = []\n for (let i = 0; i < booksA.length; i++) {\n A_sum += booksA[i]\n Alist.push(booksA[i])\n\n while (A_sum + currentSum > K && maxB.length) currentSum -= maxB.pop()\n if (A_sum + currentSum > K) break\n\n ans = Math.max(ans, Alist.length + maxB.length)\n }\n\n return console.log(ans)\n}\n\n\nprocess.env.MYTEST ? test() : main(require('fs').readFileSync('/dev/stdin', 'utf8'))", "language": "JavaScript", "metadata": {"date": 1593340472, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s072568407.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s072568407", "user_id": "u124735330"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "const main = (input) => {\n input = input.trim().split('\\n')\n const [N, M, K] = input[0].split(' ').map(BigInt)\n const booksA = input[1].split(' ').map(BigInt)\n const booksB = input[2].split(' ').map(BigInt)\n\n let currentSum = 0n\n const maxB = []\n for (let i = 0; i < booksB.length; i++) {\n currentSum += booksB[i]\n maxB.push(booksB[i])\n\n if (currentSum > K) {\n currentSum -= maxB.pop()\n break\n }\n }\n\n let ans = maxB.length\n\n let A_sum = 0n\n const Alist = []\n for (let i = 0; i < booksA.length; i++) {\n A_sum += booksA[i]\n Alist.push(booksA[i])\n\n while (A_sum + currentSum > K && maxB.length) currentSum -= maxB.pop()\n if (A_sum + currentSum > K) break\n\n ans = Math.max(ans, Alist.length + maxB.length)\n }\n\n return console.log(ans)\n}\n\n\nprocess.env.MYTEST ? test() : main(require('fs').readFileSync('/dev/stdin', 'utf8'))", "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": 870, "cpu_time_ms": 249, "memory_kb": 96572}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s888820900", "group_id": "codeNet:p02623", "input_text": "inp = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\\n')\n\nconst K = Number(inp[0].split(\" \")[2])\nconst timeA = inp[1].split(\" \").map(Number)\nconst timeB = inp[2].split(\" \").map(Number)\nlet timer = 0\nlet counter = 0\nwhile (timer <= K){\n if (timer + timeA[0] <= K || timer + timeB[0] <= K){\n\n if (timeA[0] < timeB[0]){\n timer += Number(timeA[0])\n timeA.shift()\n counter ++\n } else if (timeA.length === 0 || timeB.length !== 0){\n timer += Number(timeB[0])\n timeB.shift()\n counter ++\n } else if (timeA[0] >= timeB[0]){\n timer += Number(timeB[0])\n timeB.shift()\n counter ++\n } else if (timeB.length === 0 || timeA.length !== 0){\n timer += Number(timeA[0])\n timeA.shift()\n counter ++\n } else if (timeA.length === 0 && timeB.length === 0){\n break\n }\n } else {\n break\n }\n}\nconsole.log(counter)\n", "language": "JavaScript", "metadata": {"date": 1593322848, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s888820900.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s888820900", "user_id": "u737801844"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "inp = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\\n')\n\nconst K = Number(inp[0].split(\" \")[2])\nconst timeA = inp[1].split(\" \").map(Number)\nconst timeB = inp[2].split(\" \").map(Number)\nlet timer = 0\nlet counter = 0\nwhile (timer <= K){\n if (timer + timeA[0] <= K || timer + timeB[0] <= K){\n\n if (timeA[0] < timeB[0]){\n timer += Number(timeA[0])\n timeA.shift()\n counter ++\n } else if (timeA.length === 0 || timeB.length !== 0){\n timer += Number(timeB[0])\n timeB.shift()\n counter ++\n } else if (timeA[0] >= timeB[0]){\n timer += Number(timeB[0])\n timeB.shift()\n counter ++\n } else if (timeB.length === 0 || timeA.length !== 0){\n timer += Number(timeA[0])\n timeA.shift()\n counter ++\n } else if (timeA.length === 0 && timeB.length === 0){\n break\n }\n } else {\n break\n }\n}\nconsole.log(counter)\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": 1004, "cpu_time_ms": 2207, "memory_kb": 56720}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s632239186", "group_id": "codeNet:p02623", "input_text": "\"use strict\"\nconst create = () => {\n const input = require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\").trim().split(\"\\n\");\n const res = {\n \"list\": input, \"index\": 0, \"max\": input.length,\n \"hasNext\": function() {return this.index < this.max},\n \"next\": function() { if (!this.hasNext()) {throw \"ArrayIndexOutOfBoundsException\";}else{return this.list[this.index++];}}\n };\n return res;\n}\nconst o = create();\nconst next = () => o.next()\nconst nextInt = () => parseInt(o.next())\nconst nextStrArray = () => o.next().split(\" \")\nconst nextIntArray = () => o.next().split(\" \").map(el => parseInt(el))\nconst nextCharArray = () => o.next().split(\"\")\nconst hasNext = () => o.hasNext()\nconst myout = (...x) => console.log(...x)\nconst Main = () => {\n let [N,M,K] = nextIntArray()\n K = BigInt(K)\n let a = next().split(\" \").map(el => BigInt(el)).reverse()\n let b = next().split(\" \").map(el => BigInt(el)).reverse()\n let pat = []\n if(a[a.length - 1] > K && b[b.length - 1] > K){\n console.log(0)\n return\n }\n const func = (past, cnt, restA, restB) => {\n // console.log(past, cnt, restA, restB)\n if(past > K ) return\n if(restA.length == 0 && restB.length == 0){\n pat.push(cnt)\n return\n }\n if(restA.length > 0 ){\n let tmp = restA.pop()\n if(past <= K && past + tmp > K){\n pat.push(cnt)\n restA.push(tmp)\n } else {\n func(past+tmp, cnt + 1, restA, restB)\n restA.push(tmp)\n }\n\n }\n if(restB.length>0 ){\n let tmp = restB.pop()\n if(past <= K && past + tmp > K){\n pat.push(cnt)\n } else {\n func(past+tmp, cnt + 1, restA, restB)\n }\n }\n }\n func(0n, 0, a, b)\n pat.sort((a,b) => b-a)\n console.log(pat[0])\n\n}\nMain()\n", "language": "JavaScript", "metadata": {"date": 1593317565, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s632239186.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s632239186", "user_id": "u267235552"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "\"use strict\"\nconst create = () => {\n const input = require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\").trim().split(\"\\n\");\n const res = {\n \"list\": input, \"index\": 0, \"max\": input.length,\n \"hasNext\": function() {return this.index < this.max},\n \"next\": function() { if (!this.hasNext()) {throw \"ArrayIndexOutOfBoundsException\";}else{return this.list[this.index++];}}\n };\n return res;\n}\nconst o = create();\nconst next = () => o.next()\nconst nextInt = () => parseInt(o.next())\nconst nextStrArray = () => o.next().split(\" \")\nconst nextIntArray = () => o.next().split(\" \").map(el => parseInt(el))\nconst nextCharArray = () => o.next().split(\"\")\nconst hasNext = () => o.hasNext()\nconst myout = (...x) => console.log(...x)\nconst Main = () => {\n let [N,M,K] = nextIntArray()\n K = BigInt(K)\n let a = next().split(\" \").map(el => BigInt(el)).reverse()\n let b = next().split(\" \").map(el => BigInt(el)).reverse()\n let pat = []\n if(a[a.length - 1] > K && b[b.length - 1] > K){\n console.log(0)\n return\n }\n const func = (past, cnt, restA, restB) => {\n // console.log(past, cnt, restA, restB)\n if(past > K ) return\n if(restA.length == 0 && restB.length == 0){\n pat.push(cnt)\n return\n }\n if(restA.length > 0 ){\n let tmp = restA.pop()\n if(past <= K && past + tmp > K){\n pat.push(cnt)\n restA.push(tmp)\n } else {\n func(past+tmp, cnt + 1, restA, restB)\n restA.push(tmp)\n }\n\n }\n if(restB.length>0 ){\n let tmp = restB.pop()\n if(past <= K && past + tmp > K){\n pat.push(cnt)\n } else {\n func(past+tmp, cnt + 1, restA, restB)\n }\n }\n }\n func(0n, 0, a, b)\n pat.sort((a,b) => b-a)\n console.log(pat[0])\n\n}\nMain()\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": 1915, "cpu_time_ms": 245, "memory_kb": 72872}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s846926083", "group_id": "codeNet:p02623", "input_text": "\"use strict\"\nconst create = () => {\n const input = require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\").trim().split(\"\\n\");\n const res = {\n \"list\": input, \"index\": 0, \"max\": input.length,\n \"hasNext\": function () { return this.index < this.max },\n \"next\": function () { if (!this.hasNext()) { throw \"ArrayIndexOutOfBoundsException\"; } else { return this.list[this.index++]; } }\n };\n return res;\n}\nconst o = create();\nconst next = () => o.next()\nconst nextInt = () => parseInt(o.next())\nconst nextStrArray = () => o.next().split(\" \")\nconst nextIntArray = () => o.next().split(\" \").map(el => parseInt(el))\nconst nextCharArray = () => o.next().split(\"\")\nconst hasNext = () => o.hasNext()\nconst myout = (...x) => console.log(...x)\nconst Main = () => {\n let [N, M, K] = nextIntArray()\n let a = nextIntArray()\n let b = nextIntArray()\n\n let tmp = 0\n let sumA = [0]\n for (let i = 0; i < a.length; i++) {\n tmp += a[i]\n sumA.push(tmp)\n }\n tmp = 0\n let sumB = [0]\n for (let i = 0; i < b.length; i++) {\n tmp += b[i]\n sumB.push(tmp)\n }\n let res = 0\n for(let i = 0, j = M; i <= N; i++){\n if(sumA[i] > K) break\n while(sumA[i] + sumB[j] > K ) j--\n res = Math.max(res, i+j)\n }\n console.log(res)\n}\nMain()\n", "language": "JavaScript", "metadata": {"date": 1593314913, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s846926083.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s846926083", "user_id": "u267235552"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "\"use strict\"\nconst create = () => {\n const input = require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\").trim().split(\"\\n\");\n const res = {\n \"list\": input, \"index\": 0, \"max\": input.length,\n \"hasNext\": function () { return this.index < this.max },\n \"next\": function () { if (!this.hasNext()) { throw \"ArrayIndexOutOfBoundsException\"; } else { return this.list[this.index++]; } }\n };\n return res;\n}\nconst o = create();\nconst next = () => o.next()\nconst nextInt = () => parseInt(o.next())\nconst nextStrArray = () => o.next().split(\" \")\nconst nextIntArray = () => o.next().split(\" \").map(el => parseInt(el))\nconst nextCharArray = () => o.next().split(\"\")\nconst hasNext = () => o.hasNext()\nconst myout = (...x) => console.log(...x)\nconst Main = () => {\n let [N, M, K] = nextIntArray()\n let a = nextIntArray()\n let b = nextIntArray()\n\n let tmp = 0\n let sumA = [0]\n for (let i = 0; i < a.length; i++) {\n tmp += a[i]\n sumA.push(tmp)\n }\n tmp = 0\n let sumB = [0]\n for (let i = 0; i < b.length; i++) {\n tmp += b[i]\n sumB.push(tmp)\n }\n let res = 0\n for(let i = 0, j = M; i <= N; i++){\n if(sumA[i] > K) break\n while(sumA[i] + sumB[j] > K ) j--\n res = Math.max(res, i+j)\n }\n console.log(res)\n}\nMain()\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": 1309, "cpu_time_ms": 168, "memory_kb": 67056}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s374812963", "group_id": "codeNet:p02623", "input_text": "'use strict';\nlet int_input_list = [];\nlet count = 0;\n\n// let answer;\nfunction main(input) {\n let state_of_books_on_the_desk = {\n \tdeskA:[],\n deskB:[],\n }\n \n const str_list = input.replace(/\\r?\\n/g,\" \").split(\" \");\n\n for (let i = 0; i < str_list.length; i++){\n str_list[i] = parseInt(str_list[i])\n int_input_list.push(str_list[i])\n }\n // each books minutes\n let books_minutes = int_input_list.slice(3) \n let initial_num_of_books_on_the_desk = int_input_list[0] + int_input_list[1]\n \n state_of_books_on_the_desk.deskA = books_minutes.slice(0, int_input_list[0])\n state_of_books_on_the_desk.deskB = books_minutes.slice(int_input_list[0])\n \n //console.log(state_of_books_on_the_desk)\n //console.log('int_input_list: ', int_input_list) \n //console.log('books_minutes: ',books_minutes)\n \n let max_minutes = int_input_list[2]\n let num_of_books_read = 0\n let sum_of_minutes = 0\n //console.log(books_minutes);\n for (let z=0; z < initial_num_of_books_on_the_desk; z++ ){\n //console.log('current state: ', state_of_books_on_the_desk)\n if (sum_of_minutes <= max_minutes){\n //console.log('state_of_books_on_the_desk.deskA[z]:',state_of_books_on_the_desk.deskA[z] )\n \n let current_book = Math.min(state_of_books_on_the_desk.deskA[0], state_of_books_on_the_desk.deskB[0]);\n //console.log('current_book: ',current_book)\n sum_of_minutes = sum_of_minutes + current_book\n //console.log('sum_of_minutes: ', sum_of_minutes)\n \n \n // remove element from state\n if (state_of_books_on_the_desk.deskA[z] <= state_of_books_on_the_desk.deskB[z]){\n state_of_books_on_the_desk.deskA.splice(0, 1) \n }else{\n state_of_books_on_the_desk.deskB.splice(0, 1) \n }\n }\n \n \n //sum_of_minutes = sum_of_minutes + books_minutes[z];\n\t//console.log(z)\n num_of_books_read = z+1\n\t//console.log(z)\n\n }\n console.log(num_of_books_read)\n };\n \n\n \nmain(require('fs').readFileSync('/dev/stdin', 'utf8'))", "language": "JavaScript", "metadata": {"date": 1593313185, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s374812963.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s374812963", "user_id": "u696603070"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "'use strict';\nlet int_input_list = [];\nlet count = 0;\n\n// let answer;\nfunction main(input) {\n let state_of_books_on_the_desk = {\n \tdeskA:[],\n deskB:[],\n }\n \n const str_list = input.replace(/\\r?\\n/g,\" \").split(\" \");\n\n for (let i = 0; i < str_list.length; i++){\n str_list[i] = parseInt(str_list[i])\n int_input_list.push(str_list[i])\n }\n // each books minutes\n let books_minutes = int_input_list.slice(3) \n let initial_num_of_books_on_the_desk = int_input_list[0] + int_input_list[1]\n \n state_of_books_on_the_desk.deskA = books_minutes.slice(0, int_input_list[0])\n state_of_books_on_the_desk.deskB = books_minutes.slice(int_input_list[0])\n \n //console.log(state_of_books_on_the_desk)\n //console.log('int_input_list: ', int_input_list) \n //console.log('books_minutes: ',books_minutes)\n \n let max_minutes = int_input_list[2]\n let num_of_books_read = 0\n let sum_of_minutes = 0\n //console.log(books_minutes);\n for (let z=0; z < initial_num_of_books_on_the_desk; z++ ){\n //console.log('current state: ', state_of_books_on_the_desk)\n if (sum_of_minutes <= max_minutes){\n //console.log('state_of_books_on_the_desk.deskA[z]:',state_of_books_on_the_desk.deskA[z] )\n \n let current_book = Math.min(state_of_books_on_the_desk.deskA[0], state_of_books_on_the_desk.deskB[0]);\n //console.log('current_book: ',current_book)\n sum_of_minutes = sum_of_minutes + current_book\n //console.log('sum_of_minutes: ', sum_of_minutes)\n \n \n // remove element from state\n if (state_of_books_on_the_desk.deskA[z] <= state_of_books_on_the_desk.deskB[z]){\n state_of_books_on_the_desk.deskA.splice(0, 1) \n }else{\n state_of_books_on_the_desk.deskB.splice(0, 1) \n }\n }\n \n \n //sum_of_minutes = sum_of_minutes + books_minutes[z];\n\t//console.log(z)\n num_of_books_read = z+1\n\t//console.log(z)\n\n }\n console.log(num_of_books_read)\n };\n \n\n \nmain(require('fs').readFileSync('/dev/stdin', 'utf8'))", "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": 1959, "cpu_time_ms": 2208, "memory_kb": 87840}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s484341658", "group_id": "codeNet:p02623", "input_text": "function Main(input) {\n input = input.split(\"\\n\");\n const array = input[0].split(' ');\n const n = Number(array[0]);\n const m = Number(array[1]);\n const k = Number(array[2]);\n\n const array1 = input[1].split(' ').map( str => parseInt(str, 10) );\n const array2 = input[2].split(' ').map( str => parseInt(str, 10) );\n \n let num = 0;\n let time = 0;\n\n for (let i = 0, count = m + n; i < count; i++) {\n \n if (array1.length < 1) {\n time += array2[0];\n array2.shift();\n } else if (array2.length < 1) {\n time += array1[0];\n array1.shift();\n } else if (array1[0] <= array2[0]) {\n time += array1[0];\n array1.shift();\n } else {\n time += array2[0];\n array2.shift();\n }\n\nif (time > k) {\n break;\n } else {\nnum ++;\n}\n \n }\n \n console.log(num);\n}\n\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "language": "JavaScript", "metadata": {"date": 1593311985, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s484341658.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s484341658", "user_id": "u457440934"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "function Main(input) {\n input = input.split(\"\\n\");\n const array = input[0].split(' ');\n const n = Number(array[0]);\n const m = Number(array[1]);\n const k = Number(array[2]);\n\n const array1 = input[1].split(' ').map( str => parseInt(str, 10) );\n const array2 = input[2].split(' ').map( str => parseInt(str, 10) );\n \n let num = 0;\n let time = 0;\n\n for (let i = 0, count = m + n; i < count; i++) {\n \n if (array1.length < 1) {\n time += array2[0];\n array2.shift();\n } else if (array2.length < 1) {\n time += array1[0];\n array1.shift();\n } else if (array1[0] <= array2[0]) {\n time += array1[0];\n array1.shift();\n } else {\n time += array2[0];\n array2.shift();\n }\n\nif (time > k) {\n break;\n } else {\nnum ++;\n}\n \n }\n \n console.log(num);\n}\n\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "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": 974, "cpu_time_ms": 2207, "memory_kb": 58584}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s547880977", "group_id": "codeNet:p02623", "input_text": "\"use strict\"\nfunction main(arg) {\n let [N,M,K] = arg.trim().split(\"\\n\")[0].split(\" \").map(Number)\n let A = arg.trim().split(\"\\n\")[1].split(\" \").map(Number)\n let B = arg.trim().split(\"\\n\")[2].split(\" \").map(Number)\n N = A.length\n M = B.length\n K = BigInt(K)\n let ans = 0\n let sum = 0\n let a = 0\n let b = 0\n let aSum = BigInt(0)\n let bSumList = []\n let bSum = BigInt(0)\n for (b = 0; b < M; b++) {\n bSum += BigInt(B[b])\n if (bSum > K) {\n break\n }\n bSumList.push(bSum)\n }\n for (a = 0; a < N; a++) {\n aSum += BigInt(A[a])\n if (aSum > K) {\n break\n }\n // console.log(aSum)\n // let bSum = BigInt(0)\n for (b = 0; b < bSumList.length; b++) {\n bSum = bSumList[b]\n if (aSum + bSum > K) {\n break\n }\n ans = Math.max(ans, (a+1) + (b+1))\n // console.log([ans,a+1,b+1])\n }\n }\n console.log(ans)\n // console.log(sum)\n}\nmain(require('fs').readFileSync('/dev/stdin', 'utf8'));\n", "language": "JavaScript", "metadata": {"date": 1593311867, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s547880977.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s547880977", "user_id": "u063969814"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "\"use strict\"\nfunction main(arg) {\n let [N,M,K] = arg.trim().split(\"\\n\")[0].split(\" \").map(Number)\n let A = arg.trim().split(\"\\n\")[1].split(\" \").map(Number)\n let B = arg.trim().split(\"\\n\")[2].split(\" \").map(Number)\n N = A.length\n M = B.length\n K = BigInt(K)\n let ans = 0\n let sum = 0\n let a = 0\n let b = 0\n let aSum = BigInt(0)\n let bSumList = []\n let bSum = BigInt(0)\n for (b = 0; b < M; b++) {\n bSum += BigInt(B[b])\n if (bSum > K) {\n break\n }\n bSumList.push(bSum)\n }\n for (a = 0; a < N; a++) {\n aSum += BigInt(A[a])\n if (aSum > K) {\n break\n }\n // console.log(aSum)\n // let bSum = BigInt(0)\n for (b = 0; b < bSumList.length; b++) {\n bSum = bSumList[b]\n if (aSum + bSum > K) {\n break\n }\n ans = Math.max(ans, (a+1) + (b+1))\n // console.log([ans,a+1,b+1])\n }\n }\n console.log(ans)\n // console.log(sum)\n}\nmain(require('fs').readFileSync('/dev/stdin', 'utf8'));\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": 1082, "cpu_time_ms": 2209, "memory_kb": 91964}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s210149629", "group_id": "codeNet:p02623", "input_text": "\"use strict\"\nfunction main(arg) {\n let [N,M,K] = arg.trim().split(\"\\n\")[0].split(\" \").map(Number)\n let A = arg.trim().split(\"\\n\")[1].split(\" \").map(Number)\n let B = arg.trim().split(\"\\n\")[2].split(\" \").map(Number)\n N = A.length\n M = B.length\n K = BigInt(K)\n let ans = 0\n let sum = 0\n let a = 0\n let b = 0\n let aSum = BigInt(0)\n let bSumList = new Array(B.length).fill(0)\n let bSum = BigInt(0)\n for (b = 0; b < M; b++) {\n bSum += BigInt(B[b])\n bSumList[b] = bSum\n }\n for (a = 0; a < N; a++) {\n aSum += BigInt(A[a])\n // console.log(aSum)\n // let bSum = BigInt(0)\n for (b = 0; b < M; b++) {\n bSum = bSumList[b]\n if (aSum + bSum > K) {\n break\n }\n ans = Math.max(ans, (a+1) + (b+1))\n // console.log([ans,a+1,b+1])\n }\n }\n console.log(ans)\n // console.log(sum)\n}\nmain(require('fs').readFileSync('/dev/stdin', 'utf8'));\n", "language": "JavaScript", "metadata": {"date": 1593311428, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s210149629.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s210149629", "user_id": "u063969814"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "\"use strict\"\nfunction main(arg) {\n let [N,M,K] = arg.trim().split(\"\\n\")[0].split(\" \").map(Number)\n let A = arg.trim().split(\"\\n\")[1].split(\" \").map(Number)\n let B = arg.trim().split(\"\\n\")[2].split(\" \").map(Number)\n N = A.length\n M = B.length\n K = BigInt(K)\n let ans = 0\n let sum = 0\n let a = 0\n let b = 0\n let aSum = BigInt(0)\n let bSumList = new Array(B.length).fill(0)\n let bSum = BigInt(0)\n for (b = 0; b < M; b++) {\n bSum += BigInt(B[b])\n bSumList[b] = bSum\n }\n for (a = 0; a < N; a++) {\n aSum += BigInt(A[a])\n // console.log(aSum)\n // let bSum = BigInt(0)\n for (b = 0; b < M; b++) {\n bSum = bSumList[b]\n if (aSum + bSum > K) {\n break\n }\n ans = Math.max(ans, (a+1) + (b+1))\n // console.log([ans,a+1,b+1])\n }\n }\n console.log(ans)\n // console.log(sum)\n}\nmain(require('fs').readFileSync('/dev/stdin', 'utf8'));\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": 988, "cpu_time_ms": 2209, "memory_kb": 89904}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s984485762", "group_id": "codeNet:p02623", "input_text": "\"use strict\";\n\nfunction main(input) {\n input = input.trim().split(\"\\n\");\n const line_one_arr = input[0].split(\" \");\n const A = input[1].split(\" \");\n const B = input[2].split(\" \");\n let K = BigInt(line_one_arr[2]);\n\n let a = parseInt(A.length); // A counter\n let b = parseInt(B.length); // B counter\n let ab = a + b;\n\n let n = 0;\n let m = 0;\n while (true) {\n try {\n A[n] = BigInt(A[n]);\n } catch {\n A[n] = BigInt(0);\n }\n try {\n B[m] = BigInt(B[m]) || 0;\n } catch {\n B[m] = BigInt(0);\n }\n if (a == 0 && b == 0) break;\n\n if (A[n] > B[m] || a == 0) {\n if (K - B[m] < 0) break;\n K = K - B[m];\n b--;\n m++;\n } else {\n if (K - A[n] < 0) break;\n K = K - A[n];\n a--;\n n++;\n }\n }\n const ans = ab - (a + b);\n\n console.log(ans);\n}\n\nfunction numberSort(array) {\n array.sort(f);\n return array;\n}\n\nvar f = function (a, b) {\n return a - b;\n};\n\nmain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf-8\"));\n", "language": "JavaScript", "metadata": {"date": 1593311383, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s984485762.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s984485762", "user_id": "u479559778"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "\"use strict\";\n\nfunction main(input) {\n input = input.trim().split(\"\\n\");\n const line_one_arr = input[0].split(\" \");\n const A = input[1].split(\" \");\n const B = input[2].split(\" \");\n let K = BigInt(line_one_arr[2]);\n\n let a = parseInt(A.length); // A counter\n let b = parseInt(B.length); // B counter\n let ab = a + b;\n\n let n = 0;\n let m = 0;\n while (true) {\n try {\n A[n] = BigInt(A[n]);\n } catch {\n A[n] = BigInt(0);\n }\n try {\n B[m] = BigInt(B[m]) || 0;\n } catch {\n B[m] = BigInt(0);\n }\n if (a == 0 && b == 0) break;\n\n if (A[n] > B[m] || a == 0) {\n if (K - B[m] < 0) break;\n K = K - B[m];\n b--;\n m++;\n } else {\n if (K - A[n] < 0) break;\n K = K - A[n];\n a--;\n n++;\n }\n }\n const ans = ab - (a + b);\n\n console.log(ans);\n}\n\nfunction numberSort(array) {\n array.sort(f);\n return array;\n}\n\nvar f = function (a, b) {\n return a - b;\n};\n\nmain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf-8\"));\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": 991, "cpu_time_ms": 2209, "memory_kb": 101044}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s121648905", "group_id": "codeNet:p02623", "input_text": "function main(arg) {\n const array = arg.trim().split(\"\\n\");\n const firstArray = array[0].trim().split(\" \");\n let N = parseInt(firstArray[0], 10);\n let M = parseInt(firstArray[1], 10);\n let K = parseInt(firstArray[2], 10);\n let aBooks = array[1].trim().split(\" \");\n let bBooks = array[2].trim().split(\" \");\n\n let result = 0;\n let counter = 0;\n\n // TODO 処理を書く\n while (counter < N + M) {\n counter++;\n let A = 0;\n let B = 0;\n let readBook = 0;\n\n if (aBooks.length == 0 && bBooks.length == 0) {\n break;\n }\n\n A = parseInt(aBooks[0], 10);\n B = parseInt(bBooks[0], 10);\n\n if (A < B) {\n readBook = A;\n aBooks.shift();\n } else {\n readBook = B;\n bBooks.shift();\n }\n\n K -= readBook;\n if (K < 0) {\n break;\n }\n result++;\n }\n\n console.log(result);\n}\nmain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));\n// main(\n// \"5 4 1\\n1000000000 1000000000 1000000000 1000000000 1000000000\\n1000000000 1000000000 1000000000 1000000000\"\n// );\n// main(\"1 1 240\\n1\\n1\");\n// main(\"3 4 730\\n60 90 120\\n80 150 80 150\");\n// main(\"3 4 240\\n60 90 120\\n80 150 80 150\");\n//https://atcoder.jp/contests/abc167/tasks/abc167_b\n", "language": "JavaScript", "metadata": {"date": 1593311218, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s121648905.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s121648905", "user_id": "u819348316"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "function main(arg) {\n const array = arg.trim().split(\"\\n\");\n const firstArray = array[0].trim().split(\" \");\n let N = parseInt(firstArray[0], 10);\n let M = parseInt(firstArray[1], 10);\n let K = parseInt(firstArray[2], 10);\n let aBooks = array[1].trim().split(\" \");\n let bBooks = array[2].trim().split(\" \");\n\n let result = 0;\n let counter = 0;\n\n // TODO 処理を書く\n while (counter < N + M) {\n counter++;\n let A = 0;\n let B = 0;\n let readBook = 0;\n\n if (aBooks.length == 0 && bBooks.length == 0) {\n break;\n }\n\n A = parseInt(aBooks[0], 10);\n B = parseInt(bBooks[0], 10);\n\n if (A < B) {\n readBook = A;\n aBooks.shift();\n } else {\n readBook = B;\n bBooks.shift();\n }\n\n K -= readBook;\n if (K < 0) {\n break;\n }\n result++;\n }\n\n console.log(result);\n}\nmain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));\n// main(\n// \"5 4 1\\n1000000000 1000000000 1000000000 1000000000 1000000000\\n1000000000 1000000000 1000000000 1000000000\"\n// );\n// main(\"1 1 240\\n1\\n1\");\n// main(\"3 4 730\\n60 90 120\\n80 150 80 150\");\n// main(\"3 4 240\\n60 90 120\\n80 150 80 150\");\n//https://atcoder.jp/contests/abc167/tasks/abc167_b\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": 1188, "cpu_time_ms": 2207, "memory_kb": 53608}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s198910062", "group_id": "codeNet:p02623", "input_text": "'use strict';\nlet int_input_list = [];\nlet count = 0;\n\n// let answer;\nfunction main(input) {\n const str_list = input.replace(/\\r?\\n/g,\" \").split(\" \");\n\n for (let i = 0; i < str_list.length; i++){\n str_list[i] = parseInt(str_list[i])\n int_input_list.push(str_list[i])\n }\n \n let books_minutes = []\n books_minutes = int_input_list.slice(3)\n \n let num_of_books_on_the_desk = int_input_list[0]+int_input_list[1]\n \n //console.log('int_input_list: ', int_input_list) \n //console.log('books_minutes: ',books_minutes)\n \n let max_minutes = int_input_list[2]\n \n // sort each books' minutes\n books_minutes.sort(function(a, b) {\n return a - b;\n});\n \n \n let num_of_books_read = 0\n let sum_of_minutes = 0\n //console.log(books_minutes);\n for (let z=0; z < num_of_books_on_the_desk; z++ ){\n \n sum_of_minutes = sum_of_minutes + books_minutes[z];\n\t//console.log(z)\n num_of_books_read = z\n\t//console.log(z)\n\n }\n console.log(num_of_books_read)\n };\n \n\n \nmain(require('fs').readFileSync('/dev/stdin', 'utf8'))", "language": "JavaScript", "metadata": {"date": 1593311114, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s198910062.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s198910062", "user_id": "u696603070"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "'use strict';\nlet int_input_list = [];\nlet count = 0;\n\n// let answer;\nfunction main(input) {\n const str_list = input.replace(/\\r?\\n/g,\" \").split(\" \");\n\n for (let i = 0; i < str_list.length; i++){\n str_list[i] = parseInt(str_list[i])\n int_input_list.push(str_list[i])\n }\n \n let books_minutes = []\n books_minutes = int_input_list.slice(3)\n \n let num_of_books_on_the_desk = int_input_list[0]+int_input_list[1]\n \n //console.log('int_input_list: ', int_input_list) \n //console.log('books_minutes: ',books_minutes)\n \n let max_minutes = int_input_list[2]\n \n // sort each books' minutes\n books_minutes.sort(function(a, b) {\n return a - b;\n});\n \n \n let num_of_books_read = 0\n let sum_of_minutes = 0\n //console.log(books_minutes);\n for (let z=0; z < num_of_books_on_the_desk; z++ ){\n \n sum_of_minutes = sum_of_minutes + books_minutes[z];\n\t//console.log(z)\n num_of_books_read = z\n\t//console.log(z)\n\n }\n console.log(num_of_books_read)\n };\n \n\n \nmain(require('fs').readFileSync('/dev/stdin', 'utf8'))", "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": 1028, "cpu_time_ms": 354, "memory_kb": 88596}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s702359168", "group_id": "codeNet:p02623", "input_text": "\"use strict\";\n\nfunction main(input) {\n input = input.trim().split(\"\\n\");\n const line_one_arr = input[0].split(\" \");\n const A = input[1].split(\" \");\n const B = input[2].split(\" \");\n let K = BigInt(line_one_arr[2]);\n\n let a = parseInt(A.length); // A counter\n let b = parseInt(B.length); // B counter\n let ab = a + b;\n\n let n = 0;\n let m = 0;\n while (true) {\n A[n] = BigInt(A[n]);\n B[m] = BigInt(B[m]);\n if (a == 0 && b == 0) break;\n\n if (A[n] > B[m] || a == 0) {\n if (K - B[m] < 0) break;\n K = K - B[m];\n b--;\n m++;\n } else {\n if (K - A[n] < 0) break;\n K = K - A[n];\n a--;\n n++;\n }\n }\n const ans = ab - (a + b);\n\n console.log(ans);\n}\n\nfunction numberSort(array) {\n array.sort(f);\n return array;\n}\n\nvar f = function (a, b) {\n return a - b;\n};\n\nmain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf-8\"));\n", "language": "JavaScript", "metadata": {"date": 1593310853, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s702359168.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s702359168", "user_id": "u479559778"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "\"use strict\";\n\nfunction main(input) {\n input = input.trim().split(\"\\n\");\n const line_one_arr = input[0].split(\" \");\n const A = input[1].split(\" \");\n const B = input[2].split(\" \");\n let K = BigInt(line_one_arr[2]);\n\n let a = parseInt(A.length); // A counter\n let b = parseInt(B.length); // B counter\n let ab = a + b;\n\n let n = 0;\n let m = 0;\n while (true) {\n A[n] = BigInt(A[n]);\n B[m] = BigInt(B[m]);\n if (a == 0 && b == 0) break;\n\n if (A[n] > B[m] || a == 0) {\n if (K - B[m] < 0) break;\n K = K - B[m];\n b--;\n m++;\n } else {\n if (K - A[n] < 0) break;\n K = K - A[n];\n a--;\n n++;\n }\n }\n const ans = ab - (a + b);\n\n console.log(ans);\n}\n\nfunction numberSort(array) {\n array.sort(f);\n return array;\n}\n\nvar f = function (a, b) {\n return a - b;\n};\n\nmain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf-8\"));\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": 874, "cpu_time_ms": 190, "memory_kb": 65564}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s994791582", "group_id": "codeNet:p02623", "input_text": "process.stdin.resume();\nprocess.stdin.setEncoding(\"utf8\");\nprocess.stdin.on(\"data\", input => {\n const splitted = input.split(\"\\n\");\n const nums = splitted[0].split(\" \");\n const N = Number(nums[0]);\n const M = Number(nums[1]);\n const K = Number(nums[2]);\n const Ak = createReadTime(splitted[1]);\n const Bk = splitted[2].split(\" \");\n let n = N;\n let readCount = n;\n\n let currentReadTime = Ak[N].total;\n let a = Ak[n];\n for (const b of Bk) {\n const num = Number(b);\n if (currentReadTime + num <= K) {\n readCount++;\n currentReadTime += num;\n continue;\n }\n\n if (a.val >= num) {\n // 入れ替え\n n--;\n currentReadTime+= num- a.val;\n a = Ak[n];\n continue;\n }\n break;\n }\n console.log(readCount);\n});\n\nconst createReadTime = (array, K) => {\n let prevTotal = 0;\n return array.split(\" \").reduce((total, val, index) => {\n if (prevTotal >= K) {\n return total;\n }\n const num = Number(val);\n prevTotal += num;\n if (prevTotal > K) {\n return total;\n }\n total[index + 1] = { val: num, total: prevTotal };\n return total;\n }, {});\n};\n", "language": "JavaScript", "metadata": {"date": 1593310594, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s994791582.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s994791582", "user_id": "u938005055"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "process.stdin.resume();\nprocess.stdin.setEncoding(\"utf8\");\nprocess.stdin.on(\"data\", input => {\n const splitted = input.split(\"\\n\");\n const nums = splitted[0].split(\" \");\n const N = Number(nums[0]);\n const M = Number(nums[1]);\n const K = Number(nums[2]);\n const Ak = createReadTime(splitted[1]);\n const Bk = splitted[2].split(\" \");\n let n = N;\n let readCount = n;\n\n let currentReadTime = Ak[N].total;\n let a = Ak[n];\n for (const b of Bk) {\n const num = Number(b);\n if (currentReadTime + num <= K) {\n readCount++;\n currentReadTime += num;\n continue;\n }\n\n if (a.val >= num) {\n // 入れ替え\n n--;\n currentReadTime+= num- a.val;\n a = Ak[n];\n continue;\n }\n break;\n }\n console.log(readCount);\n});\n\nconst createReadTime = (array, K) => {\n let prevTotal = 0;\n return array.split(\" \").reduce((total, val, index) => {\n if (prevTotal >= K) {\n return total;\n }\n const num = Number(val);\n prevTotal += num;\n if (prevTotal > K) {\n return total;\n }\n total[index + 1] = { val: num, total: prevTotal };\n return total;\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": 1124, "cpu_time_ms": 111, "memory_kb": 35556}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s011614325", "group_id": "codeNet:p02623", "input_text": "function main(input){\n input = input.split('\\n');\n const [n, m, k] = input[0].split(' ').map(x=>Number(x));\n const a = input[1].split(' ').map(x=>Number(x)).reverse();\n const b = input[2].split(' ').map(x=>Number(x)).reverse();\n\n let count = 0;\n let totalTime = 0;\n while(totalTime <= k){\n\n count++;\n if( (a.length === 0) && (b.length === 0)) {break;}\n\n let next;\n if(a.length === 0){\n next = b.pop();\n }else if(b.length === 0){\n next = a.pop();\n }else if(a[a.length-1] <= b[b.length-1]){\n next = a.pop();\n }else{\n next = b.pop();\n }\n totalTime += next;\n }\n\n console.log(count-1);\n}\n\nmain(require('fs').readFileSync('/dev/stdin', 'utf8'));", "language": "JavaScript", "metadata": {"date": 1593310222, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s011614325.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s011614325", "user_id": "u955037994"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "function main(input){\n input = input.split('\\n');\n const [n, m, k] = input[0].split(' ').map(x=>Number(x));\n const a = input[1].split(' ').map(x=>Number(x)).reverse();\n const b = input[2].split(' ').map(x=>Number(x)).reverse();\n\n let count = 0;\n let totalTime = 0;\n while(totalTime <= k){\n\n count++;\n if( (a.length === 0) && (b.length === 0)) {break;}\n\n let next;\n if(a.length === 0){\n next = b.pop();\n }else if(b.length === 0){\n next = a.pop();\n }else if(a[a.length-1] <= b[b.length-1]){\n next = a.pop();\n }else{\n next = b.pop();\n }\n totalTime += next;\n }\n\n console.log(count-1);\n}\n\nmain(require('fs').readFileSync('/dev/stdin', 'utf8'));", "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": 695, "cpu_time_ms": 135, "memory_kb": 58608}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s203822313", "group_id": "codeNet:p02623", "input_text": "const input = require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\")\n\n;(input => {\n\n const lines = input.split('\\n')\n const [N, M, K] = lines[0].split(' ').map(BigInt)\n const A = lines[1].split(' ').map(BigInt)\n const B = lines[2].split(' ').map(BigInt)\n\n let t = 0n\n const max = A.length + B.length\n let a = 0\n let b = 0\n for (var i = 0; i < max; i++) {\n if (!B[b] || A[a] < B[b]) {\n t += A[a]\n a++\n } else {\n t += B[b]\n b++\n }\n if (t > K) {\n break\n }\n }\n\n console.log(i)\n\n})(input)\n", "language": "JavaScript", "metadata": {"date": 1593309948, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s203822313.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s203822313", "user_id": "u968011443"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "const input = require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\")\n\n;(input => {\n\n const lines = input.split('\\n')\n const [N, M, K] = lines[0].split(' ').map(BigInt)\n const A = lines[1].split(' ').map(BigInt)\n const B = lines[2].split(' ').map(BigInt)\n\n let t = 0n\n const max = A.length + B.length\n let a = 0\n let b = 0\n for (var i = 0; i < max; i++) {\n if (!B[b] || A[a] < B[b]) {\n t += A[a]\n a++\n } else {\n t += B[b]\n b++\n }\n if (t > K) {\n break\n }\n }\n\n console.log(i)\n\n})(input)\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": 601, "cpu_time_ms": 202, "memory_kb": 78504}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s487794732", "group_id": "codeNet:p02623", "input_text": "function main(input){\n const [l1, l2, l3] = input.split('\\n');\n let [N, M, K] = l1.split(' ');\n K = Number(K);\n let aArray = l2.split(' ');\n let bArray = l3.split(' ');\n const aArrayLenOri = aArray.length;\n const bArrayLenOri = bArray.length;\n while(K > 0 && (aArray.length > 1 || bArray.length > 1)) {\n let aTime = (aArray.length === 0) ? 0 : aArray[0];\n let bTime = (bArray.length === 0) ? 0 : bArray[0];\n console.log(K,aTime,bTime);\n if (aTime === 0 && bTime === 0) K = 0;\n if (aTime < bTime && K >= aTime) {\n K - aTime;\n aArray.shift();\n return;\n } else if(bTime < aTime && K >= bTime) {\n K - bTime;\n bArray.shift();\n return;\n }\n }\n console.log((aArrayLenOri - aArray.length) + (bArrayLenOri - bArray.length));\n}\nmain(require('fs').readFileSync('/dev/stdin', 'utf8'));\n", "language": "JavaScript", "metadata": {"date": 1593309892, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s487794732.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s487794732", "user_id": "u430859163"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "function main(input){\n const [l1, l2, l3] = input.split('\\n');\n let [N, M, K] = l1.split(' ');\n K = Number(K);\n let aArray = l2.split(' ');\n let bArray = l3.split(' ');\n const aArrayLenOri = aArray.length;\n const bArrayLenOri = bArray.length;\n while(K > 0 && (aArray.length > 1 || bArray.length > 1)) {\n let aTime = (aArray.length === 0) ? 0 : aArray[0];\n let bTime = (bArray.length === 0) ? 0 : bArray[0];\n console.log(K,aTime,bTime);\n if (aTime === 0 && bTime === 0) K = 0;\n if (aTime < bTime && K >= aTime) {\n K - aTime;\n aArray.shift();\n return;\n } else if(bTime < aTime && K >= bTime) {\n K - bTime;\n bArray.shift();\n return;\n }\n }\n console.log((aArrayLenOri - aArray.length) + (bArrayLenOri - bArray.length));\n}\nmain(require('fs').readFileSync('/dev/stdin', 'utf8'));\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": 834, "cpu_time_ms": 2243, "memory_kb": 88952}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s029017791", "group_id": "codeNet:p02623", "input_text": "let main = (input) => {\n let usrInput = input.split(/\\n/)\n let sample = usrInput[0].split(/\\s+/).map(Number)\n let bookA = usrInput[1].split(/\\s+/).map(Number)\n let bookB = usrInput[2].split(/\\s+/).map(Number)\n\n let book = 0\n for (let time = 0; time < sample[2];) {\n if (bookA.length !== 0 && bookB.length !== 0) {\n if (bookA[0] < bookB[0]) {\n time += bookA.shift()\n book++\n } else {\n time += bookB.shift()\n console.log(bookA)\n book++\n }\n }\n if (bookA.length === 0 && bookB.length !== 0) {\n if (time + bookB[0] <= sample[2]) {\n time += bookB.shift()\n book++\n }\n }\n if (bookB.length === 0 && bookA.length !== 0) {\n if (time + bookA[0] <= sample[2]) {\n time += bookA.shift()\n book++\n }\n }\n\n if (bookB.length === 0 && bookA.length === 0)\n break\n }\n\n console.log(book)\n}\n\nmain(require('fs').readFileSync('/dev/stdin', 'utf8'))", "language": "JavaScript", "metadata": {"date": 1593309738, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s029017791.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s029017791", "user_id": "u506563357"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "let main = (input) => {\n let usrInput = input.split(/\\n/)\n let sample = usrInput[0].split(/\\s+/).map(Number)\n let bookA = usrInput[1].split(/\\s+/).map(Number)\n let bookB = usrInput[2].split(/\\s+/).map(Number)\n\n let book = 0\n for (let time = 0; time < sample[2];) {\n if (bookA.length !== 0 && bookB.length !== 0) {\n if (bookA[0] < bookB[0]) {\n time += bookA.shift()\n book++\n } else {\n time += bookB.shift()\n console.log(bookA)\n book++\n }\n }\n if (bookA.length === 0 && bookB.length !== 0) {\n if (time + bookB[0] <= sample[2]) {\n time += bookB.shift()\n book++\n }\n }\n if (bookB.length === 0 && bookA.length !== 0) {\n if (time + bookA[0] <= sample[2]) {\n time += bookA.shift()\n book++\n }\n }\n\n if (bookB.length === 0 && bookA.length === 0)\n break\n }\n\n console.log(book)\n}\n\nmain(require('fs').readFileSync('/dev/stdin', 'utf8'))", "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": 1117, "cpu_time_ms": 2539, "memory_kb": 87488}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s082542604", "group_id": "codeNet:p02623", "input_text": "const Main = input => {\n input = input.split(\"\\n\");\n const nmk = input[0].split(\" \").map(value => parseInt(value, 10));\n const n = nmk[0];\n const m = nmk[1];\n const k = nmk[2];\n const a = input[1].split(\" \").map(value => parseInt(value, 10));\n const b = input[2].split(\" \").map(value => parseInt(value, 10));\n\n let time = 0;\n let count = 0;\n\n // 与えられた配列の0番目の本を読む\n const read = arr => {\n // aの一番上の本を読む\n time += arr[0];\n\n //読んだら取り除く\n arr.shift();\n\n // 読んだ本の数を増やす\n count++;\n }\n\n for(let i = 0; i < n + m; i++) {\n // どちらの本も読み切っている場合\n if(a.length === 0 && b.length === 0) break;\n \n // Aの本がない場合\n if(a.length === 0) {\n // Bの本を読んでk分を超えるなら詰みなので脱出\n if(time + b[0] > k) break;\n read(b);\n }\n // Bの本がない場合\n else if(b.length === 0) {\n // Aの本を読んでk分を超えるなら詰みなので脱出\n if(time + a[0] > k) break;\n read(a);\n }\n // まだどちらの本もある場合\n else {\n // どちらの本を読んでもk分を超えるなら詰みなので脱出\n if(time + a[0] > k && time + b[0] > k) break;\n\n if(a[0] <= b[0]) {\n // aの一番上の本を読む\n read(a);\n } else {\n // bの一番上の本を読む\n read(b);\n }\n }\n }\n\n console.log(count);\n}\n \nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "language": "JavaScript", "metadata": {"date": 1593309550, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s082542604.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s082542604", "user_id": "u765734095"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "const Main = input => {\n input = input.split(\"\\n\");\n const nmk = input[0].split(\" \").map(value => parseInt(value, 10));\n const n = nmk[0];\n const m = nmk[1];\n const k = nmk[2];\n const a = input[1].split(\" \").map(value => parseInt(value, 10));\n const b = input[2].split(\" \").map(value => parseInt(value, 10));\n\n let time = 0;\n let count = 0;\n\n // 与えられた配列の0番目の本を読む\n const read = arr => {\n // aの一番上の本を読む\n time += arr[0];\n\n //読んだら取り除く\n arr.shift();\n\n // 読んだ本の数を増やす\n count++;\n }\n\n for(let i = 0; i < n + m; i++) {\n // どちらの本も読み切っている場合\n if(a.length === 0 && b.length === 0) break;\n \n // Aの本がない場合\n if(a.length === 0) {\n // Bの本を読んでk分を超えるなら詰みなので脱出\n if(time + b[0] > k) break;\n read(b);\n }\n // Bの本がない場合\n else if(b.length === 0) {\n // Aの本を読んでk分を超えるなら詰みなので脱出\n if(time + a[0] > k) break;\n read(a);\n }\n // まだどちらの本もある場合\n else {\n // どちらの本を読んでもk分を超えるなら詰みなので脱出\n if(time + a[0] > k && time + b[0] > k) break;\n\n if(a[0] <= b[0]) {\n // aの一番上の本を読む\n read(a);\n } else {\n // bの一番上の本を読む\n read(b);\n }\n }\n }\n\n console.log(count);\n}\n \nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "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": 1742, "cpu_time_ms": 2207, "memory_kb": 58452}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s945046837", "group_id": "codeNet:p02623", "input_text": "function main(input){\n const [l1, l2, l3] = input.split('\\n');\n let [N, M, K] = l1.split(' ');\n let aArray = l2.split(' ');\n let bArray = l3.split(' ');\n const aArrayLenOri = aArray.length;\n const bArrayLenOri = bArray.length;\n while(K > 0 && (aArray.length > 1 || bArray.length > 1)) {\n const aTime = (aArray.length === 0) ? 0 : aArray[0];\n const bTime = (bArray.length === 0) ? 0 : bArray[0];\n if (aTime < bTime && K >= aTime) {\n if (K >= aTime)\n K - aTime;\n aArray.shift();\n } else if(bTime < aTime && K >= aTime) {\n K - bTime;\n bArray.shift();\n }\n }\n console.log((aArrayLenOri - aArray.length) + (bArrayLenOri - bArray.length));\n}\nmain(require('fs').readFileSync('/dev/stdin', 'utf8'));\n", "language": "JavaScript", "metadata": {"date": 1593308873, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s945046837.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s945046837", "user_id": "u430859163"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "function main(input){\n const [l1, l2, l3] = input.split('\\n');\n let [N, M, K] = l1.split(' ');\n let aArray = l2.split(' ');\n let bArray = l3.split(' ');\n const aArrayLenOri = aArray.length;\n const bArrayLenOri = bArray.length;\n while(K > 0 && (aArray.length > 1 || bArray.length > 1)) {\n const aTime = (aArray.length === 0) ? 0 : aArray[0];\n const bTime = (bArray.length === 0) ? 0 : bArray[0];\n if (aTime < bTime && K >= aTime) {\n if (K >= aTime)\n K - aTime;\n aArray.shift();\n } else if(bTime < aTime && K >= aTime) {\n K - bTime;\n bArray.shift();\n }\n }\n console.log((aArrayLenOri - aArray.length) + (bArrayLenOri - bArray.length));\n}\nmain(require('fs').readFileSync('/dev/stdin', 'utf8'));\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": 740, "cpu_time_ms": 2207, "memory_kb": 56244}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s380731061", "group_id": "codeNet:p02623", "input_text": "console.log((args=>{\n const [[N,M,K],A,B] = args.trim().split('\\n').map( r=>r.split(' ').map(v=>v|0) );\n let max = 0, sA = 0; \n for ( let i = 0; i <= N; i++ ) {\n if ( sA > K ) break;\n let sB = 0;\n for ( let j = 0; j <= M; j++ ) {\n if ( sA + sB > K ) break;\n else if ( i+j > max ) max = i+j;\n sB += B[j];\n }\n sA += A[i];\n }\n return `${max}`;\n})(require('fs').readFileSync('/dev/stdin', 'utf8')));", "language": "JavaScript", "metadata": {"date": 1593308607, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s380731061.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s380731061", "user_id": "u088845406"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "console.log((args=>{\n const [[N,M,K],A,B] = args.trim().split('\\n').map( r=>r.split(' ').map(v=>v|0) );\n let max = 0, sA = 0; \n for ( let i = 0; i <= N; i++ ) {\n if ( sA > K ) break;\n let sB = 0;\n for ( let j = 0; j <= M; j++ ) {\n if ( sA + sB > K ) break;\n else if ( i+j > max ) max = i+j;\n sB += B[j];\n }\n sA += A[i];\n }\n return `${max}`;\n})(require('fs').readFileSync('/dev/stdin', 'utf8')));", "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": 430, "cpu_time_ms": 2207, "memory_kb": 58440}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s658331633", "group_id": "codeNet:p02623", "input_text": "function main(input){\n const [l1, l2, l3] = input.split('\\n');\n let [N, M, K] = l1.split(' ');\n let aArray = l2.split(' ');\n let bArray = l3.split(' ');\n const aArrayLenOri = aArray.length;\n const bArrayLenOri = bArray.length;\n while(K > 0 && (aArray.length > 1 || bArray.length > 1)) {\n const aTime = (aArray.length === 0) ? 0 : aArray[N - 1];\n const bTime = (bArray.length === 0) ? 0 : bArray[M - 1];\n if (aTime < bTime) {\n K - aTime;\n aArray.pop();\n } else {\n K - bTime;\n bArray.pop();\n }\n }\n console.log((aArrayLenOri - aArray.length) + (bArrayLenOri - bArray.length));\n}\nmain(require('fs').readFileSync('/dev/stdin', 'utf8'));\n", "language": "JavaScript", "metadata": {"date": 1593308406, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s658331633.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s658331633", "user_id": "u430859163"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "function main(input){\n const [l1, l2, l3] = input.split('\\n');\n let [N, M, K] = l1.split(' ');\n let aArray = l2.split(' ');\n let bArray = l3.split(' ');\n const aArrayLenOri = aArray.length;\n const bArrayLenOri = bArray.length;\n while(K > 0 && (aArray.length > 1 || bArray.length > 1)) {\n const aTime = (aArray.length === 0) ? 0 : aArray[N - 1];\n const bTime = (bArray.length === 0) ? 0 : bArray[M - 1];\n if (aTime < bTime) {\n K - aTime;\n aArray.pop();\n } else {\n K - bTime;\n bArray.pop();\n }\n }\n console.log((aArrayLenOri - aArray.length) + (bArrayLenOri - bArray.length));\n}\nmain(require('fs').readFileSync('/dev/stdin', 'utf8'));\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": 676, "cpu_time_ms": 2207, "memory_kb": 64428}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s142988464", "group_id": "codeNet:p02623", "input_text": "// inputに入力データ全体が入る\nfunction Main(input) {\n\tvar ans = 0\n\t// 1行目がinput[0], 2行目がinput[1], …に入る\n\tinput = input.trim().split(\"\\n\")\n\t// var arr = input.trim().split(\"\\n\")\n\tvar max = input[0].split(' ').map(n => parseInt(n))[2]\n\tvar da = input[1].split(' ').map(n => parseInt(n))\n\tvar db = input[2].split(' ').map(n => parseInt(n))\n\tvar now = 0\n\tvar ai = 0\n\tvar bi = 0\n\n\twhile (now < max) {\n\t\tvar read \n\t\tvar isa\n\t\tif (da[ai] == -1 && db[bi] == -1) {\n\t\t\tbreak\n\t\t} else if (da[ai] == -1 && db[bi] > 0) {\n\t\t\tread = db[bi]\n\t\t\tisa = false\n\t\t} else if (da[ai] == -1 && db[bi] > 0) {\n\t\t\tread = da[ai]\n\t\t\tisa = true\n\t\t} else if (da[ai] < db[bi]) {\n\t\t\tread = da[ai]\n\t\t\tisa = true\n\t\t} else {\n\t\t\tread = db[bi]\n\t\t\tisa = false\n\t\t}\n\n\t\tif (now + read <= max) {\n\t\t\tnow = now + read\n\t\t\tans++\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\n\t\tif (isa) {\n\t\t\tai++\n\t\t\tif (da[ai] == undefined) da[ai] = -1\n\t\t} else {\n\t\t\tbi++\n\t\t\tif (db[bi] == undefined) db[bi] = -1\n\t\t}\n\t}\n\n\n\t//出力\n\tconsole.log(ans)\n}\n//*この行以降は編集しないでください(標準入出力から一度に読み込み、Mainを呼び出します)\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));\n// Main(require('fs').readFileSync('./input.txt', 'utf-8'));", "language": "JavaScript", "metadata": {"date": 1593308371, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s142988464.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s142988464", "user_id": "u795511254"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "// inputに入力データ全体が入る\nfunction Main(input) {\n\tvar ans = 0\n\t// 1行目がinput[0], 2行目がinput[1], …に入る\n\tinput = input.trim().split(\"\\n\")\n\t// var arr = input.trim().split(\"\\n\")\n\tvar max = input[0].split(' ').map(n => parseInt(n))[2]\n\tvar da = input[1].split(' ').map(n => parseInt(n))\n\tvar db = input[2].split(' ').map(n => parseInt(n))\n\tvar now = 0\n\tvar ai = 0\n\tvar bi = 0\n\n\twhile (now < max) {\n\t\tvar read \n\t\tvar isa\n\t\tif (da[ai] == -1 && db[bi] == -1) {\n\t\t\tbreak\n\t\t} else if (da[ai] == -1 && db[bi] > 0) {\n\t\t\tread = db[bi]\n\t\t\tisa = false\n\t\t} else if (da[ai] == -1 && db[bi] > 0) {\n\t\t\tread = da[ai]\n\t\t\tisa = true\n\t\t} else if (da[ai] < db[bi]) {\n\t\t\tread = da[ai]\n\t\t\tisa = true\n\t\t} else {\n\t\t\tread = db[bi]\n\t\t\tisa = false\n\t\t}\n\n\t\tif (now + read <= max) {\n\t\t\tnow = now + read\n\t\t\tans++\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\n\t\tif (isa) {\n\t\t\tai++\n\t\t\tif (da[ai] == undefined) da[ai] = -1\n\t\t} else {\n\t\t\tbi++\n\t\t\tif (db[bi] == undefined) db[bi] = -1\n\t\t}\n\t}\n\n\n\t//出力\n\tconsole.log(ans)\n}\n//*この行以降は編集しないでください(標準入出力から一度に読み込み、Mainを呼び出します)\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));\n// Main(require('fs').readFileSync('./input.txt', 'utf-8'));", "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": 1240, "cpu_time_ms": 2270, "memory_kb": 1965140}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s837052649", "group_id": "codeNet:p02623", "input_text": "\"use strict\";\n\nconst main = arg => {\n const inputList = arg.trim().split(\"\\n\");\n // 回答を記述\n const N = parseInt(inputList[0].split(\" \")[0]);\n const M = parseInt(inputList[0].split(\" \")[1]);\n const K = parseInt(inputList[0].split(\" \")[2]);\n const A = inputList[1].split(\" \").map(ele => parseInt(ele));\n const B = inputList[2].split(\" \").map(ele => parseInt(ele));\n\n if (K < A[0] && K < B[0]) {\n console.log(0);\n } else {\n\n let addA = []\n for (let i = 0; i < N; i++) {\n addA[i] = A[i] + (addA[i - 1] ? addA[i - 1] : 0)\n }\n\n let addB = []\n for (let i = 0; i < M; i++) {\n addB[i] = B[i] + (addB[i - 1] ? addB[i - 1] : 0)\n }\n\n if ((addA[addA.length - 1] + addB[addB.length - 1]) <= K) {\n console.log(addA.length + addB.length)\n } else {\n let result = 0;\n for (let j = 0; j < addA.length; j++) {\n let num = addA[j];\n for (let k = 0; k < addB.length; k++) {\n let num2 = addB[k];\n if ((num + num2) <= K) {\n result = Math.max(result, j + k + 2)\n } else {\n break;\n }\n }\n\n }\n\n console.log(result)\n }\n }\n\n}\nmain(require('fs').readFileSync('/dev/stdin', 'utf8'));", "language": "JavaScript", "metadata": {"date": 1593308306, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s837052649.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s837052649", "user_id": "u472713288"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "\"use strict\";\n\nconst main = arg => {\n const inputList = arg.trim().split(\"\\n\");\n // 回答を記述\n const N = parseInt(inputList[0].split(\" \")[0]);\n const M = parseInt(inputList[0].split(\" \")[1]);\n const K = parseInt(inputList[0].split(\" \")[2]);\n const A = inputList[1].split(\" \").map(ele => parseInt(ele));\n const B = inputList[2].split(\" \").map(ele => parseInt(ele));\n\n if (K < A[0] && K < B[0]) {\n console.log(0);\n } else {\n\n let addA = []\n for (let i = 0; i < N; i++) {\n addA[i] = A[i] + (addA[i - 1] ? addA[i - 1] : 0)\n }\n\n let addB = []\n for (let i = 0; i < M; i++) {\n addB[i] = B[i] + (addB[i - 1] ? addB[i - 1] : 0)\n }\n\n if ((addA[addA.length - 1] + addB[addB.length - 1]) <= K) {\n console.log(addA.length + addB.length)\n } else {\n let result = 0;\n for (let j = 0; j < addA.length; j++) {\n let num = addA[j];\n for (let k = 0; k < addB.length; k++) {\n let num2 = addB[k];\n if ((num + num2) <= K) {\n result = Math.max(result, j + k + 2)\n } else {\n break;\n }\n }\n\n }\n\n console.log(result)\n }\n }\n\n}\nmain(require('fs').readFileSync('/dev/stdin', 'utf8'));", "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": 1402, "cpu_time_ms": 2207, "memory_kb": 69040}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s155236829", "group_id": "codeNet:p02623", "input_text": "const p=i=>i.split(\" \").map(e=>Number.parseInt(e))\nconst main = input => {\n const[[n,m,k],a,b]=input.trim().split(\"\\n\").map(p)\n const c=[...a,...b].sort((a,b)=>a-b)\n const l=c.length\n let r=k\n for(let i=0;ii.split(\" \").map(e=>Number.parseInt(e))\nconst main = input => {\n const[[n,m,k],a,b]=input.trim().split(\"\\n\").map(p)\n const c=[...a,...b].sort((a,b)=>a-b)\n const l=c.length\n let r=k\n for(let i=0;i K) {\n break\n }\n sum += v\n ans++\n } else if (N === b) {\n v = A[a]\n a++\n if (sum + v > K) {\n break\n }\n sum += v\n ans++\n } else {\n v\n if (A[a] > B[b]) {\n v = B[b]\n b++\n } else {\n v = A[a]\n a++\n }\n if (sum + v > K) {\n break\n }\n sum += v\n ans++\n }\n // console.log(v)\n }\n console.log(ans)\n // console.log(sum)\n}\nmain(require('fs').readFileSync('/dev/stdin', 'utf8'));", "language": "JavaScript", "metadata": {"date": 1593307856, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s384505192.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s384505192", "user_id": "u063969814"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "\"use strict\"\nfunction main(arg) {\n let [N,M,K] = arg.trim().split(\"\\n\")[0].split(\" \").map(Number)\n let A = arg.trim().split(\"\\n\")[1].split(\" \").map(Number)\n let B = arg.trim().split(\"\\n\")[2].split(\" \").map(Number)\n let ans = 0\n let sum = 0\n let a = 0\n let b = 0\n for (;;) {\n let v\n if (N === a && N === b) {\n break\n }\n if (N === a) {\n v = B[b]\n b++\n if (sum + v > K) {\n break\n }\n sum += v\n ans++\n } else if (N === b) {\n v = A[a]\n a++\n if (sum + v > K) {\n break\n }\n sum += v\n ans++\n } else {\n v\n if (A[a] > B[b]) {\n v = B[b]\n b++\n } else {\n v = A[a]\n a++\n }\n if (sum + v > K) {\n break\n }\n sum += v\n ans++\n }\n // console.log(v)\n }\n console.log(ans)\n // console.log(sum)\n}\nmain(require('fs').readFileSync('/dev/stdin', 'utf8'));", "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": 1150, "cpu_time_ms": 135, "memory_kb": 56760}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s026355763", "group_id": "codeNet:p02623", "input_text": "'use strict';\nfunction Main(stdin){\n const input = stdin.trim().split(/\\r?\\n/g);\n const N = Number(input[0].split(' ')[0]);\n const M = Number(input[0].split(' ')[1]);\n const K = Number(input[0].split(' ')[2]);\n const A = input[1].split(' ').map(str => Number(str)).reverse();\n const B = input[2].split(' ').map(str => Number(str)).reverse();\n let sum = 0;\n let count = 0;\n\n if(A[0] > K || B[0] > K) sum = K;\n while(sum < K){\n if(A[0] < B[0]){ \n sum += A.pop();\n } else {\n sum += B.pop();\n }\n if(sum < K) count++;\n }\n console.log(count);\n}\n\n// 固定\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "language": "JavaScript", "metadata": {"date": 1593307686, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02623.html", "problem_id": "p02623", "resource_group": "medium_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/JavaScript/s026355763.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s026355763", "user_id": "u253942942"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "'use strict';\nfunction Main(stdin){\n const input = stdin.trim().split(/\\r?\\n/g);\n const N = Number(input[0].split(' ')[0]);\n const M = Number(input[0].split(' ')[1]);\n const K = Number(input[0].split(' ')[2]);\n const A = input[1].split(' ').map(str => Number(str)).reverse();\n const B = input[2].split(' ').map(str => Number(str)).reverse();\n let sum = 0;\n let count = 0;\n\n if(A[0] > K || B[0] > K) sum = K;\n while(sum < K){\n if(A[0] < B[0]){ \n sum += A.pop();\n } else {\n sum += B.pop();\n }\n if(sum < K) count++;\n }\n console.log(count);\n}\n\n// 固定\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "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": 639, "cpu_time_ms": 132, "memory_kb": 58604}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s987328684", "group_id": "codeNet:p02624", "input_text": "const n = Number(require('fs').readFileSync('/dev/stdin', 'utf8'))\nlet result = 0\nfor (let k = 1; k <= n; k++) {\n const y = Math.floor(n / k)\n result += y * (y + 1) * k / 2\n}\nconsole.log(result)", "language": "JavaScript", "metadata": {"date": 1594790671, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02624.html", "problem_id": "p02624", "resource_group": "medium_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/JavaScript/s987328684.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s987328684", "user_id": "u944958519"}, "prompt_components": {"gold_output": "23\n", "input_to_evaluate": "const n = Number(require('fs').readFileSync('/dev/stdin', 'utf8'))\nlet result = 0\nfor (let k = 1; k <= n; k++) {\n const y = Math.floor(n / k)\n result += y * (y + 1) * k / 2\n}\nconsole.log(result)", "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": 196, "cpu_time_ms": 114, "memory_kb": 32968}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s628445784", "group_id": "codeNet:p02624", "input_text": "\"use strict\";\nvar input=require(\"fs\").readFileSync(\"/dev/stdin\",\"utf8\");\nvar cin=input.split(/ |\\n/),cid=0;\nfunction next(){return +cin[cid++];}\nfunction nextstr(){return cin[cid++];}\nfunction nextbig(){return BigInt(cin[cid++]);}\nfunction nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}\nfunction nextm(h,w,a){var r=[],i=0;if(a)for(;i+a));return r;}\nfunction xArray(v){var a=arguments,l=a.length,r=\"Array(a[\"+--l+\"]).fill().map(x=>{return \"+v+\";})\";while(--l)r=\"Array(a[\"+l+\"]).fill().map(x=>\"+r+\")\";return eval(r);}\n\nvar myOut = main();\nif(myOut !== undefined)console.log(String(myOut));\n\nfunction main(){\n var n = next();\n var a = xArray(1,n+1);\n var ans = 1;\n for(var i = 2; i <= n; i++){\n if(a[i] === 1){\n ans += i*2;\n for(var j = i+i; j <= n; j+=i){\n var t = j, s = 1;\n while(t % i === 0)t /= i, s++;\n a[j] *= s;\n }\n }else{\n ans += i*a[i];\n }\n }\n return ans;\n}", "language": "JavaScript", "metadata": {"date": 1593308985, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02624.html", "problem_id": "p02624", "resource_group": "medium_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/JavaScript/s628445784.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s628445784", "user_id": "u643613120"}, "prompt_components": {"gold_output": "23\n", "input_to_evaluate": "\"use strict\";\nvar input=require(\"fs\").readFileSync(\"/dev/stdin\",\"utf8\");\nvar cin=input.split(/ |\\n/),cid=0;\nfunction next(){return +cin[cid++];}\nfunction nextstr(){return cin[cid++];}\nfunction nextbig(){return BigInt(cin[cid++]);}\nfunction nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}\nfunction nextm(h,w,a){var r=[],i=0;if(a)for(;i+a));return r;}\nfunction xArray(v){var a=arguments,l=a.length,r=\"Array(a[\"+--l+\"]).fill().map(x=>{return \"+v+\";})\";while(--l)r=\"Array(a[\"+l+\"]).fill().map(x=>\"+r+\")\";return eval(r);}\n\nvar myOut = main();\nif(myOut !== undefined)console.log(String(myOut));\n\nfunction main(){\n var n = next();\n var a = xArray(1,n+1);\n var ans = 1;\n for(var i = 2; i <= n; i++){\n if(a[i] === 1){\n ans += i*2;\n for(var j = i+i; j <= n; j+=i){\n var t = j, s = 1;\n while(t % i === 0)t /= i, s++;\n a[j] *= s;\n }\n }else{\n ans += i*a[i];\n }\n }\n return ans;\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": 1041, "cpu_time_ms": 1257, "memory_kb": 195636}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s169340793", "group_id": "codeNet:p02642", "input_text": "const main = (input) => {\n input = input.trim().split('\\n')\n\n const n = input[1].split(' ').map(Number).sort((a, b) => a - b)\n const arr = new Array(parseInt(input[0], 10)+1).fill(false)\n const biggest = n[n.length-1]\n\n if (Array.from(new Set(n)).length === 1) return console.log(0)\n\n let ans = 0\n\n for (let i=0; i {\n input = input.trim().split('\\n')\n\n const n = input[1].split(' ').map(Number).sort((a, b) => a - b)\n const arr = new Array(parseInt(input[0], 10)+1).fill(false)\n const biggest = n[n.length-1]\n\n if (Array.from(new Set(n)).length === 1) return console.log(0)\n\n let ans = 0\n\n for (let i=0; i {\n const num = Number(curr)\n acc[num] = (acc[num] || 0) + 1\n return acc\n}, [])\nif (as[1] === 1) {\n console.log(1)\n} else if (as[1]) {\n console.log(0)\n} else {\n for (let i = 2; i < as.length; i++) {\n if (!as[i]) {\n continue\n }\n const until = Math.floor(Math.pow(i, 0.5))\n for (let j = 2; j <= until; j++) {\n if (i % j === 0 && (as[j] || as[i / j])) {\n as[i] = 0\n break\n }\n }\n }\n console.log(as.reduce((a, b) => a + (b === 1 ? b : 0), 0))\n}", "language": "JavaScript", "metadata": {"date": 1595194807, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "medium_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/JavaScript/s788777055.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s788777055", "user_id": "u944958519"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "const [nStr, aStr] = require('fs').readFileSync('/dev/stdin', 'utf8').split(/\\n/)\nconst as = aStr.split(/\\s/).reduce((acc, curr) => {\n const num = Number(curr)\n acc[num] = (acc[num] || 0) + 1\n return acc\n}, [])\nif (as[1] === 1) {\n console.log(1)\n} else if (as[1]) {\n console.log(0)\n} else {\n for (let i = 2; i < as.length; i++) {\n if (!as[i]) {\n continue\n }\n const until = Math.floor(Math.pow(i, 0.5))\n for (let j = 2; j <= until; j++) {\n if (i % j === 0 && (as[j] || as[i / j])) {\n as[i] = 0\n break\n }\n }\n }\n console.log(as.reduce((a, b) => a + (b === 1 ? b : 0), 0))\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": 622, "cpu_time_ms": 965, "memory_kb": 78512}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s006523554", "group_id": "codeNet:p02642", "input_text": "console.log((args=>{\n const [[N],A] = args.trim().split`\\n`.map(r=>r.split` `.map(v=>v|0));\n A.sort((a,b)=>a-b);\n const MAX = A[N-1];\n const ex = Array(MAX+1).fill(false);\n let count = 0;\n for ( let i = 0; i < N; i++ ) {\n if ( ex[A[i]] ) continue;\n for ( let j = A[i]; j <= MAX; j+=A[i] ) {\n ex[j] = true;\n }\n if ( A[i] !== A[i+1] ) count++;\n }\n return `${count}`;\n})(require('fs').readFileSync('/dev/stdin', 'utf8')));\n", "language": "JavaScript", "metadata": {"date": 1594746182, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "medium_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/JavaScript/s006523554.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s006523554", "user_id": "u088845406"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "console.log((args=>{\n const [[N],A] = args.trim().split`\\n`.map(r=>r.split` `.map(v=>v|0));\n A.sort((a,b)=>a-b);\n const MAX = A[N-1];\n const ex = Array(MAX+1).fill(false);\n let count = 0;\n for ( let i = 0; i < N; i++ ) {\n if ( ex[A[i]] ) continue;\n for ( let j = A[i]; j <= MAX; j+=A[i] ) {\n ex[j] = true;\n }\n if ( A[i] !== A[i+1] ) count++;\n }\n return `${count}`;\n})(require('fs').readFileSync('/dev/stdin', 'utf8')));\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": 445, "cpu_time_ms": 185, "memory_kb": 58580}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s842742784", "group_id": "codeNet:p02642", "input_text": "function main(input) {\n var a = input[1].trim().split(\" \").map(e => parseInt(e, 10));\n var a_max = 10**6+1;\n var dp = new Array(a_max+1).fill(0);\n for(var i of a){\n dp[i]++;\n }\n \n for(var i=1;i<=a_max;i++){\n if(dp[i]===0){ \n continue;\n }\n for(var j=i+i;j<=a_max;j+=i){\n if(dp[j]!==0){\n dp[j]=0;\n }\n }\n }\n console.log(dp.filter(function(x){return x===1}).length);\n}\nmain(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split(\"\\n\"));", "language": "JavaScript", "metadata": {"date": 1592704774, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "medium_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/JavaScript/s842742784.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s842742784", "user_id": "u624950076"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "function main(input) {\n var a = input[1].trim().split(\" \").map(e => parseInt(e, 10));\n var a_max = 10**6+1;\n var dp = new Array(a_max+1).fill(0);\n for(var i of a){\n dp[i]++;\n }\n \n for(var i=1;i<=a_max;i++){\n if(dp[i]===0){ \n continue;\n }\n for(var j=i+i;j<=a_max;j+=i){\n if(dp[j]!==0){\n dp[j]=0;\n }\n }\n }\n console.log(dp.filter(function(x){return x===1}).length);\n}\nmain(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split(\"\\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": 484, "cpu_time_ms": 148, "memory_kb": 66052}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s639468293", "group_id": "codeNet:p02642", "input_text": "function Main(input) {\n input = input.trim().split(\"\\n\").map(function(x) { return x.split(\" \")});\n var N = parseInt(input[0],10);\n var vec_A = input[1].map(e => parseInt(e, 10)); \n var vec_ans = [];\n var X, groupL, groupH, searchTableL, searchTableH;\n var aryMax = function (a, b) {return Math.max(a, b);}\n\tif (vec_A.indexOf(1) !== -1) {\n\t\t vec_A = vec_A.filter(function (x, i, self) {\n return self.indexOf(x) === i && i === self.lastIndexOf(x);\n });\n if (vec_A.indexOf(1) === -1) {\n \tvec_ans = [];\n } else {\n\t\t\tvec_ans = [1];\n\t\t}\n\t} else {\n\t\twhile (true){\n\t\t\tif (vec_A.length == 1) {\n\t\t\t\tvec_ans.push(vec_A[0]);\n\t\t\t\tbreak;\n\t\t\t} else if (vec_A.length < 1){\n\t\t\t\tbreak;\n\t\t\t} else {\n\t\t\t\tX = Math.sqrt(vec_A.reduce(aryMax));\n\t\t\t\tgroupL = vec_A.filter( function( value ) {\n\t\t\t\t\treturn value <= X;\n\t\t\t\t\t})\n\t\t\t\tsearchTableL = groupL.reduce(function(m, a, i) {\n\t\t\t\t\tm[a] = (m[a] || []).concat(i);\n\t\t\t\t\treturn m;\n\t\t\t\t\t}, {});\n\t\t\t\tgroupH = vec_A.filter( function( value ) {\n\t\t\t\t\treturn value > X;\n\t\t\t\t\t})\n\t\t\t\tsearchTableH = groupH.reduce(function(m, a, i) {\n\t\t\t\t\tm[a] = (m[a] || []).concat(i);\n\t\t\t\t\treturn m;\n\t\t\t\t\t}, {});\n\t\t\t\tfor (var i = 0; i < groupH.length; i++){\n\t\t\t\t\tdivisionCheck_loop:\t\n\t\t\t\t\tfor (var j = 2; j <= X; j++){\n\t\t\t\t\t\tif (groupH[i] % j == 0){\n\t\t\t\t\t\t\tif((j in searchTableL) || ((groupH[i]/j) in searchTableH)) break divisionCheck_loop;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (j == Math.floor(X)) vec_ans.push(groupH[i]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\tvec_A = groupL.slice();\n\t\t}\n\t}\n \n vec_ans = vec_ans.filter(function (x, i, self) {\n return self.indexOf(x) === i && i === self.lastIndexOf(x);\n });\n\tconsole.log(vec_ans.length);\n} \n\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "language": "JavaScript", "metadata": {"date": 1592599153, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "medium_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/JavaScript/s639468293.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s639468293", "user_id": "u624950076"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "function Main(input) {\n input = input.trim().split(\"\\n\").map(function(x) { return x.split(\" \")});\n var N = parseInt(input[0],10);\n var vec_A = input[1].map(e => parseInt(e, 10)); \n var vec_ans = [];\n var X, groupL, groupH, searchTableL, searchTableH;\n var aryMax = function (a, b) {return Math.max(a, b);}\n\tif (vec_A.indexOf(1) !== -1) {\n\t\t vec_A = vec_A.filter(function (x, i, self) {\n return self.indexOf(x) === i && i === self.lastIndexOf(x);\n });\n if (vec_A.indexOf(1) === -1) {\n \tvec_ans = [];\n } else {\n\t\t\tvec_ans = [1];\n\t\t}\n\t} else {\n\t\twhile (true){\n\t\t\tif (vec_A.length == 1) {\n\t\t\t\tvec_ans.push(vec_A[0]);\n\t\t\t\tbreak;\n\t\t\t} else if (vec_A.length < 1){\n\t\t\t\tbreak;\n\t\t\t} else {\n\t\t\t\tX = Math.sqrt(vec_A.reduce(aryMax));\n\t\t\t\tgroupL = vec_A.filter( function( value ) {\n\t\t\t\t\treturn value <= X;\n\t\t\t\t\t})\n\t\t\t\tsearchTableL = groupL.reduce(function(m, a, i) {\n\t\t\t\t\tm[a] = (m[a] || []).concat(i);\n\t\t\t\t\treturn m;\n\t\t\t\t\t}, {});\n\t\t\t\tgroupH = vec_A.filter( function( value ) {\n\t\t\t\t\treturn value > X;\n\t\t\t\t\t})\n\t\t\t\tsearchTableH = groupH.reduce(function(m, a, i) {\n\t\t\t\t\tm[a] = (m[a] || []).concat(i);\n\t\t\t\t\treturn m;\n\t\t\t\t\t}, {});\n\t\t\t\tfor (var i = 0; i < groupH.length; i++){\n\t\t\t\t\tdivisionCheck_loop:\t\n\t\t\t\t\tfor (var j = 2; j <= X; j++){\n\t\t\t\t\t\tif (groupH[i] % j == 0){\n\t\t\t\t\t\t\tif((j in searchTableL) || ((groupH[i]/j) in searchTableH)) break divisionCheck_loop;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (j == Math.floor(X)) vec_ans.push(groupH[i]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\tvec_A = groupL.slice();\n\t\t}\n\t}\n \n vec_ans = vec_ans.filter(function (x, i, self) {\n return self.indexOf(x) === i && i === self.lastIndexOf(x);\n });\n\tconsole.log(vec_ans.length);\n} \n\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "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": 1749, "cpu_time_ms": 2209, "memory_kb": 109556}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s488816918", "group_id": "codeNet:p02642", "input_text": "function main(input){\n var input = input.trim();\n var input = input.split(\"\\n\");\n var n = input[0];\n var list = input[1].split(\" \");\n for(var i=0; ijList[j]; j++){\n if(i!=j){\n if(list[i]%jList[j]==0){\n wareta=1; break;\n }\n } // if i != j\n } // j loop\n if(wareta==0){nList[nList.length]=i+1;}\n } // i loop\n console.log(nList.length);\n}\nmain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "language": "JavaScript", "metadata": {"date": 1592494565, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "medium_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/JavaScript/s488816918.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s488816918", "user_id": "u028542581"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "function main(input){\n var input = input.trim();\n var input = input.split(\"\\n\");\n var n = input[0];\n var list = input[1].split(\" \");\n for(var i=0; ijList[j]; j++){\n if(i!=j){\n if(list[i]%jList[j]==0){\n wareta=1; break;\n }\n } // if i != j\n } // j loop\n if(wareta==0){nList[nList.length]=i+1;}\n } // i loop\n console.log(nList.length);\n}\nmain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "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": 633, "cpu_time_ms": 2207, "memory_kb": 46008}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s665720103", "group_id": "codeNet:p02642", "input_text": "function main(input){\n var input = input.trim();\n var input = input.split(\"\\n\");\n var n = input[0];\n var list = input[1].split(\" \");\n for(var i=0; i {\n const [, n] = input.trim().split('\\n')\n const nums = n.split(' ').map(v => Number(v))\n\n const max = Math.max(...nums)\n const arr = new Array(max+10).fill(0)\n\n for (let v of nums) {\n if (arr[v] !== 0) {\n arr[v] = 2\n continue\n }\n\n for (let i=v; i<=max+1; i+=v) arr[i]++\n }\n\n let ans = 0\n for (let v of nums) {\n if (arr[v] === 1) ans++\n }\n console.log(ans)\n}\n\nprocess.env.MYTEST ? test() : main(require('fs').readFileSync('/dev/stdin', 'utf8'))", "language": "JavaScript", "metadata": {"date": 1592466232, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "medium_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/JavaScript/s697853779.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s697853779", "user_id": "u124735330"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "const main = (input) => {\n const [, n] = input.trim().split('\\n')\n const nums = n.split(' ').map(v => Number(v))\n\n const max = Math.max(...nums)\n const arr = new Array(max+10).fill(0)\n\n for (let v of nums) {\n if (arr[v] !== 0) {\n arr[v] = 2\n continue\n }\n\n for (let i=v; i<=max+1; i+=v) arr[i]++\n }\n\n let ans = 0\n for (let v of nums) {\n if (arr[v] === 1) ans++\n }\n console.log(ans)\n}\n\nprocess.env.MYTEST ? test() : main(require('fs').readFileSync('/dev/stdin', 'utf8'))", "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": 500, "cpu_time_ms": 109, "memory_kb": 51224}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s800686796", "group_id": "codeNet:p02642", "input_text": "const main = (input) => {\n const [, n] = input.trim().split('\\n')\n const nums = n.split(' ').map(v => Number(v))\n\n const max = Math.max(...nums)\n const arr = new Array(max+1).fill(0)\n\n for (let v of nums) {\n let t = v\n arr[t] = arr[t] + 1\n\n while (t < max+1) {\n t = t + v\n if (t < max+1) arr[t] = arr[t] + 1\n }\n }\n\n let ans = 0\n for (let v of nums) {\n if (arr[v] > 1) continue\n ans++\n }\n console.log(ans)\n}\n\nprocess.env.MYTEST ? test() : main(require('fs').readFileSync('/dev/stdin', 'utf8'))", "language": "JavaScript", "metadata": {"date": 1592465217, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "medium_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/JavaScript/s800686796.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s800686796", "user_id": "u124735330"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "const main = (input) => {\n const [, n] = input.trim().split('\\n')\n const nums = n.split(' ').map(v => Number(v))\n\n const max = Math.max(...nums)\n const arr = new Array(max+1).fill(0)\n\n for (let v of nums) {\n let t = v\n arr[t] = arr[t] + 1\n\n while (t < max+1) {\n t = t + v\n if (t < max+1) arr[t] = arr[t] + 1\n }\n }\n\n let ans = 0\n for (let v of nums) {\n if (arr[v] > 1) continue\n ans++\n }\n console.log(ans)\n}\n\nprocess.env.MYTEST ? test() : main(require('fs').readFileSync('/dev/stdin', 'utf8'))", "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": 530, "cpu_time_ms": 110, "memory_kb": 51172}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s015534864", "group_id": "codeNet:p02642", "input_text": "\nlet input = require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\")\n\nfunction main({ input, load, yesno, math_sum }) {\n\n const [N] = load()\n const A = load(N)\n\n let Ai_max = 0\n for(const a of A) if(a > Ai_max) Ai_max = a\n\n const nums = new Array(Ai_max + 1).fill(0)\n\n for(const a of A) nums[a]++\n\n for(let i = 1; i <= Ai_max; i++) {\n if(!nums[i]) continue\n for(let j = i * 2; j <= Ai_max; j += i) {\n nums[j] = 0\n }\n }\n\n console.log(nums.filter(n => n === 1).length)\n}\n\nlet inputs = input.split(/[\\s\\n]/)\nmain({\n input,\n yesno: value => value ? 'Yes' : 'No',\n load(rows = 1, cols = 1, is_number = true) {\n const length = rows * cols\n let result = inputs.splice(0, length)\n if(is_number) result = result.map(Number)\n if(cols > 1) {\n const arrays = new Array(cols)\n for(let col = 0; col < cols; col++) {\n arrays[col] = new Array()\n for(let row = 0; row < rows; row++) {\n arrays[col].push(result[row * cols + col])\n }\n }\n result = arrays\n }\n return result\n },\n inifinite_loop_preventer() {\n throw new Error(\"Infinite loop\")\n },\n math_sum(numbers) {\n return numbers.reduce((acc, cur) => acc + cur, 0)\n },\n})\n", "language": "JavaScript", "metadata": {"date": 1592368417, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "medium_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/JavaScript/s015534864.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s015534864", "user_id": "u760244603"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "\nlet input = require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\")\n\nfunction main({ input, load, yesno, math_sum }) {\n\n const [N] = load()\n const A = load(N)\n\n let Ai_max = 0\n for(const a of A) if(a > Ai_max) Ai_max = a\n\n const nums = new Array(Ai_max + 1).fill(0)\n\n for(const a of A) nums[a]++\n\n for(let i = 1; i <= Ai_max; i++) {\n if(!nums[i]) continue\n for(let j = i * 2; j <= Ai_max; j += i) {\n nums[j] = 0\n }\n }\n\n console.log(nums.filter(n => n === 1).length)\n}\n\nlet inputs = input.split(/[\\s\\n]/)\nmain({\n input,\n yesno: value => value ? 'Yes' : 'No',\n load(rows = 1, cols = 1, is_number = true) {\n const length = rows * cols\n let result = inputs.splice(0, length)\n if(is_number) result = result.map(Number)\n if(cols > 1) {\n const arrays = new Array(cols)\n for(let col = 0; col < cols; col++) {\n arrays[col] = new Array()\n for(let row = 0; row < rows; row++) {\n arrays[col].push(result[row * cols + col])\n }\n }\n result = arrays\n }\n return result\n },\n inifinite_loop_preventer() {\n throw new Error(\"Infinite loop\")\n },\n math_sum(numbers) {\n return numbers.reduce((acc, cur) => acc + cur, 0)\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": 1344, "cpu_time_ms": 180, "memory_kb": 70392}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s418743186", "group_id": "codeNet:p02642", "input_text": "\nlet input = require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\")\n\nfunction main({ input, load, yesno, math_sum }) {\n\n const [N] = load()\n const A = load(N)\n\n const Ai_max = 2e5\n const nums = new Array(Ai_max + 1).fill(0)\n\n for(const a of A) nums[a]++\n\n for(let i = 1; i <= Ai_max; i++) {\n if(!nums[i]) continue\n for(let j = i * 2; j <= Ai_max; j += i) {\n nums[j] = 0\n }\n }\n\n console.log(nums.filter(n => n === 1).length)\n}\n\nlet inputs = input.trim().split(/[\\s\\n]/)\nmain({\n input,\n yesno: value => value ? 'Yes' : 'No',\n load(rows = 1, cols = 1, is_number = true) {\n const length = rows * cols\n let result = inputs.splice(0, length)\n if(is_number) result = result.map(Number)\n if(cols > 1) {\n const arrays = new Array(cols)\n for(let col = 0; col < cols; col++) {\n arrays[col] = new Array()\n for(let row = 0; row < rows; row++) {\n arrays[col].push(result[row * cols + col])\n }\n }\n result = arrays\n }\n return result\n },\n inifinite_loop_preventer() {\n throw new Error(\"Infinite loop\")\n },\n math_sum(numbers) {\n return numbers.reduce((acc, cur) => acc + cur, 0)\n },\n})\n", "language": "JavaScript", "metadata": {"date": 1592367262, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "medium_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/JavaScript/s418743186.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s418743186", "user_id": "u760244603"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "\nlet input = require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\")\n\nfunction main({ input, load, yesno, math_sum }) {\n\n const [N] = load()\n const A = load(N)\n\n const Ai_max = 2e5\n const nums = new Array(Ai_max + 1).fill(0)\n\n for(const a of A) nums[a]++\n\n for(let i = 1; i <= Ai_max; i++) {\n if(!nums[i]) continue\n for(let j = i * 2; j <= Ai_max; j += i) {\n nums[j] = 0\n }\n }\n\n console.log(nums.filter(n => n === 1).length)\n}\n\nlet inputs = input.trim().split(/[\\s\\n]/)\nmain({\n input,\n yesno: value => value ? 'Yes' : 'No',\n load(rows = 1, cols = 1, is_number = true) {\n const length = rows * cols\n let result = inputs.splice(0, length)\n if(is_number) result = result.map(Number)\n if(cols > 1) {\n const arrays = new Array(cols)\n for(let col = 0; col < cols; col++) {\n arrays[col] = new Array()\n for(let row = 0; row < rows; row++) {\n arrays[col].push(result[row * cols + col])\n }\n }\n result = arrays\n }\n return result\n },\n inifinite_loop_preventer() {\n throw new Error(\"Infinite loop\")\n },\n math_sum(numbers) {\n return numbers.reduce((acc, cur) => acc + cur, 0)\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": 1306, "cpu_time_ms": 833, "memory_kb": 206388}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s728138480", "group_id": "codeNet:p02642", "input_text": "\nlet input = require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\")\n\nfunction main({ input, load, yesno, math_sum }) {\n\n const [N] = load()\n const A = load(N)\n\n const Ai_max = 2e5\n const nums = new Array(Ai_max + 1).fill(0)\n\n for(const a of A) nums[a]++\n\n for(let i = 1; i <= Ai_max; i++) {\n if(nums[i]) {\n if(nums[i] > 1) nums[i] = 0\n for(let j = i * 2; j <= Ai_max; j += i) {\n nums[j] = 0\n }\n }\n }\n\n console.log(math_sum(nums))\n}\n\nlet inputs = input.split(/[\\s\\n]/)\nmain({\n input,\n yesno: value => value ? 'Yes' : 'No',\n load(rows = 1, cols = 1, is_number = true) {\n const length = rows * cols\n let result = inputs.splice(0, length)\n if(is_number) result = result.map(Number)\n if(cols > 1) {\n const arrays = new Array(cols)\n for(let col = 0; col < cols; col++) {\n arrays[col] = new Array()\n for(let row = 0; row < rows; row++) {\n arrays[col].push(result[row * cols + col])\n }\n }\n result = arrays\n }\n return result\n },\n inifinite_loop_preventer() {\n throw new Error(\"Infinite loop\")\n },\n math_sum(numbers) {\n return numbers.reduce((acc, cur) => acc + cur, 0)\n },\n})\n", "language": "JavaScript", "metadata": {"date": 1592366758, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "medium_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/JavaScript/s728138480.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s728138480", "user_id": "u760244603"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "\nlet input = require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\")\n\nfunction main({ input, load, yesno, math_sum }) {\n\n const [N] = load()\n const A = load(N)\n\n const Ai_max = 2e5\n const nums = new Array(Ai_max + 1).fill(0)\n\n for(const a of A) nums[a]++\n\n for(let i = 1; i <= Ai_max; i++) {\n if(nums[i]) {\n if(nums[i] > 1) nums[i] = 0\n for(let j = i * 2; j <= Ai_max; j += i) {\n nums[j] = 0\n }\n }\n }\n\n console.log(math_sum(nums))\n}\n\nlet inputs = input.split(/[\\s\\n]/)\nmain({\n input,\n yesno: value => value ? 'Yes' : 'No',\n load(rows = 1, cols = 1, is_number = true) {\n const length = rows * cols\n let result = inputs.splice(0, length)\n if(is_number) result = result.map(Number)\n if(cols > 1) {\n const arrays = new Array(cols)\n for(let col = 0; col < cols; col++) {\n arrays[col] = new Array()\n for(let row = 0; row < rows; row++) {\n arrays[col].push(result[row * cols + col])\n }\n }\n result = arrays\n }\n return result\n },\n inifinite_loop_preventer() {\n throw new Error(\"Infinite loop\")\n },\n math_sum(numbers) {\n return numbers.reduce((acc, cur) => acc + cur, 0)\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": 1335, "cpu_time_ms": 1034, "memory_kb": 208044}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s272997125", "group_id": "codeNet:p02642", "input_text": "const main = (input) => {\n const args = input.trim().split(\"\\n\");\n const Ai = args[1]\n .trim()\n .split(\" \")\n .map((n) => parseInt(n, 10));\n \n const isNotDividable = (ai, i) => {\n // const Aj = Ai.filter((_, j) => j !== i);\n let Aj = [...Ai];\n Aj.splice(i, 1);\n return Aj.every((aj) => ai % aj !== 0);\n };\n \n const count = Ai.filter((ai, i) => isNotDividable(ai, i)).filter((b) => b).length;\n \n console.log(count);\n};\n \nmain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "language": "JavaScript", "metadata": {"date": 1592273879, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "medium_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/JavaScript/s272997125.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s272997125", "user_id": "u199519744"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "const main = (input) => {\n const args = input.trim().split(\"\\n\");\n const Ai = args[1]\n .trim()\n .split(\" \")\n .map((n) => parseInt(n, 10));\n \n const isNotDividable = (ai, i) => {\n // const Aj = Ai.filter((_, j) => j !== i);\n let Aj = [...Ai];\n Aj.splice(i, 1);\n return Aj.every((aj) => ai % aj !== 0);\n };\n \n const count = Ai.filter((ai, i) => isNotDividable(ai, i)).filter((b) => b).length;\n \n console.log(count);\n};\n \nmain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "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": 501, "cpu_time_ms": 2207, "memory_kb": 56268}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s135119134", "group_id": "codeNet:p02642", "input_text": "const main = (input) => {\n const args = input.trim().split(\"\\n\");\n const Ai = args[1]\n .trim()\n .split(\" \")\n .map((n) => parseInt(n, 10));\n\n const isNotDividable = (ai) => {\n const Aj = Ai.filter((a) => a !== ai);\n return Aj.every((aj) => ai % aj !== 0);\n };\n\n const count = Ai.filter(isNotDividable).length;\n\n console.log(count);\n};\n\nmain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "language": "JavaScript", "metadata": {"date": 1592270629, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "medium_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/JavaScript/s135119134.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s135119134", "user_id": "u199519744"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "const main = (input) => {\n const args = input.trim().split(\"\\n\");\n const Ai = args[1]\n .trim()\n .split(\" \")\n .map((n) => parseInt(n, 10));\n\n const isNotDividable = (ai) => {\n const Aj = Ai.filter((a) => a !== ai);\n return Aj.every((aj) => ai % aj !== 0);\n };\n\n const count = Ai.filter(isNotDividable).length;\n\n console.log(count);\n};\n\nmain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "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": 411, "cpu_time_ms": 2208, "memory_kb": 89748}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s979466857", "group_id": "codeNet:p02642", "input_text": "'use strict';\n\nfunction Main(input) {\n let tmp = input.trim().split('\\n');\n const N = Number(tmp[0]);\n let A = tmp[1].split(' ').map((v) => Number(v)).sort((a, b) => a - b);\n\n // 1が存在する場合\n if (A[0] === 1) {\n console.log('0');\n return;\n }\n\n let siftedA = [];\n for (let i = 2; i <= 10**6; i++) {\n if (A[0] !== i) continue;\n const filterA = A.filter(v => v === i);\n if (filterA.length === 1) {\n siftedA = [...siftedA, A[0]];\n }\n A = A.filter(v => v % i !== 0)\n if (A.length === 0) break;\n }\n\n console.log(String(siftedA.length + A.length));\n\n\n return;\n}\nMain(require('fs').readFileSync('/dev/stdin', 'utf8'));\n\n// Main(`5\n// 24 11 8 3 16`); // 3\n// Main(`4\n// 5 5 5 5`); // 0\n// Main(`10\n// 33 18 45 28 8 19 89 86 2 4`); // 5", "language": "JavaScript", "metadata": {"date": 1592263621, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "medium_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/JavaScript/s979466857.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s979466857", "user_id": "u291678294"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "'use strict';\n\nfunction Main(input) {\n let tmp = input.trim().split('\\n');\n const N = Number(tmp[0]);\n let A = tmp[1].split(' ').map((v) => Number(v)).sort((a, b) => a - b);\n\n // 1が存在する場合\n if (A[0] === 1) {\n console.log('0');\n return;\n }\n\n let siftedA = [];\n for (let i = 2; i <= 10**6; i++) {\n if (A[0] !== i) continue;\n const filterA = A.filter(v => v === i);\n if (filterA.length === 1) {\n siftedA = [...siftedA, A[0]];\n }\n A = A.filter(v => v % i !== 0)\n if (A.length === 0) break;\n }\n\n console.log(String(siftedA.length + A.length));\n\n\n return;\n}\nMain(require('fs').readFileSync('/dev/stdin', 'utf8'));\n\n// Main(`5\n// 24 11 8 3 16`); // 3\n// Main(`4\n// 5 5 5 5`); // 0\n// Main(`10\n// 33 18 45 28 8 19 89 86 2 4`); // 5", "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": 839, "cpu_time_ms": 2208, "memory_kb": 107980}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s257482829", "group_id": "codeNet:p02642", "input_text": "'use strict';\n\nfunction Main(stdin){\n const input = stdin.trim().split(/\\r?\\n/g);\n const N = Number(input[0]);\n let A = input[1].split(' ').map(str => Number(str));\n A.sort(((a, b) => a - b));\n\n for(let i = 0; i < A.length; i++){\n for(let j = i+1; j < A.length; j++){ \n if(A[j]%A[i] === 0 && A[j] !==A[i]) {\n A.splice(j,1);\n j--;\n }\n }\n }\n for(let k = 0; k < N; k++){\n let firstIndex = A.indexOf(A[k]);\n let lastIndex = A.lastIndexOf(A[k]);\n if(firstIndex !== lastIndex){\n A.splice(firstIndex,lastIndex+1);\n }\n }\n console.log(A.length);\n}\n\n// 固定\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "language": "JavaScript", "metadata": {"date": 1592233295, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "medium_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/JavaScript/s257482829.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s257482829", "user_id": "u253942942"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "'use strict';\n\nfunction Main(stdin){\n const input = stdin.trim().split(/\\r?\\n/g);\n const N = Number(input[0]);\n let A = input[1].split(' ').map(str => Number(str));\n A.sort(((a, b) => a - b));\n\n for(let i = 0; i < A.length; i++){\n for(let j = i+1; j < A.length; j++){ \n if(A[j]%A[i] === 0 && A[j] !==A[i]) {\n A.splice(j,1);\n j--;\n }\n }\n }\n for(let k = 0; k < N; k++){\n let firstIndex = A.indexOf(A[k]);\n let lastIndex = A.lastIndexOf(A[k]);\n if(firstIndex !== lastIndex){\n A.splice(firstIndex,lastIndex+1);\n }\n }\n console.log(A.length);\n}\n\n// 固定\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "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": 680, "cpu_time_ms": 2207, "memory_kb": 49004}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s510679847", "group_id": "codeNet:p02642", "input_text": "const input = require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\")\nlet cin = input.split(/ |\\n/), cid = 0\nconst next = () => cin[cid++]\nconst nexts = (n) => cin.slice(cid, cid+=n).map(i=>parseInt(i))\nconst xArray = (n, v) => [...Array(n)].fill(v)\n\nconst N = parseInt(next())\nlet array = xArray(1e6+1, 0)\nfor (let i = 0; i < N; i++) {\n a = next()\n array[a]++\n}\nlet ans = 0\nfor (let i = 0; i <= 1e6; i++) {\n if(array[i] === 0) continue;\n if(array[i] === 1) ans++;\n for (let j = i + i; j <= 1e6; j+=i) {\n array[j] = 0\n }\n}\nconsole.log(ans)\n", "language": "JavaScript", "metadata": {"date": 1592194469, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "medium_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/JavaScript/s510679847.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s510679847", "user_id": "u291625338"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "const input = require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\")\nlet cin = input.split(/ |\\n/), cid = 0\nconst next = () => cin[cid++]\nconst nexts = (n) => cin.slice(cid, cid+=n).map(i=>parseInt(i))\nconst xArray = (n, v) => [...Array(n)].fill(v)\n\nconst N = parseInt(next())\nlet array = xArray(1e6+1, 0)\nfor (let i = 0; i < N; i++) {\n a = next()\n array[a]++\n}\nlet ans = 0\nfor (let i = 0; i <= 1e6; i++) {\n if(array[i] === 0) continue;\n if(array[i] === 1) ans++;\n for (let j = i + i; j <= 1e6; j+=i) {\n array[j] = 0\n }\n}\nconsole.log(ans)\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": 558, "cpu_time_ms": 137, "memory_kb": 61532}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s181674538", "group_id": "codeNet:p02642", "input_text": "const input = require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\")\n;(input => {\n const rows = input.split('\\n')\n const N = rows[0] - 0\n\n const A = rows[1].split(' ').map(Number)\n A.sort((a, b) => {\n return a < b ? -1 : 1\n })\n\n const mem = []\n let count = 0\n\n for (let i = 0; i < N; i ++) {\n if (mem[A[i]] === 0) {\n count = Math.max(0, count - 1)\n continue\n } else if (mem[A[i]] === 1) {\n continue\n } else {\n mem[A[i]] = 0\n }\n for (let j = 2; A[i] * j <= A[N - 1]; j++) {\n mem[A[i] * j] = 1\n }\n count++\n }\n console.log(count)\n\n})(input)\n", "language": "JavaScript", "metadata": {"date": 1592193667, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "medium_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/JavaScript/s181674538.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s181674538", "user_id": "u968011443"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "const input = require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\")\n;(input => {\n const rows = input.split('\\n')\n const N = rows[0] - 0\n\n const A = rows[1].split(' ').map(Number)\n A.sort((a, b) => {\n return a < b ? -1 : 1\n })\n\n const mem = []\n let count = 0\n\n for (let i = 0; i < N; i ++) {\n if (mem[A[i]] === 0) {\n count = Math.max(0, count - 1)\n continue\n } else if (mem[A[i]] === 1) {\n continue\n } else {\n mem[A[i]] = 0\n }\n for (let j = 2; A[i] * j <= A[N - 1]; j++) {\n mem[A[i] * j] = 1\n }\n count++\n }\n console.log(count)\n\n})(input)\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": 673, "cpu_time_ms": 261, "memory_kb": 78524}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s991568313", "group_id": "codeNet:p02642", "input_text": "\"use strict\";\nvar input = require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\");\nvar cin = input.split(/ |\\n/),\n cid = 0;\n\n// number一個取得\n// eslint-disable-next-line no-unused-vars\nconst next = () => +cin[cid++];\n\n// 文字列一個取得\n// eslint-disable-next-line no-unused-vars\nconst nextstr = () => cin[cid++];\n\n// BigInteger一個取得\n// eslint-disable-next-line no-unused-vars\nconst nextbig = () => BigInt(cin[cid++]);\n\n// 長さnの配列として取得。aは文字列フラグ\n// eslint-disable-next-line no-unused-vars\nconst nexts = (n, a) =>\n a ? cin.slice(cid, (cid += n)) : cin.slice(cid, (cid += n)).map((a) => +a);\n\n// w個ずつを組にして長さhの配列。aは文字列フラグ。\n// eslint-disable-next-line no-unused-vars\nconst nextm = (h, w, a) => {\n var r = [],\n i = 0;\n if (a) for (; i < h; i++) r.push(cin.slice(cid, (cid += w)));\n else for (; i < h; i++) r.push(cin.slice(cid, (cid += w)).map((a) => +a));\n return r;\n};\n// 多次元配列。v,a1,a2,a3 なら、3次元。[[値vで長さa3の配列]をa2個並べた配列]をa1個並べた配列。\n// eslint-disable-next-line no-unused-vars\nconst xArray = (...args) => {\n var a = args,\n l = a.length,\n r = \"Array(a[\" + --l + \"]).fill().map(x=>{return \" + a[0] + \";})\";\n while (--l) r = \"Array(a[\" + l + \"]).fill().map(x=>\" + r + \")\";\n return eval(r);\n};\n\nconsole.log(main());\n\nfunction main() {\n let n = next();\n let a = nexts(n).sort((a, b) => a - b);\n let ans = 0;\n if (n == 1) return 1;\n let b = Array.from(new Set(a));\n let nums = Array(200001).fill(0);\n for (let i = 0; i < n; i++) nums[a[i]]++;\n while (b.length > 1) {\n let v = b.shift();\n b = b.filter((x) => x % v != 0);\n if (nums[v] == 1) ans++;\n }\n if (b.length == 1 && nums[b[0]] == 1) ans++;\n return ans;\n}\n", "language": "JavaScript", "metadata": {"date": 1592192003, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "medium_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/JavaScript/s991568313.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s991568313", "user_id": "u499179030"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "\"use strict\";\nvar input = require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\");\nvar cin = input.split(/ |\\n/),\n cid = 0;\n\n// number一個取得\n// eslint-disable-next-line no-unused-vars\nconst next = () => +cin[cid++];\n\n// 文字列一個取得\n// eslint-disable-next-line no-unused-vars\nconst nextstr = () => cin[cid++];\n\n// BigInteger一個取得\n// eslint-disable-next-line no-unused-vars\nconst nextbig = () => BigInt(cin[cid++]);\n\n// 長さnの配列として取得。aは文字列フラグ\n// eslint-disable-next-line no-unused-vars\nconst nexts = (n, a) =>\n a ? cin.slice(cid, (cid += n)) : cin.slice(cid, (cid += n)).map((a) => +a);\n\n// w個ずつを組にして長さhの配列。aは文字列フラグ。\n// eslint-disable-next-line no-unused-vars\nconst nextm = (h, w, a) => {\n var r = [],\n i = 0;\n if (a) for (; i < h; i++) r.push(cin.slice(cid, (cid += w)));\n else for (; i < h; i++) r.push(cin.slice(cid, (cid += w)).map((a) => +a));\n return r;\n};\n// 多次元配列。v,a1,a2,a3 なら、3次元。[[値vで長さa3の配列]をa2個並べた配列]をa1個並べた配列。\n// eslint-disable-next-line no-unused-vars\nconst xArray = (...args) => {\n var a = args,\n l = a.length,\n r = \"Array(a[\" + --l + \"]).fill().map(x=>{return \" + a[0] + \";})\";\n while (--l) r = \"Array(a[\" + l + \"]).fill().map(x=>\" + r + \")\";\n return eval(r);\n};\n\nconsole.log(main());\n\nfunction main() {\n let n = next();\n let a = nexts(n).sort((a, b) => a - b);\n let ans = 0;\n if (n == 1) return 1;\n let b = Array.from(new Set(a));\n let nums = Array(200001).fill(0);\n for (let i = 0; i < n; i++) nums[a[i]]++;\n while (b.length > 1) {\n let v = b.shift();\n b = b.filter((x) => x % v != 0);\n if (nums[v] == 1) ans++;\n }\n if (b.length == 1 && nums[b[0]] == 1) ans++;\n return ans;\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": 1857, "cpu_time_ms": 2211, "memory_kb": 200144}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s150197495", "group_id": "codeNet:p02642", "input_text": "'use strict';\n\nfunction Main(stdin){\n const input = stdin.trim().split(/\\r?\\n/g);\n const N = Number(input[0]);\n let A = input[1].split(' ').map(str => Number(str));\n A.sort(((a, b) => a - b));\n let tmpA = A.slice(0);\n\n for(let i = 0; i < N; i++){\n for(let j = 0; j < tmpA.length; j++){ \n if(tmpA[j]%A[i] === 0 && tmpA[j] !==A[i]) {\n tmpA.splice(j,1);\n }\n }\n }\n\n for(let k = 0; k < N; k++){\n let firstIndex = tmpA.indexOf(tmpA[k]);\n let lastIndex = tmpA.lastIndexOf(tmpA[k]);\n if(firstIndex !== lastIndex){\n tmpA.splice(firstIndex,lastIndex+1);\n }\n }\n console.log(tmpA.length);\n}\n\n// 固定\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "language": "JavaScript", "metadata": {"date": 1592191433, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "medium_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/JavaScript/s150197495.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s150197495", "user_id": "u253942942"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "'use strict';\n\nfunction Main(stdin){\n const input = stdin.trim().split(/\\r?\\n/g);\n const N = Number(input[0]);\n let A = input[1].split(' ').map(str => Number(str));\n A.sort(((a, b) => a - b));\n let tmpA = A.slice(0);\n\n for(let i = 0; i < N; i++){\n for(let j = 0; j < tmpA.length; j++){ \n if(tmpA[j]%A[i] === 0 && tmpA[j] !==A[i]) {\n tmpA.splice(j,1);\n }\n }\n }\n\n for(let k = 0; k < N; k++){\n let firstIndex = tmpA.indexOf(tmpA[k]);\n let lastIndex = tmpA.lastIndexOf(tmpA[k]);\n if(firstIndex !== lastIndex){\n tmpA.splice(firstIndex,lastIndex+1);\n }\n }\n console.log(tmpA.length);\n}\n\n// 固定\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "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": 714, "cpu_time_ms": 2207, "memory_kb": 53532}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s809105487", "group_id": "codeNet:p02642", "input_text": "'use strict';\n\nfunction Main(stdin){\n const input = stdin.trim().split(/\\r?\\n/g);\n const N = Number(input[0]);\n let A = input[1].split(' ').map(str => Number(str));\n A.sort(((a, b) => a - b));\n let tmpA = A.slice(0);\n for(let k = 0; k < N; k++){\n let firstIndex = tmpA.indexOf(tmpA[k]);\n let lastIndex = tmpA.indexOf(tmpA[k]);\n if(firstIndex !== lastIndex){\n tmpA.splice(firstIndex,lastIndex);\n }}\n for(let i = 0; i < N; i++){\n for(let j = 0; j < tmpA.length; j++){\n \n if(tmpA[j]%A[i] === 0 && tmpA[j] !==A[i]) {\n tmpA.splice(j,1);\n }\n }\n }\n console.log(tmpA.length);\n}\n\n// 固定\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "language": "JavaScript", "metadata": {"date": 1592188782, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "medium_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/JavaScript/s809105487.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s809105487", "user_id": "u253942942"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "'use strict';\n\nfunction Main(stdin){\n const input = stdin.trim().split(/\\r?\\n/g);\n const N = Number(input[0]);\n let A = input[1].split(' ').map(str => Number(str));\n A.sort(((a, b) => a - b));\n let tmpA = A.slice(0);\n for(let k = 0; k < N; k++){\n let firstIndex = tmpA.indexOf(tmpA[k]);\n let lastIndex = tmpA.indexOf(tmpA[k]);\n if(firstIndex !== lastIndex){\n tmpA.splice(firstIndex,lastIndex);\n }}\n for(let i = 0; i < N; i++){\n for(let j = 0; j < tmpA.length; j++){\n \n if(tmpA[j]%A[i] === 0 && tmpA[j] !==A[i]) {\n tmpA.splice(j,1);\n }\n }\n }\n console.log(tmpA.length);\n}\n\n// 固定\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "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": 704, "cpu_time_ms": 2207, "memory_kb": 50128}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s299934384", "group_id": "codeNet:p02642", "input_text": "\"use strict\";\n \nconst main = arg => {\n arg = arg.trim().split(\"\\n\");\n const N = parseInt(arg[0].split(\" \")[0]);\n let A = arg[1].split(\" \").map(n=>parseInt(n)).sort((a,b)=>a-b);\n \n // console.log(A);\n \n for(let i=0; i n !== -1);\n }\n }\n \n // console.log(A);\n\n console.log(A.length);\n}\nmain(require('fs').readFileSync('/dev/stdin', 'utf8'));\n", "language": "JavaScript", "metadata": {"date": 1592188287, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "medium_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/JavaScript/s299934384.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s299934384", "user_id": "u598795006"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "\"use strict\";\n \nconst main = arg => {\n arg = arg.trim().split(\"\\n\");\n const N = parseInt(arg[0].split(\" \")[0]);\n let A = arg[1].split(\" \").map(n=>parseInt(n)).sort((a,b)=>a-b);\n \n // console.log(A);\n \n for(let i=0; i n !== -1);\n }\n }\n \n // console.log(A);\n\n console.log(A.length);\n}\nmain(require('fs').readFileSync('/dev/stdin', 'utf8'));\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": 969, "cpu_time_ms": 2208, "memory_kb": 99660}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s872102800", "group_id": "codeNet:p02642", "input_text": "\n// A[i]は自分以外すべての要素に対して互いに素である\n\nfunction main(input) {\n let [N, ...As] = input.trim().split(/[\\s\\n]/).map(Number)\n \n As.sort((a,b) => a-b)\n \n let dups = []\n for(let i = 0; i < As.length; i++) {\n for(let j = As.length - 1; j > i; j--) {\n\n if(As[j] === As[i]) {\n dups.push(As[i])\n }\n\n if(As[j] % As[i] === 0) {\n As.splice(j, 1)\n }\n }\n }\n \n console.log(As.length - new Set(dups).size)\n}\n\nmain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"))\n", "language": "JavaScript", "metadata": {"date": 1592188257, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "medium_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/JavaScript/s872102800.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s872102800", "user_id": "u760244603"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "\n// A[i]は自分以外すべての要素に対して互いに素である\n\nfunction main(input) {\n let [N, ...As] = input.trim().split(/[\\s\\n]/).map(Number)\n \n As.sort((a,b) => a-b)\n \n let dups = []\n for(let i = 0; i < As.length; i++) {\n for(let j = As.length - 1; j > i; j--) {\n\n if(As[j] === As[i]) {\n dups.push(As[i])\n }\n\n if(As[j] % As[i] === 0) {\n As.splice(j, 1)\n }\n }\n }\n \n console.log(As.length - new Set(dups).size)\n}\n\nmain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"))\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": 599, "cpu_time_ms": 2207, "memory_kb": 65736}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s330421005", "group_id": "codeNet:p02642", "input_text": "const input = require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\")\nlet cin = input.split(/ |\\n/), cid = 0\nconst next = () => cin[cid++]\nconst nexts = (n) => cin.slice(cid, cid+=n).map(i=>parseInt(i))\n\nconst N = parseInt(next())\nconst A = nexts(N).sort((a, b) => a - b)\ncount = N\nfor (let i = 0; i < N; i++) {\n if (A[i] == A[i+1]) {\n count--\n continue\n }\n for (let j = 0; j < i; j++) {\n if (i / j < 2) {\n break\n }\n if (A[i] % A[j] == 0) {\n count--\n break\n }\n }\n}\nconsole.log(count)\n", "language": "JavaScript", "metadata": {"date": 1592188226, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "medium_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/JavaScript/s330421005.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s330421005", "user_id": "u291625338"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "const input = require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\")\nlet cin = input.split(/ |\\n/), cid = 0\nconst next = () => cin[cid++]\nconst nexts = (n) => cin.slice(cid, cid+=n).map(i=>parseInt(i))\n\nconst N = parseInt(next())\nconst A = nexts(N).sort((a, b) => a - b)\ncount = N\nfor (let i = 0; i < N; i++) {\n if (A[i] == A[i+1]) {\n count--\n continue\n }\n for (let j = 0; j < i; j++) {\n if (i / j < 2) {\n break\n }\n if (A[i] % A[j] == 0) {\n count--\n break\n }\n }\n}\nconsole.log(count)\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": 564, "cpu_time_ms": 2207, "memory_kb": 51592}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s066176906", "group_id": "codeNet:p02642", "input_text": "// ABC170\nfunction main(input) {\n var inputs = input.trim().split('\\n');\n var N = parseInt(inputs[0], 10);\n var A = typeof(inputs[1]) !== 'undefined' ? inputs[1].split(' ').map(n => parseInt(n, 10)) : [];\n\n var full = [];\n for (var i = 0; i < 1000001; i++) {\n full.push(0);\n }\n\n for (var i = 0; i < N; i++) {\n if (full[A[i]] > 1) continue;\n\n loop = 1;\n while (true) {\n var temp = loop * A[i];\n if (temp > 1000001) {\n break;\n } else {\n if (full[temp] > 1) {\n loop += 1;\n continue;\n } else {\n full[temp] += 1;\n loop += 1;\n }\n }\n }\n }\n\n var counter = 0;\n for (var n = 0; n < N; n++) {\n if (full[A[n]] === 1) counter += 1;\n }\n\n console.log(counter);\n}\n\nmain(require('fs').readFileSync('/dev/stdin', 'utf8'));", "language": "JavaScript", "metadata": {"date": 1592187283, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "medium_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/JavaScript/s066176906.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s066176906", "user_id": "u474579514"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "// ABC170\nfunction main(input) {\n var inputs = input.trim().split('\\n');\n var N = parseInt(inputs[0], 10);\n var A = typeof(inputs[1]) !== 'undefined' ? inputs[1].split(' ').map(n => parseInt(n, 10)) : [];\n\n var full = [];\n for (var i = 0; i < 1000001; i++) {\n full.push(0);\n }\n\n for (var i = 0; i < N; i++) {\n if (full[A[i]] > 1) continue;\n\n loop = 1;\n while (true) {\n var temp = loop * A[i];\n if (temp > 1000001) {\n break;\n } else {\n if (full[temp] > 1) {\n loop += 1;\n continue;\n } else {\n full[temp] += 1;\n loop += 1;\n }\n }\n }\n }\n\n var counter = 0;\n for (var n = 0; n < N; n++) {\n if (full[A[n]] === 1) counter += 1;\n }\n\n console.log(counter);\n}\n\nmain(require('fs').readFileSync('/dev/stdin', 'utf8'));", "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": 818, "cpu_time_ms": 205, "memory_kb": 85752}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s256592958", "group_id": "codeNet:p02642", "input_text": "\"use strict\";\n\nconst main = arg => {\n const input = arg.trim().split(\"\\n\");\n\n const N = parseInt(input[0].split(\" \")[0]);\n const A = input[1].split(\" \").map(n => parseInt(n));\n if(A.includes(1)){\n console.log(0)\n return\n }\n if(A.length == 1){\n console.log(1)\n return\n }\n A.sort((a,b) => a-b)\n let cnt = 0\n for(let i = 1; i {\n const input = arg.trim().split(\"\\n\");\n\n const N = parseInt(input[0].split(\" \")[0]);\n const A = input[1].split(\" \").map(n => parseInt(n));\n if(A.includes(1)){\n console.log(0)\n return\n }\n if(A.length == 1){\n console.log(1)\n return\n }\n A.sort((a,b) => a-b)\n let cnt = 0\n for(let i = 1; i parseInt(n, 10)) : [];\n\n var full = [];\n for (var i = 0; i < 1000001; i++) {\n full.push(0);\n }\n\n for (var i = 0; i < N; i++) {\n if (full[A[i]] > 1) continue;\n\n shouldCont = true;\n loop = 1;\n while (true) {\n var temp = loop * A[i];\n if (temp > 1000001) {\n break;\n } else {\n if (full[temp] > 1) break;\n full[temp] += 1;\n loop += 1;\n }\n }\n }\n\n var counter = 0;\n for (var n = 0; n < N; n++) {\n if (full[A[n]] === 1) counter += 1;\n }\n\n console.log(counter);\n}\n\nmain(require('fs').readFileSync('/dev/stdin', 'utf8'));", "language": "JavaScript", "metadata": {"date": 1592186563, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "medium_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/JavaScript/s802361095.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s802361095", "user_id": "u474579514"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "// ABC170\nfunction main(input) {\n var inputs = input.trim().split('\\n');\n var N = parseInt(inputs[0], 10);\n var A = typeof(inputs[1]) !== 'undefined' ? inputs[1].split(' ').map(n => parseInt(n, 10)) : [];\n\n var full = [];\n for (var i = 0; i < 1000001; i++) {\n full.push(0);\n }\n\n for (var i = 0; i < N; i++) {\n if (full[A[i]] > 1) continue;\n\n shouldCont = true;\n loop = 1;\n while (true) {\n var temp = loop * A[i];\n if (temp > 1000001) {\n break;\n } else {\n if (full[temp] > 1) break;\n full[temp] += 1;\n loop += 1;\n }\n }\n }\n\n var counter = 0;\n for (var n = 0; n < N; n++) {\n if (full[A[n]] === 1) counter += 1;\n }\n\n console.log(counter);\n}\n\nmain(require('fs').readFileSync('/dev/stdin', 'utf8'));", "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": 774, "cpu_time_ms": 145, "memory_kb": 78492}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s839252845", "group_id": "codeNet:p02642", "input_text": "function gcd(a,b){while(b)[a,b]=[b,a%b];return a};\nconsole.log(function(args){\n const tmp = args.trim().split('\\n')\n const N = tmp[0]|0;\n const A = tmp[1].split(' ').map(v=>v|0).sort((a,b)=>b-a);\n let AA = 1, count = 0;\n for ( let i = 0; i < N-1; i++ ) {\n AA *= A[i];\n if ( AA % A[i+1] ) count++;\n else AA = AA * A[i] / gcd( AA, A[i] );\n }\n return count.toString();\n}(require('fs').readFileSync('/dev/stdin', 'utf8')));", "language": "JavaScript", "metadata": {"date": 1592185276, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02642.html", "problem_id": "p02642", "resource_group": "medium_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/JavaScript/s839252845.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s839252845", "user_id": "u088845406"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "function gcd(a,b){while(b)[a,b]=[b,a%b];return a};\nconsole.log(function(args){\n const tmp = args.trim().split('\\n')\n const N = tmp[0]|0;\n const A = tmp[1].split(' ').map(v=>v|0).sort((a,b)=>b-a);\n let AA = 1, count = 0;\n for ( let i = 0; i < N-1; i++ ) {\n AA *= A[i];\n if ( AA % A[i+1] ) count++;\n else AA = AA * A[i] / gcd( AA, A[i] );\n }\n return count.toString();\n}(require('fs').readFileSync('/dev/stdin', 'utf8')));", "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": 435, "cpu_time_ms": 189, "memory_kb": 52200}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s962815804", "group_id": "codeNet:p02658", "input_text": "const main = stdin => {\n const input = stdin.trim().split('\\n')\n const N = parseInt(input[0])\n const nums = input[1].split(' ').map(x => BigInt(x))\n let ans = 1n\n for (let i = 0; i < N; i++) {\n ans = ans * nums[i]\n }\n if (ans > 1000000000000000000n) {\n console.log(-1)\n } else {\n console.log(ans.toString())\n }\n}\n// 標準入力\nmain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"))\n", "language": "JavaScript", "metadata": {"date": 1599750901, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "medium_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/JavaScript/s962815804.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s962815804", "user_id": "u825925638"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "const main = stdin => {\n const input = stdin.trim().split('\\n')\n const N = parseInt(input[0])\n const nums = input[1].split(' ').map(x => BigInt(x))\n let ans = 1n\n for (let i = 0; i < N; i++) {\n ans = ans * nums[i]\n }\n if (ans > 1000000000000000000n) {\n console.log(-1)\n } else {\n console.log(ans.toString())\n }\n}\n// 標準入力\nmain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"))\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": 2208, "memory_kb": 95932}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s571602428", "group_id": "codeNet:p02658", "input_text": "function Main(input) {\n input = input.split(\"\\n\");\n const N = parseInt(input[0]);\n const A = input[1].split(\" \");\n\n let answer = BigInt(A[0]);\n let B = [];\n for (let i = 0; i < N; i++) {\n B[i] = BigInt(A[i]);\n }\n\n if (A.indexOf(\"0\") === -1) {\n for (let i = 1; i < N; i++) {\n answer = answer * B[i];\n if (answer > BigInt(10 ** 18)) {\n answer = -1;\n break;\n }\n }\n } else {\n answer = 0;\n }\n\n\n console.log(String(answer));\n}\n\n// デバッグ用\nfunction debug() {\n var input = document.getElementById(\"input\").value;\n Main(input);\n}\n\n//* この行以降は編集しないでください(標準入出力から一度に読み込み、Mainを呼び出します)\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "language": "JavaScript", "metadata": {"date": 1599615308, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "medium_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/JavaScript/s571602428.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s571602428", "user_id": "u396391104"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "function Main(input) {\n input = input.split(\"\\n\");\n const N = parseInt(input[0]);\n const A = input[1].split(\" \");\n\n let answer = BigInt(A[0]);\n let B = [];\n for (let i = 0; i < N; i++) {\n B[i] = BigInt(A[i]);\n }\n\n if (A.indexOf(\"0\") === -1) {\n for (let i = 1; i < N; i++) {\n answer = answer * B[i];\n if (answer > BigInt(10 ** 18)) {\n answer = -1;\n break;\n }\n }\n } else {\n answer = 0;\n }\n\n\n console.log(String(answer));\n}\n\n// デバッグ用\nfunction debug() {\n var input = document.getElementById(\"input\").value;\n Main(input);\n}\n\n//* この行以降は編集しないでください(標準入出力から一度に読み込み、Mainを呼び出します���\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "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": 768, "cpu_time_ms": 114, "memory_kb": 48196}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s294842535", "group_id": "codeNet:p02658", "input_text": "function Main(input) {\n var tmp = input.split(\"\\n\");\n var num = parseInt(tmp[0]);\n var ary = tmp[1].split(\" \");\n \n for(var n=0; nbig){\n console.log(-1);\n break loop;\n }\n }\n console.log(Number(count));\n }\n}\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "language": "JavaScript", "metadata": {"date": 1598221885, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "medium_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/JavaScript/s294842535.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s294842535", "user_id": "u860584387"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "function Main(input) {\n var tmp = input.split(\"\\n\");\n var num = parseInt(tmp[0]);\n var ary = tmp[1].split(\" \");\n \n for(var n=0; nbig){\n console.log(-1);\n break loop;\n }\n }\n console.log(Number(count));\n }\n}\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "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": 618, "cpu_time_ms": 217, "memory_kb": 43932}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s197119991", "group_id": "codeNet:p02658", "input_text": "function Main(input) {\n var tmp = input.split(\"\\n\");\n var num = parseInt(tmp[0]);\n var ary = tmp[1].split(\" \");\n \n for(var n=0; nBigInt(Math.pow(10,18))){\n console.log(-1);\n break loop;\n }\n }\n console.log(Number(count));\n }\n}\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "language": "JavaScript", "metadata": {"date": 1598220094, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "medium_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/JavaScript/s197119991.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s197119991", "user_id": "u860584387"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "function Main(input) {\n var tmp = input.split(\"\\n\");\n var num = parseInt(tmp[0]);\n var ary = tmp[1].split(\" \");\n \n for(var n=0; nBigInt(Math.pow(10,18))){\n console.log(-1);\n break loop;\n }\n }\n console.log(Number(count));\n }\n}\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "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": 613, "cpu_time_ms": 92, "memory_kb": 43224}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s801138501", "group_id": "codeNet:p02658", "input_text": "\"use strict\";\n\nconst main = (input) => {\n const spi = input.split('\\n');\n const n = spi[0];\n const a = spi[1].split(' ').map(e => BigInt(e));\n\n a.sort(function(a, b){\n return (a < b ? -1 : 1);\n });\n\n const MAX = 1000000000000000000n;\n let ans = a[0];\n for (let i = 1; i < n; i++) {\n ans *= a[i];\n if (ans > MAX) {\n console.log(\"-1\");\n return ;\n }\n }\n\n console.log(ans);\n\n};\n\nmain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));\n", "language": "JavaScript", "metadata": {"date": 1597089486, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "medium_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/JavaScript/s801138501.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s801138501", "user_id": "u688789047"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "\"use strict\";\n\nconst main = (input) => {\n const spi = input.split('\\n');\n const n = spi[0];\n const a = spi[1].split(' ').map(e => BigInt(e));\n\n a.sort(function(a, b){\n return (a < b ? -1 : 1);\n });\n\n const MAX = 1000000000000000000n;\n let ans = a[0];\n for (let i = 1; i < n; i++) {\n ans *= a[i];\n if (ans > MAX) {\n console.log(\"-1\");\n return ;\n }\n }\n\n console.log(ans);\n\n};\n\nmain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));\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": 511, "cpu_time_ms": 230, "memory_kb": 46588}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s830285438", "group_id": "codeNet:p02658", "input_text": "process.stdin.resume();\nprocess.stdin.setEncoding('utf8');\n// Your code here!\n\n\"use strict\";\n\nconst main = arg => {\n const input = arg.trim().split(\"\\n\");\n\n const N = input[0].split(\" \").map(Number)[0];\n const K = input[1].split(\" \").map(Number);\n \n const limit = Math.pow(10, 18);\n \n \n let multi = 1;\n let breakP = 0;\n for(let i = 0; i limit || multi == 1000000000000000000) {\n console.log(-1)\n } else {\n console.log(multi); \n }\n}\nmain(require('fs').readFileSync('/dev/stdin', 'utf8')); \n", "language": "JavaScript", "metadata": {"date": 1593570976, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "medium_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/JavaScript/s830285438.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s830285438", "user_id": "u348482601"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "process.stdin.resume();\nprocess.stdin.setEncoding('utf8');\n// Your code here!\n\n\"use strict\";\n\nconst main = arg => {\n const input = arg.trim().split(\"\\n\");\n\n const N = input[0].split(\" \").map(Number)[0];\n const K = input[1].split(\" \").map(Number);\n \n const limit = Math.pow(10, 18);\n \n \n let multi = 1;\n let breakP = 0;\n for(let i = 0; i limit || multi == 1000000000000000000) {\n console.log(-1)\n } else {\n console.log(multi); \n }\n}\nmain(require('fs').readFileSync('/dev/stdin', 'utf8')); \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": 598, "cpu_time_ms": 113, "memory_kb": 47612}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s787939511", "group_id": "codeNet:p02658", "input_text": "function main(input) {\n const a = input.split('\\n')[1].split(' ').map(BigInt);\n\n if(a.some(x => x===0)){\n console.log('0');\n return;\n }\n\n let c = BigInt(1);\n for(let i=0; i< a.length; i++){\n if((a[i] * c) > 1000000000000000000) {\n console.log('-1');\n return;\n }\n c *= a[i];\n }\n\n console.log(c);\n}\n\nmain(require('fs').readFileSync('/dev/stdin', 'utf8').trim());\n", "language": "JavaScript", "metadata": {"date": 1593547528, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "medium_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/JavaScript/s787939511.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s787939511", "user_id": "u955037994"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "function main(input) {\n const a = input.split('\\n')[1].split(' ').map(BigInt);\n\n if(a.some(x => x===0)){\n console.log('0');\n return;\n }\n\n let c = BigInt(1);\n for(let i=0; i< a.length; i++){\n if((a[i] * c) > 1000000000000000000) {\n console.log('-1');\n return;\n }\n c *= a[i];\n }\n\n console.log(c);\n}\n\nmain(require('fs').readFileSync('/dev/stdin', 'utf8').trim());\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": 393, "cpu_time_ms": 108, "memory_kb": 43784}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s741016695", "group_id": "codeNet:p02658", "input_text": "function main(input) {\n const a = input.split('\\n')[1].split(' ').map(BigInt);\n\n if(a.some(x => x===0)){\n console.log('0');\n return;\n }\n\n let c = BigInt(1);\n for(let i=0; i< a.length; i++){\n if(a[i] * c) > BigInt(1000000000000000000)) {\n console.log('-1');\n return;\n }\n c *= a[i];\n }\n\n console.log(c);\n}\n\nmain(require('fs').readFileSync('/dev/stdin', 'utf8').trim());\n", "language": "JavaScript", "metadata": {"date": 1593547281, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "medium_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/JavaScript/s741016695.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s741016695", "user_id": "u955037994"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "function main(input) {\n const a = input.split('\\n')[1].split(' ').map(BigInt);\n\n if(a.some(x => x===0)){\n console.log('0');\n return;\n }\n\n let c = BigInt(1);\n for(let i=0; i< a.length; i++){\n if(a[i] * c) > BigInt(1000000000000000000)) {\n console.log('-1');\n return;\n }\n c *= a[i];\n }\n\n console.log(c);\n}\n\nmain(require('fs').readFileSync('/dev/stdin', 'utf8').trim());\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": 400, "cpu_time_ms": 134, "memory_kb": 29828}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s621498894", "group_id": "codeNet:p02658", "input_text": "function main(input) {\n const a = input.split('\\n')[1].split(' ').map(Number);\n \n if(a.some(x => x===0)){\n console.log('0');\n return;\n }\n \n let c = 1;\n for(let i=0; i< a.length; i++){\n if(a[i] >= 1000000000000000000/c) {\n console.log('-1');\n return;\n }\n c *= a[i];\n if(c >= 1000000000000000000) {\n console.log('-1');\n return;\n }\n\n }\n \n console.log(c);\n}\n \nmain(require('fs').readFileSync('/dev/stdin', 'utf8').trim());\n", "language": "JavaScript", "metadata": {"date": 1593490906, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "medium_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/JavaScript/s621498894.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s621498894", "user_id": "u955037994"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "function main(input) {\n const a = input.split('\\n')[1].split(' ').map(Number);\n \n if(a.some(x => x===0)){\n console.log('0');\n return;\n }\n \n let c = 1;\n for(let i=0; i< a.length; i++){\n if(a[i] >= 1000000000000000000/c) {\n console.log('-1');\n return;\n }\n c *= a[i];\n if(c >= 1000000000000000000) {\n console.log('-1');\n return;\n }\n\n }\n \n console.log(c);\n}\n \nmain(require('fs').readFileSync('/dev/stdin', 'utf8').trim());\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": 470, "cpu_time_ms": 284, "memory_kb": 45800}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s053758998", "group_id": "codeNet:p02658", "input_text": "const main = (input) => {\n const [, n] = input.trim().split('\\n')\n const LIMIT = BigInt(10 ** 18)\n const nums = n.trim().split(' ').map(v => parseInt(v, 10)).sort((a, b) => a - b)\n\n if (nums[0] === 0) return console.log(0)\n\n let ans = BigInt(1)\n for (let v of nums) {\n ans = ans * BigInt(v)\n if (ans > LIMIT) return console.log(-1)\n }\n\n ans > LIMIT ? console.log(-1) : console.log(ans.toString())\n}\n\nprocess.env.MYTEST ? test() : main(require('fs').readFileSync('/dev/stdin', 'utf8'))", "language": "JavaScript", "metadata": {"date": 1592725788, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "medium_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/JavaScript/s053758998.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s053758998", "user_id": "u124735330"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "const main = (input) => {\n const [, n] = input.trim().split('\\n')\n const LIMIT = BigInt(10 ** 18)\n const nums = n.trim().split(' ').map(v => parseInt(v, 10)).sort((a, b) => a - b)\n\n if (nums[0] === 0) return console.log(0)\n\n let ans = BigInt(1)\n for (let v of nums) {\n ans = ans * BigInt(v)\n if (ans > LIMIT) return console.log(-1)\n }\n\n ans > LIMIT ? console.log(-1) : console.log(ans.toString())\n}\n\nprocess.env.MYTEST ? test() : main(require('fs').readFileSync('/dev/stdin', 'utf8'))", "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": 498, "cpu_time_ms": 152, "memory_kb": 59840}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s939526308", "group_id": "codeNet:p02658", "input_text": "\nlet input = require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\")\n\nfunction main({ input, load, yesno, math_sum, math_max, math_min, log_json }) {\n const [N] = load()\n const A = load(N,1,BigInt)\n \n if(A.includes(0n)) return 0\n \n let result = 1n\n for(const a of A) {\n result *= a\n if(result > 1e18) return -1\n }\n \n return result.toString()\n}\n\n\n\nlet inputs = input.split(/[\\s\\n]/)\nlet result = main({\n input,\n yesno: value => value ? 'Yes' : 'No',\n math_sum: numbers => numbers.reduce((acc, cur) => acc + cur, 0),\n load(rows = 1, cols = 1, type = Number) {\n const length = rows * cols\n let result = inputs.splice(0, length)\n if(type !== String) result = result.map(type)\n if(cols > 1) {\n const arrays = new Array(cols)\n for(let col = 0; col < cols; col++) {\n arrays[col] = new Array()\n for(let row = 0; row < rows; row++) {\n arrays[col].push(result[row * cols + col])\n }\n }\n result = arrays\n }\n return result\n },\n inifinite_loop_preventer() {\n throw new Error(\"Infinite loop\")\n },\n math_max,\n math_min,\n log_json(value) {\n console.log(JSON.stringify(value))\n },\n})\n\nif(result === undefined) {\n console.warn(\"result is undefined\")\n} else {\n console.log(result)\n}\n\nfunction math_max(numbers, initial_value = null) {\n let result = (initial_value === null) ? numbers[0] : initial_value\n for(const n of numbers) if(n > result) result = n\n return result\n}\n\nfunction math_min(numbers, initial_value = null) {\n let result = (initial_value === null) ? numbers[0] : initial_value\n for(const n of numbers) if(n < result) result = n\n return result\n}\n", "language": "JavaScript", "metadata": {"date": 1592627819, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "medium_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/JavaScript/s939526308.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s939526308", "user_id": "u760244603"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "\nlet input = require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\")\n\nfunction main({ input, load, yesno, math_sum, math_max, math_min, log_json }) {\n const [N] = load()\n const A = load(N,1,BigInt)\n \n if(A.includes(0n)) return 0\n \n let result = 1n\n for(const a of A) {\n result *= a\n if(result > 1e18) return -1\n }\n \n return result.toString()\n}\n\n\n\nlet inputs = input.split(/[\\s\\n]/)\nlet result = main({\n input,\n yesno: value => value ? 'Yes' : 'No',\n math_sum: numbers => numbers.reduce((acc, cur) => acc + cur, 0),\n load(rows = 1, cols = 1, type = Number) {\n const length = rows * cols\n let result = inputs.splice(0, length)\n if(type !== String) result = result.map(type)\n if(cols > 1) {\n const arrays = new Array(cols)\n for(let col = 0; col < cols; col++) {\n arrays[col] = new Array()\n for(let row = 0; row < rows; row++) {\n arrays[col].push(result[row * cols + col])\n }\n }\n result = arrays\n }\n return result\n },\n inifinite_loop_preventer() {\n throw new Error(\"Infinite loop\")\n },\n math_max,\n math_min,\n log_json(value) {\n console.log(JSON.stringify(value))\n },\n})\n\nif(result === undefined) {\n console.warn(\"result is undefined\")\n} else {\n console.log(result)\n}\n\nfunction math_max(numbers, initial_value = null) {\n let result = (initial_value === null) ? numbers[0] : initial_value\n for(const n of numbers) if(n > result) result = n\n return result\n}\n\nfunction math_min(numbers, initial_value = null) {\n let result = (initial_value === null) ? numbers[0] : initial_value\n for(const n of numbers) if(n < result) result = n\n return result\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": 1794, "cpu_time_ms": 164, "memory_kb": 46072}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s590607706", "group_id": "codeNet:p02658", "input_text": "function main(input){\n input = input.trim().split(\"\\n\")[1];\n var list = input.split(\" \");\n var seki = BigInt(list[0]);\n for(var i=1; i<=list.length; i++){\n seki = BigInt(seki) * BigInt(list[i]);\n }\n if(seki<10**18){\n console.log(seki.toString());\n }else{\n \tconsole.log(-1);\n }\n}main(require(\"fs\").readFileSync(\"/dev/stdin\",\"utf8\"));", "language": "JavaScript", "metadata": {"date": 1592318543, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "medium_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/JavaScript/s590607706.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s590607706", "user_id": "u028542581"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "function main(input){\n input = input.trim().split(\"\\n\")[1];\n var list = input.split(\" \");\n var seki = BigInt(list[0]);\n for(var i=1; i<=list.length; i++){\n seki = BigInt(seki) * BigInt(list[i]);\n }\n if(seki<10**18){\n console.log(seki.toString());\n }else{\n \tconsole.log(-1);\n }\n}main(require(\"fs\").readFileSync(\"/dev/stdin\",\"utf8\"));", "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": 347, "cpu_time_ms": 2209, "memory_kb": 92132}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s903972457", "group_id": "codeNet:p02658", "input_text": "function main(input){\n input = input.trim().split(\"\\n\")[1];\n var list = input.split(\" \");\n var seki = BigInt(list[0]);\n for(var i=1; iMath.pow(10,18)){\n \tconsole.log(-1);\n }else{\n \tconsole.log(seki);\n }\n}main(input);", "language": "JavaScript", "metadata": {"date": 1592313161, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "medium_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/JavaScript/s461862670.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s461862670", "user_id": "u028542581"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "var input=\"3\\n101 9901 999999000001\";\n\nfunction main(input){\n var list = input.split(\"\\n\")[1];\n list = list.split(\" \");\n var seki=BigInt(list[0]);\n for(var i=1; iMath.pow(10,18)){\n \tconsole.log(-1);\n }else{\n \tconsole.log(seki);\n }\n}main(input);", "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": 321, "cpu_time_ms": 58, "memory_kb": 29816}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s734857071", "group_id": "codeNet:p02658", "input_text": "function main(input){\n var list = input.split(\"\\n\")[1];\n list = list.split(\" \");\n var seki=list[0];\n for(var i=1; iMath.pow(10,18)){\n \tconsole.log(seki);\n }else{\n \tconsole.log(-1);\n }\n}\nmain(require(\"fs\".readFileSync(\"/dev/stdin/\",\"utf8\"));", "language": "JavaScript", "metadata": {"date": 1592311528, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "medium_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/JavaScript/s734857071.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s734857071", "user_id": "u028542581"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "function main(input){\n var list = input.split(\"\\n\")[1];\n list = list.split(\" \");\n var seki=list[0];\n for(var i=1; iMath.pow(10,18)){\n \tconsole.log(seki);\n }else{\n \tconsole.log(-1);\n }\n}\nmain(require(\"fs\".readFileSync(\"/dev/stdin/\",\"utf8\"));", "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": 309, "cpu_time_ms": 57, "memory_kb": 29804}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s504515870", "group_id": "codeNet:p02658", "input_text": "// inputに入力データ全体が入る\nfunction Main(input) {\n\t// 1行目がinput[0], 2行目がinput[1], …に入る\n\tinput = input.split(\"\\n\");\n tmp = input[1].split(\" \");\n\t//文字列から10進数に変換するときはparseIntを使います\n var tt = tmp[0];\n for(var i=1; i 10**18){\n console.log(-1);\n } else{\n console.log(tt);\n }\n\t\n}\n//*この行以降は編集しないでください(標準入出力から一度に読み込み、Mainを呼び出します)\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "language": "JavaScript", "metadata": {"date": 1591575998, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "medium_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/JavaScript/s504515870.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s504515870", "user_id": "u214432369"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "// inputに入力データ全体が入る\nfunction Main(input) {\n\t// 1行目がinput[0], 2行目がinput[1], …に入る\n\tinput = input.split(\"\\n\");\n tmp = input[1].split(\" \");\n\t//文字列から10進数に変換するときはparseIntを使います\n var tt = tmp[0];\n for(var i=1; i 10**18){\n console.log(-1);\n } else{\n console.log(tt);\n }\n\t\n}\n//*この行以降は編集しないでください(標準入出力から一度に読み込み、Mainを呼び出します)\nMain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "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": 626, "cpu_time_ms": 222, "memory_kb": 45056}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s888636463", "group_id": "codeNet:p02658", "input_text": "function main(input) {\n const inputs = input.split('\\n')\n const N = Number(inputs[0])\n const Ai = inputs[1].split(' ').map(BigInt)\n const l = Ai.length\n let r = 1n\n\n for(let i = 0; i < l; i++) {\n r *= Ai[i]\n }\n if (r > 1000000000000000000n) {\n console.log(-1)\n } else {\n console.log(r.toString())\n }\n}\n\nmain(require('fs').readFileSync('/dev/stdin', 'utf8'))\n", "language": "JavaScript", "metadata": {"date": 1591467898, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "medium_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/JavaScript/s888636463.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s888636463", "user_id": "u431663947"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "function main(input) {\n const inputs = input.split('\\n')\n const N = Number(inputs[0])\n const Ai = inputs[1].split(' ').map(BigInt)\n const l = Ai.length\n let r = 1n\n\n for(let i = 0; i < l; i++) {\n r *= Ai[i]\n }\n if (r > 1000000000000000000n) {\n console.log(-1)\n } else {\n console.log(r.toString())\n }\n}\n\nmain(require('fs').readFileSync('/dev/stdin', 'utf8'))\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": 377, "cpu_time_ms": 2208, "memory_kb": 93400}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s947259267", "group_id": "codeNet:p02658", "input_text": "function main(input) {\n const inputs = input.split('\\n')\n const N = Number(inputs[0])\n const Ai = inputs[1].split(' ').map(BigInt)\n const r = Ai.reduce((a, b) => {\n return a * b\n }, 1n)\n // console.log(r, r > 1000000000000000000n)\n\n if (r > 1000000000000000000n) {\n console.log(-1)\n } else {\n console.log(r.toString())\n }\n}\n\nmain(require('fs').readFileSync('/dev/stdin', 'utf8'))\n", "language": "JavaScript", "metadata": {"date": 1591467087, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "medium_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/JavaScript/s947259267.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s947259267", "user_id": "u431663947"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "function main(input) {\n const inputs = input.split('\\n')\n const N = Number(inputs[0])\n const Ai = inputs[1].split(' ').map(BigInt)\n const r = Ai.reduce((a, b) => {\n return a * b\n }, 1n)\n // console.log(r, r > 1000000000000000000n)\n\n if (r > 1000000000000000000n) {\n console.log(-1)\n } else {\n console.log(r.toString())\n }\n}\n\nmain(require('fs').readFileSync('/dev/stdin', 'utf8'))\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": 398, "cpu_time_ms": 2208, "memory_kb": 91884}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s262389059", "group_id": "codeNet:p02658", "input_text": "console.log(\n [\n require(\"fs\")\n .readFileSync(\"/dev/stdin\", \"utf8\")\n .split(\"\\n\")[1]\n .split(\" \")\n .reduce(\n (acc, sum) => BigInt(sum) * BigInt(acc),\n BigInt(1)\n )\n ].map(n => n > 10**18 ? -1 : n).join()\n)", "language": "JavaScript", "metadata": {"date": 1591145850, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "medium_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/JavaScript/s262389059.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s262389059", "user_id": "u338775406"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "console.log(\n [\n require(\"fs\")\n .readFileSync(\"/dev/stdin\", \"utf8\")\n .split(\"\\n\")[1]\n .split(\" \")\n .reduce(\n (acc, sum) => BigInt(sum) * BigInt(acc),\n BigInt(1)\n )\n ].map(n => n > 10**18 ? -1 : n).join()\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": 219, "cpu_time_ms": 2209, "memory_kb": 97620}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s847427209", "group_id": "codeNet:p02658", "input_text": "\"use strict\";\nconst main = arg => {\n var input = arg.split('\\n');\n var line = input.shift();\n var lines = input.shift().split(' ').map(Number);\n\n var answer = BigInt(lines[0]);\n\n for(let i = 1; i < line;i++){\n\n answer = BigInt(answer * lines[i]);\n if(answer > 1000000000000000000n){\n console.log(-1);\n return;\n }\n }\n\n\n console.log(answer.toString());\n\n\n}\n\nmain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "language": "JavaScript", "metadata": {"date": 1591066644, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "medium_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/JavaScript/s847427209.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s847427209", "user_id": "u580911308"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "\"use strict\";\nconst main = arg => {\n var input = arg.split('\\n');\n var line = input.shift();\n var lines = input.shift().split(' ').map(Number);\n\n var answer = BigInt(lines[0]);\n\n for(let i = 1; i < line;i++){\n\n answer = BigInt(answer * lines[i]);\n if(answer > 1000000000000000000n){\n console.log(-1);\n return;\n }\n }\n\n\n console.log(answer.toString());\n\n\n}\n\nmain(require(\"fs\").readFileSync(\"/dev/stdin\", \"utf8\"));", "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": 476, "cpu_time_ms": 77, "memory_kb": 42484}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s483380077", "group_id": "codeNet:p02658", "input_text": "function main(input) {\n const num = Number(input.split(\"\\n\")[0]);\n let ans = 1n;\n const numbers = input.split(\"\\n\")[1].split(\" \").map(i => BigInt(i));\n \n if (numbers.includes(0n)) {\n return console.log(0);\n }\n \n for(let i=0; i < num; i++) {\n \tans *= numbers[i];\n if (ans > 10n**18n) {\n break;\n }\n }\n \n if (ans > 10n**18n) {\n console.log(-1);\n } else {\n \tconsole.log(ans + \"\");\n }\n}\n \nmain(require('fs').readFileSync('/dev/stdin', 'utf8'));\n", "language": "JavaScript", "metadata": {"date": 1591063229, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "medium_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/JavaScript/s483380077.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s483380077", "user_id": "u292715340"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "function main(input) {\n const num = Number(input.split(\"\\n\")[0]);\n let ans = 1n;\n const numbers = input.split(\"\\n\")[1].split(\" \").map(i => BigInt(i));\n \n if (numbers.includes(0n)) {\n return console.log(0);\n }\n \n for(let i=0; i < num; i++) {\n \tans *= numbers[i];\n if (ans > 10n**18n) {\n break;\n }\n }\n \n if (ans > 10n**18n) {\n console.log(-1);\n } else {\n \tconsole.log(ans + \"\");\n }\n}\n \nmain(require('fs').readFileSync('/dev/stdin', 'utf8'));\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": 472, "cpu_time_ms": 109, "memory_kb": 44024}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s227663330", "group_id": "codeNet:p02658", "input_text": "main(require('fs').readFileSync('/dev/stdin', 'utf8'));\n\n\nfunction main(input) {\n input = input.split('\\n');\n const n = +input[0];\n const arr = input[1].split(' ').map(BigInt);\n let sum = 1n;\n const max = BigInt(1000000000000000000);\n for (let i = 0; i < n; ++i) {\n if (arr[i] === 0n) {\n console.log(0);\n return;\n } else {\n sum *= arr[i];\n if (sum > max) {\n console.log(-1);\n return;\n }\n }\n }\n console.log(sum.toString());\n}", "language": "JavaScript", "metadata": {"date": 1590994422, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "medium_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/JavaScript/s227663330.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s227663330", "user_id": "u634650717"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "main(require('fs').readFileSync('/dev/stdin', 'utf8'));\n\n\nfunction main(input) {\n input = input.split('\\n');\n const n = +input[0];\n const arr = input[1].split(' ').map(BigInt);\n let sum = 1n;\n const max = BigInt(1000000000000000000);\n for (let i = 0; i < n; ++i) {\n if (arr[i] === 0n) {\n console.log(0);\n return;\n } else {\n sum *= arr[i];\n if (sum > max) {\n console.log(-1);\n return;\n }\n }\n }\n console.log(sum.toString());\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": 480, "cpu_time_ms": 105, "memory_kb": 42268}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s976978693", "group_id": "codeNet:p02658", "input_text": "const main = (input) => {\n\tconst args = input.trim().split(\"\\n\");\n\tconst N = args[0]\n\tconst As = args[1].trim().split(\" \")\n\tlet flag = ''\n\tif (As.includes('0')) { flag = 'zero' }\n\tlet answer = As[0]\n\n\tconst limit = 10 ** 18\n\tif (flag !== 'zero') {\n\t\tlet i = 1;\n\t\twhile (i < As.length) {\n\t\t\tif (answer <= limit) {\n\t\t\t\tanswer = BigInt(answer) * BigInt(As[i])\n\t\t\t\ti = (i + 1) | 0\n\t\t\t\tif (answer > limit) {\n\t\t\t\t\tflag = 'over'\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tswitch (flag) {\n\t\tcase 'zero' :\n\t\t\tconsole.log(0)\n\t\t\tbreak\n\t\tcase 'over':\n\t\t\tconsole.log(-1)\n\t\t\tbreak\n\t\tdefault:\n\t\t\tconsole.log(answer.toString())\n\t}\n}\n\nmain(require('fs').readFileSync('/dev/stdin', 'utf8'))", "language": "JavaScript", "metadata": {"date": 1590985077, "filename_ext": "js", "original_language": "JavaScript (Node.js 12.16.1)", "problem_description_relpath": "problem_descriptions/p02658.html", "problem_id": "p02658", "resource_group": "medium_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/JavaScript/s976978693.js", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s976978693", "user_id": "u976219964"}, "prompt_components": {"gold_output": "1000000000000000000\n", "input_to_evaluate": "const main = (input) => {\n\tconst args = input.trim().split(\"\\n\");\n\tconst N = args[0]\n\tconst As = args[1].trim().split(\" \")\n\tlet flag = ''\n\tif (As.includes('0')) { flag = 'zero' }\n\tlet answer = As[0]\n\n\tconst limit = 10 ** 18\n\tif (flag !== 'zero') {\n\t\tlet i = 1;\n\t\twhile (i < As.length) {\n\t\t\tif (answer <= limit) {\n\t\t\t\tanswer = BigInt(answer) * BigInt(As[i])\n\t\t\t\ti = (i + 1) | 0\n\t\t\t\tif (answer > limit) {\n\t\t\t\t\tflag = 'over'\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tswitch (flag) {\n\t\tcase 'zero' :\n\t\t\tconsole.log(0)\n\t\t\tbreak\n\t\tcase 'over':\n\t\t\tconsole.log(-1)\n\t\t\tbreak\n\t\tdefault:\n\t\t\tconsole.log(answer.toString())\n\t}\n}\n\nmain(require('fs').readFileSync('/dev/stdin', 'utf8'))", "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": 659, "cpu_time_ms": 68, "memory_kb": 39864}, "variant": "medium_resource"} +{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:JavaScript:s740673801", "group_id": "codeNet:p02658", "input_text": "!function(t){var r={};function n(e){if(r[e])return r[e].exports;var o=r[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=r,n.d=function(t,r,e){n.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:e})},n.r=function(t){\"undefined\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(t,\"__esModule\",{value:!0})},n.t=function(t,r){if(1&r&&(t=n(t)),8&r)return t;if(4&r&&\"object\"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(n.r(e),Object.defineProperty(e,\"default\",{enumerable:!0,value:t}),2&r&&\"string\"!=typeof t)for(var o in t)n.d(e,o,function(r){return t[r]}.bind(null,o));return e},n.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(r,\"a\",r),r},n.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},n.p=\"\",n(n.s=74)}([function(t,r,n){var e=n(7),o=n(51).f,i=n(13),u=n(27),a=n(40),c=n(77),f=n(60);t.exports=function(t,r){var n,s,l,v,p,d=t.target,h=t.global,g=t.stat;if(n=h?e:g?e[d]||a(d,{}):(e[d]||{}).prototype)for(s in r){if(v=r[s],l=t.noTargetGet?(p=o(n,s))&&p.value:n[s],!f(h?s:d+(g?\".\":\"#\")+s,t.forced)&&void 0!==l){if(typeof v==typeof l)continue;c(v,l)}(t.sham||l&&l.sham)&&i(v,\"sham\",!0),u(n,s,v,t)}}},function(t,r,n){var e=n(9);t.exports=function(t){if(!e(t))throw TypeError(String(t)+\" is not an object\");return t}},function(t,r){t.exports=!1},function(t,r,n){var e=n(1),o=n(88),i=n(24),u=n(6),a=n(61),c=n(91),f=function(t,r){this.stopped=t,this.result=r};(t.exports=function(t,r,n,s,l){var v,p,d,h,g,y,x=u(r,n,s?2:1);if(l)v=t;else{if(\"function\"!=typeof(p=a(t)))throw TypeError(\"Target is not iterable\");if(o(p)){for(d=0,h=i(t.length);h>d;d++)if((g=s?x(e(y=t[d])[0],y[1]):x(t[d]))&&g instanceof f)return g;return new f(!1)}v=p.call(t)}for(;!(y=v.next()).done;)if((g=c(v,x,y.value,s))&&g instanceof f)return g;return new f(!1)}).stop=function(t){return new f(!0,t)}},function(t,r){t.exports=function(t){if(\"function\"!=typeof t)throw TypeError(String(t)+\" is not a function\");return t}},function(t,r,n){var e=n(58),o=n(7),i=function(t){return\"function\"==typeof t?t:void 0};t.exports=function(t,r){return arguments.length<2?i(e[t])||i(o[t]):e[t]&&e[t][r]||o[t]&&o[t][r]}},function(t,r,n){var e=n(4);t.exports=function(t,r,n){if(e(t),void 0===r)return t;switch(n){case 0:return function(){return t.call(r)};case 1:return function(n){return t.call(r,n)};case 2:return function(n,e){return t.call(r,n,e)};case 3:return function(n,e,o){return t.call(r,n,e,o)}}return function(){return t.apply(r,arguments)}}},function(t,r){var n=\"object\",e=function(t){return t&&t.Math==Math&&t};t.exports=e(typeof globalThis==n&&globalThis)||e(typeof window==n&&window)||e(typeof self==n&&self)||e(typeof global==n&&global)||Function(\"return this\")()},function(t,r,n){var e=n(7),o=n(23),i=n(42),u=n(89),a=e.Symbol,c=o(\"wks\");t.exports=function(t){return c[t]||(c[t]=u&&a[t]||(u?a:i)(\"Symbol.\"+t))}},function(t,r){t.exports=function(t){return\"object\"==typeof t?null!==t:\"function\"==typeof t}},function(t,r){var n={}.hasOwnProperty;t.exports=function(t,r){return n.call(t,r)}},function(t,r,n){var e=n(12),o=n(54),i=n(1),u=n(53),a=Object.defineProperty;r.f=e?a:function(t,r,n){if(i(t),r=u(r,!0),i(n),o)try{return a(t,r,n)}catch(t){}if(\"get\"in n||\"set\"in n)throw TypeError(\"Accessors not supported\");return\"value\"in n&&(t[r]=n.value),t}},function(t,r,n){var e=n(17);t.exports=!e((function(){return 7!=Object.defineProperty({},\"a\",{get:function(){return 7}}).a}))},function(t,r,n){var e=n(12),o=n(11),i=n(25);t.exports=e?function(t,r,n){return o.f(t,r,i(1,n))}:function(t,r,n){return t[r]=n,t}},function(t,r,n){var e=n(2),o=n(36);t.exports=e?o:function(t){return Map.prototype.entries.call(t)}},function(t,r,n){var e=n(1),o=n(4),i=n(8)(\"species\");t.exports=function(t,r){var n,u=e(t).constructor;return void 0===u||null==(n=e(u)[i])?r:o(n)}},function(t,r,n){var e=n(64),o=n(68),i=n(23)(\"metadata\"),u=i.store||(i.store=new o),a=function(t,r,n){var o=u.get(t);if(!o){if(!n)return;u.set(t,o=new e)}var i=o.get(r);if(!i){if(!n)return;o.set(r,i=new e)}return i};t.exports={store:u,getMap:a,has:function(t,r,n){var e=a(r,n,!1);return void 0!==e&&e.has(t)},get:function(t,r,n){var e=a(r,n,!1);return void 0===e?void 0:e.get(t)},set:function(t,r,n,e){a(n,e,!0).set(t,r)},keys:function(t,r){var n=a(t,r,!1),e=[];return n&&n.forEach((function(t,r){e.push(r)})),e},toKey:function(t){return void 0===t||\"symbol\"==typeof t?t:String(t)}}},function(t,r){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,r,n){var e,o,i,u=n(57),a=n(7),c=n(9),f=n(13),s=n(10),l=n(41),v=n(28),p=a.WeakMap;if(u){var d=new p,h=d.get,g=d.has,y=d.set;e=function(t,r){return y.call(d,t,r),r},o=function(t){return h.call(d,t)||{}},i=function(t){return g.call(d,t)}}else{var x=l(\"state\");v[x]=!0,e=function(t,r){return f(t,x,r),r},o=function(t){return s(t,x)?t[x]:{}},i=function(t){return s(t,x)}}t.exports={set:e,get:o,has:i,enforce:function(t){return i(t)?o(t):e(t,{})},getterFor:function(t){return function(r){var n;if(!c(r)||(n=o(r)).type!==t)throw TypeError(\"Incompatible receiver, \"+t+\" required\");return n}}}},function(t,r,n){var e=n(2),o=n(36);t.exports=e?o:function(t){return Set.prototype.values.call(t)}},function(t,r){t.exports=function(t){if(null==t)throw TypeError(\"Can't call method on \"+t);return t}},function(t,r,n){var e=n(10),o=n(30),i=n(41),u=n(83),a=i(\"IE_PROTO\"),c=Object.prototype;t.exports=u?Object.getPrototypeOf:function(t){return t=o(t),e(t,a)?t[a]:\"function\"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?c:null}},function(t,r,n){var e=n(1),o=n(85),i=n(43),u=n(28),a=n(87),c=n(55),f=n(41)(\"IE_PROTO\"),s=function(){},l=function(){var t,r=c(\"iframe\"),n=i.length;for(r.style.display=\"none\",a.appendChild(r),r.src=String(\"javascript:\"),(t=r.contentWindow.document).open(),t.write(\"